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