source: rtems/c/src/lib/libbsp/i386/shared/irq/irq.h @ 93fb8797

Last change on this file since 93fb8797 was 93fb8797, checked in by Chris Johns <chrisj@…>, on May 6, 2016 at 7:55:29 AM

i386/pc386: Fix interrupt support.

Fix the interrupt and stop the spurious interrupt from happening.

The fix moves the EOI to C code and cleans that functionality out
of the asm part of the ISR handler.

The code checks the ISR and IRR registers on the enable.

Only ack the master for a slave IRQ if the slave has no other pending
requests.

  • Property mode set to 100644
File size: 4.4 KB
Line 
1/**
2 * @file
3 * @ingroup i386_irq
4 * @brief Interrupt handlers
5 */
6
7/* irq.h
8 *
9 *  This include file describe the data structure and the functions implemented
10 *  by rtems to write interrupt handlers.
11 *
12 *  CopyRight (C) 1998 valette@crf.canon.fr
13 *
14 *  This code is heavilly inspired by the public specification of STREAM V2
15 *  that can be found at :
16 *
17 *      <http://www.chorus.com/Documentation/index.html> by following
18 *  the STREAM API Specification Document link.
19 *
20 *  The license and distribution terms for this file may be
21 *  found in the file LICENSE in this distribution or at
22 *  http://www.rtems.org/license/LICENSE.
23 */
24
25/**
26 * @defgroup i386_irq Interrupt handlers
27 * @ingroup i386_shared
28 * @brief Data structure and the functions to write interrupt handlers
29 * @{
30 */
31
32#ifndef _IRQ_H_
33#define _IRQ_H_
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/** @brief
40 * Include some preprocessor value also used by assember code
41 */
42
43#include <bsp/irq_asm.h>
44#include <rtems.h>
45#define BSP_SHARED_HANDLER_SUPPORT      1
46#include <rtems/irq.h>
47#include <rtems/irq-extension.h>
48
49/*-------------------------------------------------------------------------+
50| Constants
51+--------------------------------------------------------------------------*/
52
53/** @brief Base vector for our IRQ handlers. */
54#define BSP_IRQ_VECTOR_BASE             BSP_ASM_IRQ_VECTOR_BASE
55#define BSP_IRQ_LINES_NUMBER            16
56#define BSP_IRQ_MAX_ON_i8259A           (BSP_IRQ_LINES_NUMBER - 1)
57
58/*
59 * Define the number of valid vectors. This is different to the number of IRQ
60 * signals supported. Use this value to allocation vector data or range check.
61 */
62#define BSP_IRQ_VECTOR_NUMBER        17
63#define BSP_IRQ_VECTOR_LOWEST_OFFSET 0
64#define BSP_IRQ_VECTOR_MAX_OFFSET    (BSP_IRQ_VECTOR_NUMBER - 1)
65
66/** @brief
67 * Interrupt offset in comparison to BSP_ASM_IRQ_VECTOR_BASE
68 * NB : 1) Interrupt vector number in IDT = offset + BSP_ASM_IRQ_VECTOR_BASE
69 *          2) The same name should be defined on all architecture
70 *             so that handler connection can be unchanged.
71 */
72#define BSP_PERIODIC_TIMER      0 /* fixed on all builds of PC */
73#define BSP_KEYBOARD            1 /* fixed on all builds of PC */
74#define BSP_UART_COM2_IRQ       3 /* fixed for ISA bus */
75#define BSP_UART_COM1_IRQ       4 /* fixed for ISA bus */
76#define BSP_UART_COM3_IRQ       5
77#define BSP_UART_COM4_IRQ       6
78#define BSP_RT_TIMER1           8
79#define BSP_RT_TIMER3           10
80#define BSP_SMP_IPI             16 /* not part of the ATPIC */
81
82#define BSP_INTERRUPT_VECTOR_MIN BSP_IRQ_VECTOR_LOWEST_OFFSET
83#define BSP_INTERRUPT_VECTOR_MAX BSP_IRQ_VECTOR_MAX_OFFSET
84
85/** @brief
86 * Type definition for RTEMS managed interrupts
87 */
88typedef unsigned short rtems_i8259_masks;
89
90/**
91 * @brief Contains the current IMR of both i8259s.
92 */
93//extern rtems_i8259_masks i8259s_cache;
94
95/**
96 * @brief Contains the super IMR of both i8259s to overrule i8259s_cache during
97 * interrupt exit.
98 *
99 * This enables a bsp_interrupt_vector_disable() in interrupt handlers.  This
100 * is required for the interrupt server support used by the new network stack.
101 */
102//extern rtems_i8259_masks i8259s_super_imr;
103
104/*-------------------------------------------------------------------------+
105| Function Prototypes.
106+--------------------------------------------------------------------------*/
107/*
108 * ------------------------ Intel 8259 (or emulation) Mngt Routines -------
109 */
110
111/** @brief
112 * function to disable a particular irq at 8259 level. After calling
113 * this function, even if the device asserts the interrupt line it will
114 * not be propagated further to the processor
115 */
116//int BSP_irq_disable_at_i8259s        (const rtems_irq_number irqLine);
117/** @brief
118 * function to enable a particular irq at 8259 level. After calling
119 * this function, if the device asserts the interrupt line it will
120 * be propagated further to the processor
121 */
122//int BSP_irq_enable_at_i8259s          (const rtems_irq_number irqLine);
123/** @brief
124 * function to acknoledge a particular irq at 8259 level. After calling
125 * this function, if a device asserts an enabled interrupt line it will
126 * be propagated further to the processor. Mainly usefull for people
127 * writting raw handlers as this is automagically done for rtems managed
128 * handlers.
129 */
130//int BSP_irq_ack_at_i8259s             (const rtems_irq_number irqLine);
131/** @brief
132 * function to check if a particular irq is enabled at 8259 level. After calling
133 */
134//int BSP_irq_enabled_at_i8259s         (const rtems_irq_number irqLine);
135
136/** @} */
137
138#ifdef __cplusplus
139}
140#endif
141
142#endif /* _IRQ_H_ */
Note: See TracBrowser for help on using the repository browser.