Interrupt Service Procedures
K
A
DAK
57
4.4 ISP/Task Communication
AMX provides a set of service procedures to ease the communication between tasks and
device Interrupt Handlers. These AMX procedures simplify event synchronization and
permit parameter passing to tasks.
Wait/Wake Synchronization
The ajwait/ajwake pair of procedures is often used for event synchronization. A task
issues an ajwait call to AMX to wait unconditionally for an event. When the event
occurs, as indicated by an interrupt, the Interrupt Handler makes an ajwake call
identifying the task which it wishes to wake up.
Synchronization capability can be further enhanced using the automatic timeout facility
provided by AMX. The task issues an ajwatm call indicating the maximum interval for
which it is willing to wait for the event. When the interrupt occurs, the Interrupt Handler
issues the ajwake call to wake up the task. The task resumes execution with an
indication provided to it by AMX that the event did occur. If, on the other hand, the
interrupt does not occur within the specified timeout interval, the AMX Kernel Task will
wake up the task. In this case, the task resumes execution with an indication provided by
AMX that a timeout occurred. When the task resumes execution, it is, therefore, capable
of determining if the event occurred within the expected interval.
Task Signal Synchronization
The simple wait/wake synchronization described above is actually a subset of event
synchronization provided by AMX known as task signals. Each task has associated with
it a set of 15 independent flags called task signals. The task can wait for any specific task
signal or combination of task signals by calling ajsgwat indicating the maximum interval
which it is willing to wait.
When the interrupt associated with a particular task signal occurs, the Interrupt Handler
issues the ajsgnl call to signal the task that the particular event has occurred. If the task
is not still waiting for other task signals, AMX will allow the task to resume execution
with an indication that its task signal conditions were met. If, on the other hand, all task
signals for which the task was waiting do not occur within the specified timeout interval,
the AMX Kernel Task will force the task to resume execution with a timeout indication.