[acc25ee] | 1 | /* irq.h |
---|
| 2 | * |
---|
| 3 | * This include file describe the data structure and the functions implemented |
---|
[e79a1947] | 4 | * by RTEMS to write interrupt handlers. |
---|
[acc25ee] | 5 | * |
---|
[e79a1947] | 6 | * Copyright (C) 1999 valette@crf.canon.fr |
---|
[acc25ee] | 7 | * |
---|
| 8 | * This code is heavilly inspired by the public specification of STREAM V2 |
---|
| 9 | * that can be found at : |
---|
| 10 | * |
---|
| 11 | * <http://www.chorus.com/Documentation/index.html> by following |
---|
| 12 | * the STREAM API Specification Document link. |
---|
| 13 | * |
---|
| 14 | * The license and distribution terms for this file may be |
---|
[0c875c6a] | 15 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 16 | * http://www.rtems.org/license/LICENSE. |
---|
[acc25ee] | 17 | */ |
---|
| 18 | |
---|
[d8999b7] | 19 | #ifndef BSP_POWERPC_IRQ_H |
---|
| 20 | #define BSP_POWERPC_IRQ_H |
---|
| 21 | |
---|
| 22 | #define BSP_SHARED_HANDLER_SUPPORT 1 |
---|
| 23 | #include <rtems/irq.h> |
---|
[acc25ee] | 24 | |
---|
| 25 | /* |
---|
| 26 | * 8259 edge/level control definitions at VIA |
---|
| 27 | */ |
---|
| 28 | #define ISA8259_M_ELCR 0x4d0 |
---|
| 29 | #define ISA8259_S_ELCR 0x4d1 |
---|
| 30 | |
---|
| 31 | #define ELCRS_INT15_LVL 0x80 |
---|
| 32 | #define ELCRS_INT14_LVL 0x40 |
---|
| 33 | #define ELCRS_INT13_LVL 0x20 |
---|
| 34 | #define ELCRS_INT12_LVL 0x10 |
---|
| 35 | #define ELCRS_INT11_LVL 0x08 |
---|
| 36 | #define ELCRS_INT10_LVL 0x04 |
---|
| 37 | #define ELCRS_INT9_LVL 0x02 |
---|
| 38 | #define ELCRS_INT8_LVL 0x01 |
---|
| 39 | #define ELCRM_INT7_LVL 0x80 |
---|
| 40 | #define ELCRM_INT6_LVL 0x40 |
---|
| 41 | #define ELCRM_INT5_LVL 0x20 |
---|
| 42 | #define ELCRM_INT4_LVL 0x10 |
---|
| 43 | #define ELCRM_INT3_LVL 0x8 |
---|
| 44 | #define ELCRM_INT2_LVL 0x4 |
---|
| 45 | #define ELCRM_INT1_LVL 0x2 |
---|
| 46 | #define ELCRM_INT0_LVL 0x1 |
---|
| 47 | |
---|
| 48 | /* PIC's command and mask registers */ |
---|
| 49 | #define PIC_MASTER_COMMAND_IO_PORT 0x20 /* Master PIC command register */ |
---|
| 50 | #define PIC_SLAVE_COMMAND_IO_PORT 0xa0 /* Slave PIC command register */ |
---|
| 51 | #define PIC_MASTER_IMR_IO_PORT 0x21 /* Master PIC Interrupt Mask Register */ |
---|
| 52 | #define PIC_SLAVE_IMR_IO_PORT 0xa1 /* Slave PIC Interrupt Mask Register */ |
---|
| 53 | |
---|
| 54 | /* Command for specific EOI (End Of Interrupt): Interrupt acknowledge */ |
---|
| 55 | #define PIC_EOSI 0x60 /* End of Specific Interrupt (EOSI) */ |
---|
| 56 | #define SLAVE_PIC_EOSI 0x62 /* End of Specific Interrupt (EOSI) for cascade */ |
---|
| 57 | #define PIC_EOI 0x20 /* Generic End of Interrupt (EOI) */ |
---|
| 58 | |
---|
| 59 | #ifndef ASM |
---|
| 60 | |
---|
[ae1f243] | 61 | #ifdef __cplusplus |
---|
| 62 | extern "C" { |
---|
| 63 | #endif |
---|
| 64 | |
---|
[acc25ee] | 65 | /* |
---|
[d8999b7] | 66 | * rtems_irq_number Definitions |
---|
[acc25ee] | 67 | */ |
---|
| 68 | |
---|
[d8999b7] | 69 | /* |
---|
| 70 | * ISA IRQ handler related definitions |
---|
| 71 | */ |
---|
| 72 | #define BSP_ISA_IRQ_NUMBER (16) |
---|
| 73 | #define BSP_ISA_IRQ_LOWEST_OFFSET (0) |
---|
| 74 | #define BSP_ISA_IRQ_MAX_OFFSET (BSP_ISA_IRQ_LOWEST_OFFSET + BSP_ISA_IRQ_NUMBER - 1) |
---|
| 75 | /* |
---|
| 76 | * PCI IRQ handlers related definitions |
---|
| 77 | * CAUTION : BSP_PCI_IRQ_LOWEST_OFFSET should be equal to OPENPIC_VEC_SOURCE |
---|
| 78 | */ |
---|
[58127230] | 79 | #ifndef qemu |
---|
[d8999b7] | 80 | #define BSP_PCI_IRQ_NUMBER (16) |
---|
[58127230] | 81 | #else |
---|
| 82 | #define BSP_PCI_IRQ_NUMBER (0) |
---|
| 83 | #endif |
---|
[d8999b7] | 84 | #define BSP_PCI_IRQ_LOWEST_OFFSET (BSP_ISA_IRQ_NUMBER) |
---|
| 85 | #define BSP_PCI_IRQ_MAX_OFFSET (BSP_PCI_IRQ_LOWEST_OFFSET + BSP_PCI_IRQ_NUMBER - 1) |
---|
| 86 | /* |
---|
| 87 | * PowerPC exceptions handled as interrupt where an RTEMS managed interrupt |
---|
| 88 | * handler might be connected |
---|
| 89 | */ |
---|
| 90 | #define BSP_PROCESSOR_IRQ_NUMBER (1) |
---|
| 91 | #define BSP_PROCESSOR_IRQ_LOWEST_OFFSET (BSP_PCI_IRQ_MAX_OFFSET + 1) |
---|
| 92 | #define BSP_PROCESSOR_IRQ_MAX_OFFSET (BSP_PROCESSOR_IRQ_LOWEST_OFFSET + BSP_PROCESSOR_IRQ_NUMBER - 1) |
---|
| 93 | /* Misc vectors for OPENPIC irqs (IPI, timers) |
---|
| 94 | */ |
---|
[58127230] | 95 | #ifndef qemu |
---|
[d8999b7] | 96 | #define BSP_MISC_IRQ_NUMBER (8) |
---|
[58127230] | 97 | #else |
---|
| 98 | #define BSP_MISC_IRQ_NUMBER (0) |
---|
| 99 | #endif |
---|
| 100 | |
---|
[d8999b7] | 101 | #define BSP_MISC_IRQ_LOWEST_OFFSET (BSP_PROCESSOR_IRQ_MAX_OFFSET + 1) |
---|
| 102 | #define BSP_MISC_IRQ_MAX_OFFSET (BSP_MISC_IRQ_LOWEST_OFFSET + BSP_MISC_IRQ_NUMBER - 1) |
---|
| 103 | /* |
---|
| 104 | * Summary |
---|
| 105 | */ |
---|
| 106 | #define BSP_IRQ_NUMBER (BSP_MISC_IRQ_MAX_OFFSET + 1) |
---|
| 107 | #define BSP_LOWEST_OFFSET (BSP_ISA_IRQ_LOWEST_OFFSET) |
---|
| 108 | #define BSP_MAX_OFFSET (BSP_MISC_IRQ_MAX_OFFSET) |
---|
| 109 | /* |
---|
| 110 | * Some ISA IRQ symbolic name definition |
---|
| 111 | */ |
---|
| 112 | #define BSP_ISA_PERIODIC_TIMER (0) |
---|
| 113 | #define BSP_ISA_KEYBOARD (1) |
---|
| 114 | #define BSP_ISA_UART_COM2_IRQ (3) |
---|
| 115 | #define BSP_ISA_UART_COM1_IRQ (4) |
---|
| 116 | #define BSP_ISA_RT_TIMER1 (8) |
---|
| 117 | #define BSP_ISA_RT_TIMER3 (10) |
---|
| 118 | /* |
---|
| 119 | * Some PCI IRQ symbolic name definition |
---|
| 120 | */ |
---|
| 121 | #define BSP_PCI_IRQ0 (BSP_PCI_IRQ_LOWEST_OFFSET) |
---|
[58127230] | 122 | #if BSP_PCI_IRQ_NUMBER > 0 |
---|
[d8999b7] | 123 | #define BSP_PCI_ISA_BRIDGE_IRQ (BSP_PCI_IRQ0) |
---|
[58127230] | 124 | #endif |
---|
[e79a1947] | 125 | |
---|
| 126 | #if defined(mvme2100) |
---|
[d8999b7] | 127 | #define BSP_DEC21143_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 1) |
---|
| 128 | #define BSP_PMC_PCMIP_TYPE1_SLOT0_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 2) |
---|
| 129 | #define BSP_PCMIP_TYPE1_SLOT1_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 3) |
---|
| 130 | #define BSP_PCMIP_TYPE2_SLOT0_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 4) |
---|
| 131 | #define BSP_PCMIP_TYPE2_SLOT1_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 5) |
---|
| 132 | #define BSP_PCI_INTA_UNIVERSE_LINT0_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 7) |
---|
| 133 | #define BSP_PCI_INTB_UNIVERSE_LINT1_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 8) |
---|
| 134 | #define BSP_PCI_INTC_UNIVERSE_LINT2_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 9) |
---|
| 135 | #define BSP_PCI_INTD_UNIVERSE_LINT3_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 10) |
---|
| 136 | #define BSP_UART_COM1_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 13) |
---|
| 137 | #define BSP_FRONT_PANEL_ABORT_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 14) |
---|
| 138 | #define BSP_RTC_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 15) |
---|
[f3173c0] | 139 | #else |
---|
| 140 | #define BSP_UART_COM1_IRQ BSP_ISA_UART_COM1_IRQ |
---|
| 141 | #define BSP_UART_COM2_IRQ BSP_ISA_UART_COM2_IRQ |
---|
[e79a1947] | 142 | #endif |
---|
| 143 | |
---|
[d8999b7] | 144 | /* |
---|
| 145 | * Some Processor execption handled as RTEMS IRQ symbolic name definition |
---|
| 146 | */ |
---|
| 147 | #define BSP_DECREMENTER (BSP_PROCESSOR_IRQ_LOWEST_OFFSET) |
---|
[6128a4a] | 148 | |
---|
[acc25ee] | 149 | |
---|
| 150 | /* |
---|
| 151 | * Type definition for RTEMS managed interrupts |
---|
| 152 | */ |
---|
| 153 | typedef unsigned short rtems_i8259_masks; |
---|
| 154 | |
---|
| 155 | extern volatile rtems_i8259_masks i8259s_cache; |
---|
| 156 | |
---|
| 157 | /*-------------------------------------------------------------------------+ |
---|
| 158 | | Function Prototypes. |
---|
| 159 | +--------------------------------------------------------------------------*/ |
---|
| 160 | /* |
---|
| 161 | * ------------------------ Intel 8259 (or emulation) Mngt Routines ------- |
---|
| 162 | */ |
---|
[8c9fffd] | 163 | void BSP_i8259s_init(void); |
---|
[acc25ee] | 164 | |
---|
| 165 | /* |
---|
| 166 | * function to disable a particular irq at 8259 level. After calling |
---|
| 167 | * this function, even if the device asserts the interrupt line it will |
---|
| 168 | * not be propagated further to the processor |
---|
[c10dc13] | 169 | * |
---|
| 170 | * RETURNS: 1/0 if the interrupt was enabled/disabled originally or |
---|
| 171 | * a value < 0 on error. |
---|
[acc25ee] | 172 | */ |
---|
[d8999b7] | 173 | int BSP_irq_disable_at_i8259s (const rtems_irq_number irqLine); |
---|
[acc25ee] | 174 | /* |
---|
| 175 | * function to enable a particular irq at 8259 level. After calling |
---|
| 176 | * this function, if the device asserts the interrupt line it will |
---|
| 177 | * be propagated further to the processor |
---|
| 178 | */ |
---|
[d8999b7] | 179 | int BSP_irq_enable_at_i8259s (const rtems_irq_number irqLine); |
---|
[acc25ee] | 180 | /* |
---|
[e79a1947] | 181 | * function to acknowledge a particular irq at 8259 level. After calling |
---|
[acc25ee] | 182 | * this function, if a device asserts an enabled interrupt line it will |
---|
| 183 | * be propagated further to the processor. Mainly usefull for people |
---|
[e79a1947] | 184 | * writing raw handlers as this is automagically done for RTEMS managed |
---|
[acc25ee] | 185 | * handlers. |
---|
| 186 | */ |
---|
[d8999b7] | 187 | int BSP_irq_ack_at_i8259s (const rtems_irq_number irqLine); |
---|
[acc25ee] | 188 | /* |
---|
| 189 | * function to check if a particular irq is enabled at 8259 level. After calling |
---|
| 190 | */ |
---|
[d8999b7] | 191 | int BSP_irq_enabled_at_i8259s (const rtems_irq_number irqLine); |
---|
[6128a4a] | 192 | |
---|
[acc25ee] | 193 | extern void BSP_rtems_irq_mng_init(unsigned cpuId); |
---|
| 194 | extern void BSP_i8259s_init(void); |
---|
[ae1f243] | 195 | |
---|
[2eb9e399] | 196 | /* Stuff in irq_supp.h should eventually go into <rtems/irq.h> */ |
---|
| 197 | #include <bsp/irq_supp.h> |
---|
[8c9fffd] | 198 | |
---|
[ae1f243] | 199 | #ifdef __cplusplus |
---|
[8c9fffd] | 200 | }; |
---|
[ae1f243] | 201 | #endif |
---|
| 202 | |
---|
[acc25ee] | 203 | #endif |
---|
| 204 | #endif |
---|