source: rtems/c/src/lib/libcpu/arm/s3c2410/irq/irq.h @ dbdb0255

4.104.114.95
Last change on this file since dbdb0255 was dbdb0255, checked in by Joel Sherrill <joel.sherrill@…>, on 05/06/08 at 20:58:05

2008-05-06 Ray Xu <rayx.cn@…>

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