 |
Operation
|
|
The block diagram illustrates the general operation of an AMX system.
Execution begins in the user domain providing the opportunity for hardware
specific and application dependent setup prior to the initialization
of the AMX system. Once AMX has initialized all of its internal variables
and structures, it executes a sequence of user provided Restart Procedures.
These procedures can invoke AMX services to start tasks and initialize
interval timers. It is also possible to pre-define specific tasks and
timers which will be automatically created by AMX during its initialization
phase.
|
 |
|
View full size. |
Once all of the application Restart Procedures have been executed,
control is transferred to the AMX Task Scheduler which selects the highest
priority task which is ready for execution and gives it control of the
processor.
The task ends by returning to the AMX Task Scheduler which again finds
the next highest priority task ready to execute and gives it control of the
processor. A task, once executing, is free to call any of the AMX task
services. For instance, a task can send a message to another task, wait for
an event or wait for a timed interval. If the task wishes to wait for an event,
the AMX service procedure will suspend the task and request the AMX Task
Scheduler to force execution of the next highest priority task ready for
execution.
When a hardware interrupt occurs, the processor automatically vectors
control to a user provided Interrupt Service Procedure. This procedure
services the hardware device to clear the source of interrupt. If the
procedure wishes to invoke any of the AMX services, it must inform the
AMX Interrupt Supervisor that the interrupt has occurred. It is then free
to invoke the AMX services to send messages to tasks, signal events or
wake tasks. The procedure ends by informing the AMX Interrupt Supervisor
that the interrupt service is complete.
The AMX Interrupt Supervisor will either return directly to the
interrupted task, or, if as a result of servicing the interrupt, a higher
priority task is ready for execution, will request the AMX Task Scheduler
to suspend the interrupted task at its point of interruption and begin
or resume execution of the higher priority task.
Whenever a clock interrupt occurs, the application Interrupt Service
Procedure dismisses the hardware clock interrupt and calls the AMX Clock
Handler to trigger the AMX Kernel Task if required. The Kernel Task is
triggered at the user 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.
If a task's timer expires, the AMX Kernel Task primes the task to resume
execution with a timeout indication.
The AMX Kernel Task also services all active user timers. Whenever a user
timer expires, the corresponding user Timer Procedure is executed.
This procedure can invoke a subset of the AMX services to send messages to
tasks, signal events or wake tasks. If the timer is defined to be periodic,
the AMX Kernel Task automatically restarts it with the pre-defined period.
This brief description of the AMX Multitasking Executive is provided to show
the simplicity of the operating system. The rules are simple.
Restart Procedures kick the system off the ground. Tasks execute in response
to requests from other tasks, from Interrupt Service Procedures or from
Timer Procedures. Tasks can create other tasks. Interrupt Service Procedures
handle the specifics of the hardware configuration, service the device in
question and send messages to tasks to handle the more complex processing
associated with the event. Timer Procedures provide precise interval
measurement and can be used to provide periodic requests for task execution.
|