Install a ISR for the selected interrupt. The interrupt service procedure is executed in supervisor mode.
|irq ||Interrupt number|
|handler ||Pointer to user interrupt service procedure. If pointer is NULL, user ISR is disabled.|
|type ||ISR type|
ISR_HW (0) = Hardware ISR: No RTX calls are allowed inside this installed service routine. Interrupts must remain masked. Total hardware interrupt stack size is 2048 bytes.
ISR_RTX (1) = RTX ISR: Some RTX calls are allowed. Interrupts are enabled. Total RTX ISR stack size is 2048 bytes.
Two calls to this API can be made to install both type handlers for a specific interrupt.
- Interrupt handling is split into two phases. A user callback can be installed for either phase or both phases.
Hardware ISR callback - This callback, if installed, executes first. On entry to this callback interrupts are masked and must remain so throughout the callback. The intent here is execute a very minimal amount of time-critical code to, for example, access volatile data at the hardware. Level sensitive interrupts must be released. Then a decision can be made whether or not a call to the "off-line" RTX ISR portion of the handling is required. This would be the case if, for example, some task needed to be signaled. Returning non-zero value will cause the RTX ISR callback to be called. Returning zero will tell the system to skip the RTX ISR call.
RTX ISR callback - This callback handles the less urgent "off-line" portion of the interrupt processing. On entry to this callback the interrupts are enabled. The user may mask interrupts for short periods if desired. Tasks can safely be signaled from within this callback.
The user-defined ISR are called from a system ISR with the interrupt identifier number as parameter, thus allowing for a single user ISR to handle multiple interrupt sources. The user ISR (either type) must be declared with the following form:
int My_ISR (int irq); Hardware ISR return 0, if no subsequent RTX ISR should be called. If it returns 1, a subsequent RTX ISR callback is called (if installed).
The return value from RTX ISR type callbacks has no significance and is ignored by the system.
The system enforces a sequential execution of RTX ISR by queuing request in a 31 slot service request FIFO. Care must be taken to not allow RTX ISR service functions to dwell too long to avoid exhausting this queue space. This is particularly true if the system's RTI rate is turned up high. A system shut down results if this RTX ISR request queue space is exhausted.
Floating-point operations are not permitted inside Interrrupt Service Routines.
ISR execute in supervisor mode, so extra care must be taken to not intefere with system memory which is not protected in this mode of operation.
In RTX ISR the programmer may mask interrupts for very short periods of time. In hardware ISR, the interrupts must always remain masked.
When installing callbacks for a Power Fail Interrupt handler, the system must first be configured by the PFI shell command before using this API to install your callbacks. (The PFI configuration is non-volatile, so it need not be performed after every reboot.)
- Pointer to old ISR handler
- SC2x3 V1.00 - CLIB V1.00
- SC2x3 V1.02 - CLIB V1.02: Add RTC interrupts
SC2x3 V1.05 - CLIB V1.03: Add DMA interrupts
- See also:
- isrSetPriorityHiGroup(), isrSetPriorityLoGroup(), isrSetPriorityPeriph()
irqEnable(), gpioEnable(), gpioSetIntMode()
PFI shell command