General AMX Operation
K
A
DAK
17
2.3 AMX ManagersAMX provides a set of managers to simplify event synchronization, resource
manipulation and memory allocation. Not all applications will make use of all of the
managers. The system designer can decide which of the AMX managers is best suited
for a particular application.
The Time/Date Manager provides Y2K compliant time of day calendar support if
required. The AMX calendar clock includes second, minute, hour, day, month, year and
day of the week. AMX services are provided to set and read the calendar clock.
A formatting procedure is also provided to translate the calendar time and date from the
internal format in which it is maintained by AMX into an ASCII string in several of the
most popular formats.
An application procedure can be tied to the calendar clock and called at one second
intervals to permit simple time of day event scheduling.
The Semaphore Manager provides two types of semaphores each with priority queuing
and timeout: resource semaphores and counting semaphores.
A resource semaphore can be used to provide controlled access to your resources. It uses
a binary semaphore to limit access to each resource to one task at a time. Ownership and
release of a resource is governed by calls to the Semaphore Manager. A resource
semaphore offers the unique characteristic of identifying each resource owner. Only the
task which owns a resource is permitted to release it.
General purpose counting semaphores can be created for mutual exclusion and resource
management. Tasks must request the Semaphore Manager for access to the resource
controlled by such a semaphore. The task can specify the priority of its request to use the
semaphore. If the semaphore is not free, the task will be forced to wait for its
availability. The task will be placed on the semaphore wait queue at the priority specified
by the task. Optionally, the task can specify a timeout interval limiting the time the task
is prepared to wait.
A task, ISP or Timer Procedure can signal the semaphore with a call to the Semaphore
Manager. The Semaphore Manager grants access to the semaphore to the task, if any,
waiting at the top of the semaphore's wait queue.
The Event Manager provides a convenient method for synchronizing one or more tasks
to events detected in Interrupt Service Procedures, Timer Procedures and other tasks. A
task requests the Event Manager to suspend its operation until any one of a particular set
of events occurs. Alternatively, the task can request to wait until all of a set of event
conditions are met. Optionally, the task can specify a timeout interval limiting the time
the task is prepared to wait. More than one task can be waiting for the same event or set
of events.
When a task, ISP or Timer Procedure detects an event, it signals the event with a call to
the Event Manager. The Event Manager checks to see if the event has resulted in an
event combination for which one or more tasks are waiting. If so, the tasks which were
waiting are allowed to resume execution.