[ac7d5ef0] | 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 | * _Modes_Mask_changed |
---|
| 23 | * |
---|
[1a8fde6c] | 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. |
---|
[ac7d5ef0] | 28 | */ |
---|
| 29 | |
---|
[503dc058] | 30 | RTEMS_INLINE_ROUTINE boolean _Modes_Mask_changed ( |
---|
[7f6a24ab] | 31 | Modes_Control mode_set, |
---|
| 32 | Modes_Control masks |
---|
[ac7d5ef0] | 33 | ) |
---|
| 34 | { |
---|
| 35 | return ( mode_set & masks ); |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | /*PAGE |
---|
| 39 | * |
---|
| 40 | * _Modes_Is_asr_disabled |
---|
| 41 | * |
---|
[1a8fde6c] | 42 | * DESCRIPTION: |
---|
| 43 | * |
---|
| 44 | * This function returns TRUE if mode_set indicates that Asynchronous |
---|
| 45 | * Signal Processing is disabled, and FALSE otherwise. |
---|
[ac7d5ef0] | 46 | */ |
---|
| 47 | |
---|
[503dc058] | 48 | RTEMS_INLINE_ROUTINE boolean _Modes_Is_asr_disabled ( |
---|
[7f6a24ab] | 49 | Modes_Control mode_set |
---|
[ac7d5ef0] | 50 | ) |
---|
| 51 | { |
---|
[3a4ae6c] | 52 | return (mode_set & RTEMS_ASR_MASK) == RTEMS_NO_ASR; |
---|
[ac7d5ef0] | 53 | } |
---|
| 54 | |
---|
| 55 | /*PAGE |
---|
| 56 | * |
---|
| 57 | * _Modes_Is_preempt |
---|
| 58 | * |
---|
[1a8fde6c] | 59 | * DESCRIPTION: |
---|
| 60 | * |
---|
| 61 | * This function returns TRUE if mode_set indicates that preemption |
---|
| 62 | * is enabled, and FALSE otherwise. |
---|
[ac7d5ef0] | 63 | */ |
---|
| 64 | |
---|
[503dc058] | 65 | RTEMS_INLINE_ROUTINE boolean _Modes_Is_preempt ( |
---|
[7f6a24ab] | 66 | Modes_Control mode_set |
---|
[ac7d5ef0] | 67 | ) |
---|
| 68 | { |
---|
[3a4ae6c] | 69 | return (mode_set & RTEMS_PREEMPT_MASK) == RTEMS_PREEMPT; |
---|
[ac7d5ef0] | 70 | } |
---|
| 71 | |
---|
| 72 | /*PAGE |
---|
| 73 | * |
---|
| 74 | * _Modes_Is_timeslice |
---|
| 75 | * |
---|
[1a8fde6c] | 76 | * DESCRIPTION: |
---|
| 77 | * |
---|
| 78 | * This function returns TRUE if mode_set indicates that timeslicing |
---|
| 79 | * is enabled, and FALSE otherwise. |
---|
[ac7d5ef0] | 80 | */ |
---|
| 81 | |
---|
[503dc058] | 82 | RTEMS_INLINE_ROUTINE boolean _Modes_Is_timeslice ( |
---|
[7f6a24ab] | 83 | Modes_Control mode_set |
---|
[ac7d5ef0] | 84 | ) |
---|
| 85 | { |
---|
[3a4ae6c] | 86 | return (mode_set & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE; |
---|
[ac7d5ef0] | 87 | } |
---|
| 88 | |
---|
| 89 | /*PAGE |
---|
| 90 | * |
---|
| 91 | * _Modes_Get_interrupt_level |
---|
| 92 | * |
---|
[1a8fde6c] | 93 | * DESCRIPTION: |
---|
| 94 | * |
---|
| 95 | * This function returns the interrupt level portion of the mode_set. |
---|
[ac7d5ef0] | 96 | */ |
---|
| 97 | |
---|
[503dc058] | 98 | RTEMS_INLINE_ROUTINE ISR_Level _Modes_Get_interrupt_level ( |
---|
[7f6a24ab] | 99 | Modes_Control mode_set |
---|
[ac7d5ef0] | 100 | ) |
---|
| 101 | { |
---|
| 102 | return ( mode_set & RTEMS_INTERRUPT_MASK ); |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | /*PAGE |
---|
| 106 | * |
---|
| 107 | * _Modes_Set_interrupt_level |
---|
| 108 | * |
---|
[1a8fde6c] | 109 | * DESCRIPTION: |
---|
| 110 | * |
---|
| 111 | * This routine sets the current interrupt level to that specified |
---|
| 112 | * in the mode_set. |
---|
[ac7d5ef0] | 113 | */ |
---|
| 114 | |
---|
[503dc058] | 115 | RTEMS_INLINE_ROUTINE void _Modes_Set_interrupt_level ( |
---|
[7f6a24ab] | 116 | Modes_Control mode_set |
---|
[ac7d5ef0] | 117 | ) |
---|
| 118 | { |
---|
| 119 | _ISR_Set_level( _Modes_Get_interrupt_level( mode_set ) ); |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | /*PAGE |
---|
| 123 | * |
---|
| 124 | * _Modes_Change |
---|
| 125 | * |
---|
[1a8fde6c] | 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. |
---|
[ac7d5ef0] | 132 | */ |
---|
| 133 | |
---|
[503dc058] | 134 | RTEMS_INLINE_ROUTINE void _Modes_Change ( |
---|
[7f6a24ab] | 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 |
---|
[ac7d5ef0] | 140 | ) |
---|
| 141 | { |
---|
[7f6a24ab] | 142 | Modes_Control _out_mode; |
---|
[ac7d5ef0] | 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 */ |
---|