1 | /* thread.h |
---|
2 | * |
---|
3 | * This include file contains all constants and structures associated |
---|
4 | * with the thread control block. |
---|
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 __RTEMS_THREAD_h |
---|
18 | #define __RTEMS_THREAD_h |
---|
19 | |
---|
20 | #ifdef __cplusplus |
---|
21 | extern "C" { |
---|
22 | #endif |
---|
23 | |
---|
24 | #include <rtems/asr.h> |
---|
25 | #include <rtems/attr.h> |
---|
26 | #include <rtems/context.h> |
---|
27 | #include <rtems/cpu.h> |
---|
28 | #include <rtems/eventset.h> |
---|
29 | #include <rtems/modes.h> |
---|
30 | #include <rtems/mppkt.h> |
---|
31 | #include <rtems/object.h> |
---|
32 | #include <rtems/options.h> |
---|
33 | #include <rtems/priority.h> |
---|
34 | #include <rtems/stack.h> |
---|
35 | #include <rtems/states.h> |
---|
36 | #include <rtems/tod.h> |
---|
37 | #include <rtems/tqdata.h> |
---|
38 | #include <rtems/watchdog.h> |
---|
39 | |
---|
40 | /* |
---|
41 | * Notepads constants (indices into notepad array) |
---|
42 | */ |
---|
43 | |
---|
44 | #define RTEMS_NOTEPAD_FIRST 0 /* lowest numbered notepad */ |
---|
45 | #define RTEMS_NOTEPAD_0 0 /* notepad location 0 */ |
---|
46 | #define RTEMS_NOTEPAD_1 1 /* notepad location 1 */ |
---|
47 | #define RTEMS_NOTEPAD_2 2 /* notepad location 2 */ |
---|
48 | #define RTEMS_NOTEPAD_3 3 /* notepad location 3 */ |
---|
49 | #define RTEMS_NOTEPAD_4 4 /* notepad location 4 */ |
---|
50 | #define RTEMS_NOTEPAD_5 5 /* notepad location 5 */ |
---|
51 | #define RTEMS_NOTEPAD_6 6 /* notepad location 6 */ |
---|
52 | #define RTEMS_NOTEPAD_7 7 /* notepad location 7 */ |
---|
53 | #define RTEMS_NOTEPAD_8 8 /* notepad location 8 */ |
---|
54 | #define RTEMS_NOTEPAD_9 9 /* notepad location 9 */ |
---|
55 | #define RTEMS_NOTEPAD_10 10 /* notepad location 10 */ |
---|
56 | #define RTEMS_NOTEPAD_11 11 /* notepad location 11 */ |
---|
57 | #define RTEMS_NOTEPAD_12 12 /* notepad location 12 */ |
---|
58 | #define RTEMS_NOTEPAD_13 13 /* notepad location 13 */ |
---|
59 | #define RTEMS_NOTEPAD_14 14 /* notepad location 14 */ |
---|
60 | #define RTEMS_NOTEPAD_15 15 /* notepad location 15 */ |
---|
61 | #define RTEMS_NOTEPAD_LAST RTEMS_NOTEPAD_15 /* highest numbered notepad */ |
---|
62 | |
---|
63 | #define RTEMS_NUMBER_NOTEPADS (RTEMS_NOTEPAD_LAST+1) |
---|
64 | |
---|
65 | /* |
---|
66 | * The following defines the "return type" of an RTEMS thread. |
---|
67 | * |
---|
68 | * NOTE: Keep both types for internal threads. |
---|
69 | */ |
---|
70 | |
---|
71 | typedef void rtems_task; |
---|
72 | typedef void Thread; |
---|
73 | |
---|
74 | /* |
---|
75 | * The following defines the argument to an RTEMS thread. |
---|
76 | */ |
---|
77 | |
---|
78 | typedef unsigned32 rtems_task_argument; |
---|
79 | typedef unsigned32 Thread_Argument; |
---|
80 | |
---|
81 | /* |
---|
82 | * The following defines the type for the entry point of an RTEMS thread. |
---|
83 | */ |
---|
84 | |
---|
85 | typedef rtems_task ( *rtems_task_entry )( |
---|
86 | rtems_task_argument |
---|
87 | ); |
---|
88 | |
---|
89 | typedef Thread ( *Thread_Entry )( ); |
---|
90 | |
---|
91 | /* |
---|
92 | * The following structure contains the information which defines |
---|
93 | * the starting state of a thread. |
---|
94 | */ |
---|
95 | |
---|
96 | typedef enum { |
---|
97 | THREAD_START_NUMERIC, |
---|
98 | THREAD_START_POINTER, |
---|
99 | THREAD_START_BOTH_POINTER_FIRST, |
---|
100 | THREAD_START_BOTH_NUMERIC_FIRST |
---|
101 | } Thread_Start_types; |
---|
102 | |
---|
103 | typedef struct { |
---|
104 | Thread_Entry entry_point; /* starting thread address */ |
---|
105 | Thread_Start_types prototype; /* how task is invoked */ |
---|
106 | void *pointer_argument; /* pointer argument */ |
---|
107 | unsigned32 numeric_argument; /* numeric argument */ |
---|
108 | Modes_Control initial_modes; /* initial mode */ |
---|
109 | Priority_Control initial_priority; /* initial priority */ |
---|
110 | Stack_Control Initial_stack; /* stack information */ |
---|
111 | void *fp_context; /* initial FP context area address */ |
---|
112 | void *stack; /* initial FP context area address */ |
---|
113 | } Thread_Start_information; |
---|
114 | |
---|
115 | /* |
---|
116 | * The following structure contains the information necessary to manage |
---|
117 | * a thread which it is waiting for a resource. |
---|
118 | */ |
---|
119 | |
---|
120 | typedef struct { |
---|
121 | Objects_Id id; /* waiting on this object */ |
---|
122 | rtems_option option_set; /* wait mode */ |
---|
123 | union { |
---|
124 | unsigned32 segment_size; /* size of segment requested */ |
---|
125 | rtems_event_set event_condition; |
---|
126 | unsigned32 *message_size_p; /* ptr for return size of message */ |
---|
127 | } Extra; |
---|
128 | void *return_argument; /* address of user return param */ |
---|
129 | rtems_status_code return_code; /* status for thread awakened */ |
---|
130 | Chain_Control Block2n; /* 2 - n priority blocked chain */ |
---|
131 | Thread_queue_Control *queue; /* pointer to thread queue */ |
---|
132 | } Thread_Wait_information; |
---|
133 | |
---|
134 | /* |
---|
135 | * The following defines the control block used to manage |
---|
136 | * each thread proxy. |
---|
137 | * |
---|
138 | * NOTE: It is critical that proxies and threads have identical |
---|
139 | * memory images for the shared part. |
---|
140 | */ |
---|
141 | |
---|
142 | typedef struct { |
---|
143 | Objects_Control Object; |
---|
144 | States_Control current_state; |
---|
145 | Priority_Control current_priority; |
---|
146 | Priority_Control real_priority; |
---|
147 | unsigned32 resource_count; |
---|
148 | Thread_Wait_information Wait; |
---|
149 | Watchdog_Control Timer; |
---|
150 | rtems_packet_prefix *receive_packet; |
---|
151 | /****************** end of common block ********************/ |
---|
152 | Chain_Node Active; |
---|
153 | } Thread_Proxy_control; |
---|
154 | |
---|
155 | |
---|
156 | /* |
---|
157 | * The following record defines the control block used |
---|
158 | * to manage each thread. |
---|
159 | * |
---|
160 | * NOTE: It is critical that proxies and threads have identical |
---|
161 | * memory images for the shared part. |
---|
162 | */ |
---|
163 | |
---|
164 | /* XXX structure in wrong file .. API .. not core */ |
---|
165 | |
---|
166 | typedef struct { |
---|
167 | boolean is_global; |
---|
168 | unsigned32 Notepads[ RTEMS_NUMBER_NOTEPADS ]; |
---|
169 | rtems_event_set pending_events; |
---|
170 | rtems_event_set events_out; |
---|
171 | ASR_Information Signal; |
---|
172 | } RTEMS_API_Control; |
---|
173 | |
---|
174 | typedef struct { |
---|
175 | Objects_Control Object; |
---|
176 | States_Control current_state; |
---|
177 | Priority_Control current_priority; |
---|
178 | Priority_Control real_priority; |
---|
179 | unsigned32 resource_count; |
---|
180 | Thread_Wait_information Wait; |
---|
181 | Watchdog_Control Timer; |
---|
182 | rtems_packet_prefix *receive_packet; |
---|
183 | /****************** end of common block ********************/ |
---|
184 | Chain_Control *ready; |
---|
185 | Priority_Information Priority_map; |
---|
186 | Thread_Start_information Start; |
---|
187 | Modes_Control current_modes; |
---|
188 | Context_Control Registers; |
---|
189 | void *fp_context; |
---|
190 | RTEMS_API_Control *RTEMS_API; |
---|
191 | void *extension; |
---|
192 | } Thread_Control; |
---|
193 | |
---|
194 | /* |
---|
195 | * External API name for Thread_Control |
---|
196 | */ |
---|
197 | |
---|
198 | typedef Thread_Control rtems_tcb; |
---|
199 | |
---|
200 | /* |
---|
201 | * The following declares the dispatch critical section nesting |
---|
202 | * counter which is used to prevent context switches at inopportune |
---|
203 | * moments. |
---|
204 | */ |
---|
205 | |
---|
206 | EXTERN unsigned32 _Thread_Dispatch_disable_level; |
---|
207 | |
---|
208 | /* |
---|
209 | * The following data items are used to manage timeslicing. |
---|
210 | */ |
---|
211 | |
---|
212 | EXTERN unsigned32 _Thread_Ticks_remaining_in_timeslice; |
---|
213 | EXTERN unsigned32 _Thread_Ticks_per_timeslice; |
---|
214 | |
---|
215 | /* |
---|
216 | * The following points to the array of FIFOs used to manage the |
---|
217 | * set of ready threads. |
---|
218 | */ |
---|
219 | |
---|
220 | EXTERN Chain_Control *_Thread_Ready_chain; |
---|
221 | |
---|
222 | /* |
---|
223 | * The following points to the thread which is currently executing. |
---|
224 | * This thread is implicitly manipulated by numerous directives. |
---|
225 | */ |
---|
226 | |
---|
227 | EXTERN Thread_Control *_Thread_Executing; |
---|
228 | |
---|
229 | /* |
---|
230 | * The following points to the highest priority ready thread |
---|
231 | * in the system. Unless the current thread is RTEMS_NO_PREEMPT, |
---|
232 | * then this thread will be context switched to when the next |
---|
233 | * dispatch occurs. |
---|
234 | */ |
---|
235 | |
---|
236 | EXTERN Thread_Control *_Thread_Heir; |
---|
237 | |
---|
238 | /* |
---|
239 | * The following points to the thread whose floating point |
---|
240 | * context is currently loaded. |
---|
241 | */ |
---|
242 | |
---|
243 | EXTERN Thread_Control *_Thread_Allocated_fp; |
---|
244 | |
---|
245 | /* |
---|
246 | * The following context area contains the context of the "thread" |
---|
247 | * which invoked rtems_initialize_executive. This context is restored |
---|
248 | * as the last action of the rtems_shutdown_executive directive. Thus |
---|
249 | * control of the processor can be returned to the environment |
---|
250 | * which initiated RTEMS. |
---|
251 | */ |
---|
252 | |
---|
253 | EXTERN Context_Control _Thread_BSP_context; |
---|
254 | |
---|
255 | /* |
---|
256 | * _Thread_Handler_initialization |
---|
257 | * |
---|
258 | * DESCRIPTION: |
---|
259 | * |
---|
260 | * This routine performs the initialization necessary for this handler. |
---|
261 | */ |
---|
262 | |
---|
263 | void _Thread_Handler_initialization ( |
---|
264 | unsigned32 ticks_per_timeslice, |
---|
265 | unsigned32 maximum_proxies |
---|
266 | ); |
---|
267 | |
---|
268 | /* |
---|
269 | * _Thread_Start_multitasking |
---|
270 | * |
---|
271 | * DESCRIPTION: |
---|
272 | * |
---|
273 | * This routine initiates multitasking. It is invoked only as |
---|
274 | * part of initialization and its invocation is the last act of |
---|
275 | * the rtems_initialize_executive directive. |
---|
276 | */ |
---|
277 | |
---|
278 | void _Thread_Start_multitasking ( |
---|
279 | Thread_Control *system_thread, |
---|
280 | Thread_Control *idle_thread |
---|
281 | ); |
---|
282 | |
---|
283 | /* |
---|
284 | * _Thread_Stop_multitasking |
---|
285 | * |
---|
286 | * DESCRIPTION: |
---|
287 | * |
---|
288 | * This routine halts multitasking and returns control to |
---|
289 | * the "thread" which initially invoked the rtems_initialize_executive |
---|
290 | * directive. |
---|
291 | */ |
---|
292 | |
---|
293 | STATIC INLINE void _Thread_Stop_multitasking( void ); |
---|
294 | |
---|
295 | /* |
---|
296 | * _Thread_Dispatch_initialization |
---|
297 | * |
---|
298 | * DESCRIPTION: |
---|
299 | * |
---|
300 | * This routine initializes the thread dispatching subsystem. |
---|
301 | */ |
---|
302 | |
---|
303 | STATIC INLINE void _Thread_Dispatch_initialization( void ); |
---|
304 | |
---|
305 | /* |
---|
306 | * _Thread_Dispatch |
---|
307 | * |
---|
308 | * DESCRIPTION: |
---|
309 | * |
---|
310 | * This routine is responsible for transferring control of the |
---|
311 | * processor from the executing thread to the heir thread. As part |
---|
312 | * of this process, it is responsible for the following actions: |
---|
313 | * |
---|
314 | * + saving the context of the executing thread |
---|
315 | * + restoring the context of the heir thread |
---|
316 | * + dispatching any signals for the resulting executing thread |
---|
317 | */ |
---|
318 | |
---|
319 | void _Thread_Dispatch( void ); |
---|
320 | |
---|
321 | /* |
---|
322 | * _Thread_Initialize |
---|
323 | * |
---|
324 | * DESCRIPTION: |
---|
325 | * |
---|
326 | * XXX |
---|
327 | */ |
---|
328 | |
---|
329 | boolean _Thread_Initialize( |
---|
330 | Objects_Information *information, |
---|
331 | Thread_Control *the_thread, |
---|
332 | void *stack_area, /* NULL if to be allocated */ |
---|
333 | unsigned32 stack_size, /* insure it is >= min */ |
---|
334 | boolean is_fp, /* TRUE if thread uses FP */ |
---|
335 | Priority_Control priority, |
---|
336 | Modes_Control mode, |
---|
337 | Objects_Name name |
---|
338 | |
---|
339 | ); |
---|
340 | |
---|
341 | /* |
---|
342 | * _Thread_Start |
---|
343 | * |
---|
344 | * DESCRIPTION: |
---|
345 | * |
---|
346 | * XXX |
---|
347 | */ |
---|
348 | |
---|
349 | boolean _Thread_Start( |
---|
350 | Thread_Control *the_thread, |
---|
351 | Thread_Start_types the_prototype, |
---|
352 | void *entry_point, |
---|
353 | void *pointer_argument, |
---|
354 | unsigned32 numeric_argument |
---|
355 | ); |
---|
356 | |
---|
357 | /* |
---|
358 | * _Thread_Restart |
---|
359 | * |
---|
360 | * DESCRIPTION: |
---|
361 | * |
---|
362 | * XXX |
---|
363 | */ |
---|
364 | |
---|
365 | /* XXX multiple task arg profiles */ |
---|
366 | |
---|
367 | boolean _Thread_Restart( |
---|
368 | Thread_Control *the_thread, |
---|
369 | void *pointer_argument, |
---|
370 | unsigned32 numeric_argument |
---|
371 | ); |
---|
372 | |
---|
373 | /* |
---|
374 | * _Thread_Close |
---|
375 | * |
---|
376 | * DESCRIPTION: |
---|
377 | * |
---|
378 | * XXX |
---|
379 | */ |
---|
380 | |
---|
381 | void _Thread_Close( |
---|
382 | Objects_Information *information, |
---|
383 | Thread_Control *the_thread |
---|
384 | ); |
---|
385 | |
---|
386 | /* |
---|
387 | * _Thread_Ready |
---|
388 | * |
---|
389 | * DESCRIPTION: |
---|
390 | * |
---|
391 | * This routine removes any set states for the_thread. It performs |
---|
392 | * any necessary scheduling operations including the selection of |
---|
393 | * a new heir thread. |
---|
394 | */ |
---|
395 | |
---|
396 | void _Thread_Ready( |
---|
397 | Thread_Control *the_thread |
---|
398 | ); |
---|
399 | |
---|
400 | /* |
---|
401 | * _Thread_Clear_state |
---|
402 | * |
---|
403 | * DESCRIPTION: |
---|
404 | * |
---|
405 | * This routine clears the indicated STATES for the_thread. It performs |
---|
406 | * any necessary scheduling operations including the selection of |
---|
407 | * a new heir thread. |
---|
408 | */ |
---|
409 | |
---|
410 | void _Thread_Clear_state( |
---|
411 | Thread_Control *the_thread, |
---|
412 | States_Control state |
---|
413 | ); |
---|
414 | |
---|
415 | /* |
---|
416 | * _Thread_Set_state |
---|
417 | * |
---|
418 | * DESCRIPTION: |
---|
419 | * |
---|
420 | * This routine sets the indicated states for the_thread. It performs |
---|
421 | * any necessary scheduling operations including the selection of |
---|
422 | * a new heir thread. |
---|
423 | * |
---|
424 | */ |
---|
425 | |
---|
426 | void _Thread_Set_state( |
---|
427 | Thread_Control *the_thread, |
---|
428 | States_Control state |
---|
429 | ); |
---|
430 | |
---|
431 | /* |
---|
432 | * _Thread_Set_transient |
---|
433 | * |
---|
434 | * DESCRIPTION: |
---|
435 | * |
---|
436 | * This routine sets the TRANSIENT state for the_thread. It performs |
---|
437 | * any necessary scheduling operations including the selection of |
---|
438 | * a new heir thread. |
---|
439 | */ |
---|
440 | |
---|
441 | void _Thread_Set_transient( |
---|
442 | Thread_Control *the_thread |
---|
443 | ); |
---|
444 | |
---|
445 | /* |
---|
446 | * _Thread_Reset_timeslice |
---|
447 | * |
---|
448 | * DESCRIPTION: |
---|
449 | * |
---|
450 | * This routine is invoked upon expiration of the currently |
---|
451 | * executing thread's timeslice. If no other thread's are ready |
---|
452 | * at the priority of the currently executing thread, then the |
---|
453 | * executing thread's timeslice is reset. Otherwise, the |
---|
454 | * currently executing thread is placed at the rear of the |
---|
455 | * RTEMS_FIFO for this priority and a new heir is selected. |
---|
456 | */ |
---|
457 | |
---|
458 | void _Thread_Reset_timeslice( void ); |
---|
459 | |
---|
460 | /* |
---|
461 | * _Thread_Tickle_timeslice |
---|
462 | * |
---|
463 | * DESCRIPTION: |
---|
464 | * |
---|
465 | * This routine is invoked as part of processing each clock tick. |
---|
466 | * It is responsible for determining if the current thread allows |
---|
467 | * timeslicing and, if so, when its timeslice expires. |
---|
468 | */ |
---|
469 | |
---|
470 | void _Thread_Tickle_timeslice( void ); |
---|
471 | |
---|
472 | /* |
---|
473 | * _Thread_Yield_processor |
---|
474 | * |
---|
475 | * DESCRIPTION: |
---|
476 | * |
---|
477 | * This routine is invoked when a thread wishes to voluntarily |
---|
478 | * transfer control of the processor to another thread of equal |
---|
479 | * or greater priority. |
---|
480 | */ |
---|
481 | |
---|
482 | void _Thread_Yield_processor( void ); |
---|
483 | |
---|
484 | /* |
---|
485 | * _Thread_Is_executing |
---|
486 | * |
---|
487 | * DESCRIPTION: |
---|
488 | * |
---|
489 | * This function returns TRUE if the_thread is the currently executing |
---|
490 | * thread, and FALSE otherwise. |
---|
491 | */ |
---|
492 | |
---|
493 | STATIC INLINE boolean _Thread_Is_executing ( |
---|
494 | Thread_Control *the_thread |
---|
495 | ); |
---|
496 | |
---|
497 | /* |
---|
498 | * _Thread_Is_heir |
---|
499 | * |
---|
500 | * DESCRIPTION: |
---|
501 | * |
---|
502 | * This function returns TRUE if the_thread is the heir |
---|
503 | * thread, and FALSE otherwise. |
---|
504 | */ |
---|
505 | |
---|
506 | STATIC INLINE boolean _Thread_Is_executing ( |
---|
507 | Thread_Control *the_thread |
---|
508 | ); |
---|
509 | |
---|
510 | /* |
---|
511 | * _Thread_Is_executing_also_the_heir |
---|
512 | * |
---|
513 | * DESCRIPTION: |
---|
514 | * |
---|
515 | * This function returns TRUE if the currently executing thread |
---|
516 | * is also the heir thread, and FALSE otherwise. |
---|
517 | */ |
---|
518 | |
---|
519 | STATIC INLINE boolean _Thread_Is_executing_also_the_heir( void ); |
---|
520 | |
---|
521 | /* |
---|
522 | * _Thread_Load_environment |
---|
523 | * |
---|
524 | * DESCRIPTION: |
---|
525 | * |
---|
526 | * This routine initializes the context of the_thread to its |
---|
527 | * appropriate starting state. |
---|
528 | */ |
---|
529 | |
---|
530 | void _Thread_Load_environment( |
---|
531 | Thread_Control *the_thread |
---|
532 | ); |
---|
533 | |
---|
534 | /* |
---|
535 | * _Thread_Handler |
---|
536 | * |
---|
537 | * DESCRIPTION: |
---|
538 | * |
---|
539 | * This routine is the wrapper function for all threads. It is |
---|
540 | * the starting point for all threads. The user provided thread |
---|
541 | * entry point is invoked by this routine. Operations |
---|
542 | * which must be performed immediately before and after the user's |
---|
543 | * thread executes are found here. |
---|
544 | */ |
---|
545 | |
---|
546 | void _Thread_Handler( void ); |
---|
547 | |
---|
548 | /* |
---|
549 | * _Thread_Delay_ended |
---|
550 | * |
---|
551 | * DESCRIPTION: |
---|
552 | * |
---|
553 | * This routine is invoked when a thread must be unblocked at the |
---|
554 | * end of a delay such as the rtems_task_wake_after and rtems_task_wake_when |
---|
555 | * directives. |
---|
556 | */ |
---|
557 | |
---|
558 | void _Thread_Delay_ended( |
---|
559 | Objects_Id id, |
---|
560 | void *ignored |
---|
561 | ); |
---|
562 | |
---|
563 | /* |
---|
564 | * _Thread_Change_priority |
---|
565 | * |
---|
566 | * DESCRIPTION: |
---|
567 | * |
---|
568 | * This routine changes the current priority of the_thread to |
---|
569 | * new_priority. It performs any necessary scheduling operations |
---|
570 | * including the selection of a new heir thread. |
---|
571 | */ |
---|
572 | |
---|
573 | void _Thread_Change_priority ( |
---|
574 | Thread_Control *the_thread, |
---|
575 | Priority_Control new_priority |
---|
576 | ); |
---|
577 | |
---|
578 | /* |
---|
579 | * _Thread_Set_priority |
---|
580 | * |
---|
581 | * DESCRIPTION: |
---|
582 | * |
---|
583 | * This routine updates the priority related fields in the_thread |
---|
584 | * control block to indicate the current priority is now new_priority. |
---|
585 | */ |
---|
586 | |
---|
587 | void _Thread_Set_priority( |
---|
588 | Thread_Control *the_thread, |
---|
589 | Priority_Control new_priority |
---|
590 | ); |
---|
591 | |
---|
592 | /* |
---|
593 | * _Thread_Change_mode |
---|
594 | * |
---|
595 | * DESCRIPTION: |
---|
596 | * |
---|
597 | * This routine changes the current values of the modes |
---|
598 | * indicated by mask of the calling thread are changed to that |
---|
599 | * indicated in mode_set. The former mode of the thread is |
---|
600 | * returned in mode_set. If the changes in the current mode |
---|
601 | * indicate that a thread dispatch operation may be necessary, |
---|
602 | * then need_dispatch is TRUE, otherwise it is FALSE. |
---|
603 | */ |
---|
604 | |
---|
605 | boolean _Thread_Change_mode( |
---|
606 | Modes_Control new_mode_set, |
---|
607 | Modes_Control mask, |
---|
608 | Modes_Control *old_mode_set |
---|
609 | ); |
---|
610 | |
---|
611 | /* |
---|
612 | * _Thread_Resume |
---|
613 | * |
---|
614 | * DESCRIPTION: |
---|
615 | * |
---|
616 | * This routine clears the SUSPENDED state for the_thread. It performs |
---|
617 | * any necessary scheduling operations including the selection of |
---|
618 | * a new heir thread. |
---|
619 | */ |
---|
620 | |
---|
621 | STATIC INLINE void _Thread_Resume ( |
---|
622 | Thread_Control *the_thread |
---|
623 | ); |
---|
624 | |
---|
625 | /* |
---|
626 | * _Thread_Unblock |
---|
627 | * |
---|
628 | * DESCRIPTION: |
---|
629 | * |
---|
630 | * This routine clears any blocking state for the_thread. It performs |
---|
631 | * any necessary scheduling operations including the selection of |
---|
632 | * a new heir thread. |
---|
633 | */ |
---|
634 | |
---|
635 | STATIC INLINE void _Thread_Unblock ( |
---|
636 | Thread_Control *the_thread |
---|
637 | ); |
---|
638 | |
---|
639 | /* |
---|
640 | * _Thread_Restart_self |
---|
641 | * |
---|
642 | * DESCRIPTION: |
---|
643 | * |
---|
644 | * This routine resets the current context of the calling thread |
---|
645 | * to that of its initial state. |
---|
646 | */ |
---|
647 | |
---|
648 | STATIC INLINE void _Thread_Restart_self( void ); |
---|
649 | |
---|
650 | /* |
---|
651 | * _Thread_Calculate_heir |
---|
652 | * |
---|
653 | * DESCRIPTION: |
---|
654 | * |
---|
655 | * This function returns a pointer to the highest priority |
---|
656 | * ready thread. |
---|
657 | */ |
---|
658 | |
---|
659 | STATIC INLINE void _Thread_Calculate_heir( void ); |
---|
660 | |
---|
661 | /* |
---|
662 | * _Thread_Is_allocated_fp |
---|
663 | * |
---|
664 | * DESCRIPTION: |
---|
665 | * |
---|
666 | * This function returns TRUE if the floating point context of |
---|
667 | * the_thread is currently loaded in the floating point unit, and |
---|
668 | * FALSE otherwise. |
---|
669 | */ |
---|
670 | |
---|
671 | STATIC INLINE boolean _Thread_Is_allocated_fp ( |
---|
672 | Thread_Control *the_thread |
---|
673 | ); |
---|
674 | |
---|
675 | /* |
---|
676 | * _Thread_Deallocate_fp |
---|
677 | * |
---|
678 | * DESCRIPTION: |
---|
679 | * |
---|
680 | * This routine is invoked when the currently loaded floating |
---|
681 | * point context is now longer associated with an active thread. |
---|
682 | */ |
---|
683 | |
---|
684 | STATIC INLINE void _Thread_Deallocate_fp( void ); |
---|
685 | |
---|
686 | /* |
---|
687 | * _Thread_Disable_dispatch |
---|
688 | * |
---|
689 | * DESCRIPTION: |
---|
690 | * |
---|
691 | * This routine prevents dispatching. |
---|
692 | */ |
---|
693 | |
---|
694 | STATIC INLINE void _Thread_Disable_dispatch( void ); |
---|
695 | |
---|
696 | /* |
---|
697 | * _Thread_Enable_dispatch |
---|
698 | * |
---|
699 | * DESCRIPTION: |
---|
700 | * |
---|
701 | * This routine allows dispatching to occur again. If this is |
---|
702 | * the outer most dispatching critical section, then a dispatching |
---|
703 | * operation will be performed and, if necessary, control of the |
---|
704 | * processor will be transferred to the heir thread. |
---|
705 | */ |
---|
706 | |
---|
707 | #if ( CPU_INLINE_ENABLE_DISPATCH == TRUE ) |
---|
708 | |
---|
709 | STATIC INLINE void _Thread_Enable_dispatch(); |
---|
710 | |
---|
711 | #endif |
---|
712 | |
---|
713 | #if ( CPU_INLINE_ENABLE_DISPATCH == FALSE ) |
---|
714 | |
---|
715 | void _Thread_Enable_dispatch( void ); |
---|
716 | |
---|
717 | #endif |
---|
718 | |
---|
719 | /* |
---|
720 | * _Thread_Unnest_dispatch |
---|
721 | * |
---|
722 | * DESCRIPTION: |
---|
723 | * |
---|
724 | * This routine allows dispatching to occur again. However, |
---|
725 | * no dispatching operation is performed even if this is the outer |
---|
726 | * most dispatching critical section. |
---|
727 | */ |
---|
728 | |
---|
729 | STATIC INLINE void _Thread_Unnest_dispatch( void ); |
---|
730 | |
---|
731 | /* |
---|
732 | * _Thread_Is_dispatching_enabled |
---|
733 | * |
---|
734 | * DESCRIPTION: |
---|
735 | * |
---|
736 | * This function returns TRUE if dispatching is disabled, and FALSE |
---|
737 | * otherwise. |
---|
738 | */ |
---|
739 | |
---|
740 | STATIC INLINE boolean _Thread_Is_dispatching_enabled( void ); |
---|
741 | |
---|
742 | /* |
---|
743 | * _Thread_Is_context_switch_necessary |
---|
744 | * |
---|
745 | * DESCRIPTION: |
---|
746 | * |
---|
747 | * This function returns TRUE if dispatching is disabled, and FALSE |
---|
748 | * otherwise. |
---|
749 | */ |
---|
750 | |
---|
751 | STATIC INLINE boolean _Thread_Is_context_switch_necessary( void ); |
---|
752 | |
---|
753 | /* |
---|
754 | * _Thread_Is_null |
---|
755 | * |
---|
756 | * DESCRIPTION: |
---|
757 | * |
---|
758 | * This function returns TRUE if the_thread is NULL and FALSE otherwise. |
---|
759 | */ |
---|
760 | |
---|
761 | STATIC INLINE boolean _Thread_Is_null ( |
---|
762 | Thread_Control *the_thread |
---|
763 | ); |
---|
764 | |
---|
765 | /* |
---|
766 | * _Thread_Get |
---|
767 | * |
---|
768 | * DESCRIPTION: |
---|
769 | * |
---|
770 | * This function maps thread IDs to thread control |
---|
771 | * blocks. If ID corresponds to a local thread, then it |
---|
772 | * returns the_thread control pointer which maps to ID |
---|
773 | * and location is set to OBJECTS_LOCAL. If the thread ID is |
---|
774 | * global and resides on a remote node, then location is set |
---|
775 | * to OBJECTS_REMOTE, and the_thread is undefined. |
---|
776 | * Otherwise, location is set to OBJECTS_ERROR and |
---|
777 | * the_thread is undefined. |
---|
778 | */ |
---|
779 | |
---|
780 | STATIC INLINE Thread_Control *_Thread_Get ( |
---|
781 | Objects_Id id, |
---|
782 | Objects_Locations *location |
---|
783 | ); |
---|
784 | |
---|
785 | #include <rtems/thread.inl> |
---|
786 | #include <rtems/threadmp.h> |
---|
787 | |
---|
788 | #ifdef __cplusplus |
---|
789 | } |
---|
790 | #endif |
---|
791 | |
---|
792 | #endif |
---|
793 | /* end of include file */ |
---|