source: rtems/cpukit/score/include/rtems/score/thread.h @ 81b329a

4.104.114.9
Last change on this file since 81b329a was 81b329a, checked in by Ralf Corsepius <ralf.corsepius@…>, on Jul 2, 2008 at 3:28:54 PM

Support rtems_ada_self iff RTEMS_ADA is given.

  • Property mode set to 100644
File size: 26.7 KB
Line 
1/**
2 *  @file  rtems/score/thread.h
3 *
4 *  This include file contains all constants and structures associated
5 *  with the thread control block.
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2008.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#ifndef _RTEMS_SCORE_THREAD_H
20#define _RTEMS_SCORE_THREAD_H
21
22/**
23 *  @defgroup ScoreThread Thread Handler
24 *
25 *  This handler encapsulates functionality related to the management of
26 *  threads.  This includes the creation, deletion, and scheduling of threads.
27 */
28/**@{*/
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/*
35 *  The user can define this at configure time and go back to ticks
36 *  resolution.
37 */
38#ifndef __RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__
39  /**
40   *  This macro enables the nanosecond accurate statistics
41   *
42   *  When not defined, the older style tick accurate granularity
43   *  is used.
44   */
45  #define RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
46
47  typedef struct timespec rtems_thread_cpu_usage_t;
48
49#else
50  typedef uint32_t rtems_thread_cpu_usage_t;
51#endif
52
53#include <rtems/score/context.h>
54#include <rtems/score/cpu.h>
55#if defined(RTEMS_MULTIPROCESSING)
56#include <rtems/score/mppkt.h>
57#endif
58#include <rtems/score/object.h>
59#include <rtems/score/priority.h>
60#include <rtems/score/stack.h>
61#include <rtems/score/states.h>
62#include <rtems/score/tod.h>
63#include <rtems/score/tqdata.h>
64#include <rtems/score/watchdog.h>
65
66#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
67  /* XXX include something for timespec */
68#endif
69
70/**
71 *  The following defines the "return type" of a thread.
72 *
73 *  @note  This cannot always be right.  Some APIs have void
74 *         tasks/threads, others return pointers, others may
75 *         return a numeric value.  Hopefully a pointer is
76 *         always at least as big as an uint32_t  . :)
77 */
78typedef void *Thread;
79
80/**
81 *  The following defines the ways in which the entry point for a
82 *  thread can be invoked.  Basically, it can be passed any
83 *  combination/permutation of a pointer and an uint32_t   value.
84 *
85 *  @note For now, we are ignoring the return type.
86 */
87typedef enum {
88  THREAD_START_NUMERIC,
89  THREAD_START_POINTER,
90  THREAD_START_BOTH_POINTER_FIRST,
91  THREAD_START_BOTH_NUMERIC_FIRST
92} Thread_Start_types;
93
94/** This type corresponds to a very simple style thread entry point. */
95typedef Thread ( *Thread_Entry )();   /* basic type */
96
97/** This type corresponds to a thread entry point which takes a single
98 *  unsigned thirty-two bit integer as an argument.
99 */
100typedef Thread ( *Thread_Entry_numeric )( uint32_t   );
101
102/** This type corresponds to a thread entry point which takes a single
103 *  untyped pointer as an argument.
104 */
105typedef Thread ( *Thread_Entry_pointer )( void * );
106
107/** This type corresponds to a thread entry point which takes a single
108 *  untyped pointer and an unsigned thirty-two bit integer as arguments.
109 */
110typedef Thread ( *Thread_Entry_both_pointer_first )( void *, uint32_t   );
111
112/** This type corresponds to a thread entry point which takes a single
113 *  unsigned thirty-two bit integer and an untyped pointer and an
114 *  as arguments.
115 */
116typedef Thread ( *Thread_Entry_both_numeric_first )( uint32_t  , void * );
117
118/**
119 *  The following lists the algorithms used to manage the thread cpu budget.
120 *
121 *  Reset Timeslice:   At each context switch, reset the time quantum.
122 *  Exhaust Timeslice: Only reset the quantum once it is consumed.
123 *  Callout:           Execute routine when budget is consumed.
124 */
125typedef enum {
126  THREAD_CPU_BUDGET_ALGORITHM_NONE,
127  THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE,
128  THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE,
129  THREAD_CPU_BUDGET_ALGORITHM_CALLOUT
130}  Thread_CPU_budget_algorithms;
131
132/** This type defines the Thread Control Block structure.
133 */
134typedef struct Thread_Control_struct Thread_Control;
135
136/**  This defines thes the entry point for the thread specific timeslice
137 *   budget management algorithm.
138 */
139typedef void (*Thread_CPU_budget_algorithm_callout )( Thread_Control * );
140
141/** @brief Per Task Variable Manager Structure Forward Reference
142 *
143 *  Forward reference to the per task variable structure.
144 */
145struct rtems_task_variable_tt;
146
147/** @brief Per Task Variable Manager Structure
148 *
149 *  This is the internal structure used to manager per Task Variables.
150 */
151typedef struct {
152  /** This field points to the next per task variable for this task. */
153  struct rtems_task_variable_tt  *next;
154  /** This field points to the physical memory location of this per
155   *  task variable.
156   */
157  void                          **ptr;
158  /** This field is to the global value for this per task variable. */
159  void                           *gval;
160  /** This field is to this thread's value for this per task variable. */
161  void                           *tval;
162  /** This field points to the destructor for this per task variable. */
163  void                          (*dtor)(void *);
164} rtems_task_variable_t;
165
166/**
167 *  The following structure contains the information which defines
168 *  the starting state of a thread.
169 */
170typedef struct {
171  /** This field is the starting address for the thread. */
172  Thread_Entry         entry_point;
173  /** This field indicates the how task is invoked. */
174  Thread_Start_types   prototype;
175  /** This field is the pointer argument passed at thread start. */
176  void                *pointer_argument;
177  /** This field is the numeric argument passed at thread start. */
178  uint32_t             numeric_argument;
179  /*-------------- initial execution modes ----------------- */
180  /** This field indicates whether the thread was preemptible when
181    * it started.
182    */
183  boolean              is_preemptible;
184  /** This field indicates the CPU budget algorith. */
185  Thread_CPU_budget_algorithms          budget_algorithm;
186  /** This field is the routine to invoke when the CPU allotment is
187   *  consumed.
188   */
189  Thread_CPU_budget_algorithm_callout   budget_callout;
190  /** This field is the initial ISR disable level of this thread. */
191  uint32_t             isr_level;
192  /** This field is the initial priority. */
193  Priority_Control     initial_priority;
194  /** This field indicates whether the SuperCore allocated the stack. */
195  boolean              core_allocated_stack;
196  /** This field is the stack information. */
197  Stack_Control        Initial_stack;
198#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
199  /** This field is the initial FP context area address. */
200  Context_Control_fp  *fp_context;
201#endif
202  /** This field is the initial stack area address. */
203  void                *stack;
204}   Thread_Start_information;
205
206/**
207 *  The following structure contains the information necessary to manage
208 *  a thread which it is  waiting for a resource.
209 */
210#define THREAD_STATUS_PROXY_BLOCKING 0x1111111
211
212/** @brief Thread Blocking Management Information
213 *
214 *  This contains the information required to manage a thread while it is
215 *  blocked and to return information to it.
216 */
217typedef struct {
218  /** This field is the Id of the object this thread is waiting upon. */
219  Objects_Id            id;
220  /** This field is used to return an integer while when blocked. */
221  uint32_t              count;
222  /** This field is the first pointer to a user return argument. */
223  void                 *return_argument;
224  /** This field is the second pointer to a user return argument. */
225  void                 *return_argument_1;
226  /** This field contains any options in effect on this blocking operation. */
227  uint32_t              option;
228  /** This field will contain the return status from a blocking operation.
229   *
230   *  @note The following assumes that all API return codes can be
231   *        treated as an uint32_t.
232   */
233  uint32_t              return_code;
234
235  /** This field is the chain header for the second through Nth tasks
236   *  of the same priority blocked waiting on the same object.
237   */
238  Chain_Control         Block2n;
239  /** This field points to the thread queue on which this thread is blocked. */
240  Thread_queue_Control *queue;
241}   Thread_Wait_information;
242
243/**
244 *  The following defines the control block used to manage
245 *  each thread proxy.
246 *
247 *  @note It is critical that proxies and threads have identical
248 *        memory images for the shared part.
249 */
250typedef struct {
251  /** This field is the object management structure for each proxy. */
252  Objects_Control          Object;
253  /** This field is the current execution state of this proxy. */
254  States_Control           current_state;
255  /** This field is the current priority state of this proxy. */
256  Priority_Control         current_priority;
257  /** This field is the base priority of this proxy. */
258  Priority_Control         real_priority;
259  /** This field is the number of mutexes currently held by this proxy. */
260  uint32_t                 resource_count;
261
262  /** This field is the blocking information for this proxy. */
263  Thread_Wait_information  Wait;
264  /** This field is the Watchdog used to manage proxy delays and timeouts. */
265  Watchdog_Control         Timer;
266#if defined(RTEMS_MULTIPROCESSING)
267  /** This field is the received response packet in an MP system. */
268  MP_packet_Prefix        *receive_packet;
269#endif
270     /****************** end of common block ********************/
271  /** This field is used to manage the set of proxies in the system. */
272  Chain_Node               Active;
273}   Thread_Proxy_control;
274
275/**
276 *  The following record defines the control block used
277 *  to manage each thread.
278 *
279 *  @note It is critical that proxies and threads have identical
280 *        memory images for the shared part.
281 */
282typedef enum {
283  /** This value is for the Classic RTEMS API. */
284  THREAD_API_RTEMS,
285  /** This value is for the POSIX API. */
286  THREAD_API_POSIX,
287  /** This value is for the ITRON API. */
288  THREAD_API_ITRON
289}  Thread_APIs;
290
291/** This macro defines the first API which has threads. */
292#define THREAD_API_FIRST THREAD_API_RTEMS
293
294/** This macro defines the last API which has threads. */
295#define THREAD_API_LAST  THREAD_API_ITRON
296
297/**
298 *  This structure defines the Thread Control Block (TCB).
299 */
300struct Thread_Control_struct {
301  /** This field is the object management structure for each thread. */
302  Objects_Control          Object;
303  /** This field is the current execution state of this thread. */
304  States_Control           current_state;
305  /** This field is the current priority state of this thread. */
306  Priority_Control         current_priority;
307  /** This field is the base priority of this thread. */
308  Priority_Control         real_priority;
309  /** This field is the number of mutexes currently held by this thread. */
310  uint32_t                 resource_count;
311  /** This field is the blocking information for this thread. */
312  Thread_Wait_information  Wait;
313  /** This field is the Watchdog used to manage thread delays and timeouts. */
314  Watchdog_Control         Timer;
315#if defined(RTEMS_MULTIPROCESSING)
316  /** This field is the received response packet in an MP system. */
317  MP_packet_Prefix        *receive_packet;
318#endif
319#ifdef __RTEMS_STRICT_ORDER_MUTEX__
320  /**This field is the head of queue of priority inheritance mutex holed by the thread*/
321  Chain_Control            lock_mutex;
322#endif
323     /*================= end of common block =================*/
324  /** This field is the number of nested suspend calls. */
325  uint32_t                              suspend_count;
326  /** This field is true if the thread is offered globally */
327  boolean                               is_global;
328  /** This field is is true if the post task context switch should be
329   *  executed for this thread at the next context switch.
330   */
331  boolean                               do_post_task_switch_extension;
332  /** This field is true if the thread is preemptible. */
333  boolean                               is_preemptible;
334#if __RTEMS_ADA__
335  /** This field is the GNAT self context pointer. */
336  void                                 *rtems_ada_self;
337#endif
338  /** This field is the length of the time quantum that this thread is
339   *  allowed to consume.  The algorithm used to manage limits on CPU usage
340   *  is specified by budget_algorithm.
341   */
342  uint32_t                              cpu_time_budget;
343  /** This field is the algorithm used to manage this thread's time
344   *  quantum.  The algorithm may be specified as none which case,
345   *  no limit is in place.
346   */
347  Thread_CPU_budget_algorithms          budget_algorithm;
348  /** This field is the method invoked with the budgeted time is consumed. */
349  Thread_CPU_budget_algorithm_callout   budget_callout;
350
351  /** This field is the amount of CPU time consumed by this thread
352   *  since it was created.
353   */
354  rtems_thread_cpu_usage_t              cpu_time_used;
355  /** This field points to the Ready FIFO for this priority. */
356  Chain_Control                        *ready;
357  /** This field contains precalculated priority map indices. */
358  Priority_Information                  Priority_map;
359  /** This field contains information about the starting state of
360   *  this thread.
361   */
362  Thread_Start_information              Start;
363  /** This field contains the context of this thread. */
364  Context_Control                       Registers;
365#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
366  /** This field points to the floating point context for this thread.
367   *  If NULL, the thread is integer only.
368   */
369  Context_Control_fp                   *fp_context;
370#endif
371  /** This field points to the newlib reentrancy structure for this thread. */
372  struct _reent                        *libc_reent;
373  /** This array contains the API extension area pointers. */
374  void                                 *API_Extensions[ THREAD_API_LAST + 1 ];
375  /** This field points to the user extension pointers. */
376  void                                **extensions;
377  /** This field points to the set of per task variables. */
378  rtems_task_variable_t                *task_variables;
379};
380
381/**
382 *  Self for the GNU Ada Run-Time
383 */
384SCORE_EXTERN void *rtems_ada_self;
385
386/**
387 *  The following defines the information control block used to
388 *  manage this class of objects.
389 */
390SCORE_EXTERN Objects_Information _Thread_Internal_information;
391
392/**
393 *  The following define the thread control pointers used to access
394 *  and manipulate the idle thread.
395 */
396SCORE_EXTERN Thread_Control *_Thread_Idle;
397
398/**
399 *  The following context area contains the context of the "thread"
400 *  which invoked the start multitasking routine.  This context is
401 *  restored as the last action of the stop multitasking routine.  Thus
402 *  control of the processor can be returned to the environment
403 *  which initiated the system.
404 */
405SCORE_EXTERN Context_Control _Thread_BSP_context;
406
407/**
408 *  The following declares the dispatch critical section nesting
409 *  counter which is used to prevent context switches at inopportune
410 *  moments.
411 */
412SCORE_EXTERN volatile uint32_t   _Thread_Dispatch_disable_level;
413
414/**
415 *  If this is non-zero, then the post-task switch extension
416 *  is run regardless of the state of the per thread flag.
417 */
418SCORE_EXTERN uint32_t   _Thread_Do_post_task_switch_extension;
419
420/**
421 *  The following holds how many user extensions are in the system.  This
422 *  is used to determine how many user extension data areas to allocate
423 *  per thread.
424 */
425SCORE_EXTERN uint32_t   _Thread_Maximum_extensions;
426
427/**
428 *  The following is used to manage the length of a timeslice quantum.
429 */
430SCORE_EXTERN uint32_t   _Thread_Ticks_per_timeslice;
431
432/**
433 *  The following points to the array of FIFOs used to manage the
434 *  set of ready threads.
435 */
436SCORE_EXTERN Chain_Control *_Thread_Ready_chain;
437
438/**
439 *  The following points to the thread which is currently executing.
440 *  This thread is implicitly manipulated by numerous directives.
441 */
442SCORE_EXTERN Thread_Control *_Thread_Executing;
443
444/**
445 *  The following points to the highest priority ready thread
446 *  in the system.  Unless the current thread is not preemptibl,
447 *  then this thread will be context switched to when the next
448 *  dispatch occurs.
449 */
450SCORE_EXTERN Thread_Control *_Thread_Heir;
451
452/**
453 *  The following points to the thread whose floating point
454 *  context is currently loaded.
455 */
456#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
457SCORE_EXTERN Thread_Control *_Thread_Allocated_fp;
458#endif
459
460/**
461 * The C library re-enter-rant global pointer. Some C library implementations
462 * such as newlib have a single global pointer that changed during a context
463 * switch. The pointer points to that global pointer. The Thread control block
464 * holds a pointer to the task specific data.
465 */
466SCORE_EXTERN struct _reent **_Thread_libc_reent;
467
468#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
469
470  /**
471   * This contains the time since boot when the last context switch occurred.
472   * By placing it in the BSS, it will automatically be zeroed out at
473   * system initialization and does not need to be known outside this
474   * file.
475   */
476  SCORE_EXTERN struct timespec _Thread_Time_of_last_context_switch;
477#endif
478
479/**
480 *  This routine performs the initialization necessary for this handler.
481 */
482void _Thread_Handler_initialization (
483  uint32_t     ticks_per_timeslice,
484  uint32_t     maximum_extensions
485#if defined(RTEMS_MULTIPROCESSING)
486  ,
487  uint32_t     maximum_proxies
488#endif
489);
490
491/**
492 *  This routine creates the idle thread.
493 *
494 *  @warning No thread should be created before this one.
495 */
496void _Thread_Create_idle( void );
497
498/**
499 *  This routine initiates multitasking.  It is invoked only as
500 *  part of initialization and its invocation is the last act of
501 *  the non-multitasking part of the system initialization.
502 */
503void _Thread_Start_multitasking( void );
504
505/**
506 *  This routine is responsible for transferring control of the
507 *  processor from the executing thread to the heir thread.  As part
508 *  of this process, it is responsible for the following actions:
509 *
510 *     + saving the context of the executing thread
511 *     + restoring the context of the heir thread
512 *     + dispatching any signals for the resulting executing thread
513 */
514void _Thread_Dispatch( void );
515
516/**
517 *  Allocate the requested stack space for the thread.
518 *  return the actual size allocated after any adjustment
519 *  or return zero if the allocation failed.
520 *  Set the Start.stack field to the address of the stack
521 */
522
523size_t _Thread_Stack_Allocate(
524  Thread_Control *the_thread,
525  size_t          stack_size
526);
527
528/**
529 *  Deallocate the Thread's stack.
530 */
531void _Thread_Stack_Free(
532  Thread_Control *the_thread
533);
534
535/**
536 *  This routine initializes the specified the thread.  It allocates
537 *  all memory associated with this thread.  It completes by adding
538 *  the thread to the local object table so operations on this
539 *  thread id are allowed.
540 *
541 *  @note If stack_area is NULL, it is allocated from the workspace.
542 *
543 *  @note If the stack is allocated from the workspace, then it is
544 *        guaranteed to be of at least minimum size.
545 */
546boolean _Thread_Initialize(
547  Objects_Information                  *information,
548  Thread_Control                       *the_thread,
549  void                                 *stack_area,
550  size_t                                stack_size,
551  boolean                               is_fp,
552  Priority_Control                      priority,
553  boolean                               is_preemptible,
554  Thread_CPU_budget_algorithms          budget_algorithm,
555  Thread_CPU_budget_algorithm_callout   budget_callout,
556  uint32_t                              isr_level,
557  Objects_Name                          name
558);
559
560/**
561 *  This routine initializes the executable information for a thread
562 *  and makes it ready to execute.  After this routine executes, the
563 *  thread competes with all other threads for CPU time.
564 */
565boolean _Thread_Start(
566  Thread_Control           *the_thread,
567  Thread_Start_types        the_prototype,
568  void                     *entry_point,
569  void                     *pointer_argument,
570  uint32_t                  numeric_argument
571);
572
573/**
574 *  This support routine restarts the specified task in a way that the
575 *  next time this thread executes, it will begin execution at its
576 *  original starting point.
577 *
578 *  TODO:  multiple task arg profiles
579 */
580boolean _Thread_Restart(
581  Thread_Control           *the_thread,
582  void                     *pointer_argument,
583  uint32_t                  numeric_argument
584);
585
586/**
587 *  This routine resets a thread to its initial state but does
588 *  not restart it.
589 */
590void _Thread_Reset(
591  Thread_Control      *the_thread,
592  void                *pointer_argument,
593  uint32_t             numeric_argument
594);
595
596/**
597 *  This routine frees all memory associated with the specified
598 *  thread and removes it from the local object table so no further
599 *  operations on this thread are allowed.
600 */
601void _Thread_Close(
602  Objects_Information  *information,
603  Thread_Control       *the_thread
604);
605
606/**
607 *  This routine removes any set states for the_thread.  It performs
608 *  any necessary scheduling operations including the selection of
609 *  a new heir thread.
610 */
611void _Thread_Ready(
612  Thread_Control *the_thread
613);
614
615/**
616 *  This routine clears the indicated STATES for the_thread.  It performs
617 *  any necessary scheduling operations including the selection of
618 *  a new heir thread.
619 */
620void _Thread_Clear_state(
621  Thread_Control *the_thread,
622  States_Control  state
623);
624
625/**
626 *  This routine sets the indicated states for the_thread.  It performs
627 *  any necessary scheduling operations including the selection of
628 *  a new heir thread.
629 */
630void _Thread_Set_state(
631  Thread_Control *the_thread,
632  States_Control  state
633);
634
635/**
636 *  This routine sets the TRANSIENT state for the_thread.  It performs
637 *  any necessary scheduling operations including the selection of
638 *  a new heir thread.
639 */
640void _Thread_Set_transient(
641  Thread_Control *the_thread
642);
643
644/**
645 *  This routine is invoked upon expiration of the currently
646 *  executing thread's timeslice.  If no other thread's are ready
647 *  at the priority of the currently executing thread, then the
648 *  executing thread's timeslice is reset.  Otherwise, the
649 *  currently executing thread is placed at the rear of the
650 *  FIFO for this priority and a new heir is selected.
651 */
652void _Thread_Reset_timeslice( void );
653
654/**
655 *  This routine is invoked as part of processing each clock tick.
656 *  It is responsible for determining if the current thread allows
657 *  timeslicing and, if so, when its timeslice expires.
658 */
659void _Thread_Tickle_timeslice( void );
660
661/**
662 *  This routine is invoked when a thread wishes to voluntarily
663 *  transfer control of the processor to another thread of equal
664 *  or greater priority.
665 */
666void _Thread_Yield_processor( void );
667
668/**
669 *  This routine is invoked to rotate the ready queue for the
670 *  given priority.  It can be used to yeild the processor
671 *  by rotating the executing threads ready queue.
672 */
673void _Thread_Rotate_Ready_Queue(
674  Priority_Control  priority
675);
676
677/**
678 *  This routine initializes the context of the_thread to its
679 *  appropriate starting state.
680 */
681void _Thread_Load_environment(
682  Thread_Control *the_thread
683);
684
685/**
686 *  This routine is the wrapper function for all threads.  It is
687 *  the starting point for all threads.  The user provided thread
688 *  entry point is invoked by this routine.  Operations
689 *  which must be performed immediately before and after the user's
690 *  thread executes are found here.
691 */
692void _Thread_Handler( void );
693
694/**
695 *  This routine is invoked when a thread must be unblocked at the
696 *  end of a time based delay (i.e. wake after or wake when).
697 */
698void _Thread_Delay_ended(
699  Objects_Id  id,
700  void       *ignored
701);
702
703/**
704 *  This routine changes the current priority of the_thread to
705 *  new_priority.  It performs any necessary scheduling operations
706 *  including the selection of a new heir thread.
707 */
708void _Thread_Change_priority (
709  Thread_Control   *the_thread,
710  Priority_Control  new_priority,
711  boolean           prepend_it
712);
713
714/**
715 *  This routine updates the priority related fields in the_thread
716 *  control block to indicate the current priority is now new_priority.
717 */
718void _Thread_Set_priority(
719  Thread_Control   *the_thread,
720  Priority_Control  new_priority
721);
722
723/**
724 *  This routine updates the related suspend fields in the_thread
725 *  control block to indicate the current nested level.
726 */
727void _Thread_Suspend(
728  Thread_Control   *the_thread
729);
730
731/**
732 *  This routine updates the related suspend fields in the_thread
733 *  control block to indicate the current nested level.  A force
734 *  parameter of TRUE will force a resume and clear the suspend count.
735 */
736void _Thread_Resume(
737  Thread_Control   *the_thread,
738  boolean           force
739);
740
741/**
742 *  This routine evaluates the current scheduling information for the
743 *  system and determines if a context switch is required.  This
744 *  is usually called after changing an execution mode such as preemptability
745 *  for a thread.
746 */
747boolean _Thread_Evaluate_mode( void );
748
749#if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE)
750/**
751 *  This routine is the body of the system idle thread.
752 */
753Thread _Thread_Idle_body(
754  uint32_t   ignored
755);
756#endif
757
758/**  This defines the type for a method which operates on a single thread.
759 */
760typedef void (*rtems_per_thread_routine)( Thread_Control * );
761
762/**
763 *  This routine iterates over all threads regardless of API and
764 *  invokes the specified routine.
765 */
766void rtems_iterate_over_all_threads(
767  rtems_per_thread_routine routine
768);
769
770/**
771 *  This function maps thread IDs to thread control
772 *  blocks.  If ID corresponds to a local thread, then it
773 *  returns the_thread control pointer which maps to ID
774 *  and location is set to OBJECTS_LOCAL.  If the thread ID is
775 *  global and resides on a remote node, then location is set
776 *  to OBJECTS_REMOTE, and the_thread is undefined.
777 *  Otherwise, location is set to OBJECTS_ERROR and
778 *  the_thread is undefined.
779 *
780 *  @note  The performance of many RTEMS services depends upon
781 *         the quick execution of the "good object" path in this
782 *         routine.  If there is a possibility of saving a few
783 *         cycles off the execution time, this routine is worth
784 *         further optimization attention.
785 */
786Thread_Control *_Thread_Get (
787  Objects_Id         id,
788  Objects_Locations *location
789);
790
791/**
792 *  @brief Cancel a blocking operation due to ISR
793 *
794 *  This method is used to cancel a blocking operation that was
795 *  satisfied from an ISR while the thread executing was in the
796 *  process of blocking.
797 *
798 *  @param[in] sync_state is the synchronization state
799 *  @param[in] the_thread is the thread whose blocking is canceled
800 *  @param[in] level is the previous ISR disable level
801 *
802 *  @note This is a rare routine in RTEMS.  It is called with
803 *        interrupts disabled and only when an ISR completed
804 *        a blocking condition in process.
805 */
806void _Thread_blocking_operation_Cancel(
807  Thread_blocking_operation_States  sync_state,
808  Thread_Control                   *the_thread,
809  ISR_Level                         level
810);
811
812#ifndef __RTEMS_APPLICATION__
813#include <rtems/score/thread.inl>
814#endif
815#if defined(RTEMS_MULTIPROCESSING)
816#include <rtems/score/threadmp.h>
817#endif
818
819#ifdef __cplusplus
820}
821#endif
822
823/**@}*/
824
825#endif
826/* end of include file */
Note: See TracBrowser for help on using the repository browser.