1 | /* modes.inl |
---|
2 | * |
---|
3 | * This include file contains the static inline implementation of the |
---|
4 | * inlined routines in the Mode Handler |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989-1998. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * Copyright assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.OARcorp.com/rtems/license.html. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __MODES_inl |
---|
18 | #define __MODES_inl |
---|
19 | |
---|
20 | /*PAGE |
---|
21 | * |
---|
22 | * _Modes_Mask_changed |
---|
23 | * |
---|
24 | * DESCRIPTION: |
---|
25 | * |
---|
26 | * This function returns TRUE if any of the mode flags in mask |
---|
27 | * are set in mode_set, and FALSE otherwise. |
---|
28 | */ |
---|
29 | |
---|
30 | RTEMS_INLINE_ROUTINE boolean _Modes_Mask_changed ( |
---|
31 | Modes_Control mode_set, |
---|
32 | Modes_Control masks |
---|
33 | ) |
---|
34 | { |
---|
35 | return ( mode_set & masks ); |
---|
36 | } |
---|
37 | |
---|
38 | /*PAGE |
---|
39 | * |
---|
40 | * _Modes_Is_asr_disabled |
---|
41 | * |
---|
42 | * DESCRIPTION: |
---|
43 | * |
---|
44 | * This function returns TRUE if mode_set indicates that Asynchronous |
---|
45 | * Signal Processing is disabled, and FALSE otherwise. |
---|
46 | */ |
---|
47 | |
---|
48 | RTEMS_INLINE_ROUTINE boolean _Modes_Is_asr_disabled ( |
---|
49 | Modes_Control mode_set |
---|
50 | ) |
---|
51 | { |
---|
52 | return (mode_set & RTEMS_ASR_MASK) == RTEMS_NO_ASR; |
---|
53 | } |
---|
54 | |
---|
55 | /*PAGE |
---|
56 | * |
---|
57 | * _Modes_Is_preempt |
---|
58 | * |
---|
59 | * DESCRIPTION: |
---|
60 | * |
---|
61 | * This function returns TRUE if mode_set indicates that preemption |
---|
62 | * is enabled, and FALSE otherwise. |
---|
63 | */ |
---|
64 | |
---|
65 | RTEMS_INLINE_ROUTINE boolean _Modes_Is_preempt ( |
---|
66 | Modes_Control mode_set |
---|
67 | ) |
---|
68 | { |
---|
69 | return (mode_set & RTEMS_PREEMPT_MASK) == RTEMS_PREEMPT; |
---|
70 | } |
---|
71 | |
---|
72 | /*PAGE |
---|
73 | * |
---|
74 | * _Modes_Is_timeslice |
---|
75 | * |
---|
76 | * DESCRIPTION: |
---|
77 | * |
---|
78 | * This function returns TRUE if mode_set indicates that timeslicing |
---|
79 | * is enabled, and FALSE otherwise. |
---|
80 | */ |
---|
81 | |
---|
82 | RTEMS_INLINE_ROUTINE boolean _Modes_Is_timeslice ( |
---|
83 | Modes_Control mode_set |
---|
84 | ) |
---|
85 | { |
---|
86 | return (mode_set & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE; |
---|
87 | } |
---|
88 | |
---|
89 | /*PAGE |
---|
90 | * |
---|
91 | * _Modes_Get_interrupt_level |
---|
92 | * |
---|
93 | * DESCRIPTION: |
---|
94 | * |
---|
95 | * This function returns the interrupt level portion of the mode_set. |
---|
96 | */ |
---|
97 | |
---|
98 | RTEMS_INLINE_ROUTINE ISR_Level _Modes_Get_interrupt_level ( |
---|
99 | Modes_Control mode_set |
---|
100 | ) |
---|
101 | { |
---|
102 | return ( mode_set & RTEMS_INTERRUPT_MASK ); |
---|
103 | } |
---|
104 | |
---|
105 | /*PAGE |
---|
106 | * |
---|
107 | * _Modes_Set_interrupt_level |
---|
108 | * |
---|
109 | * DESCRIPTION: |
---|
110 | * |
---|
111 | * This routine sets the current interrupt level to that specified |
---|
112 | * in the mode_set. |
---|
113 | */ |
---|
114 | |
---|
115 | RTEMS_INLINE_ROUTINE void _Modes_Set_interrupt_level ( |
---|
116 | Modes_Control mode_set |
---|
117 | ) |
---|
118 | { |
---|
119 | _ISR_Set_level( _Modes_Get_interrupt_level( mode_set ) ); |
---|
120 | } |
---|
121 | |
---|
122 | /*PAGE |
---|
123 | * |
---|
124 | * _Modes_Change |
---|
125 | * |
---|
126 | * DESCRIPTION: |
---|
127 | * |
---|
128 | * This routine changes the modes in old_mode_set indicated by |
---|
129 | * mask to the requested values in new_mode_set. The resulting |
---|
130 | * mode set is returned in out_mode_set and the modes that changed |
---|
131 | * is returned in changed. |
---|
132 | */ |
---|
133 | |
---|
134 | RTEMS_INLINE_ROUTINE void _Modes_Change ( |
---|
135 | Modes_Control old_mode_set, |
---|
136 | Modes_Control new_mode_set, |
---|
137 | Modes_Control mask, |
---|
138 | Modes_Control *out_mode_set, |
---|
139 | Modes_Control *changed |
---|
140 | ) |
---|
141 | { |
---|
142 | Modes_Control _out_mode; |
---|
143 | |
---|
144 | _out_mode = old_mode_set; |
---|
145 | _out_mode &= ~mask; |
---|
146 | _out_mode |= new_mode_set & mask; |
---|
147 | *changed = _out_mode ^ old_mode_set; |
---|
148 | *out_mode_set = _out_mode; |
---|
149 | } |
---|
150 | |
---|
151 | #endif |
---|
152 | /* end of include file */ |
---|