Isr and vsr management, Interrupt controller management – Comtrol eCos User Manual
Page 288
Chapter 9. HAL Interfaces
HAL_DISABLE_INTERRUPTS()
disables the delivery of interrupts and stores the original state of the interrupt mask
in the variable passed in the
old
argument.
HAL_RESTORE_INTERRUPTS()
restores the state of the interrupt mask to that recorded in
old
.
HAL_ENABLE_INTERRUPTS()
simply enables interrupts regardless of the current state of the mask.
HAL_QUERY_INTERRUPTS()
stores the state of the interrupt mask in the variable passed in the
state
argument.
The state stored here should also be capable of being passed to
HAL_RESTORE_INTERRUPTS()
at a later point.
It is at the HAL implementer’s discretion exactly which interrupts are masked by this mechanism. Where a CPU
has more than one interrupt type that may be masked separately (e.g. the ARM’s IRQ and FIQ) only those that can
raise DSRs need to be masked here. A separate architecture specific mechanism may then be used to control the
other interrupt types.
ISR and VSR management
HAL_INTERRUPT_IN_USE( vector, state )
HAL_INTERRUPT_ATTACH( vector, isr, data, object )
HAL_INTERRUPT_DETACH( vector, isr )
HAL_VSR_SET( vector, vsr, poldvsr )
HAL_VSR_GET( vector, pvsr )
HAL_VSR_SET_TO_ECOS_HANDLER( vector, poldvsr )
These macros manage the attachment of interrupt and vector service routines to interrupt and exception vectors
respectively.
HAL_INTERRUPT_IN_USE()
tests the state of the supplied interrupt vector and sets the value of the state parameter
to either 1 or 0 depending on whether there is already an ISR attached to the vector. The HAL will only allow one
ISR to be attached to each vector, so it is a good idea to use this function before using
HAL_INTERRUPT_ATTACH()
.
HAL_INTERRUPT_ATTACH()
attaches the ISR, data pointer and object pointer to the given
vector
. When an
interrupt occurs on this vector the ISR is called using the C calling convention and the vector number and data
pointer are passed to it as the first and second arguments respectively.
HAL_INTERRUPT_DETACH()
detaches the ISR from the vector.
HAL_VSR_SET()
replaces the VSR attached to the
vector
with the replacement supplied in
vsr
. The old VSR
is returned in the location pointed to by
pvsr
.
HAL_VSR_GET()
assigns a copy of the VSR to the location pointed to by
pvsr
.
HAL_VSR_SET_TO_ECOS_HANDLER()
ensures that the VSR for a specific exception is pointing at the eCos excep-
tion VSR and not one for RedBoot or some other ROM monitor. The default when running under RedBoot is for
exceptions to be handled by RedBoot and passed to GDB. This macro diverts the exception to eCos so that it may
be handled by application code. The arguments are the VSR vector to be replaces, and a location in which to store
the old VSR pointer, so that it may be replaced at a later point.
Interrupt controller management
HAL_INTERRUPT_MASK( vector )
HAL_INTERRUPT_UNMASK( vector )
HAL_INTERRUPT_ACKNOWLEDGE( vector )
184