source: rtems/c/src/lib/libbsp/arm/vegaplus/irq/irq.h @ 7cc96f5

4.104.114.84.95
Last change on this file since 7cc96f5 was 4564566, checked in by Joel Sherrill <joel.sherrill@…>, on 09/13/00 at 13:45:05

2000-09-13 Emmanuel Raguet <raguet@…>

  • vegaplus BSP submitted by Emmanuel Raguet <raguet@…> and Eric Valette <valette@…>.
  • vegaplus/bsp_specs, configure.in, console/Makefile.am, include/Makefile.am, include/bsp.h, include/registers.h, irq/Makefile.am, irq/bsp_irq_asm.S, irq/bsp_irq_init.c, irq/irq.c, irq/irq.h, start/Makefile.am, start/start.S, startup/Makefile.am, startup/bspstart.c, startup/exit.c, startup/linkcmds, wrapup/Makefile.am: New files.
  • Property mode set to 100644
File size: 5.6 KB
Line 
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) 2000 Canon Research Centre France SA.
7 * Emmanuel Raguet, mailto:raguet@crf.canon.fr
8 *
9 *  The license and distribution terms for this file may be
10 *  found in found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 */
14
15#ifndef _IRQ_H_
16#define _IRQ_H_
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/*
23 * Include some preprocessor value also used by assember code
24 */
25 
26#include <rtems.h>
27
28extern void default_int_handler();
29/*-------------------------------------------------------------------------+
30| Constants
31+--------------------------------------------------------------------------*/
32
33typedef enum {
34  BSP_DECT_CORE = 0,
35  BSP_PCM       = 1,
36  BSP_UART      = 2,
37  BSP_RESERVED1 = 3,
38  BSP_TIMER_0   = 4,
39  BSP_TIMER_1   = 5,
40  BSP_RESERVED2 = 6,
41  BSP_RESERVED3 = 7,
42  BSP_LCD       = 8,
43  BSP_KPAD      = 9,
44  BSP_TAD       = 10,
45  BSP_ADC       = 11,
46  BSP_EXT_0     = 12,
47  BSP_EXT_1     = 13,
48  BSP_EXT_2     = 14,
49  BSP_EXT_3     = 15,
50  BSP_MAX_INT   = 16
51} rtems_irq_symbolic_name;
52
53#define LEVEL_EDGE_MASK  0xC0
54#define LEVEL_LOW        0x00
55#define LEVEL_HIGH       0x40
56#define EDGE_FALLING     0x80
57#define EDGE_RISING      0xC0
58
59#define PRIO_MASK        0x07
60
61#define LEVEL_MASK       0x07
62
63#define MASKIRQ          0x80
64#define MASKFIQ          0x40
65 
66#define END_OF_INT       0x80
67
68#define VECTOR_TABLE     0x40
69 
70/*
71 * Type definition for RTEMS managed interrupts
72 */
73typedef unsigned char  rtems_irq_level;
74typedef unsigned char  rtems_irq_trigger;
75
76struct  __rtems_irq_connect_data__;     /* forward declaratiuon */
77
78typedef void (*rtems_irq_hdl)           (void);
79typedef void (*rtems_irq_enable)        (const struct __rtems_irq_connect_data__*);
80typedef void (*rtems_irq_disable)       (const struct __rtems_irq_connect_data__*);
81typedef int  (*rtems_irq_is_enabled)    (const struct __rtems_irq_connect_data__*);
82
83typedef struct __rtems_irq_connect_data__ {
84  /*
85   * IRQ line
86   */
87  rtems_irq_symbolic_name       name;
88  /*
89   * handler. See comment on handler properties below in function prototype.
90   */
91  rtems_irq_hdl                 hdl;
92  /*
93   * function for enabling interrupts at device level (ONLY!).
94   * The BSP code will automatically enable it at i8259s level.
95   * RATIONALE : anyway such code has to exist in current driver code.
96   * It is usually called immediately AFTER connecting the interrupt handler.
97   * RTEMS may well need such a function when restoring normal interrupt
98   * processing after a debug session.
99   *
100   */
101    rtems_irq_enable            on;     
102  /*
103   * function for disabling interrupts at device level (ONLY!).
104   * The code will disable it at i8259s level. RATIONALE : anyway
105   * such code has to exist for clean shutdown. It is usually called
106   * BEFORE disconnecting the interrupt. RTEMS may well need such
107   * a function when disabling normal interrupt processing for
108   * a debug session. May well be a NOP function.
109   */
110  rtems_irq_disable             off;
111  /*
112   * function enabling to know what interrupt may currently occur
113   * if someone manipulates the i8259s interrupt mask without care...
114   */
115    rtems_irq_is_enabled        isOn;
116  /*
117   * priority level at the vplus level
118   */
119  rtems_irq_level               irqLevel;
120  /*
121   * Trigger way : Rising or falling edge or High or low level
122   */
123  rtems_irq_trigger             irqTrigger;
124} rtems_irq_connect_data;
125
126/*-------------------------------------------------------------------------+
127| Function Prototypes.
128+--------------------------------------------------------------------------*/
129/*
130 * ------------------------ RTEMS Single Irq Handler Mngt Routines ----------------
131 */
132
133/*
134 * function to initialize the interrupt for a specific BSP
135 */
136void BSP_rtems_irq_mngt_init();
137
138
139/*
140 * function to connect a particular irq handler. This hanlder will NOT be called
141 * directly as the result of the corresponding interrupt. Instead, a RTEMS
142 * irq prologue will be called that will :
143 *
144 *      1) save the C scratch registers,
145 *      2) switch to a interrupt stack if the interrupt is not nested,
146 *      3) store the current i8259s' interrupt masks
147 *      4) modify them to disable the current interrupt at 8259 level (and may
148 *      be others depending on software priorities)
149 *      5) aknowledge the i8259s',
150 *      6) demask the processor,
151 *      7) call the application handler
152 *
153 * As a result the hdl function provided
154 *
155 *      a) can perfectly be written is C,
156 *      b) may also well directly call the part of the RTEMS API that can be used
157 *      from interrupt level,
158 *      c) It only responsible for handling the jobs that need to be done at
159 *      the device level including (aknowledging/re-enabling the interrupt at device,
160 *      level, getting the data,...)
161 *
162 *      When returning from the function, the following will be performed by
163 *      the RTEMS irq epilogue :
164 *
165 *      1) masks the interrupts again,
166 *      2) restore the original i8259s' interrupt masks
167 *      3) switch back on the orinal stack if needed,
168 *      4) perform rescheduling when necessary,
169 *      5) restore the C scratch registers...
170 *      6) restore initial execution flow
171 *
172 */
173
174int BSP_install_rtems_irq_handler       (const rtems_irq_connect_data*);
175/*
176 * function to get the current RTEMS irq handler for ptr->name. It enables to
177 * define hanlder chain...
178 */
179int BSP_get_current_rtems_irq_handler   (rtems_irq_connect_data* ptr);
180/*
181 * function to get disconnect the RTEMS irq handler for ptr->name.
182 * This function checks that the value given is the current one for safety reason.
183 * The user can use the previous function to get it.
184 */
185int BSP_remove_rtems_irq_handler        (const rtems_irq_connect_data*);
186
187
188#ifdef __cplusplus
189}
190#endif
191
192#endif /* _IRQ_H_ */
193/* end of include file */
Note: See TracBrowser for help on using the repository browser.