source: rtems/c/src/lib/libbsp/arm/edb7312/irq/irq.h @ f1c62bb

4.104.114.84.95
Last change on this file since f1c62bb was 3d6669cc, checked in by Joel Sherrill <joel.sherrill@…>, on 11/13/02 at 17:55:09

2002-11-13 Jay Monkman <jtm@…>

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