rt-kernel: User & Reference Manual  424
Functions
Interrupt Services

Functions

void int_connect (irq_t irq, void(*isr)(void *), void *arg)
void int_enable (irq_t irq)
void int_disable (irq_t irq)
void int_lock (void)
void int_unlock (void)

Function Documentation

void int_connect ( irq_t  irq,
void(*)(void *)  isr,
void *  arg 
)

Connects the function isr as the Interrupt Service Routine for the interrupt specified by irq. The ISR will be called with the parameter arg when the interrupt is raised.

The arg parameter is normally used to let one ISR service several devices of the same type.

 void uartISR (void * arg)
 {
    volatile uart_t * pUART = (uart_t *)arg;

    // Handle UART interrupt
    if (pUART->irq_status == ...)
    {
       ...
    }
 }

 void myInit (void)
 {
    int_connect (IRQ_UART0, uartISR, pUART0);
    int_connect (IRQ_UART1, uartISR, pUART1);

    int_enable (IRQ_UART0);
    int_enable (IRQ_UART1);
 }
Parameters:
irqInterrupt to be serviced
isrInterrupt service routine
argSent as argument to ISR
void int_disable ( irq_t  irq)

Disables the interrupt specified by irq.

Parameters:
irqInterrupt to disable
void int_enable ( irq_t  irq)

Enables the interrupt specified by irq.

Parameters:
irqInterrupt to enable
void int_lock ( void  )

Globally disables all maskable interrupts.

void int_unlock ( void  )

Globally enables all maskable interrupts.


rt-kernel