[294] | 1 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 2 | // File : irq_handler.h |
---|
| 3 | // Date : 01/04/2012 |
---|
| 4 | // Author : alain greiner |
---|
| 5 | // Copyright (c) UPMC-LIP6 |
---|
| 6 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 7 | // The irq_handler.c and irq_handler.h files are part of the GIET-VM nano-kernel. |
---|
| 8 | // They contain the code of the _irq_demux() function that access the XICU or |
---|
| 9 | // ICU component (Interupt Controler Unit), and the various ISRs (Interrupt |
---|
| 10 | // Service Routine) associated to the various ISR types. |
---|
| 11 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 12 | |
---|
[258] | 13 | #ifndef _IRQ_HANDLER_H |
---|
| 14 | #define _IRQ_HANDLER_H |
---|
| 15 | |
---|
[294] | 16 | //////////////////////////////////////////////////////////////////////////////// |
---|
[519] | 17 | // This enum must consistent with the values defined in |
---|
| 18 | // xml_driver.c / irq_handler.c / mapping.py |
---|
[294] | 19 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 20 | |
---|
[258] | 21 | enum isr_type_t |
---|
| 22 | { |
---|
| 23 | ISR_DEFAULT = 0, |
---|
[294] | 24 | ISR_TICK = 1, |
---|
| 25 | ISR_TTY_RX = 2, |
---|
| 26 | ISR_TTY_TX = 3, |
---|
| 27 | ISR_BDV = 4, |
---|
[258] | 28 | ISR_TIMER = 5, |
---|
| 29 | ISR_WAKUP = 6, |
---|
[294] | 30 | ISR_NIC_RX = 7, |
---|
| 31 | ISR_NIC_TX = 8, |
---|
| 32 | ISR_CMA = 9, |
---|
[297] | 33 | ISR_MMC = 10, |
---|
[322] | 34 | ISR_DMA = 11, |
---|
| 35 | ISR_SPI = 12, |
---|
[519] | 36 | ISR_MWR = 13, |
---|
[258] | 37 | }; |
---|
| 38 | |
---|
[440] | 39 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 40 | // irq_handler functions |
---|
| 41 | /////////////////////////////////////////////////////////////////////////////////// |
---|
[258] | 42 | |
---|
[440] | 43 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 44 | // This function access the ICU or XICU component (Interrupt Controler Unit) |
---|
| 45 | // to get the interrupt vector entry. There is one ICU or XICU component per |
---|
| 46 | // cluster, and this component can support up to NB_PROCS_MAX output IRQs. |
---|
| 47 | // It returns the highest priority active interrupt index (smaller |
---|
| 48 | // indexes have the highest priority). |
---|
| 49 | // Any value larger than 31 means "no active interrupt", and no ISR is executed. |
---|
| 50 | // |
---|
| 51 | // There is three interrupt vectors per processor (stored in the processor's |
---|
| 52 | // scheduler) for the three HWI, PTI, and WTI interrupts types. |
---|
| 53 | // Each interrupt vector entry contains three bits fields: |
---|
| 54 | // - isr_id bits[15:0] : defines the type of ISR to be executed. |
---|
| 55 | // - channel_id bits[30:16] : defines the channel for multi-channels peripherals. |
---|
| 56 | // - valid bit 31 : valid interrupt vector entry |
---|
| 57 | // If the peripheral is replicated in clusters, the channel_id is |
---|
| 58 | // a global index : channel_id = cluster_id * NB_CHANNELS_MAX + loc_id |
---|
| 59 | /////////////////////////////////////////////////////////////////////////////////// |
---|
[258] | 60 | extern void _irq_demux(); |
---|
| 61 | |
---|
[440] | 62 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 63 | // This default ISR is called when the interrupt handler is called, |
---|
| 64 | // and there is no active IRQ. It simply displays a warning message on TTY[0]. |
---|
| 65 | /////////////////////////////////////////////////////////////////////////////////// |
---|
[258] | 66 | extern void _isr_default(); |
---|
| 67 | |
---|
[440] | 68 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 69 | // This ISR can only be executed after a WTI (IPI) to force a context switch |
---|
| 70 | // on a remote processor. The context switch is only executed if the current task |
---|
| 71 | // is the IDLE_TASK, or if the value written in the mailbox is non zero. |
---|
| 72 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 73 | extern void _isr_wakup( unsigned int irq_type, |
---|
| 74 | unsigned int irq_id, |
---|
| 75 | unsigned int channel ); |
---|
| 76 | |
---|
| 77 | ///////////////////////////////////////////////////////////////////////////////////// |
---|
| 78 | // This ISR is in charge of context switch, and handles the IRQs generated by |
---|
| 79 | // the "system" timers. It can be PTI in case of XCU, or it can be HWI generated |
---|
| 80 | // by an external timer in case of ICU. |
---|
| 81 | // The ISR acknowledges the IRQ, and calls the _ctx_switch() function. |
---|
| 82 | ///////////////////////////////////////////////////////////////////////////////////// |
---|
[294] | 83 | extern void _isr_tick( unsigned int irq_type, |
---|
| 84 | unsigned int irq_id, |
---|
| 85 | unsigned int channel ); |
---|
| 86 | |
---|
[258] | 87 | #endif |
---|
| 88 | |
---|
| 89 | // Local Variables: |
---|
| 90 | // tab-width: 4 |
---|
| 91 | // c-basic-offset: 4 |
---|
| 92 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 93 | // indent-tabs-mode: nil |
---|
| 94 | // End: |
---|
| 95 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
| 96 | |
---|