Interrupt Service Procedures
K
A
DAK
51
4.2 ISPs for External Interrupts
Two types of ISPs exist: nonconforming ISPs and conforming ISPs.
Nonconforming ISPs
A nonconforming ISP must quickly service the device to remove the interrupting
condition. The ISP must preserve all registers which it uses. The nonconforming ISP
cannot make calls to any AMX service procedures.
The nonconforming ISP executes in the context of the process (task, ISP, AMX kernel)
which was interrupted. The ISP therefore uses the stack of the interrupted process.
Consequently, all stacks must be large enough to meet the worst case needs of all
nonconforming ISPs.
The nonconforming ISP can enable interrupts to allow interrupt service by other higher
priority nonconforming ISPs. The nonconforming ISP MUST NOT allow an interrupt to
a conforming ISP.
Conforming ISPs
A conforming ISP is intended for use with AMX. A conforming ISP consists of an ISP
root and an Interrupt Handler. Often these two components are merged indistinguishably
into one body of code. The processor vectors to the ISP root which informs the AMX
Interrupt Supervisor that the interrupt has occurred. The Interrupt Supervisor preserves
the state of the interrupted task and, if necessary, switches to an interrupt stack. Upon
return to the ISP root, the associated Interrupt Handler is called. Your handler must
perform all services required by the device. Your handler is free to make procedure calls
to a subset of the AMX service facilities.
The conditions that will exist upon entry to your Interrupt Handler are dependent upon
the tool set which you are using and the language in which your Interrupt Handler is
programmed. In general:
Interrupts are disabled (masked) at a device dependent priority level.
A subset of the registers are free for use.
The AMX Interrupt Stack is in use.
When your Interrupt Handler executes, external interrupts of priority less than or equal to
the interrupting device are always disabled. Your Interrupt Handler must NOT enable
any interrupts of lesser or equal priority. Your handler can enable higher priority external
interrupts if permitted by your target hardware and your application software design.
When device service is completed, your Interrupt Handler returns to the ISP root which
informs the AMX Interrupt Supervisor that interrupt service is complete.
AMX monitors calls made by the Interrupt Handler to AMX service procedures. If no
such calls have been made, the AMX Interrupt Supervisor automatically restores the state
of the interrupted task and allows the ISP root to return directly to the interrupted task at
its point of interruption.