source: rtems/cpukit/include/rtems/irq.h @ c062c295

4.115
Last change on this file since c062c295 was 21242c2, checked in by Joel Sherrill <joel.sherrill@…>, on 06/24/11 at 17:52:58

2011-06-24 Joel Sherrill <joel.sherrill@…>

  • include/rtems/bspIo.h, include/rtems/concat.h, include/rtems/endian.h, include/rtems/fs.h, include/rtems/irq.h, include/rtems/pci.h, include/rtems/userenv.h, libblock/include/rtems/flashdisk.h, libblock/include/rtems/nvdisk-sram.h, libblock/include/rtems/nvdisk.h, libcsupport/include/clockdrv.h, libcsupport/include/console.h, libcsupport/include/iosupp.h, libcsupport/include/spurious.h, libcsupport/include/motorola/mc68230.h, libcsupport/include/rtems/assoc.h, libcsupport/include/rtems/error.h, libcsupport/include/rtems/framebuffer.h, libcsupport/include/rtems/gxx_wrappers.h, libcsupport/include/rtems/libcsupport.h, libcsupport/include/rtems/libio_.h, libcsupport/include/rtems/malloc.h, libcsupport/include/rtems/termiostypes.h, libcsupport/include/sys/statvfs.h, libcsupport/include/sys/termios.h, libcsupport/include/sys/utsname.h, libcsupport/include/zilog/z8036.h, libcsupport/include/zilog/z8530.h, libcsupport/include/zilog/z8536.h, libfs/src/imfs/imfs.h, libfs/src/pipe/pipe.h, libmisc/capture/capture-cli.h, libmisc/capture/capture.h, libmisc/cpuuse/cpuuse.h, libmisc/devnull/devnull.h, libmisc/devnull/devzero.h, libmisc/dumpbuf/dumpbuf.h, libmisc/fb/fb.h, libmisc/fb/mw_uid.h, libmisc/mouse/mouse_parser.h, libmisc/shell/shellconfig.h, libmisc/stringto/stringto.h, libmisc/untar/untar.h, libnetworking/memory.h, posix/include/aio.h, posix/include/mqueue.h, posix/include/semaphore.h, posix/include/rtems/posix/aio_misc.h, posix/include/rtems/posix/barrier.h, posix/include/rtems/posix/cond.h, posix/include/rtems/posix/config.h, posix/include/rtems/posix/key.h, posix/include/rtems/posix/mqueue.h, posix/include/rtems/posix/mutex.h, posix/include/rtems/posix/posixapi.h, posix/include/rtems/posix/priority.h, posix/include/rtems/posix/psignal.h, posix/include/rtems/posix/pthread.h, posix/include/rtems/posix/ptimer.h, posix/include/rtems/posix/rwlock.h, posix/include/rtems/posix/semaphore.h, posix/include/rtems/posix/sigset.h, posix/include/rtems/posix/spinlock.h, posix/include/rtems/posix/threadsup.h, posix/include/rtems/posix/time.h, posix/include/rtems/posix/timer.h, posix/inline/rtems/posix/barrier.inl, posix/inline/rtems/posix/cond.inl, posix/inline/rtems/posix/mqueue.inl, posix/inline/rtems/posix/mutex.inl, posix/inline/rtems/posix/priority.inl, posix/inline/rtems/posix/pthread.inl, posix/inline/rtems/posix/rwlock.inl, posix/inline/rtems/posix/semaphore.inl, posix/inline/rtems/posix/spinlock.inl, posix/inline/rtems/posix/timer.inl, rtems/mainpage.h, rtems/include/rtems/rtems/barrier.h, rtems/include/rtems/rtems/object.h, rtems/include/rtems/rtems/timer.h, rtems/inline/rtems/rtems/barrier.inl, rtems/inline/rtems/rtems/timer.inl, rtems/src/semtranslatereturncode.c, sapi/include/rtems/config.h, sapi/include/rtems/fatal.h, sapi/include/rtems/mptables.h, score/include/rtems/score/object.h, score/include/rtems/score/priority.h, score/inline/rtems/score/object.inl, score/inline/rtems/score/priority.inl: Add @file Doxygen directives and descriptions to files which originated with RTEMS. This improves the file list page generated by Doxygen.
  • Property mode set to 100644
