IPC@CHIP® RTOS-PPC – API Documentation

Header image

Main page

InterruptHandler isrInstall ( int  irq,
InterruptHandler  handler,
int  type 

Install a ISR for the selected interrupt. The interrupt service procedure is executed in supervisor mode.

irq Interrupt number


ISR_IRQ0 (0) = IRQ0
ISR_IRQ1 (1) = IRQ1
ISR_IRQ2 (2) = IRQ2
ISR_IRQ3 (3) = IRQ3
ISR_SLICE0 (6) = SliceTimer0
ISR_TIMER1 (11) = Timer1
ISR_TIMER2 (12) = Timer2
ISR_TIMER3 (13) = Timer3
ISR_TIMER4 (14) = Timer4
ISR_TIMER5 (15) = Timer5
ISR_TIMER6 (16) = Timer6
ISR_TIMER7 (17) = Timer7
ISR_PSC1_4 (20) = PSC1_4/PIO4
ISR_PSC2_4 (21) = PSC2_4/PIO9
ISR_PSC3_4 (22) = PSC3_4/PIO14
ISR_PSC3_5 (23) = PSC3_5/PIO15
ISR_PSC3_8 (24) = PSC3_8/PIO18
ISR_PSC3_9 (25) = PSC3_9/PIO19
ISR_PSC6_0 (26) = PSC6_0/PIO20
ISR_PSC6_1 (27) = PSC6_1/PIO21
ISR_USB1_9 (28) = USB1_9/PIO28
ISR_GPIO_7 (29) = GPIO_7/PIO31
ISR_SPI (32) = SPI controller (slave mode)
ISR_I2C1 (33) = I2C1 controller (slave mode)
ISR_I2C2 (34) = I2C2 controller (slave mode)
ISR_RTC_PERIODIC (35) = RTC periodic interrupts
ISR_RTC_STOPWATCH (36) = RTC stopwatch and alarm interrupts
ISR_DMA_GEN_DP0 (40) = General Dual-pointer DMA channel 0
ISR_DMA_GEN_DP1 (41) = General Dual-pointer DMA channel 1
ISR_DMA_GEN_DP2 (42) = General Dual-pointer DMA channel 2
ISR_DMA_GEN_DP3 (43) = General Dual-pointer DMA channel 3
ISR_DMA_GEN_DP4 (44) = General Dual-pointer DMA channel 4

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.

  1. 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.

  2. 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

Top of page | Main page

Copyright © 2018 Beck IPC GmbH
Generated on Thu Nov 1 13:20:15 2018 by Doxygen 1.6.1