1 | /* modes.h |
---|
2 | * |
---|
3 | * This include file contains all constants and structures associated |
---|
4 | * with the RTEMS thread and RTEMS_ASR modes. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * All rights assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
12 | * notice must appear in all copies of this file and its derivatives. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __RTEMS_MODES_h |
---|
18 | #define __RTEMS_MODES_h |
---|
19 | |
---|
20 | #ifdef __cplusplus |
---|
21 | extern "C" { |
---|
22 | #endif |
---|
23 | |
---|
24 | #include <rtems/isr.h> |
---|
25 | |
---|
26 | /* |
---|
27 | * The following type defines the control block used to manage |
---|
28 | * each a mode set. |
---|
29 | */ |
---|
30 | |
---|
31 | typedef unsigned32 Modes_Control; |
---|
32 | |
---|
33 | /* |
---|
34 | * The following constants define the individual modes and masks |
---|
35 | * which may be used to compose a mode set and to alter modes. |
---|
36 | */ |
---|
37 | |
---|
38 | #define RTEMS_ALL_MODE_MASKS 0x0000ffff |
---|
39 | |
---|
40 | #define RTEMS_DEFAULT_MODES 0x00000000 |
---|
41 | #define RTEMS_CURRENT_MODE 0 |
---|
42 | |
---|
43 | #define RTEMS_PREEMPT_MASK 0x00000100 /* preemption bit */ |
---|
44 | #define RTEMS_TIMESLICE_MASK 0x00000200 /* timeslice bit */ |
---|
45 | #define RTEMS_ASR_MASK 0x00000400 /* RTEMS_ASR enable bit */ |
---|
46 | #define RTEMS_INTERRUPT_MASK CPU_MODES_INTERRUPT_MASK |
---|
47 | |
---|
48 | #define RTEMS_PREEMPT 0x00000000 /* enable preemption */ |
---|
49 | #define RTEMS_NO_PREEMPT 0x00000100 /* disable preemption */ |
---|
50 | |
---|
51 | #define RTEMS_NO_TIMESLICE 0x00000000 /* disable timeslicing */ |
---|
52 | #define RTEMS_TIMESLICE 0x00000200 /* enable timeslicing */ |
---|
53 | |
---|
54 | #define RTEMS_ASR 0x00000000 /* enable RTEMS_ASR */ |
---|
55 | #define RTEMS_NO_ASR 0x00000400 /* disable RTEMS_ASR */ |
---|
56 | |
---|
57 | /* |
---|
58 | * The number of bits for interrupt levels is CPU dependent. |
---|
59 | * RTEMS supports 0 to 256 levels in bits 0-7 of the mode. |
---|
60 | */ |
---|
61 | |
---|
62 | /* |
---|
63 | * RTEMS_INTERRUPT_LEVEL |
---|
64 | * |
---|
65 | * DESCRIPTION: |
---|
66 | * |
---|
67 | * This function returns the processor dependent interrupt |
---|
68 | * level which corresponds to the requested interrupt level. |
---|
69 | * |
---|
70 | * NOTE: RTEMS supports 256 interrupt levels using the least |
---|
71 | * significant eight bits of MODES.CONTROL. On any |
---|
72 | * particular CPU, fewer than 256 levels may be supported. |
---|
73 | */ |
---|
74 | |
---|
75 | STATIC INLINE unsigned32 RTEMS_INTERRUPT_LEVEL ( |
---|
76 | Modes_Control mode_set |
---|
77 | ); |
---|
78 | |
---|
79 | /* |
---|
80 | * _Modes_Mask_changed |
---|
81 | * |
---|
82 | * DESCRIPTION: |
---|
83 | * |
---|
84 | * This function returns TRUE if any of the mode flags in mask |
---|
85 | * are set in mode_set, and FALSE otherwise. |
---|
86 | */ |
---|
87 | |
---|
88 | STATIC INLINE boolean _Modes_Mask_changed ( |
---|
89 | Modes_Control mode_set, |
---|
90 | Modes_Control masks |
---|
91 | ); |
---|
92 | |
---|
93 | /* |
---|
94 | * _Modes_Is_asr_disabled |
---|
95 | * |
---|
96 | * DESCRIPTION: |
---|
97 | * |
---|
98 | * This function returns TRUE if mode_set indicates that Asynchronous |
---|
99 | * Signal Processing is disabled, and FALSE otherwise. |
---|
100 | */ |
---|
101 | |
---|
102 | STATIC INLINE boolean _Modes_Is_asr_disabled ( |
---|
103 | Modes_Control mode_set |
---|
104 | ); |
---|
105 | |
---|
106 | /* |
---|
107 | * _Modes_Is_preempt |
---|
108 | * |
---|
109 | * DESCRIPTION: |
---|
110 | * |
---|
111 | * This function returns TRUE if mode_set indicates that preemption |
---|
112 | * is enabled, and FALSE otherwise. |
---|
113 | */ |
---|
114 | |
---|
115 | STATIC INLINE boolean _Modes_Is_preempt ( |
---|
116 | Modes_Control mode_set |
---|
117 | ); |
---|
118 | |
---|
119 | /* |
---|
120 | * _Modes_Is_timeslice |
---|
121 | * |
---|
122 | * DESCRIPTION: |
---|
123 | * |
---|
124 | * This function returns TRUE if mode_set indicates that timeslicing |
---|
125 | * is enabled, and FALSE otherwise. |
---|
126 | */ |
---|
127 | |
---|
128 | STATIC INLINE boolean _Modes_Is_timeslice ( |
---|
129 | Modes_Control mode_set |
---|
130 | ); |
---|
131 | |
---|
132 | /* |
---|
133 | * _Modes_Get_interrupt_level |
---|
134 | * |
---|
135 | * DESCRIPTION: |
---|
136 | * |
---|
137 | * This function returns the interrupt level portion of the mode_set. |
---|
138 | */ |
---|
139 | |
---|
140 | STATIC INLINE ISR_Level _Modes_Get_interrupt_level ( |
---|
141 | Modes_Control mode_set |
---|
142 | ); |
---|
143 | |
---|
144 | /* |
---|
145 | * _Modes_Set_interrupt_level |
---|
146 | * |
---|
147 | * DESCRIPTION: |
---|
148 | * |
---|
149 | * This routine sets the current interrupt level to that specified |
---|
150 | * in the mode_set. |
---|
151 | */ |
---|
152 | |
---|
153 | STATIC INLINE void _Modes_Set_interrupt_level ( |
---|
154 | Modes_Control mode_set |
---|
155 | ); |
---|
156 | |
---|
157 | /* |
---|
158 | * _Modes_Change |
---|
159 | * |
---|
160 | * DESCRIPTION: |
---|
161 | * |
---|
162 | * This routine changes the modes in old_mode_set indicated by |
---|
163 | * mask to the requested values in new_mode_set. The resulting |
---|
164 | * mode set is returned in out_mode_set and the modes that changed |
---|
165 | * is returned in changed. |
---|
166 | */ |
---|
167 | |
---|
168 | STATIC INLINE void _Modes_Change ( |
---|
169 | Modes_Control old_mode_set, |
---|
170 | Modes_Control new_mode_set, |
---|
171 | Modes_Control mask, |
---|
172 | Modes_Control *out_mode_set, |
---|
173 | Modes_Control *changed |
---|
174 | ); |
---|
175 | |
---|
176 | #include <rtems/modes.inl> |
---|
177 | |
---|
178 | #ifdef __cplusplus |
---|
179 | } |
---|
180 | #endif |
---|
181 | |
---|
182 | #endif |
---|
183 | /* end of include file */ |
---|