1 | /** |
---|
2 | * @file rtems/rtems/modes.h |
---|
3 | * |
---|
4 | * @defgroup ClassicModes Modes |
---|
5 | * |
---|
6 | * @ingroup ClassicRTEMS |
---|
7 | * @brief RTEMS thread and RTEMS_ASR modes |
---|
8 | * |
---|
9 | * This include file contains all constants and structures associated |
---|
10 | * with the RTEMS thread and RTEMS_ASR modes. |
---|
11 | */ |
---|
12 | |
---|
13 | /* COPYRIGHT (c) 1989-2013. |
---|
14 | * On-Line Applications Research Corporation (OAR). |
---|
15 | * |
---|
16 | * The license and distribution terms for this file may be |
---|
17 | * found in the file LICENSE in this distribution or at |
---|
18 | * http://www.rtems.com/license/LICENSE. |
---|
19 | */ |
---|
20 | |
---|
21 | #ifndef _RTEMS_RTEMS_MODES_H |
---|
22 | #define _RTEMS_RTEMS_MODES_H |
---|
23 | |
---|
24 | #include <rtems/score/cpu.h> |
---|
25 | |
---|
26 | #ifdef __cplusplus |
---|
27 | extern "C" { |
---|
28 | #endif |
---|
29 | |
---|
30 | /** |
---|
31 | * @defgroup ClassicModes Modes |
---|
32 | * |
---|
33 | * @ingroup ClassicRTEMS |
---|
34 | * |
---|
35 | * This encapsulates functionality related to the task modes supported |
---|
36 | * by the Classic API Task Manager. |
---|
37 | */ |
---|
38 | /**@{*/ |
---|
39 | |
---|
40 | /** |
---|
41 | * The following type defines the control block used to manage |
---|
42 | * each a mode set. |
---|
43 | */ |
---|
44 | typedef uint32_t Modes_Control; |
---|
45 | |
---|
46 | /** |
---|
47 | * The following constants define the individual modes and masks |
---|
48 | * which may be used to compose a mode set and to alter modes. |
---|
49 | */ |
---|
50 | #define RTEMS_ALL_MODE_MASKS 0x0000ffff |
---|
51 | |
---|
52 | /** |
---|
53 | * This mode constant is the default mode set. |
---|
54 | */ |
---|
55 | #define RTEMS_DEFAULT_MODES 0x00000000 |
---|
56 | |
---|
57 | /** |
---|
58 | * This mode constant is used when the user wishes to obtain their |
---|
59 | * current execution mode. |
---|
60 | */ |
---|
61 | #define RTEMS_CURRENT_MODE 0 |
---|
62 | |
---|
63 | /** This mode constant corresponds to the timeslice enable/disable bit. */ |
---|
64 | #define RTEMS_TIMESLICE_MASK 0x00000200 |
---|
65 | |
---|
66 | /** This mode constant corresponds to the preemption enable/disable bit. */ |
---|
67 | #define RTEMS_PREEMPT_MASK 0x00000100 |
---|
68 | |
---|
69 | /** This mode constant corresponds to the signal enable/disable bit. */ |
---|
70 | #define RTEMS_ASR_MASK 0x00000400 |
---|
71 | |
---|
72 | /** This mode constant corresponds to the interrupt enable/disable bits. */ |
---|
73 | #define RTEMS_INTERRUPT_MASK CPU_MODES_INTERRUPT_MASK |
---|
74 | |
---|
75 | /** This mode constant is used to indicate preemption is enabled. */ |
---|
76 | #define RTEMS_PREEMPT 0x00000000 |
---|
77 | /** This mode constant is used to indicate preemption is disabled. */ |
---|
78 | #define RTEMS_NO_PREEMPT 0x00000100 |
---|
79 | |
---|
80 | /** This mode constant is used to indicate timeslicing is disabled. */ |
---|
81 | #define RTEMS_NO_TIMESLICE 0x00000000 |
---|
82 | /** This mode constant is used to indicate timeslicing is enabled. */ |
---|
83 | #define RTEMS_TIMESLICE 0x00000200 |
---|
84 | |
---|
85 | /** This mode constant is used to indicate signal processing is enabled. */ |
---|
86 | #define RTEMS_ASR 0x00000000 |
---|
87 | /** This mode constant is used to indicate signal processing is disabled. */ |
---|
88 | #define RTEMS_NO_ASR 0x00000400 |
---|
89 | |
---|
90 | /** |
---|
91 | * @brief RTEMS_INTERRUPT_LEVEL |
---|
92 | * |
---|
93 | * This function returns the processor dependent interrupt |
---|
94 | * level which corresponds to the requested interrupt level. |
---|
95 | * |
---|
96 | * @note RTEMS supports 256 interrupt levels using the least |
---|
97 | * significant eight bits of MODES.CONTROL. On any |
---|
98 | * particular CPU, fewer than 256 levels may be supported. |
---|
99 | */ |
---|
100 | #define RTEMS_INTERRUPT_LEVEL( _mode_set ) \ |
---|
101 | ( (_mode_set) & RTEMS_INTERRUPT_MASK ) |
---|
102 | |
---|
103 | /** |
---|
104 | * @brief Interrupt Mask Variable |
---|
105 | * |
---|
106 | * This variable is used by bindings from languages other than C and C++. |
---|
107 | */ |
---|
108 | extern const uint32_t rtems_interrupt_mask; |
---|
109 | |
---|
110 | /** |
---|
111 | * @brief Body for RTEMS_INTERRUPT_LEVEL Macro |
---|
112 | * |
---|
113 | * @param[in] level is the desired interrupt level |
---|
114 | * |
---|
115 | * @retval This methods returns a mode with the desired interrupt |
---|
116 | * @a level in the proper bitfield location. |
---|
117 | * |
---|
118 | * @note This variable is used by bindings from languages other than |
---|
119 | * C and C++. |
---|
120 | */ |
---|
121 | Modes_Control rtems_interrupt_level_body( |
---|
122 | uint32_t level |
---|
123 | ); |
---|
124 | |
---|
125 | /**@}*/ |
---|
126 | |
---|
127 | #ifdef __cplusplus |
---|
128 | } |
---|
129 | #endif |
---|
130 | |
---|
131 | #endif |
---|
132 | /* end of include file */ |
---|