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-1998. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * Copyright assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.OARcorp.com/rtems/license.html. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __THREAD_h |
---|
18 | #define __THREAD_h |
---|
19 | |
---|
20 | #ifdef __cplusplus |
---|
21 | extern "C" { |
---|
22 | #endif |
---|
23 | |
---|
24 | #include <rtems/score/context.h> |
---|
25 | #include <rtems/score/cpu.h> |
---|
26 | #if defined(RTEMS_MULTIPROCESSING) |
---|
27 | #include <rtems/score/mppkt.h> |
---|
28 | #endif |
---|
29 | #include <rtems/score/object.h> |
---|
30 | #include <rtems/score/priority.h> |
---|
31 | #include <rtems/score/stack.h> |
---|
32 | #include <rtems/score/states.h> |
---|
33 | #include <rtems/score/tod.h> |
---|
34 | #include <rtems/score/tqdata.h> |
---|
35 | #include <rtems/score/watchdog.h> |
---|
36 | |
---|
37 | /* |
---|
38 | * The following defines the "return type" of a thread. |
---|
39 | * |
---|
40 | * NOTE: This cannot always be right. Some APIs have void |
---|
41 | * tasks/threads, others return pointers, others may |
---|
42 | * return a numeric value. Hopefully a pointer is |
---|
43 | * always at least as big as an unsigned32. :) |
---|
44 | */ |
---|
45 | |
---|
46 | typedef void *Thread; |
---|
47 | |
---|
48 | /* |
---|
49 | * The following defines the ways in which the entry point for a |
---|
50 | * thread can be invoked. Basically, it can be passed any |
---|
51 | * combination/permutation of a pointer and an unsigned32 value. |
---|
52 | * |
---|
53 | * NOTE: For now, we are ignoring the return type. |
---|
54 | */ |
---|
55 | |
---|
56 | typedef enum { |
---|
57 | THREAD_START_NUMERIC, |
---|
58 | THREAD_START_POINTER, |
---|
59 | THREAD_START_BOTH_POINTER_FIRST, |
---|
60 | THREAD_START_BOTH_NUMERIC_FIRST |
---|
61 | } Thread_Start_types; |
---|
62 | |
---|
63 | typedef Thread ( *Thread_Entry )(); /* basic type */ |
---|
64 | |
---|
65 | typedef Thread ( *Thread_Entry_numeric )( unsigned32 ); |
---|
66 | typedef Thread ( *Thread_Entry_pointer )( void * ); |
---|
67 | typedef Thread ( *Thread_Entry_both_pointer_first )( void *, unsigned32 ); |
---|
68 | typedef Thread ( *Thread_Entry_both_numeric_first )( unsigned32, void * ); |
---|
69 | |
---|
70 | /* |
---|
71 | * The following lists the algorithms used to manage the thread cpu budget. |
---|
72 | * |
---|
73 | * Reset Timeslice: At each context switch, reset the time quantum. |
---|
74 | * Exhaust Timeslice: Only reset the quantum once it is consumed. |
---|
75 | * Callout: Execute routine when budget is consumed. |
---|
76 | */ |
---|
77 | |
---|
78 | typedef enum { |
---|
79 | THREAD_CPU_BUDGET_ALGORITHM_NONE, |
---|
80 | THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE, |
---|
81 | THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE, |
---|
82 | THREAD_CPU_BUDGET_ALGORITHM_CALLOUT |
---|
83 | } Thread_CPU_budget_algorithms; |
---|
84 | |
---|
85 | typedef struct Thread_Control_struct Thread_Control; |
---|
86 | |
---|
87 | typedef void (*Thread_CPU_budget_algorithm_callout )( Thread_Control * ); |
---|
88 | |
---|
89 | /* |
---|
90 | * Per task variable structure |
---|
91 | */ |
---|
92 | |
---|
93 | struct rtems_task_variable_tt; |
---|
94 | |
---|
95 | struct rtems_task_variable_tt { |
---|
96 | struct rtems_task_variable_tt *next; |
---|
97 | int *ptr; |
---|
98 | int var; |
---|
99 | }; |
---|
100 | |
---|
101 | typedef struct rtems_task_variable_tt rtems_task_variable_t; |
---|
102 | |
---|
103 | /* |
---|
104 | * The following structure contains the information which defines |
---|
105 | * the starting state of a thread. |
---|
106 | */ |
---|
107 | |
---|
108 | typedef struct { |
---|
109 | Thread_Entry entry_point; /* starting thread address */ |
---|
110 | Thread_Start_types prototype; /* how task is invoked */ |
---|
111 | void *pointer_argument; /* pointer argument */ |
---|
112 | unsigned32 numeric_argument; /* numeric argument */ |
---|
113 | /* initial execution modes */ |
---|
114 | boolean is_preemptible; |
---|
115 | Thread_CPU_budget_algorithms budget_algorithm; |
---|
116 | Thread_CPU_budget_algorithm_callout budget_callout; |
---|
117 | unsigned32 isr_level; |
---|
118 | Priority_Control initial_priority; /* initial priority */ |
---|
119 | boolean core_allocated_stack; |
---|
120 | Stack_Control Initial_stack; /* stack information */ |
---|
121 | void *fp_context; /* initial FP context area address */ |
---|
122 | void *stack; /* initial stack area address */ |
---|
123 | } Thread_Start_information; |
---|
124 | |
---|
125 | /* |
---|
126 | * The following structure contains the information necessary to manage |
---|
127 | * a thread which it is waiting for a resource. |
---|
128 | */ |
---|
129 | |
---|
130 | #define THREAD_STATUS_PROXY_BLOCKING 0x1111111 |
---|
131 | |
---|
132 | typedef struct { |
---|
133 | Objects_Id id; /* waiting on this object */ |
---|
134 | unsigned32 count; /* "generic" fields to be used */ |
---|
135 | void *return_argument; /* when blocking */ |
---|
136 | void *return_argument_1; |
---|
137 | unsigned32 option; |
---|
138 | |
---|
139 | /* |
---|
140 | * NOTE: The following assumes that all API return codes can be |
---|
141 | * treated as an unsigned32. |
---|
142 | */ |
---|
143 | unsigned32 return_code; /* status for thread awakened */ |
---|
144 | |
---|
145 | Chain_Control Block2n; /* 2 - n priority blocked chain */ |
---|
146 | Thread_queue_Control *queue; /* pointer to thread queue */ |
---|
147 | } Thread_Wait_information; |
---|
148 | |
---|
149 | /* |
---|
150 | * The following defines the control block used to manage |
---|
151 | * each thread proxy. |
---|
152 | * |
---|
153 | * NOTE: It is critical that proxies and threads have identical |
---|
154 | * memory images for the shared part. |
---|
155 | */ |
---|
156 | |
---|
157 | typedef struct { |
---|
158 | Objects_Control Object; |
---|
159 | States_Control current_state; |
---|
160 | Priority_Control current_priority; |
---|
161 | Priority_Control real_priority; |
---|
162 | unsigned32 resource_count; |
---|
163 | Thread_Wait_information Wait; |
---|
164 | Watchdog_Control Timer; |
---|
165 | #if defined(RTEMS_MULTIPROCESSING) |
---|
166 | MP_packet_Prefix *receive_packet; |
---|
167 | #endif |
---|
168 | /****************** end of common block ********************/ |
---|
169 | Chain_Node Active; |
---|
170 | } Thread_Proxy_control; |
---|
171 | |
---|
172 | |
---|
173 | /* |
---|
174 | * The following record defines the control block used |
---|
175 | * to manage each thread. |
---|
176 | * |
---|
177 | * NOTE: It is critical that proxies and threads have identical |
---|
178 | * memory images for the shared part. |
---|
179 | */ |
---|
180 | |
---|
181 | typedef enum { |
---|
182 | THREAD_API_RTEMS, |
---|
183 | THREAD_API_POSIX, |
---|
184 | THREAD_API_ITRON |
---|
185 | } Thread_APIs; |
---|
186 | |
---|
187 | #define THREAD_API_FIRST THREAD_API_RTEMS |
---|
188 | #define THREAD_API_LAST THREAD_API_ITRON |
---|
189 | |
---|
190 | struct Thread_Control_struct { |
---|
191 | Objects_Control Object; |
---|
192 | States_Control current_state; |
---|
193 | Priority_Control current_priority; |
---|
194 | Priority_Control real_priority; |
---|
195 | unsigned32 resource_count; |
---|
196 | Thread_Wait_information Wait; |
---|
197 | Watchdog_Control Timer; |
---|
198 | #if defined(RTEMS_MULTIPROCESSING) |
---|
199 | MP_packet_Prefix *receive_packet; |
---|
200 | #endif |
---|
201 | /****************** end of common block ********************/ |
---|
202 | unsigned32 suspend_count; |
---|
203 | boolean is_global; |
---|
204 | boolean do_post_task_switch_extension; |
---|
205 | |
---|
206 | boolean is_preemptible; |
---|
207 | void *rtems_ada_self; |
---|
208 | unsigned32 cpu_time_budget; |
---|
209 | Thread_CPU_budget_algorithms budget_algorithm; |
---|
210 | Thread_CPU_budget_algorithm_callout budget_callout; |
---|
211 | |
---|
212 | unsigned32 ticks_executed; |
---|
213 | Chain_Control *ready; |
---|
214 | Priority_Information Priority_map; |
---|
215 | Thread_Start_information Start; |
---|
216 | Context_Control Registers; |
---|
217 | void *fp_context; |
---|
218 | void *API_Extensions[ THREAD_API_LAST + 1 ]; |
---|
219 | void **extensions; |
---|
220 | rtems_task_variable_t *task_variables; |
---|
221 | }; |
---|
222 | |
---|
223 | /* |
---|
224 | * Self for the GNU Ada Run-Time |
---|
225 | */ |
---|
226 | |
---|
227 | SCORE_EXTERN void *rtems_ada_self; |
---|
228 | |
---|
229 | /* |
---|
230 | * The following defines the information control block used to |
---|
231 | * manage this class of objects. |
---|
232 | */ |
---|
233 | |
---|
234 | SCORE_EXTERN Objects_Information _Thread_Internal_information; |
---|
235 | |
---|
236 | /* |
---|
237 | * The following define the thread control pointers used to access |
---|
238 | * and manipulate the idle thread. |
---|
239 | */ |
---|
240 | |
---|
241 | SCORE_EXTERN Thread_Control *_Thread_Idle; |
---|
242 | |
---|
243 | /* |
---|
244 | * The following context area contains the context of the "thread" |
---|
245 | * which invoked the start multitasking routine. This context is |
---|
246 | * restored as the last action of the stop multitasking routine. Thus |
---|
247 | * control of the processor can be returned to the environment |
---|
248 | * which initiated the system. |
---|
249 | */ |
---|
250 | |
---|
251 | SCORE_EXTERN Context_Control _Thread_BSP_context; |
---|
252 | |
---|
253 | /* |
---|
254 | * The following declares the dispatch critical section nesting |
---|
255 | * counter which is used to prevent context switches at inopportune |
---|
256 | * moments. |
---|
257 | */ |
---|
258 | |
---|
259 | SCORE_EXTERN volatile unsigned32 _Thread_Dispatch_disable_level; |
---|
260 | |
---|
261 | /* |
---|
262 | * If this is non-zero, then the post-task switch extension |
---|
263 | * is run regardless of the state of the per thread flag. |
---|
264 | */ |
---|
265 | |
---|
266 | SCORE_EXTERN unsigned32 _Thread_Do_post_task_switch_extension; |
---|
267 | |
---|
268 | /* |
---|
269 | * The following holds how many user extensions are in the system. This |
---|
270 | * is used to determine how many user extension data areas to allocate |
---|
271 | * per thread. |
---|
272 | */ |
---|
273 | |
---|
274 | SCORE_EXTERN unsigned32 _Thread_Maximum_extensions; |
---|
275 | |
---|
276 | /* |
---|
277 | * The following is used to manage the length of a timeslice quantum. |
---|
278 | */ |
---|
279 | |
---|
280 | SCORE_EXTERN unsigned32 _Thread_Ticks_per_timeslice; |
---|
281 | |
---|
282 | /* |
---|
283 | * The following points to the array of FIFOs used to manage the |
---|
284 | * set of ready threads. |
---|
285 | */ |
---|
286 | |
---|
287 | SCORE_EXTERN Chain_Control *_Thread_Ready_chain; |
---|
288 | |
---|
289 | /* |
---|
290 | * The following points to the thread which is currently executing. |
---|
291 | * This thread is implicitly manipulated by numerous directives. |
---|
292 | */ |
---|
293 | |
---|
294 | SCORE_EXTERN Thread_Control *_Thread_Executing; |
---|
295 | |
---|
296 | /* |
---|
297 | * The following points to the highest priority ready thread |
---|
298 | * in the system. Unless the current thread is not preemptibl, |
---|
299 | * then this thread will be context switched to when the next |
---|
300 | * dispatch occurs. |
---|
301 | */ |
---|
302 | |
---|
303 | SCORE_EXTERN Thread_Control *_Thread_Heir; |
---|
304 | |
---|
305 | /* |
---|
306 | * The following points to the thread whose floating point |
---|
307 | * context is currently loaded. |
---|
308 | */ |
---|
309 | |
---|
310 | SCORE_EXTERN Thread_Control *_Thread_Allocated_fp; |
---|
311 | |
---|
312 | /* |
---|
313 | * _Thread_Handler_initialization |
---|
314 | * |
---|
315 | * DESCRIPTION: |
---|
316 | * |
---|
317 | * This routine performs the initialization necessary for this handler. |
---|
318 | */ |
---|
319 | |
---|
320 | void _Thread_Handler_initialization ( |
---|
321 | unsigned32 ticks_per_timeslice, |
---|
322 | unsigned32 maximum_extensions, |
---|
323 | unsigned32 maximum_proxies |
---|
324 | ); |
---|
325 | |
---|
326 | /* |
---|
327 | * _Thread_Create_idle |
---|
328 | * |
---|
329 | * DESCRIPTION: |
---|
330 | * |
---|
331 | * This routine creates the idle thread. |
---|
332 | * |
---|
333 | * WARNING!! No thread should be created before this one. |
---|
334 | */ |
---|
335 | |
---|
336 | void _Thread_Create_idle( void ); |
---|
337 | |
---|
338 | /* |
---|
339 | * _Thread_Start_multitasking |
---|
340 | * |
---|
341 | * DESCRIPTION: |
---|
342 | * |
---|
343 | * This routine initiates multitasking. It is invoked only as |
---|
344 | * part of initialization and its invocation is the last act of |
---|
345 | * the non-multitasking part of the system initialization. |
---|
346 | */ |
---|
347 | |
---|
348 | void _Thread_Start_multitasking( void ); |
---|
349 | |
---|
350 | /* |
---|
351 | * _Thread_Dispatch |
---|
352 | * |
---|
353 | * DESCRIPTION: |
---|
354 | * |
---|
355 | * This routine is responsible for transferring control of the |
---|
356 | * processor from the executing thread to the heir thread. As part |
---|
357 | * of this process, it is responsible for the following actions: |
---|
358 | * |
---|
359 | * + saving the context of the executing thread |
---|
360 | * + restoring the context of the heir thread |
---|
361 | * + dispatching any signals for the resulting executing thread |
---|
362 | */ |
---|
363 | |
---|
364 | void _Thread_Dispatch( void ); |
---|
365 | |
---|
366 | /* |
---|
367 | * _Thread_Stack_Allocate |
---|
368 | * |
---|
369 | * DESCRIPTION: |
---|
370 | * |
---|
371 | * Allocate the requested stack space for the thread. |
---|
372 | * return the actual size allocated after any adjustment |
---|
373 | * or return zero if the allocation failed. |
---|
374 | * Set the Start.stack field to the address of the stack |
---|
375 | * |
---|
376 | * NOTES: NONE |
---|
377 | * |
---|
378 | */ |
---|
379 | |
---|
380 | unsigned32 _Thread_Stack_Allocate( |
---|
381 | Thread_Control *the_thread, |
---|
382 | unsigned32 stack_size |
---|
383 | ); |
---|
384 | |
---|
385 | /* |
---|
386 | * _Thread_Stack_Free |
---|
387 | * |
---|
388 | * DESCRIPTION: |
---|
389 | * |
---|
390 | * Deallocate the Thread's stack. |
---|
391 | * NOTES: NONE |
---|
392 | * |
---|
393 | */ |
---|
394 | |
---|
395 | void _Thread_Stack_Free( |
---|
396 | Thread_Control *the_thread |
---|
397 | ); |
---|
398 | |
---|
399 | /* |
---|
400 | * _Thread_Initialize |
---|
401 | * |
---|
402 | * DESCRIPTION: |
---|
403 | * |
---|
404 | * This routine initializes the specified the thread. It allocates |
---|
405 | * all memory associated with this thread. It completes by adding |
---|
406 | * the thread to the local object table so operations on this |
---|
407 | * thread id are allowed. |
---|
408 | * |
---|
409 | * NOTES: |
---|
410 | * |
---|
411 | * If stack_area is NULL, it is allocated from the workspace. |
---|
412 | * |
---|
413 | * If the stack is allocated from the workspace, then it is guaranteed to be |
---|
414 | * of at least minimum size. |
---|
415 | */ |
---|
416 | |
---|
417 | boolean _Thread_Initialize( |
---|
418 | Objects_Information *information, |
---|
419 | Thread_Control *the_thread, |
---|
420 | void *stack_area, |
---|
421 | unsigned32 stack_size, |
---|
422 | boolean is_fp, |
---|
423 | Priority_Control priority, |
---|
424 | boolean is_preemptible, |
---|
425 | Thread_CPU_budget_algorithms budget_algorithm, |
---|
426 | Thread_CPU_budget_algorithm_callout budget_callout, |
---|
427 | unsigned32 isr_level, |
---|
428 | Objects_Name name |
---|
429 | ); |
---|
430 | |
---|
431 | /* |
---|
432 | * _Thread_Start |
---|
433 | * |
---|
434 | * DESCRIPTION: |
---|
435 | * |
---|
436 | * This routine initializes the executable information for a thread |
---|
437 | * and makes it ready to execute. After this routine executes, the |
---|
438 | * thread competes with all other threads for CPU time. |
---|
439 | */ |
---|
440 | |
---|
441 | boolean _Thread_Start( |
---|
442 | Thread_Control *the_thread, |
---|
443 | Thread_Start_types the_prototype, |
---|
444 | void *entry_point, |
---|
445 | void *pointer_argument, |
---|
446 | unsigned32 numeric_argument |
---|
447 | ); |
---|
448 | |
---|
449 | /* |
---|
450 | * _Thread_Restart |
---|
451 | * |
---|
452 | * DESCRIPTION: |
---|
453 | * |
---|
454 | * This support routine restarts the specified task in a way that the |
---|
455 | * next time this thread executes, it will begin execution at its |
---|
456 | * original starting point. |
---|
457 | */ |
---|
458 | |
---|
459 | /* XXX multiple task arg profiles */ |
---|
460 | |
---|
461 | boolean _Thread_Restart( |
---|
462 | Thread_Control *the_thread, |
---|
463 | void *pointer_argument, |
---|
464 | unsigned32 numeric_argument |
---|
465 | ); |
---|
466 | |
---|
467 | /* |
---|
468 | * _Thread_Reset |
---|
469 | * |
---|
470 | * DESCRIPTION: |
---|
471 | * |
---|
472 | * This routine resets a thread to its initial state but does |
---|
473 | * not restart it. |
---|
474 | */ |
---|
475 | |
---|
476 | void _Thread_Reset( |
---|
477 | Thread_Control *the_thread, |
---|
478 | void *pointer_argument, |
---|
479 | unsigned32 numeric_argument |
---|
480 | ); |
---|
481 | |
---|
482 | /* |
---|
483 | * _Thread_Close |
---|
484 | * |
---|
485 | * DESCRIPTION: |
---|
486 | * |
---|
487 | * This routine frees all memory associated with the specified |
---|
488 | * thread and removes it from the local object table so no further |
---|
489 | * operations on this thread are allowed. |
---|
490 | */ |
---|
491 | |
---|
492 | void _Thread_Close( |
---|
493 | Objects_Information *information, |
---|
494 | Thread_Control *the_thread |
---|
495 | ); |
---|
496 | |
---|
497 | /* |
---|
498 | * _Thread_Ready |
---|
499 | * |
---|
500 | * DESCRIPTION: |
---|
501 | * |
---|
502 | * This routine removes any set states for the_thread. It performs |
---|
503 | * any necessary scheduling operations including the selection of |
---|
504 | * a new heir thread. |
---|
505 | */ |
---|
506 | |
---|
507 | void _Thread_Ready( |
---|
508 | Thread_Control *the_thread |
---|
509 | ); |
---|
510 | |
---|
511 | /* |
---|
512 | * _Thread_Clear_state |
---|
513 | * |
---|
514 | * DESCRIPTION: |
---|
515 | * |
---|
516 | * This routine clears the indicated STATES for the_thread. It performs |
---|
517 | * any necessary scheduling operations including the selection of |
---|
518 | * a new heir thread. |
---|
519 | */ |
---|
520 | |
---|
521 | void _Thread_Clear_state( |
---|
522 | Thread_Control *the_thread, |
---|
523 | States_Control state |
---|
524 | ); |
---|
525 | |
---|
526 | /* |
---|
527 | * _Thread_Set_state |
---|
528 | * |
---|
529 | * DESCRIPTION: |
---|
530 | * |
---|
531 | * This routine sets the indicated states for the_thread. It performs |
---|
532 | * any necessary scheduling operations including the selection of |
---|
533 | * a new heir thread. |
---|
534 | * |
---|
535 | */ |
---|
536 | |
---|
537 | void _Thread_Set_state( |
---|
538 | Thread_Control *the_thread, |
---|
539 | States_Control state |
---|
540 | ); |
---|
541 | |
---|
542 | /* |
---|
543 | * _Thread_Set_transient |
---|
544 | * |
---|
545 | * DESCRIPTION: |
---|
546 | * |
---|
547 | * This routine sets the TRANSIENT state for the_thread. It performs |
---|
548 | * any necessary scheduling operations including the selection of |
---|
549 | * a new heir thread. |
---|
550 | */ |
---|
551 | |
---|
552 | void _Thread_Set_transient( |
---|
553 | Thread_Control *the_thread |
---|
554 | ); |
---|
555 | |
---|
556 | /* |
---|
557 | * _Thread_Reset_timeslice |
---|
558 | * |
---|
559 | * DESCRIPTION: |
---|
560 | * |
---|
561 | * This routine is invoked upon expiration of the currently |
---|
562 | * executing thread's timeslice. If no other thread's are ready |
---|
563 | * at the priority of the currently executing thread, then the |
---|
564 | * executing thread's timeslice is reset. Otherwise, the |
---|
565 | * currently executing thread is placed at the rear of the |
---|
566 | * FIFO for this priority and a new heir is selected. |
---|
567 | */ |
---|
568 | |
---|
569 | void _Thread_Reset_timeslice( void ); |
---|
570 | |
---|
571 | /* |
---|
572 | * _Thread_Tickle_timeslice |
---|
573 | * |
---|
574 | * DESCRIPTION: |
---|
575 | * |
---|
576 | * This routine is invoked as part of processing each clock tick. |
---|
577 | * It is responsible for determining if the current thread allows |
---|
578 | * timeslicing and, if so, when its timeslice expires. |
---|
579 | */ |
---|
580 | |
---|
581 | void _Thread_Tickle_timeslice( void ); |
---|
582 | |
---|
583 | /* |
---|
584 | * _Thread_Yield_processor |
---|
585 | * |
---|
586 | * DESCRIPTION: |
---|
587 | * |
---|
588 | * This routine is invoked when a thread wishes to voluntarily |
---|
589 | * transfer control of the processor to another thread of equal |
---|
590 | * or greater priority. |
---|
591 | */ |
---|
592 | |
---|
593 | void _Thread_Yield_processor( void ); |
---|
594 | |
---|
595 | /* |
---|
596 | * _Thread_Rotate_Ready_Queue |
---|
597 | * |
---|
598 | * DESCRIPTION: |
---|
599 | * |
---|
600 | * This routine is invoked to rotate the ready queue for the |
---|
601 | * given priority. It can be used to yeild the processor |
---|
602 | * by rotating the executing threads ready queue. |
---|
603 | */ |
---|
604 | |
---|
605 | void _Thread_Rotate_Ready_Queue( |
---|
606 | Priority_Control priority |
---|
607 | ); |
---|
608 | |
---|
609 | /* |
---|
610 | * _Thread_Load_environment |
---|
611 | * |
---|
612 | * DESCRIPTION: |
---|
613 | * |
---|
614 | * This routine initializes the context of the_thread to its |
---|
615 | * appropriate starting state. |
---|
616 | */ |
---|
617 | |
---|
618 | void _Thread_Load_environment( |
---|
619 | Thread_Control *the_thread |
---|
620 | ); |
---|
621 | |
---|
622 | /* |
---|
623 | * _Thread_Handler |
---|
624 | * |
---|
625 | * DESCRIPTION: |
---|
626 | * |
---|
627 | * This routine is the wrapper function for all threads. It is |
---|
628 | * the starting point for all threads. The user provided thread |
---|
629 | * entry point is invoked by this routine. Operations |
---|
630 | * which must be performed immediately before and after the user's |
---|
631 | * thread executes are found here. |
---|
632 | */ |
---|
633 | |
---|
634 | void _Thread_Handler( void ); |
---|
635 | |
---|
636 | /* |
---|
637 | * _Thread_Delay_ended |
---|
638 | * |
---|
639 | * DESCRIPTION: |
---|
640 | * |
---|
641 | * This routine is invoked when a thread must be unblocked at the |
---|
642 | * end of a time based delay (i.e. wake after or wake when). |
---|
643 | */ |
---|
644 | |
---|
645 | void _Thread_Delay_ended( |
---|
646 | Objects_Id id, |
---|
647 | void *ignored |
---|
648 | ); |
---|
649 | |
---|
650 | /* |
---|
651 | * _Thread_Change_priority |
---|
652 | * |
---|
653 | * DESCRIPTION: |
---|
654 | * |
---|
655 | * This routine changes the current priority of the_thread to |
---|
656 | * new_priority. It performs any necessary scheduling operations |
---|
657 | * including the selection of a new heir thread. |
---|
658 | */ |
---|
659 | |
---|
660 | void _Thread_Change_priority ( |
---|
661 | Thread_Control *the_thread, |
---|
662 | Priority_Control new_priority, |
---|
663 | boolean prepend_it |
---|
664 | ); |
---|
665 | |
---|
666 | /* |
---|
667 | * _Thread_Set_priority |
---|
668 | * |
---|
669 | * DESCRIPTION: |
---|
670 | * |
---|
671 | * This routine updates the priority related fields in the_thread |
---|
672 | * control block to indicate the current priority is now new_priority. |
---|
673 | */ |
---|
674 | |
---|
675 | void _Thread_Set_priority( |
---|
676 | Thread_Control *the_thread, |
---|
677 | Priority_Control new_priority |
---|
678 | ); |
---|
679 | |
---|
680 | /* |
---|
681 | * _Thread_Suspend |
---|
682 | * |
---|
683 | * DESCRIPTION: |
---|
684 | * |
---|
685 | * This routine updates the related suspend fields in the_thread |
---|
686 | * control block to indicate the current nested level. |
---|
687 | */ |
---|
688 | |
---|
689 | void _Thread_Suspend( |
---|
690 | Thread_Control *the_thread |
---|
691 | ); |
---|
692 | |
---|
693 | /* |
---|
694 | * _Thread_Resume |
---|
695 | * |
---|
696 | * DESCRIPTION: |
---|
697 | * |
---|
698 | * This routine updates the related suspend fields in the_thread |
---|
699 | * control block to indicate the current nested level. A force |
---|
700 | * parameter of TRUE will force a resume and clear the suspend count. |
---|
701 | */ |
---|
702 | |
---|
703 | void _Thread_Resume( |
---|
704 | Thread_Control *the_thread, |
---|
705 | boolean force |
---|
706 | ); |
---|
707 | |
---|
708 | /* |
---|
709 | * _Thread_Evaluate_mode |
---|
710 | * |
---|
711 | * DESCRIPTION: |
---|
712 | * |
---|
713 | * This routine evaluates the current scheduling information for the |
---|
714 | * system and determines if a context switch is required. This |
---|
715 | * is usually called after changing an execution mode such as preemptability |
---|
716 | * for a thread. |
---|
717 | */ |
---|
718 | |
---|
719 | boolean _Thread_Evaluate_mode( void ); |
---|
720 | |
---|
721 | /* |
---|
722 | * _Thread_Get |
---|
723 | * |
---|
724 | * NOTE: If we are not using static inlines, this must be a real |
---|
725 | * subroutine call. |
---|
726 | */ |
---|
727 | |
---|
728 | #ifndef USE_INLINES |
---|
729 | Thread_Control *_Thread_Get ( |
---|
730 | Objects_Id id, |
---|
731 | Objects_Locations *location |
---|
732 | ); |
---|
733 | #endif |
---|
734 | |
---|
735 | /* |
---|
736 | * _Thread_Idle_body |
---|
737 | * |
---|
738 | * DESCRIPTION: |
---|
739 | * |
---|
740 | * This routine is the body of the system idle thread. |
---|
741 | */ |
---|
742 | |
---|
743 | #if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE) |
---|
744 | Thread _Thread_Idle_body( |
---|
745 | unsigned32 ignored |
---|
746 | ); |
---|
747 | #endif |
---|
748 | |
---|
749 | #ifndef __RTEMS_APPLICATION__ |
---|
750 | #include <rtems/score/thread.inl> |
---|
751 | #endif |
---|
752 | #if defined(RTEMS_MULTIPROCESSING) |
---|
753 | #include <rtems/score/threadmp.h> |
---|
754 | #endif |
---|
755 | |
---|
756 | #ifdef __cplusplus |
---|
757 | } |
---|
758 | #endif |
---|
759 | |
---|
760 | #endif |
---|
761 | /* end of include file */ |
---|