Handling Interrupts

This actually is very simple. gcc provides the means to mark a function as an interrupt service routine, namely prefixing a function with __attribute__(interrupt). So, something like this:

__attribute__((interrupt)) duart_interrupt(void) {
    /* Handle the interrupt */

}

But there's a macro in machine.h to help, so you could replace the above with:

#include <machine.h>

ISR duart_interrupt(void) {
    /* Handle the interrupt */

}

gcc knows that functions declared using either of the above methods should end with the rte rather than rts instruction.

On this page
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9