This is an old revision of the document!

How to write interrupt handlers

Since version 1.1.0 ChibiOS/RT offers a cross-platform method for writing interrupt handlers. Port-related and compiler-related details are encapsulated within standard system macros.

Writing Regular Interrupt handlers

A Regular Interrupts handler is an ISR from where the invocation of system APIs is possible, it must be written using the following general form:

  /* IRQ handling code, preemptable if the architecture supports it.*/
  /* Invocation of some I-Class system APIs, never preemptable.*/
  /* More IRQ handling code, again preemptable.*/

Writing Fast Interrupt handlers

On some architectures it is supported a special class of “Fast Interrupts”, such interrupt sources have a higher hardware priority than the kernel so it is not possible to invoke system APIs from there. Fast interrupts handlers must be written using the following general form:

  /* Fast IRQ handling code, preemptable if the architecture supports it.
     The invocation of any API is forbidden here because fast interrupt
     handlers can preempt the kernel even within its critical zones in
     order to minimize latency.*/

Handlers naming

A note about the handler name “myIRQ”, in some ports it must be a vector number rather than a function name, it could also be a name from within a predefined set, see the notes about the various ports.

Important Notes

  • There is an important application note about ARM7 interrupt handlers, please read about it in the ARM7 port documentation.
chibios/howtos/interrupts.1291475304.txt.gz · Last modified: 2011/10/03 20:48 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.3