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

5
Last change on this file since f91fbbf4 was f91fbbf4, checked in by Sebastian Huber <sebastian.huber@…>, on 09/30/15 at 13:30:09

bsps/i386: Interrupt server support

  • Property mode set to 100644
File size: 4.0 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            17
56#define BSP_LOWEST_OFFSET               0
57#define BSP_MAX_ON_i8259S               (BSP_IRQ_LINES_NUMBER - 2)
58#define BSP_MAX_OFFSET                  (BSP_IRQ_LINES_NUMBER - 1)
59    /** @brief
60     * Interrupt offset in comparison to BSP_ASM_IRQ_VECTOR_BASE
61     * NB : 1) Interrupt vector number in IDT = offset + BSP_ASM_IRQ_VECTOR_BASE
62     *      2) The same name should be defined on all architecture
63     *         so that handler connection can be unchanged.
64     */
65#define BSP_PERIODIC_TIMER      0
66#define BSP_KEYBOARD            1
67#define BSP_UART_COM2_IRQ       3
68#define BSP_UART_COM1_IRQ       4
69#define BSP_UART_COM3_IRQ       5
70#define BSP_UART_COM4_IRQ       6
71#define BSP_RT_TIMER1           8
72#define BSP_RT_TIMER3           10
73#define BSP_SMP_IPI             16
74
75#define BSP_INTERRUPT_VECTOR_MIN BSP_LOWEST_OFFSET
76#define BSP_INTERRUPT_VECTOR_MAX BSP_MAX_OFFSET
77
78/** @brief
79 * Type definition for RTEMS managed interrupts
80 */
81typedef unsigned short rtems_i8259_masks;
82
83/**
84 * @brief Contains the current IMR of both i8259s.
85 */
86extern rtems_i8259_masks i8259s_cache;
87
88/**
89 * @brief Contains the super IMR of both i8259s to overrule i8259s_cache during
90 * interrupt exit.
91 *
92 * This enables a bsp_interrupt_vector_disable() in interrupt handlers.  This
93 * is required for the interrupt server support used by the new network stack.
94 */
95extern rtems_i8259_masks i8259s_super_imr;
96
97/*-------------------------------------------------------------------------+
98| Function Prototypes.
99+--------------------------------------------------------------------------*/
100/*
101 * ------------------------ Intel 8259 (or emulation) Mngt Routines -------
102 */
103
104/** @brief
105 * function to disable a particular irq at 8259 level. After calling
106 * this function, even if the device asserts the interrupt line it will
107 * not be propagated further to the processor
108 */
109int BSP_irq_disable_at_i8259s        (const rtems_irq_number irqLine);
110/** @brief
111 * function to enable a particular irq at 8259 level. After calling
112 * this function, if the device asserts the interrupt line it will
113 * be propagated further to the processor
114 */
115int BSP_irq_enable_at_i8259s            (const rtems_irq_number irqLine);
116/** @brief
117 * function to acknoledge a particular irq at 8259 level. After calling
118 * this function, if a device asserts an enabled interrupt line it will
119 * be propagated further to the processor. Mainly usefull for people
120 * writting raw handlers as this is automagically done for rtems managed
121 * handlers.
122 */
123int BSP_irq_ack_at_i8259s               (const rtems_irq_number irqLine);
124/** @brief
125 * function to check if a particular irq is enabled at 8259 level. After calling
126 */
127int BSP_irq_enabled_at_i8259s           (const rtems_irq_number irqLine);
128
129/** @} */
130
131#ifdef __cplusplus
132}
133#endif
134
135#endif /* _IRQ_H_ */
Note: See TracBrowser for help on using the repository browser.