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

4.104.114.84.95
Last change on this file since f1c62bb was 08330bf, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 27, 2000 at 1:04:11 AM

Port of RTEMS to the ARM processor family by Eric Valette
<valette@…> and Emmanuel Raguet <raguet@…>
of Canon CRF - Communication Dept. This port includes a
basic BSP that is sufficient to link hello world.

  • Property mode set to 100644
File size: 5.2 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
33  /* enum of the possible interrupt sources */
34typedef enum {
35  BSP_INT_1 = 0,
36  BSP_INT_2 = 1,
37  BSP_UART  = 2,
38  BSP_MAX_INT   = 3
39} rtems_irq_symbolic_name;
40
41  /* define that can be useful (the values are just examples) */
42#define INTMASK          0x01 
43#define VECTOR_TABLE     0x00
44 
45/*
46 * Type definition for RTEMS managed interrupts
47 */
48typedef unsigned char  rtems_irq_level;
49typedef unsigned char  rtems_irq_trigger;
50
51struct  __rtems_irq_connect_data__;     /* forward declaratiuon */
52
53typedef void (*rtems_irq_hdl)           (void);
54typedef void (*rtems_irq_enable)        (const struct __rtems_irq_connect_data__*);
55typedef void (*rtems_irq_disable)       (const struct __rtems_irq_connect_data__*);
56typedef int  (*rtems_irq_is_enabled)    (const struct __rtems_irq_connect_data__*);
57
58typedef struct __rtems_irq_connect_data__ {
59  /*
60   * IRQ line
61   */
62  rtems_irq_symbolic_name       name;
63  /*
64   * handler. See comment on handler properties below in function prototype.
65   */
66  rtems_irq_hdl                 hdl;
67  /*
68   * function for enabling interrupts at device level (ONLY!).
69   * The BSP code will automatically enable it at i8259s level.
70   * RATIONALE : anyway such code has to exist in current driver code.
71   * It is usually called immediately AFTER connecting the interrupt handler.
72   * RTEMS may well need such a function when restoring normal interrupt
73   * processing after a debug session.
74   *
75   */
76    rtems_irq_enable            on;     
77  /*
78   * function for disabling interrupts at device level (ONLY!).
79   * The code will disable it at i8259s level. RATIONALE : anyway
80   * such code has to exist for clean shutdown. It is usually called
81   * BEFORE disconnecting the interrupt. RTEMS may well need such
82   * a function when disabling normal interrupt processing for
83   * a debug session. May well be a NOP function.
84   */
85  rtems_irq_disable             off;
86  /*
87   * function enabling to know what interrupt may currently occur
88   * if someone manipulates the i8259s interrupt mask without care...
89   */
90    rtems_irq_is_enabled        isOn;
91  /*
92   * priority level at the vplus level
93   */
94  rtems_irq_level               irqLevel;
95  /*
96   * Trigger way : Rising or falling edge or High or low level
97   */
98  rtems_irq_trigger             irqTrigger;
99} rtems_irq_connect_data;
100
101/*-------------------------------------------------------------------------+
102| Function Prototypes.
103+--------------------------------------------------------------------------*/
104/*
105 * ------------------------ RTEMS Single Irq Handler Mngt Routines ----------------
106 */
107
108/*
109 * function to initialize the interrupt for a specific BSP
110 */
111void BSP_rtems_irq_mngt_init();
112
113
114/*
115 * function to connect a particular irq handler. This hanlder will NOT be called
116 * directly as the result of the corresponding interrupt. Instead, a RTEMS
117 * irq prologue will be called that will :
118 *
119 *      1) save the C scratch registers,
120 *      2) switch to a interrupt stack if the interrupt is not nested,
121 *      3) store the current i8259s' interrupt masks
122 *      4) modify them to disable the current interrupt at 8259 level (and may
123 *      be others depending on software priorities)
124 *      5) aknowledge the i8259s',
125 *      6) demask the processor,
126 *      7) call the application handler
127 *
128 * As a result the hdl function provided
129 *
130 *      a) can perfectly be written is C,
131 *      b) may also well directly call the part of the RTEMS API that can be used
132 *      from interrupt level,
133 *      c) It only responsible for handling the jobs that need to be done at
134 *      the device level including (aknowledging/re-enabling the interrupt at device,
135 *      level, getting the data,...)
136 *
137 *      When returning from the function, the following will be performed by
138 *      the RTEMS irq epilogue :
139 *
140 *      1) masks the interrupts again,
141 *      2) restore the original i8259s' interrupt masks
142 *      3) switch back on the orinal stack if needed,
143 *      4) perform rescheduling when necessary,
144 *      5) restore the C scratch registers...
145 *      6) restore initial execution flow
146 *
147 */
148
149int BSP_install_rtems_irq_handler       (const rtems_irq_connect_data*);
150/*
151 * function to get the current RTEMS irq handler for ptr->name. It enables to
152 * define hanlder chain...
153 */
154int BSP_get_current_rtems_irq_handler   (rtems_irq_connect_data* ptr);
155/*
156 * function to get disconnect the RTEMS irq handler for ptr->name.
157 * This function checks that the value given is the current one for safety reason.
158 * The user can use the previous function to get it.
159 */
160int BSP_remove_rtems_irq_handler        (const rtems_irq_connect_data*);
161
162
163#ifdef __cplusplus
164}
165#endif
166
167#endif /* _IRQ_H_ */
168/* end of include file */
Note: See TracBrowser for help on using the repository browser.