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, 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 __MODES_inl |
---|
18 | #define __MODES_inl |
---|
19 | |
---|
20 | /*PAGE |
---|
21 | * |
---|
22 | * RTEMS_INTERRUPT_LEVEL |
---|
23 | */ |
---|
24 | |
---|
25 | STATIC INLINE unsigned32 RTEMS_INTERRUPT_LEVEL ( |
---|
26 | Modes_Control mode_set |
---|
27 | ) |
---|
28 | { |
---|
29 | return mode_set & RTEMS_INTERRUPT_MASK; |
---|
30 | } |
---|
31 | |
---|
32 | /*PAGE |
---|
33 | * |
---|
34 | * _Modes_Mask_changed |
---|
35 | * |
---|
36 | */ |
---|
37 | |
---|
38 | STATIC INLINE boolean _Modes_Mask_changed ( |
---|
39 | Modes_Control mode_set, |
---|
40 | Modes_Control masks |
---|
41 | ) |
---|
42 | { |
---|
43 | return ( mode_set & masks ); |
---|
44 | } |
---|
45 | |
---|
46 | /*PAGE |
---|
47 | * |
---|
48 | * _Modes_Is_asr_disabled |
---|
49 | * |
---|
50 | */ |
---|
51 | |
---|
52 | STATIC INLINE boolean _Modes_Is_asr_disabled ( |
---|
53 | Modes_Control mode_set |
---|
54 | ) |
---|
55 | { |
---|
56 | return ( mode_set & RTEMS_ASR_MASK ); |
---|
57 | } |
---|
58 | |
---|
59 | /*PAGE |
---|
60 | * |
---|
61 | * _Modes_Is_preempt |
---|
62 | * |
---|
63 | */ |
---|
64 | |
---|
65 | STATIC INLINE 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 | */ |
---|
77 | |
---|
78 | STATIC INLINE boolean _Modes_Is_timeslice ( |
---|
79 | Modes_Control mode_set |
---|
80 | ) |
---|
81 | { |
---|
82 | return ((mode_set & (RTEMS_TIMESLICE_MASK|RTEMS_PREEMPT_MASK)) == |
---|
83 | (RTEMS_TIMESLICE|RTEMS_PREEMPT) ); |
---|
84 | } |
---|
85 | |
---|
86 | /*PAGE |
---|
87 | * |
---|
88 | * _Modes_Get_interrupt_level |
---|
89 | * |
---|
90 | */ |
---|
91 | |
---|
92 | STATIC INLINE ISR_Level _Modes_Get_interrupt_level ( |
---|
93 | Modes_Control mode_set |
---|
94 | ) |
---|
95 | { |
---|
96 | return ( mode_set & RTEMS_INTERRUPT_MASK ); |
---|
97 | } |
---|
98 | |
---|
99 | /*PAGE |
---|
100 | * |
---|
101 | * _Modes_Set_interrupt_level |
---|
102 | * |
---|
103 | */ |
---|
104 | |
---|
105 | STATIC INLINE void _Modes_Set_interrupt_level ( |
---|
106 | Modes_Control mode_set |
---|
107 | ) |
---|
108 | { |
---|
109 | _ISR_Set_level( _Modes_Get_interrupt_level( mode_set ) ); |
---|
110 | } |
---|
111 | |
---|
112 | /*PAGE |
---|
113 | * |
---|
114 | * _Modes_Change |
---|
115 | * |
---|
116 | */ |
---|
117 | |
---|
118 | STATIC INLINE void _Modes_Change ( |
---|
119 | Modes_Control old_mode_set, |
---|
120 | Modes_Control new_mode_set, |
---|
121 | Modes_Control mask, |
---|
122 | Modes_Control *out_mode_set, |
---|
123 | Modes_Control *changed |
---|
124 | ) |
---|
125 | { |
---|
126 | Modes_Control _out_mode; |
---|
127 | |
---|
128 | _out_mode = old_mode_set; |
---|
129 | _out_mode &= ~mask; |
---|
130 | _out_mode |= new_mode_set & mask; |
---|
131 | *changed = _out_mode ^ old_mode_set; |
---|
132 | *out_mode_set = _out_mode; |
---|
133 | } |
---|
134 | |
---|
135 | #endif |
---|
136 | /* end of include file */ |
---|