source: rtems/c/src/lib/libcpu/arm/s3c2400/irq/irq.h @ 2c24794

4.104.114.84.95
Last change on this file since 2c24794 was 2c24794, checked in by Jennifer Averett <Jennifer.Averett@…>, on 05/17/05 at 15:08:26

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

  • at91rm9200/irq/irq.h, mc9328mxl/irq/irq.h, s3c2400/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: 6.4 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.rtems.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#ifndef _IRQ_H_
17#define _IRQ_H_
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23/*
24 * Include some preprocessor value also used by assember code
25 */
26 
27#include <rtems.h>
28#include <s3c2400.h>
29
30extern void default_int_handler();
31/*-------------------------------------------------------------------------+
32| Constants
33+--------------------------------------------------------------------------*/
34
35  /* possible interrupt sources */
36#define BSP_EINT0             0
37#define BSP_EINT1             1
38#define BSP_EINT2             2
39#define BSP_EINT3             3
40#define BSP_EINT4             4
41#define BSP_EINT5             5
42#define BSP_EINT6             6
43#define BSP_EINT7             7
44#define BSP_INT_TICK          8 
45#define BSP_INT_WDT           9
46#define BSP_INT_TIMER0       10   
47#define BSP_INT_TIMER1       11   
48#define BSP_INT_TIMER2       12   
49#define BSP_INT_TIMER3       13   
50#define BSP_INT_TIMER4       14   
51#define BSP_INT_UERR01       15   
52#define _res0                16       
53#define BSP_INT_DMA0         17 
54#define BSP_INT_DMA1         18 
55#define BSP_INT_DMA2         19 
56#define BSP_INT_DMA3         20 
57#define BSP_INT_MMC          21
58#define BSP_INT_SPI          22
59#define BSP_INT_URXD0        23   
60#define BSP_INT_URXD1        24   
61#define BSP_INT_USBD         25 
62#define BSP_INT_USBH         26 
63#define BSP_INT_IIC          27
64#define BSP_INT_UTXD0        28   
65#define BSP_INT_UTXD1        29   
66#define BSP_INT_RTC          30
67#define BSP_INT_ADC          31
68#define BSP_MAX_INT          32
69
70extern void *bsp_vector_table;
71#define VECTOR_TABLE &bsp_vector_table
72 
73/*
74 * Type definition for RTEMS managed interrupts
75 */
76typedef unsigned char  rtems_irq_level;
77typedef unsigned char  rtems_irq_trigger;
78
79struct  __rtems_irq_connect_data__;     /* forward declaratiuon */
80typedef unsigned int rtems_irq_number;
81typedef void (*rtems_irq_hdl) (void);
82typedef void (*rtems_irq_enable) (const struct __rtems_irq_connect_data__*);
83typedef void (*rtems_irq_disable) (const struct __rtems_irq_connect_data__*);
84typedef int (*rtems_irq_is_enabled) (const struct __rtems_irq_connect_data__*);
85
86typedef struct __rtems_irq_connect_data__ {
87    /*
88     * IRQ line
89     */
90    rtems_irq_number                    name;
91
92    /*
93     * handler. See comment on handler properties below in function prototype.
94     */
95    rtems_irq_hdl                       hdl;
96
97    /*
98     * function for enabling interrupts at device level (ONLY!).
99     * The BSP code will automatically enable it at i8259s level.
100     * RATIONALE : anyway such code has to exist in current driver code.
101     * It is usually called immediately AFTER connecting the interrupt handler.
102     * RTEMS may well need such a function when restoring normal interrupt
103     * processing after a debug session.
104     *
105     */
106    rtems_irq_enable            on;     
107
108    /*
109     * function for disabling interrupts at device level (ONLY!).
110     * The code will disable it at i8259s level. RATIONALE : anyway
111     * such code has to exist for clean shutdown. It is usually called
112     * BEFORE disconnecting the interrupt. RTEMS may well need such
113     * a function when disabling normal interrupt processing for
114     * a debug session. May well be a NOP function.
115     */
116    rtems_irq_disable           off;
117
118    /*
119     * function enabling to know what interrupt may currently occur
120     * if someone manipulates the i8259s interrupt mask without care...
121     */
122    rtems_irq_is_enabled        isOn;
123
124    /*
125     * priority level at the vplus level
126     */
127    rtems_irq_level             irqLevel;
128
129    /*
130     * Trigger way : Rising or falling edge or High or low level
131     */
132    rtems_irq_trigger           irqTrigger;
133
134} rtems_irq_connect_data;
135
136/*-------------------------------------------------------------------------+
137| Function Prototypes.
138+--------------------------------------------------------------------------*/
139/*
140 * ------------------ RTEMS Single Irq Handler Mngt Routines ----------------
141 */
142
143/*
144 * function to initialize the interrupt for a specific BSP
145 */
146void BSP_rtems_irq_mngt_init();
147
148
149/*
150 * function to connect a particular irq handler. This hanlder will NOT be called
151 * directly as the result of the corresponding interrupt. Instead, a RTEMS
152 * irq prologue will be called that will :
153 *
154 *      1) save the C scratch registers,
155 *      2) switch to a interrupt stack if the interrupt is not nested,
156 *      3) store the current i8259s' interrupt masks
157 *      4) modify them to disable the current interrupt at 8259 level (and may
158 *      be others depending on software priorities)
159 *      5) aknowledge the i8259s',
160 *      6) demask the processor,
161 *      7) call the application handler
162 *
163 * As a result the hdl function provided
164 *
165 *      a) can perfectly be written is C,
166 *      b) may also well directly call the part of the RTEMS API that can be used
167 *      from interrupt level,
168 *      c) It only responsible for handling the jobs that need to be done at
169 *      the device level including (aknowledging/re-enabling the interrupt at device,
170 *      level, getting the data,...)
171 *
172 *      When returning from the function, the following will be performed by
173 *      the RTEMS irq epilogue :
174 *
175 *      1) masks the interrupts again,
176 *      2) restore the original i8259s' interrupt masks
177 *      3) switch back on the orinal stack if needed,
178 *      4) perform rescheduling when necessary,
179 *      5) restore the C scratch registers...
180 *      6) restore initial execution flow
181 *
182 */
183int BSP_install_rtems_irq_handler       (const rtems_irq_connect_data*);
184
185/*
186 * function to get the current RTEMS irq handler for ptr->name. It enables to
187 * define hanlder chain...
188 */
189int BSP_get_current_rtems_irq_handler   (rtems_irq_connect_data* ptr);
190
191/*
192 * function to get disconnect the RTEMS irq handler for ptr->name.
193 * This function checks that the value given is the current one for safety reason.
194 * The user can use the previous function to get it.
195 */
196int BSP_remove_rtems_irq_handler        (const rtems_irq_connect_data*);
197
198
199#ifdef __cplusplus
200}
201#endif
202
203#endif /* _IRQ_H_ */
204/* end of include file */
Note: See TracBrowser for help on using the repository browser.