File size: 7.1 KB
Line 
1/**
2 * @file rtems/irq.h
3 *
4 * This include file describe the data structure and the functions implemented
5 * by rtems to write interrupt handlers.
6 */
7
8/*
9 *  CopyRight (C) 1998 valette@crf.canon.fr
10 *
11 *  This code is heavilly inspired by the public specification of STREAM V2
12 *  that can be found at :
13 *
14 *      <http://www.chorus.com/Documentation/index.html> by following
15 *  the STREAM API Specification Document link.
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.rtems.com/license/LICENSE.
20 *
21 * $Id$
22 */
23
24#ifndef _RTEMS_IRQ_H
25#define _RTEMS_IRQ_H
26
27#ifndef ASM
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33
34/*
35 * Type definition for RTEMS managed interrupts
36 */
37typedef unsigned char  rtems_irq_prio;
38struct  __rtems_irq_connect_data__;     /* forward declaratiuon */
39
40typedef unsigned int rtems_irq_number;
41typedef void *rtems_irq_hdl_param;
42typedef void (*rtems_irq_hdl)           (rtems_irq_hdl_param);
43typedef void (*rtems_irq_enable)        (const struct __rtems_irq_connect_data__*);
44typedef void (*rtems_irq_disable)       (const struct __rtems_irq_connect_data__*);
45typedef int  (*rtems_irq_is_enabled)    (const struct __rtems_irq_connect_data__*);
46
47typedef struct __rtems_irq_connect_data__ {
48  /*
49   * IRQ line
50   */
51  rtems_irq_number              name;
52  /*
53   * handler. See comment on handler properties below in function prototype.
54   */
55  rtems_irq_hdl                 hdl;
56  /*
57   * Handler handle to store private data
58   */
59  rtems_irq_hdl_param           handle;
60  /*
61   * function for enabling interrupts at device level (ONLY!).
62   * The BSP code will automatically enable it at i8259s level.
63   * RATIONALE : anyway such code has to exist in current driver code.
64   * It is usually called immediately AFTER connecting the interrupt handler.
65   * RTEMS may well need such a function when restoring normal interrupt
66   * processing after a debug session.
67   *
68   */
69    rtems_irq_enable            on;
70  /*
71   * function for disabling interrupts at device level (ONLY!).
72   * The code will disable it at i8259s level. RATIONALE : anyway
73   * such code has to exist for clean shutdown. It is usually called
74   * BEFORE disconnecting the interrupt. RTEMS may well need such
75   * a function when disabling normal interrupt processing for
76   * a debug session. May well be a NOP function.
77   */
78  rtems_irq_disable             off;
79  /*
80   * function enabling to know what interrupt may currently occur
81   * if someone manipulates the i8259s interrupt mask without care...
82   */
83  rtems_irq_is_enabled        isOn;
84
85#ifdef BSP_SHARED_HANDLER_SUPPORT
86  /*
87   *  Set to -1 for vectors forced to have only 1 handler
88   */
89  void *next_handler;
90#endif
91
92} rtems_irq_connect_data;
93
94typedef struct {
95  /*
96   * size of all the table fields (*Tbl) described below.
97   */
98  unsigned int                  irqNb;
99  /*
100   * Default handler used when disconnecting interrupts.
101   */
102  rtems_irq_connect_data        defaultEntry;
103  /*
104   * Table containing initials/current value.
105   */
106  rtems_irq_connect_data*       irqHdlTbl;
107  /*
108   * actual value of BSP_ISA_IRQ_VECTOR_BASE...
109   */
110  rtems_irq_number              irqBase;
111  /*
112   * software priorities associated with interrupts.
113   * if (*irqPrio  [i]  >  intrPrio  [j]  it  means  that
114   * interrupt handler hdl connected for interrupt name i
115   * will  not be interrupted by the handler connected for interrupt j
116   * The interrupt source  will be physically masked at i8259 level.
117   */
118    rtems_irq_prio*             irqPrioTbl;
119} rtems_irq_global_settings;
120
121/*-------------------------------------------------------------------------+
122| Function Prototypes.
123+--------------------------------------------------------------------------*/
124/*
125 * -------------------- RTEMS Single Irq Handler Mngt Routines ----------------
126 */
127/*
128 * function to connect a particular irq handler. This hanlder will NOT be called
129 * directly as the result of the corresponding interrupt. Instead, a RTEMS
130 * irq prologue will be called that will :
131 *
132 *      1) save the C scratch registers,
133 *      2) switch to a interrupt stack if the interrupt is not nested,
134 *      3) store the current i8259s' interrupt masks
135 *      4) modify them to disable the current interrupt at 8259 level (and may
136 *      be others depending on software priorities)
137 *      5) aknowledge the i8259s',
138 *      6) demask the processor,
139 *      7) call the application handler
140 *
141 * As a result the hdl function provided
142 *
143 *      a) can perfectly be written is C,
144 *      b) may also well directly call the part of the RTEMS API that can be
145 *      used from interrupt level,
146 *      c) It only responsible for handling the jobs that need to be done at
147 *      the device level including (aknowledging/re-enabling the interrupt at
148 *      device level, getting the data,...)
149 *
150 *      When returning from the function, the following will be performed by
151 *      the RTEMS irq epilogue :
152 *
153 *      1) masks the interrupts again,
154 *      2) restore the original i8259s' interrupt masks
155 *      3) switch back on the orinal stack if needed,
156 *      4) perform rescheduling when necessary,
157 *      5) restore the C scratch registers...
158 *      6) restore initial execution flow
159 *
160 */
161int BSP_install_rtems_irq_handler       (const rtems_irq_connect_data*);
162/*
163 * function to get the current RTEMS irq handler for ptr->name. It enables to
164 * define hanlder chain...
165 */
166int BSP_get_current_rtems_irq_handler   (rtems_irq_connect_data* ptr);
167/*
168 * function to get disconnect the RTEMS irq handler for ptr->name.
169 * This function checks that the value given is the current one for safety reason.
170 * The user can use the previous function to get it.
171 */
172int BSP_remove_rtems_irq_handler        (const rtems_irq_connect_data*);
173
174
175/*
176 * ----------------- RTEMS Shared Irq Handler Mngt Routines ----------------
177 */
178#ifdef BSP_SHARED_HANDLER_SUPPORT
179int BSP_install_rtems_shared_irq_handler  (const rtems_irq_connect_data*);
180#endif
181
182/*
183 * ----------------- RTEMS Global Irq Handler Mngt Routines ----------------
184 */
185/*
186 * (Re) Initialize the RTEMS interrupt management.
187 *
188 * The result of calling this function will be the same as if each individual
189 * handler (config->irqHdlTbl[i].hdl)  different from "config->defaultEntry.hdl"
190 * has been individualy connected via
191 *      BSP_install_rtems_irq_handler(&config->irqHdlTbl[i])
192 * And each handler currently equal to config->defaultEntry.hdl
193 * has been previously disconnected via
194 *       BSP_remove_rtems_irq_handler (&config->irqHdlTbl[i])
195 *
196 * This is to say that all information given will be used and not just
197 * only the space.
198 *
199 * CAUTION : the various table address contained in config will be used
200 *           directly by the interrupt mangement code in order to save
201 *           data size so they must stay valid after the call => they should
202 *           not be modified or declared on a stack.
203 */
204
205int BSP_rtems_irq_mngt_set(rtems_irq_global_settings* config);
206
207/*
208 * (Re) get info on current RTEMS interrupt management.
209 */
210int BSP_rtems_irq_mngt_get(rtems_irq_global_settings**);
211
212#ifdef __cplusplus
213}
214#endif
215
216#endif /* ASM */
217#endif /* _RTEMS_IRQ_H */
Note: See TracBrowser for help on using the repository browser.