148
K
DAK
KwikNet Low Level Services
kn_addserver kn_addserver
Purpose Install (Add) a Server Function
Used by
n Task o ISP o Timer Procedure o Restart Procedure o Exit Procedure
Setup Prototype is in file KN_API.H.
#include "KN_LIB.H"
void kn_addserver(struct knx_svblock *servercbp,
unsigned long period,
int (*serverfnp)(void *), void *param);
Description Servercbp is a pointer to a KwikNet server control block which KwikNet
can use to control the periodic execution of this server function. Each
server function requires its own unique server control block.
You can create a server control block by declaring it as a unique
structure variable or by including it as a knx_svblock structure within
some other structure variable. The variable must reside outside all
functions in the source module. The call to kn_addserver() must
provide a pointer to the instance of the structure.
Parameter period specifies the interval at which the server function is to
be executed by the KwikNet Task. The interval, measured in
milliseconds, is converted to a non-zero, integral multiple of KwikNet
ticks. The server function is therefore executed at the resulting period,
measured in equivalent KwikNet ticks.
If parameter period is 0, the server function will be executed by the
KwikNet Task whenever a KwikNet clock tick or significant event is
serviced. Hence, at a minimum, the server function will execute at the
KwikNet clock frequency. However, it will also execute if, at the time
your App-Task yields to the
KwikNet Task, other stack related services
are pending.
Parameter serverfnp is a pointer to the server function to be executed by
the
KwikNet Task. The function is called with a single parameter, a
copy of parameter param presented in the call to kn_addserver().
The server function must return the value 0 in order to remain on the
active server list, ready to be executed at its specified period. If the
server function returns a non-zero value, the server will be removed
from the KwikNet server list.
Returns Nothing
Restriction This function must only be used in a single threaded system. It can be
called while executing in either the user or KwikNet domain.
See Also kn_yield()
Comments to this Manuals