RTEMS 7.0-rc1
Loading...
Searching...
No Matches
i8259.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
18/*
19 * Copyright (c) 1998 Eric Valette <eric.valette@free.fr>
20 *
21 * Redistribution and use in source and binary forms, with or without
22 * modification, are permitted provided that the following conditions
23 * are met:
24 * 1. Redistributions of source code must retain the above copyright
25 * notice, this list of conditions and the following disclaimer.
26 * 2. Redistributions in binary form must reproduce the above copyright
27 * notice, this list of conditions and the following disclaimer in the
28 * documentation and/or other materials provided with the distribution.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
34 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
37 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
38 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
39 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40 * POSSIBILITY OF SUCH DAMAGE.
41 */
42
43#ifndef I8259_H
44#define I8259_H
45
58#if 1
59#define ISA8259_M_ELCR 0x4d0
60#define ISA8259_S_ELCR 0x4d1
61#endif
62
63#define ELCRS_INT15_LVL 0x80
64#define ELCRS_INT14_LVL 0x40
65#define ELCRS_INT13_LVL 0x20
66#define ELCRS_INT12_LVL 0x10
67#define ELCRS_INT11_LVL 0x08
68#define ELCRS_INT10_LVL 0x04
69#define ELCRS_INT9_LVL 0x02
70#define ELCRS_INT8_LVL 0x01
71#define ELCRM_INT7_LVL 0x80
72#define ELCRM_INT6_LVL 0x40
73#define ELCRM_INT5_LVL 0x20
74#define ELCRM_INT4_LVL 0x10
75#define ELCRM_INT3_LVL 0x8
76#define ELCRM_INT2_LVL 0x4
77#define ELCRM_INT1_LVL 0x2
78#define ELCRM_INT0_LVL 0x1
79
87#define PIC_MASTER_COMMAND_IO_PORT 0x20
88#define PIC_SLAVE_COMMAND_IO_PORT 0xa0
89#define PIC_MASTER_IMR_IO_PORT 0x21
90#define PIC_SLAVE_IMR_IO_PORT 0xa1
91
99#define PIC_EOSI 0x60
100#define SLAVE_PIC_EOSI 0x62
101#define PIC_EOI 0x20
102
105#ifndef ASM
106
107#ifdef __cplusplus
108extern "C" {
109#endif
110
111/*
112 * rtems_irq_number Definitions
113 */
114#if 0
115
121#define BSP_ISA_IRQ_NUMBER (16)
122#define BSP_ISA_IRQ_LOWEST_OFFSET (0)
123#define BSP_ISA_IRQ_MAX_OFFSET (BSP_ISA_IRQ_LOWEST_OFFSET + BSP_ISA_IRQ_NUMBER - 1)
124
127#ifndef qemu
128#define BSP_PCI_IRQ_NUMBER (16)
129#else
130#define BSP_PCI_IRQ_NUMBER (0)
131#endif
132#define BSP_PCI_IRQ_LOWEST_OFFSET (BSP_ISA_IRQ_NUMBER)
133#define BSP_PCI_IRQ_MAX_OFFSET (BSP_PCI_IRQ_LOWEST_OFFSET + BSP_PCI_IRQ_NUMBER - 1)
134
135/*
136 * PowerPC exceptions handled as interrupt where an RTEMS managed interrupt
137 * handler might be connected
138 */
139#define BSP_PROCESSOR_IRQ_NUMBER (1)
140#define BSP_PROCESSOR_IRQ_LOWEST_OFFSET (BSP_PCI_IRQ_MAX_OFFSET + 1)
141#define BSP_PROCESSOR_IRQ_MAX_OFFSET (BSP_PROCESSOR_IRQ_LOWEST_OFFSET + BSP_PROCESSOR_IRQ_NUMBER - 1)
142/* Misc vectors for OPENPIC irqs (IPI, timers)
143 */
144#ifndef qemu
145#define BSP_MISC_IRQ_NUMBER (8)
146#else
147#define BSP_MISC_IRQ_NUMBER (0)
148#endif
149
150#define BSP_MISC_IRQ_LOWEST_OFFSET (BSP_PROCESSOR_IRQ_MAX_OFFSET + 1)
151#define BSP_MISC_IRQ_MAX_OFFSET (BSP_MISC_IRQ_LOWEST_OFFSET + BSP_MISC_IRQ_NUMBER - 1)
152
158#define BSP_IRQ_NUMBER (BSP_MISC_IRQ_MAX_OFFSET + 1)
159#define BSP_LOWEST_OFFSET (BSP_ISA_IRQ_LOWEST_OFFSET)
160#define BSP_MAX_OFFSET (BSP_MISC_IRQ_MAX_OFFSET)
161
169#define BSP_ISA_PERIODIC_TIMER (0)
170#define BSP_ISA_KEYBOARD (1)
171#define BSP_ISA_UART_COM2_IRQ (3)
172#define BSP_ISA_UART_COM1_IRQ (4)
173#define BSP_ISA_RT_TIMER1 (8)
174#define BSP_ISA_RT_TIMER3 (10)
175
183#define BSP_PCI_IRQ0 (BSP_PCI_IRQ_LOWEST_OFFSET)
184#if BSP_PCI_IRQ_NUMBER > 0
185#define BSP_PCI_ISA_BRIDGE_IRQ (BSP_PCI_IRQ0)
186#endif
187
190#if defined(mot_ppc_mvme2100)
191#define BSP_DEC21143_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 1)
192#define BSP_PMC_PCMIP_TYPE1_SLOT0_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 2)
193#define BSP_PCMIP_TYPE1_SLOT1_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 3)
194#define BSP_PCMIP_TYPE2_SLOT0_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 4)
195#define BSP_PCMIP_TYPE2_SLOT1_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 5)
196#define BSP_PCI_INTA_UNIVERSE_LINT0_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 7)
197#define BSP_PCI_INTB_UNIVERSE_LINT1_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 8)
198#define BSP_PCI_INTC_UNIVERSE_LINT2_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 9)
199#define BSP_PCI_INTD_UNIVERSE_LINT3_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 10)
200#define BSP_UART_COM1_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 13)
201#define BSP_FRONT_PANEL_ABORT_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 14)
202#define BSP_RTC_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 15)
203#else
204#define BSP_UART_COM1_IRQ BSP_ISA_UART_COM1_IRQ
205#define BSP_UART_COM2_IRQ BSP_ISA_UART_COM2_IRQ
206#endif
207
211#define BSP_DECREMENTER (BSP_PROCESSOR_IRQ_LOWEST_OFFSET)
212#endif
213
219typedef unsigned short rtems_i8259_masks;
220extern volatile rtems_i8259_masks i8259s_cache;
221
224/*-------------------------------------------------------------------------+
225| Function Prototypes.
226+--------------------------------------------------------------------------*/
227/*
228 * ------------------------ Intel 8259 (or emulation) Mngt Routines -------
229 */
230
236void BSP_i8259s_init(void);
237
248int BSP_irq_disable_at_i8259s (const rtems_irq_number irqLine);
249
256int BSP_irq_enable_at_i8259s (const rtems_irq_number irqLine);
257
266int BSP_irq_ack_at_i8259s (const rtems_irq_number irqLine);
267
271int BSP_irq_enabled_at_i8259s (const rtems_irq_number irqLine);
272
273int BSP_i8259s_int_process(void);
274
275extern void BSP_rtems_irq_mng_init(unsigned cpuId);
276extern void BSP_i8259s_init(void);
277
282#ifdef __cplusplus
283};
284#endif
285
286#endif
287#endif
unsigned short rtems_i8259_masks
Type definition for RTEMS managed interrupts.
Definition: irq.h:107
int BSP_irq_enable_at_i8259s(const rtems_irq_number irqLine)
function to enable a particular irq at 8259 level.
Definition: i8259.c:107
int BSP_irq_disable_at_i8259s(const rtems_irq_number irqLine)
function to disable a particular irq at 8259 level.
Definition: i8259.c:65
int BSP_irq_ack_at_i8259s(const rtems_irq_number irqLine)
function to acknowledge a particular irq at 8259 level.
Definition: i8259.c:159
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:141