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

4.104.114.84.95
Last change on this file since 309775c was 309775c, checked in by Jennifer Averett <Jennifer.Averett@…>, on 05/17/05 at 14:41:50

2005-05-17 Jennifer Averett <jennifer.averett@…>

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