[ac7d5ef0] | 1 | /* thread.inl |
---|
| 2 | * |
---|
| 3 | * This file contains the macro implementation of the inlined |
---|
| 4 | * routines from the Thread handler. |
---|
| 5 | * |
---|
[08311cc3] | 6 | * COPYRIGHT (c) 1989-1999. |
---|
[ac7d5ef0] | 7 | * On-Line Applications Research Corporation (OAR). |
---|
| 8 | * |
---|
[98e4ebf5] | 9 | * The license and distribution terms for this file may be |
---|
| 10 | * found in the file LICENSE in this distribution or at |
---|
[03f2154e] | 11 | * http://www.OARcorp.com/rtems/license.html. |
---|
[ac7d5ef0] | 12 | * |
---|
| 13 | * $Id$ |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #ifndef __THREAD_inl |
---|
| 17 | #define __THREAD_inl |
---|
| 18 | |
---|
| 19 | /*PAGE |
---|
| 20 | * |
---|
| 21 | * _Thread_Stop_multitasking |
---|
| 22 | * |
---|
| 23 | */ |
---|
| 24 | |
---|
| 25 | #define _Thread_Stop_multitasking() \ |
---|
| 26 | _Context_Switch( &_Thread_Executing->Registers, &_Thread_BSP_context ); |
---|
| 27 | |
---|
| 28 | /*PAGE |
---|
| 29 | * |
---|
| 30 | * _Thread_Is_executing |
---|
| 31 | * |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | #define _Thread_Is_executing( _the_thread ) \ |
---|
| 35 | ( (_the_thread) == _Thread_Executing ) |
---|
| 36 | |
---|
| 37 | /*PAGE |
---|
| 38 | * |
---|
| 39 | * _Thread_Is_heir |
---|
| 40 | * |
---|
| 41 | */ |
---|
| 42 | |
---|
| 43 | #define _Thread_Is_heir( _the_thread ) \ |
---|
| 44 | ( (_the_thread) == _Thread_Heir ) |
---|
| 45 | |
---|
| 46 | /*PAGE |
---|
| 47 | * |
---|
| 48 | * _Thread_Is_executing_also_the_heir |
---|
| 49 | * |
---|
| 50 | */ |
---|
| 51 | |
---|
| 52 | #define _Thread_Is_executing_also_the_heir() \ |
---|
| 53 | ( _Thread_Executing == _Thread_Heir ) |
---|
| 54 | |
---|
| 55 | /*PAGE |
---|
| 56 | * |
---|
| 57 | * _Thread_Unblock |
---|
| 58 | * |
---|
| 59 | */ |
---|
| 60 | |
---|
| 61 | #define _Thread_Unblock( _the_thread ) \ |
---|
| 62 | _Thread_Clear_state( (_the_thread), STATES_BLOCKED ); |
---|
| 63 | |
---|
| 64 | /*PAGE |
---|
| 65 | * |
---|
| 66 | * _Thread_Restart_self |
---|
| 67 | * |
---|
| 68 | */ |
---|
| 69 | |
---|
[17508d02] | 70 | #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) |
---|
[ac7d5ef0] | 71 | #define _Thread_Restart_self() \ |
---|
| 72 | { \ |
---|
| 73 | if ( _Thread_Executing->fp_context != NULL ) \ |
---|
| 74 | _Context_Restore_fp( &_Thread_Executing->fp_context ); \ |
---|
| 75 | \ |
---|
| 76 | _CPU_Context_Restart_self( &_Thread_Executing->Registers ); \ |
---|
| 77 | } |
---|
[17508d02] | 78 | #else |
---|
| 79 | #define _Thread_Restart_self() \ |
---|
| 80 | { \ |
---|
| 81 | _CPU_Context_Restart_self( &_Thread_Executing->Registers ); \ |
---|
| 82 | } |
---|
| 83 | #endif |
---|
[ac7d5ef0] | 84 | |
---|
| 85 | /*PAGE |
---|
| 86 | * |
---|
| 87 | * _Thread_Calculate_heir |
---|
| 88 | * |
---|
| 89 | */ |
---|
| 90 | |
---|
| 91 | #define _Thread_Calculate_heir() \ |
---|
| 92 | { \ |
---|
[7f6a24ab] | 93 | Priority_Control highest; \ |
---|
[ac7d5ef0] | 94 | \ |
---|
| 95 | _Priority_Get_highest( highest ); \ |
---|
| 96 | \ |
---|
| 97 | _Thread_Heir = (Thread_Control *) _Thread_Ready_chain[ highest ].first; \ |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | /*PAGE |
---|
| 101 | * |
---|
| 102 | * _Thread_Is_allocated_fp |
---|
| 103 | * |
---|
| 104 | */ |
---|
| 105 | |
---|
[17508d02] | 106 | #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) |
---|
[ac7d5ef0] | 107 | #define _Thread_Is_allocated_fp( _the_thread ) \ |
---|
| 108 | ( (_the_thread) == _Thread_Allocated_fp ) |
---|
[17508d02] | 109 | #endif |
---|
[ac7d5ef0] | 110 | |
---|
| 111 | /*PAGE |
---|
| 112 | * |
---|
| 113 | * _Thread_Deallocate_fp |
---|
| 114 | * |
---|
| 115 | */ |
---|
| 116 | |
---|
[17508d02] | 117 | #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) |
---|
[ac7d5ef0] | 118 | #define _Thread_Deallocate_fp() \ |
---|
| 119 | _Thread_Allocated_fp = NULL |
---|
[17508d02] | 120 | #endif |
---|
[ac7d5ef0] | 121 | |
---|
| 122 | /*PAGE |
---|
| 123 | * |
---|
| 124 | * _Thread_Disable_dispatch |
---|
| 125 | * |
---|
| 126 | */ |
---|
| 127 | |
---|
| 128 | #define _Thread_Disable_dispatch() \ |
---|
| 129 | _Thread_Dispatch_disable_level += 1 |
---|
| 130 | |
---|
| 131 | /*PAGE |
---|
| 132 | * |
---|
| 133 | * _Thread_Enable_dispatch |
---|
| 134 | * |
---|
| 135 | */ |
---|
| 136 | |
---|
| 137 | #if ( CPU_INLINE_ENABLE_DISPATCH == TRUE ) |
---|
| 138 | #define _Thread_Enable_dispatch() \ |
---|
| 139 | { if ( (--_Thread_Dispatch_disable_level) == 0 ) \ |
---|
| 140 | _Thread_Dispatch(); \ |
---|
| 141 | } |
---|
| 142 | #endif |
---|
| 143 | |
---|
| 144 | #if ( CPU_INLINE_ENABLE_DISPATCH == FALSE ) |
---|
| 145 | void _Thread_Enable_dispatch( void ); |
---|
| 146 | #endif |
---|
| 147 | |
---|
| 148 | /*PAGE |
---|
| 149 | * |
---|
| 150 | * _Thread_Unnest_dispatch |
---|
| 151 | * |
---|
| 152 | */ |
---|
| 153 | |
---|
| 154 | #define _Thread_Unnest_dispatch() \ |
---|
| 155 | _Thread_Dispatch_disable_level -= 1 |
---|
| 156 | |
---|
| 157 | /*PAGE |
---|
| 158 | * |
---|
| 159 | * _Thread_Is_dispatching_enabled |
---|
| 160 | * |
---|
| 161 | */ |
---|
| 162 | |
---|
| 163 | #define _Thread_Is_dispatching_enabled() \ |
---|
| 164 | ( _Thread_Dispatch_disable_level == 0 ) |
---|
| 165 | |
---|
| 166 | /*PAGE |
---|
| 167 | * |
---|
| 168 | * _Thread_Is_context_switch_necessary |
---|
| 169 | * |
---|
| 170 | */ |
---|
| 171 | |
---|
| 172 | #define _Thread_Is_context_switch_necessary() \ |
---|
| 173 | ( _Context_Switch_necessary == TRUE ) |
---|
| 174 | |
---|
| 175 | /*PAGE |
---|
| 176 | * |
---|
| 177 | * _Thread_Dispatch_initialization |
---|
| 178 | * |
---|
| 179 | */ |
---|
| 180 | |
---|
| 181 | #define _Thread_Dispatch_initialization() \ |
---|
| 182 | _Thread_Dispatch_disable_level = 1 |
---|
| 183 | |
---|
| 184 | /*PAGE |
---|
| 185 | * |
---|
| 186 | * _Thread_Is_null |
---|
| 187 | * |
---|
| 188 | */ |
---|
| 189 | |
---|
| 190 | #define _Thread_Is_null( _the_thread ) \ |
---|
| 191 | ( (_the_thread) == NULL ) |
---|
| 192 | |
---|
[3a4ae6c] | 193 | /* |
---|
| 194 | * _Thread_Is_proxy_blocking |
---|
| 195 | * |
---|
| 196 | */ |
---|
| 197 | |
---|
| 198 | #define _Thread_Is_proxy_blocking( _code ) \ |
---|
| 199 | ( (_code) == THREAD_STATUS_PROXY_BLOCKING ) |
---|
| 200 | |
---|
[adf98bd] | 201 | /* |
---|
| 202 | * _Thread_Internal_allocate |
---|
| 203 | * |
---|
| 204 | */ |
---|
| 205 | |
---|
| 206 | #define _Thread_Internal_allocate() \ |
---|
| 207 | ((Thread_Control *) _Objects_Allocate( &_Thread_Internal_information )) |
---|
| 208 | |
---|
| 209 | /* |
---|
| 210 | * _Thread_Internal_free |
---|
| 211 | * |
---|
| 212 | */ |
---|
| 213 | |
---|
| 214 | #define _Thread_Internal_free( _the_task ) \ |
---|
| 215 | _Objects_Free( &_Thread_Internal_information, &(_the_task)->Object ) |
---|
| 216 | |
---|
[1b074a1] | 217 | /* |
---|
| 218 | * _Thread_Get_libc_reent |
---|
| 219 | */ |
---|
| 220 | |
---|
| 221 | #define _Thread_Get_libc_reent() \ |
---|
| 222 | (_Thread_libc_reent) |
---|
| 223 | |
---|
| 224 | /* |
---|
| 225 | * _Thread_Set_libc_reent |
---|
| 226 | */ |
---|
| 227 | |
---|
| 228 | #define _Thread_Set_libc_reent(_libc_reent) \ |
---|
| 229 | do { \ |
---|
| 230 | _Thread_libc_reent = (_libc_reent); \ |
---|
| 231 | } while (0) |
---|
| 232 | |
---|
[ac7d5ef0] | 233 | #endif |
---|
| 234 | /* end of include file */ |
---|