- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

# arch/avr32/intc.c

Go to the documentation of this file.

    00001
    00044 #include <assert.h>
    00045 #include <io.h>
    00046 #include <irq_handler.h>
    00047 #include <linkerscript.h>
    00048 #include <status-codes.h>
    00049 #include <types.h>
    00050 #include <chip/memory-map.h>
    00051
    00052 #define HANDLER_OFFSET_MASK     0x00ffffff
    00053 #define INTLEV_MASK             0x00000003
    00054 #define INTLEV_SHIFT            30
    00055
    00056 void __setup_irq_handler(int irq, void (*entry)(void), void **pdata,
    00057                 unsigned int level, void *data)
    00058 {
    00059         unsigned long   handler_offset;
    00060         uint32_t        intpr;
    00061
    00062         /* Do not attempt to initialize the same irq twice */
    00063         assert(*pdata == NULL);
    00064
    00065         /* Level must be a number between 0 and 3 inclusive */
    00066         assert(!(level & ~INTLEV_MASK));
    00067
    00068         handler_offset = (unsigned long)entry - (unsigned long)_evba;
    00069
    00070         /* The low-level handler must not be placed too far from EVBA */
    00071         assert(!(handler_offset & ~HANDLER_OFFSET_MASK));
    00072
    00073         intpr = handler_offset;
    00074         intpr |= level << INTLEV_SHIFT;
    00075         mmio_write32((void *)INTC_BASE + 4 * irq, intpr);
    00076         *pdata = data;
    00077 }