AMX Timing Control
K
A
DAK
71
5.2 AMX Clock Handler and Kernel Task
AMX includes a conforming clock ISP root, a Clock Handler and a Kernel Task to
provide timing facilities. Whenever a clock interrupt occurs, the clock ISP root calls your
application clock Interrupt Handler to dismiss the hardware clock interrupt. The ISP root
then calls the AMX Clock Handler to trigger the AMX Kernel Task if required. The
Kernel Task is triggered at the defined system tick interval if, and only if, there is any
outstanding timing activity required in the system. In this case, the interrupted task is
suspended and the AMX Kernel Task begins execution.
The AMX Kernel Task monitors all tasks which are in a timed wait state. The timer used
by AMX for task waits is maintained privately by AMX for each task. If the timer
expires, the Kernel Task removes the task from the wait state. The task is allowed to
resume execution when the Kernel Task ends with an indication that a timeout occurred.
The AMX Kernel Task also services all expiring application interval timers. Whenever
an interval timer expires, the corresponding Timer Procedure is executed. This procedure
can invoke a subset of the AMX services to trigger tasks, send messages to task
mailboxes or message exchanges, signal events or wake tasks. If the timer is defined to
be periodic, the AMX Kernel Task automatically restarts it with its predefined period.
Once all expiring task timers and application interval timers have been serviced, the
AMX Kernel Task ends execution.
Your clock Interrupt Handler can be coded in either C or assembler. For efficiency,
assembly language is recommended since most handlers require only one or two machine
instructions to dismiss the clock interrupt request.
You must also start your hardware clock at the correct frequency when AMX is launched.
You can do this in a Restart Procedure or in some task which is triggered at launch time.
Note
AMX is delivered to you with clock drivers ready for use
with one or more of the timing devices commonly used
with the 80x86 processor. These clock drivers are installed
as described Appendix C of the AMX 86 Tool Guide.