AMX Timing Control
K
A
DAK
77
Timer Procedures can be written as Large or Medium model C functions with formal
parameters.
#include "amx831cf.h" /* AMX C Interface Header */
void cdecl truser( /* Timer Procedure */
AMXID timerid, /* timer id */
struct userblock FAR *userp) /* pointer to user block */
{:
Do timer expiry processing
:
}
Timerid is the timer id assigned by AMX to the interval timer when it was created.
Userp is the 32-bit application parameter provided when the timer was created. In this
example, it is assumed that userp is a FAR pointer to an application structure of type
userblock.
The Timer Procedure must execute with the interrupt facility enabled. If interrupts must
be temporarily disabled, they must be enabled prior to returning to the AMX Kernel
Task. A Timer Procedure must not issue any AMX directives which would in any way
force the Kernel Task to wait for any reason.
Note
Timer Procedures must only use AMX services which are
marked in Chapter 16 as
n Timer Procedure
Application Timer Procedures use the AMX Kernel Stack.
In addition to the minimum stack size required for the AMX Kernel Stack, you must
allocate sufficient stack to satisfy the worst case requirements of all application Timer
Procedures.