source: rtems/cpukit/score/macros/rtems/score/thread.inl @ 17508d02

4.104.114.84.95
Last change on this file since 17508d02 was 17508d02, checked in by Joel Sherrill <joel.sherrill@…>, on 07/26/00 at 19:26:28

Port of RTEMS to the Texas Instruments C3x/C4x DSP families including
a BSP (c4xsim) supporting the simulator included with gdb. This port
was done by Joel Sherrill and Jennifer Averett of OAR Corporation.
Also included with this port is a space/time optimization to eliminate
FP context switch management on CPUs without hardware or software FP.

An issue with this port was that sizeof(unsigned32) = sizeof(unsigned8)
on this CPU. This required addressing alignment checks and assumptions
as well as fixing code that assumed sizeof(unsigned32) == 4.

  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*  thread.inl
2 *
3 *  This file contains the macro implementation of the inlined
4 *  routines from the Thread handler.
5 *
6 *  COPYRIGHT (c) 1989-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
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
70#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
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  }
78#else
79#define _Thread_Restart_self()  \
80  {  \
81    _CPU_Context_Restart_self( &_Thread_Executing->Registers ); \
82  }
83#endif
84
85/*PAGE
86 *
87 *  _Thread_Calculate_heir
88 *
89 */
90
91#define _Thread_Calculate_heir() \
92 { \
93   Priority_Control  highest; \
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
106#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
107#define _Thread_Is_allocated_fp( _the_thread ) \
108        ( (_the_thread) == _Thread_Allocated_fp )
109#endif
110
111/*PAGE
112 *
113 *  _Thread_Deallocate_fp
114 *
115 */
116
117#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
118#define _Thread_Deallocate_fp() \
119        _Thread_Allocated_fp = NULL
120#endif
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 )
145void _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
193/*
194 *  _Thread_Is_proxy_blocking
195 *
196 */
197 
198#define _Thread_Is_proxy_blocking( _code ) \
199  ( (_code) == THREAD_STATUS_PROXY_BLOCKING )
200
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
217#endif
218/* end of include file */
Note: See TracBrowser for help on using the repository browser.