RTEMS 6.1-rc4
Loading...
Searching...
No Matches
irq_supp.h
1/*
2 * The license and distribution terms for this file may be
3 * found in the file LICENSE in this distribution or at
4 * http://www.rtems.org/license/LICENSE.
5 */
6
7#ifndef IRQ_SHARED_IRQ_C_GLUE_H
8#define IRQ_SHARED_IRQ_C_GLUE_H
9/*
10 * This header describes the routines that are needed by the shared
11 * version of 'irq.c' (implementing the RTEMS irq API). They
12 * must be provided by the BSP.
13 *
14 * The license and distribution terms for this file may be
15 * found in the file LICENSE in this distribution or at
16 * http://www.rtems.org/license/LICENSE.
17 *
18 */
19
20#ifndef BSP_SHARED_HANDLER_SUPPORT
21#define BSP_SHARED_HANDLER_SUPPORT 1
22#endif
23
24#include <rtems.h>
25#include <rtems/irq.h>
26
27#include <bsp/vectors.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/*
34 * PIC-independent functions to enable/disable interrupt lines at
35 * the pic.
36 *
37 * NOTE: the routines must ignore requests for enabling/disabling
38 * interrupts that are outside of the range handled by the
39 * PIC(s).
40 */
41extern void BSP_enable_irq_at_pic(const rtems_irq_number irqLine);
42/*
43 * RETURNS: nonzero (> 0 ) if irq was enabled originally, zero if irq
44 * was off and negative value if there was an error.
45 */
46extern int BSP_disable_irq_at_pic(const rtems_irq_number irqLine);
47
48/*
49 * Initialize the PIC.
50 */
51extern int BSP_setup_the_pic(rtems_irq_global_settings* config);
52
53/*
54 * Set up for the irq-generic.h interface.
55 */
56int BSP_rtems_irq_generic_set(rtems_irq_global_settings* config);
57
58/* IRQ dispatcher to be defined by the PIC driver; note that it MUST
59 * implement shared interrupts.
60 * Note also that the exception frame passed to this handler is not very
61 * meaningful. Only the volatile registers and vector info are stored.
62 *
63 *******************************************************************
64 * The routine must return zero if the interrupt was handled. If a
65 * nonzero value is returned the dispatcher may panic and flag an
66 * uncaught exception.
67 *******************************************************************
68 */
69int C_dispatch_irq_handler (BSP_Exception_frame *frame, unsigned int excNum);
70
71/*
72 * Snippet to be used by PIC drivers and by bsp_irq_dispatch_list
73 * traverses list of shared handlers for a given interrupt
74 *
75 */
76
77static inline void
78bsp_irq_dispatch_list_base(
80 unsigned irq,
81 rtems_irq_hdl sentinel
82)
83{
85 for( vchain = &tbl[irq];
86 ((intptr_t)vchain != -1 && vchain->hdl != sentinel);
87 vchain = (rtems_irq_connect_data*)vchain->next_handler )
88 {
89 vchain->hdl(vchain->handle);
90 }
91}
92
93
94/*
95 * Snippet to be used by PIC drivers;
96 * enables interrupts, traverses list of
97 * shared handlers for a given interrupt
98 * and restores original irq level
99 *
100 * Note that _ISR_Get_level() & friends are preferable to
101 * manipulating MSR directly.
102 */
103
104static inline void
105bsp_irq_dispatch_list(
107 unsigned irq,
108 rtems_irq_hdl sentinel
109)
110{
111 register uint32_t l_orig;
112
113 l_orig = _ISR_Get_level();
114
115 /* Enable all interrupts */
117
118
119 bsp_irq_dispatch_list_base( tbl, irq, sentinel );
120
121 /* Restore original level */
122 _ISR_Set_level(l_orig);
123}
124
125#ifdef __cplusplus
126}
127#endif
128
129#endif
PowerPC Exceptions API.
#define _ISR_Get_level()
Return current interrupt level.
Definition: isrlevel.h:147
#define _ISR_Set_level(_new_level)
Set current interrupt level.
Definition: isrlevel.h:159
This header file defines the RTEMS Classic API.
The set of registers that specifies the complete processor state.
Definition: cpu.h:446
Definition: irq.h:64
Definition: deflate.c:114
Definition: irq.h:111