source: rtems/doc/user/task.t @ 7e8a1fc

4.104.114.84.95
Last change on this file since 7e8a1fc was 7e8a1fc, checked in by Joel Sherrill <joel.sherrill@…>, on 06/04/97 at 13:04:36

final corrections before 4.1.0 documentation freeze.

  • Property mode set to 100644
File size: 51.0 KB
Line 
1@c
2@c  COPYRIGHT (c) 1996.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6
7@c
8@c  COPYRIGHT (c) 1996.
9@c  On-Line Applications Research Corporation (OAR).
10@c  All rights reserved.
11@c
12
13@ifinfo
14@node Task Manager, Task Manager Introduction, SHUTDOWN_EXECUTIVE - Shutdown RTEMS, Top
15@end ifinfo
16
17@chapter Task Manager
18
19@ifinfo
20@menu
21* Task Manager Introduction::
22* Task Manager Background::
23* Task Manager Operations::
24* Task Manager Directives::
25@end menu
26@end ifinfo
27
28@ifinfo
29@node Task Manager Introduction, Task Manager Background, Task Manager, Task Manager
30@end ifinfo
31@section Introduction
32
33The task manager provides a comprehensive set of directives to
34create, delete, and administer tasks.  The directives provided
35by the task manager are:
36
37@itemize @bullet
38@item @code{task_create} - Create a task
39@item @code{task_ident} - Get ID of a task
40@item @code{task_start} - Start a task
41@item @code{task_restart} - Restart a task
42@item @code{task_delete} - Delete a task
43@item @code{task_suspend} - Suspend a task
44@item @code{task_resume} - Resume a task
45@item @code{task_set_priority} - Set task priority
46@item @code{task_mode} - Change current task's mode
47@item @code{task_get_note} - Get task notepad entry
48@item @code{task_set_note} - Set task notepad entry
49@item @code{task_wake_after} - Wake up after interval
50@item @code{task_wake_when} - Wake up when specified 
51@end itemize
52
53@ifinfo
54@node Task Manager Background, Task Definition, Task Manager Introduction, Task Manager
55@end ifinfo
56
57@section Background
58
59@ifinfo
60@menu
61* Task Definition::
62* Task Control Block::
63* Task States::
64* Task Priority::
65* Task Mode::
66* Accessing Task Arguments::
67* Floating Point Considerations::
68* Building a Task's Attribute Set::
69* Building a Mode and Mask::
70@end menu
71
72@end ifinfo
73
74@ifinfo
75@node Task Definition, Task Control Block, Task Manager Background, Task Manager Background
76@end ifinfo
77
78@subsection Task Definition
79
80Many definitions of a task have been proposed in computer
81literature.  Unfortunately, none of these definitions
82encompasses all facets of the concept in a manner which is
83operating system independent.  Several of the more common
84definitions are provided to enable each user to select a
85definition which best matches their own experience and
86understanding of the task concept:
87
88@itemize @bullet
89@item a "dispatchable" unit.
90
91@item an entity to which the processor is allocated.
92
93@item an atomic unit of a real-time, multiprocessor system.
94
95@item single threads of execution which concurrently compete for resources.
96
97@item a sequence of closely related computations which can execute
98concurrently with other computational sequences.
99
100@end itemize
101
102From RTEMS' perspective, a task is the smallest thread of
103execution which can compete on its own for system resources.  A
104task is manifested by the existence of a task control block
105(TCB).
106
107@ifinfo
108@node Task Control Block, Task States, Task Definition, Task Manager Background
109@end ifinfo
110@subsection Task Control Block
111
112The Task Control Block (TCB) is an RTEMS defined data structure
113which contains all the information that is pertinent to the
114execution of a task.  During system initialization, RTEMS
115reserves a TCB for each task configured.  A TCB is allocated
116upon creation of the task and is returned to the TCB free list
117upon deletion of the task.
118
119The TCB's elements are modified as a result of system calls made
120by the application in response to external and internal stimuli.
121TCBs are the only RTEMS internal data structure that can be
122accessed by an application via user extension routines.  The TCB
123contains a task's name, ID, current priority, current and
124starting states, execution mode, set of notepad locations, TCB
125user extension pointer, scheduling control structures, as well
126as data required by a blocked task.
127
128A task's context is stored in the TCB when a task switch occurs.
129When the task regains control of the processor, its context is
130restored from the TCB.  When a task is restarted, the initial
131state of the task is restored from the starting context area in
132the task's TCB.
133
134@ifinfo
135@node Task States, Task Priority, Task Control Block, Task Manager Background
136@end ifinfo
137@subsection Task States
138
139A task may exist in one of the following five states:
140
141@itemize @bullet
142@item @code{executing} - Currently scheduled to the CPU
143@item @code{ready} - May be scheduled to the CPU
144@item @code{blocked} - Unable to be scheduled to the CPU
145@item @code{dormant} - Created task that is not started
146@item @code{non-existent} - Uncreated or deleted task
147@end itemize
148
149An active task may occupy the executing, ready, blocked or
150dormant state, otherwise the task is considered non-existent.
151One or more tasks may be active in the system simultaneously.
152Multiple tasks communicate, synchronize, and compete for system
153resources with each other via system calls.  The multiple tasks
154appear to execute in parallel, but actually each is dispatched
155to the CPU for periods of time determined by the RTEMS
156scheduling algorithm.  The scheduling of a task is based on its
157current state and priority.
158
159@ifinfo
160@node Task Priority, Task Mode, Task States, Task Manager Background
161@end ifinfo
162@subsection Task Priority
163
164A task's priority determines its importance in relation to the
165other tasks executing on the same processor.  RTEMS supports 255
166levels of priority ranging from 1 to 255.  Tasks of numerically
167smaller priority values are more important tasks than tasks of
168numerically larger priority values.  For example, a task at
169priority level 5 is of higher privilege than a task at priority
170level 10.  There is no limit to the number of tasks assigned to
171the same priority.
172
173Each task has a priority associated with it at all times.  The
174initial value of this priority is assigned at task creation
175time.  The priority of a task may be changed at any subsequent
176time.
177
178Priorities are used by the scheduler to determine which ready
179task will be allowed to execute.  In general, the higher the
180logical priority of a task, the more likely it is to receive
181processor execution time.
182
183@ifinfo
184@node Task Mode, Accessing Task Arguments, Task Priority, Task Manager Background
185@end ifinfo
186@subsection Task Mode
187
188A task's mode is a combination of the following four components:
189
190@itemize @bullet
191@item preemption
192@item ASR processing
193@item timeslicing
194@item interrupt level
195@end itemize
196
197It is used to modify RTEMS' scheduling process and to alter the
198execution environment of the task.
199
200The preemption component allows a task to determine when control
201of the processor is relinquished.  If preemption is disabled
202(NO_PREEMPT), the task will retain control of the processor as
203long as it is in the executing state -- even if a higher
204priority task is made ready.  If preemption is enabled (PREEMPT)
205and a higher priority task is made ready, then the processor
206will be taken away from the current task immediately and given
207to the higher priority task.
208
209The timeslicing component is used by the RTEMS scheduler to
210determine how the processor is allocated to tasks of equal
211priority.  If timeslicing is enabled (TIMESLICE), then RTEMS
212will limit the amount of time the task can execute before the
213processor is allocated to another ready task of equal priority.
214The length of the timeslice is application dependent and
215specified in the Configuration Table.  If timeslicing is
216disabled (NO_TIMESLICE), then the task will be allowed to
217execute until a task of higher priority is made ready.  If
218NO_PREEMPT is selected, then the timeslicing component is
219ignored by the scheduler.
220
221The asynchronous signal processing component is used to
222determine when received signals are to be processed by the task.
223 If signal processing is enabled (ASR), then signals sent to the
224task will be processed the next time the task executes.  If
225signal processing is disabled (NO_ASR), then all signals
226received by the task will remain posted until signal processing
227is enabled.  This component affects only tasks which have
228established a routine to process asynchronous signals.
229
230The interrupt level component is used to determine which
231interrupts will be enabled when the task is executing.
232INTERRUPT_LEVEL(n) specifies that the task will execute at
233interrupt level n.
234
235@itemize  @bullet
236@item @code{PREEMPT} - enable preemption (default)
237@item @code{NO_PREEMPT} - disable preemption
238@item @code{NO_TIMESLICE} - disable timeslicing (default)
239@item @code{TIMESLICE} - enable timeslicing
240@item @code{ASR} - enable ASR processing (default)
241@item @code{NO_ASR} - disable ASR processing
242@item @code{INTERRUPT_LEVEL(0)} - enable all interrupts (default)
243@item @code{INTERRUPT_LEVEL(n)} - execute at interrupt level n
244@end itemize
245
246@ifinfo
247@node Accessing Task Arguments, Floating Point Considerations, Task Mode, Task Manager Background
248@end ifinfo
249@subsection Accessing Task Arguments
250
251All RTEMS tasks are invoked with a single argument which is
252specified when they are started or restarted.  The argument is
253commonly used to communicate startup information to the task.
254The simplest manner in which to define a task which accesses it
255argument is:
256
257@ifset is-C
258@example
259rtems_task user_task(
260  rtems_task_argument argument
261);
262@end example
263@end ifset
264
265@ifset is-Ada
266@example
267procedure User_Task (
268  Argument : in    RTEMS.Task_Argument_Ptr
269);
270@end example
271@end ifset
272
273Application tasks requiring more information may view this
274single argument as an index into an array of parameter blocks.
275
276@ifinfo
277@node Floating Point Considerations, Building a Task's Attribute Set, Accessing Task Arguments, Task Manager Background
278@end ifinfo
279@subsection Floating Point Considerations
280
281Creating a task with the @code{FLOATING_POINT} flag results in
282additional memory being allocated for the TCB to store the state
283of the numeric coprocessor during task switches.  This
284additional memory is @b{NOT} allocated for @code{NO_FLOATING_POINT} tasks.
285Saving and restoring the context of a @code{FLOATING_POINT} task takes
286longer than that of a @code{NO_FLOATING_POINT} task because of the
287relatively large amount of time required for the numeric
288coprocessor to save or restore its computational state.
289
290Since RTEMS was designed specifically for embedded military
291applications which are floating point intensive, the executive
292is optimized to avoid unnecessarily saving and restoring the
293state of the numeric coprocessor.  The state of the numeric
294coprocessor is only saved when a @code{FLOATING_POINT} task is
295dispatched and that task was not the last task to utilize the
296coprocessor.  In a system with only one @code{FLOATING_POINT} task, the
297state of the numeric coprocessor will never be saved or
298restored. 
299
300Although the overhead imposed by @code{FLOATING_POINT} tasks is
301minimal, some applications may wish to completely avoid the
302overhead associated with @code{FLOATING_POINT} tasks and still utilize
303a numeric coprocessor.  By preventing a task from being
304preempted while performing a sequence of floating point
305operations, a @code{NO_FLOATING_POINT} task can utilize the numeric
306coprocessor without incurring the overhead of a @code{FLOATING_POINT}
307context switch.  This approach also avoids the allocation of a
308floating point context area.  However, if this approach is taken
309by the application designer, NO tasks should be created as
310@code{FLOATING_POINT} tasks.  Otherwise, the floating point context
311will not be correctly maintained because RTEMS assumes that the
312state of the numeric coprocessor will not be altered by
313@code{NO_FLOATING_POINT} tasks.
314
315If the supported processor type does not have hardware floating
316capabilities or a standard numeric coprocessor, RTEMS will not
317provide built-in support for hardware floating point on that
318processor.  In this case, all tasks are considered
319@code{NO_FLOATING_POINT} whether created as @code{FLOATING_POINT} or
320@code{NO_FLOATING_POINT} tasks.  A floating point emulation software
321library must be utilized for floating point operations.
322
323On some processors, it is possible to disable the floating point
324unit dynamically.  If this capability is supported by the target
325processor, then RTEMS will utilize this capability to enable the
326floating point unit only for tasks which are created with the
327@code{FLOATING_POINT} attribute.  The consequence of a
328@code{NO_FLOATING_POINT} task attempting to access the floating point
329unit is CPU dependent but will i general result in an exception
330condition.
331
332@ifinfo
333@node Building a Task's Attribute Set, Building a Mode and Mask, Floating Point Considerations, Task Manager Background
334@end ifinfo
335@subsection Building a Task's Attribute Set
336
337In general, an attribute set is built by a bitwise OR of the
338desired components.  The set of valid task attribute components
339is listed below:
340
341@itemize @bullet
342@item @code{NO_FLOATING_POINT} - does not use coprocessor (default)
343@item @code{FLOATING_POINT} - uses numeric coprocessor
344@item @code{LOCAL} - local task (default)
345@item @code{GLOBAL} - global task
346@end itemize
347
348Attribute values are specifically designed to be mutually
349exclusive, therefore bitwise OR and addition operations are
350equivalent as long as each attribute appears exactly once in the
351component list.  A component listed as a default is not required
352to appear in the component list, although it is a good
353programming practice to specify default components.  If all
354defaults are desired, then @code{DEFAULT_ATTRIBUTES} should be used.
355
356This example demonstrates the attribute_set parameter needed to
357create a local task which utilizes the numeric coprocessor.  The
358attribute_set parameter could be @code{FLOATING_POINT} or
359@code{LOCAL @value{OR} FLOATING_POINT}. 
360The attribute_set parameter can be set to
361@code{FLOATING_POINT} because @code{LOCAL} is the default for all created
362tasks.  If the task were global and used the numeric
363coprocessor, then the attribute_set parameter would be
364@code{GLOBAL @value{OR} FLOATING_POINT}.
365
366@ifinfo
367@node Building a Mode and Mask, Task Manager Operations, Building a Task's Attribute Set, Task Manager Background
368@end ifinfo
369@subsection Building a Mode and Mask
370
371In general, a mode and its corresponding mask is built by a
372bitwise OR of the desired components.  The set of valid mode
373constants and each mode's corresponding mask constant is
374listed below:
375
376@ifset use-ascii
377@itemize @bullet
378@item PREEMPT is masked by PREEMPT_MASK and enables preemption
379@item NO_PREEMPT is masked by PREEMPT_MASK and disables preemption
380@item NO_TIMESLICE is masked by TIMESLICE_MASK and disables timeslicing
381@item TIMESLICE is masked by TIMESLICE_MASK and enables timeslicing
382@item ASR is masked by ASR_MASK and enables ASR processing
383@item NO_ASR is masked by ASR_MASK and disables ASR processing
384@item INTERRUPT_LEVEL(0) is masked by INTERRUPT_MASK and enables all interrupts
385@item INTERRUPT_LEVEL(n) is masked by INTERRUPT_MASK and sets interrupts level n
386@end itemize
387@end ifset
388
389@ifset use-tex
390@sp 1
391@c this is temporary
392@itemize @bullet
393@item PREEMPT is masked by PREEMPT_MASK and enables preemption
394@item NO_PREEMPT is masked by PREEMPT_MASK and disables preemption
395@item NO_TIMESLICE is masked by TIMESLICE_MASK and disables timeslicing
396@item TIMESLICE is masked by TIMESLICE_MASK and enables timeslicing
397@item ASR is masked by ASR_MASK and enables ASR processing
398@item NO_ASR is masked by ASR_MASK and disables ASR processing
399@item INTERRUPT_LEVEL(0) is masked by INTERRUPT_MASK and enables all interrupts
400@item INTERRUPT_LEVEL(n) is masked by INTERRUPT_MASK and sets interrupts level n
401 
402@end itemize
403
404@tex
405@end tex
406@end ifset
407
408@ifset use-html
409@html
410<CENTER>
411  <TABLE COLS=3 WIDTH="80%" BORDER=2>
412<TR><TD ALIGN=center><STRONG>Mode Constant</STRONG></TD>
413    <TD ALIGN=center><STRONG>Mask Constant</STRONG></TD>
414    <TD ALIGN=center><STRONG>Description</STRONG></TD></TR>
415<TR><TD ALIGN=center>PREEMPT</TD>
416    <TD ALIGN=center>PREEMPT_MASK</TD>
417    <TD ALIGN=center>enables preemption</TD></TR>
418<TR><TD ALIGN=center>NO_PREEMPT</TD>
419    <TD ALIGN=center>PREEMPT_MASK</TD>
420    <TD ALIGN=center>disables preemption</TD></TR>
421<TR><TD ALIGN=center>NO_TIMESLICE</TD>
422    <TD ALIGN=center>TIMESLICE_MASK</TD>
423    <TD ALIGN=center>disables timeslicing</TD></TR>
424<TR><TD ALIGN=center>TIMESLICE</TD>
425    <TD ALIGN=center>TIMESLICE_MASK</TD>
426    <TD ALIGN=center>enables timeslicing</TD></TR>
427<TR><TD ALIGN=center>ASR</TD>
428    <TD ALIGN=center>ASR_MASK</TD>
429    <TD ALIGN=center>enables ASR processing</TD></TR>
430<TR><TD ALIGN=center>NO_ASR</TD>
431    <TD ALIGN=center>ASR_MASK</TD>
432    <TD ALIGN=center>disables ASR processing</TD></TR>
433<TR><TD ALIGN=center>INTERRUPT_LEVEL(0)</TD>
434    <TD ALIGN=center>INTERRUPT_MASK</TD>
435    <TD ALIGN=center>enables all interrupts</TD></TR>
436<TR><TD ALIGN=center>INTERRUPT_LEVEL(n)</TD>
437    <TD ALIGN=center>INTERRUPT_MASK</TD>
438    <TD ALIGN=center>sets interrupts level n</TD></TR>
439  </TABLE>
440</CENTER>
441@end html
442@end ifset
443
444
445
446
447Mode values are specifically designed to be mutually exclusive,
448therefore bitwise OR and addition operations are equivalent as
449long as each mode appears exactly once in the component list.  A
450mode component listed as a default is not required to appear in
451the mode component list, although it is a good programming
452practice to specify default components.  If all defaults are
453desired, the mode @code{DEFAULT_MODES} and the mask @code{ALL_MODE_MASKS}
454should be used.
455
456The following example demonstrates the mode and mask parameters
457used with the task_mode directive to place a task at interrupt
458level 3 and make it non-preemptible.  The mode should be set to
459@code{INTERRUPT_LEVEL(3) @value{RTEMSOR} NO_PREEMPT} to indicate the desired
460preemption mode and interrupt level, while the mask parameter
461should be set to @code{INTERRUPT_MASK @value{RTEMSOR} NO_PREEMPT_MASK}
462to indicate that the calling task's interrupt level and preemption mode are
463being altered.
464
465@ifinfo
466@node Task Manager Operations, Creating Tasks, Building a Mode and Mask, Task Manager
467@end ifinfo
468
469@section Operations
470
471@ifinfo
472@menu
473* Creating Tasks::
474* Obtaining Task IDs::
475* Starting and Restarting Tasks::
476* Suspending and Resuming Tasks::
477* Delaying the Currently Executing Task::
478* Changing Task Priority::
479* Changing Task Mode::
480* Notepad Locations::
481* Task Deletion::
482@end menu
483@end ifinfo
484
485@ifinfo
486@node Creating Tasks, Obtaining Task IDs, Task Manager Operations, Task Manager Operations
487@end ifinfo
488@subsection Creating Tasks
489
490The task_create directive creates a task by allocating a task
491control block, assigning the task a user-specified name,
492allocating it a stack and floating point context area, setting a
493user-specified initial priority, setting a user-specified
494initial mode, and assigning it a task ID.  Newly created tasks
495are initially placed in the dormant state.  All RTEMS tasks
496execute in the most privileged mode of the processor.
497
498@ifinfo
499@node Obtaining Task IDs, Starting and Restarting Tasks, Creating Tasks, Task Manager Operations
500@end ifinfo
501@subsection Obtaining Task IDs
502
503When a task is created, RTEMS generates a unique task ID and
504assigns it to the created task until it is deleted.  The task ID
505may be obtained by either of two methods.  First, as the result
506of an invocation of the task_create directive, the task ID is
507stored in a user provided location.  Second, the task ID may be
508obtained later using the task_ident directive.  The task ID is
509used by other directives to manipulate this task.
510
511@ifinfo
512@node Starting and Restarting Tasks, Suspending and Resuming Tasks, Obtaining Task IDs, Task Manager Operations
513@end ifinfo
514@subsection Starting and Restarting Tasks
515
516The task_start directive is used to place a dormant task in the
517ready state.  This enables the task to compete, based on its
518current priority, for the processor and other system resources.
519Any actions, such as suspension or change of priority, performed
520on a task prior to starting it are nullified when the task is
521started.
522
523With the task_start directive the user specifies the task's
524starting address and argument.  The argument is used to
525communicate some startup information to the task.  As part of
526this directive, RTEMS initializes the task's stack based upon
527the task's initial execution mode and start address.  The
528starting argument is passed to the task in accordance with the
529target processor's calling convention.
530
531The task_restart directive restarts a task at its initial
532starting address with its original priority and execution mode,
533but with a possibly different argument.  The new argument may be
534used to distinguish between the original invocation of the task
535and subsequent invocations.  The task's stack and control block
536are modified to reflect their original creation values.
537Although references to resources that have been requested are
538cleared, resources allocated by the task are NOT automatically
539returned to RTEMS.  A task cannot be restarted unless it has
540previously been started (i.e. dormant tasks cannot be
541restarted).  All restarted tasks are placed in the ready state.
542
543@ifinfo
544@node Suspending and Resuming Tasks, Delaying the Currently Executing Task, Starting and Restarting Tasks, Task Manager Operations
545@end ifinfo
546@subsection Suspending and Resuming Tasks
547
548The task_suspend directive is used to place either the caller or
549another task into a suspended state.  The task remains suspended
550until a task_resume directive is issued.  This implies that a
551task may be suspended as well as blocked waiting either to
552acquire a resource or for the expiration of a timer.
553
554The task_resume directive is used to remove another task from
555the suspended state. If the task is not also blocked, resuming
556it will place it in the ready state, allowing it to once again
557compete for the processor and resources.  If the task was
558blocked as well as suspended, this directive clears the
559suspension and leaves the task in the blocked state.
560
561@ifinfo
562@node Delaying the Currently Executing Task, Changing Task Priority, Suspending and Resuming Tasks, Task Manager Operations
563@end ifinfo
564@subsection Delaying the Currently Executing Task
565
566The task_wake_after directive creates a sleep timer which allows
567a task to go to sleep for a specified interval.  The task is
568blocked until the delay interval has elapsed, at which time the
569task is unblocked.  A task calling the task_wake_after directive
570with a delay interval of @code{YIELD_PROCESSOR} ticks will yield the
571processor to any other ready task of equal or greater priority
572and remain ready to execute.
573
574The task_wake_when directive creates a sleep timer which allows
575a task to go to sleep until a specified date and time.  The
576calling task is blocked until the specified date and time has
577occurred, at which time the task is unblocked.
578
579@ifinfo
580@node Changing Task Priority, Changing Task Mode, Delaying the Currently Executing Task, Task Manager Operations
581@end ifinfo
582@subsection Changing Task Priority
583
584The task_set_priority directive is used to obtain or change the
585current priority of either the calling task or another task.  If
586the new priority requested is CURRENT_PRIORITY or the task's
587actual priority, then the current priority will be returned and
588the task's priority will remain unchanged.  If the task's
589priority is altered, then the task will be scheduled according
590to its new priority.
591
592The task_restart directive resets the priority of a task to its
593original value.
594
595@ifinfo
596@node Changing Task Mode, Notepad Locations, Changing Task Priority, Task Manager Operations
597@end ifinfo
598@subsection Changing Task Mode
599
600The task_mode directive is used to obtain or change the current
601execution mode of the calling task.  A task's execution mode is
602used to enable preemption, timeslicing, ASR processing, and to
603set the task's interrupt level. 
604
605The task_restart directive resets the mode of a task to its
606original value.
607
608@ifinfo
609@node Notepad Locations, Task Deletion, Changing Task Mode, Task Manager Operations
610@end ifinfo
611@subsection Notepad Locations
612
613RTEMS provides sixteen notepad locations for each task.  Each
614notepad location may contain a note consisting of four bytes of
615information.  RTEMS provides two directives, task_set_note and
616task_get_note, that enable a user to access and change the
617notepad locations.  The task_set_note directive enables the user
618to set a task's notepad entry to a specified note.  The
619task_get_note directive allows the user to obtain the note
620contained in any one of the sixteen notepads of a specified task.
621
622@ifinfo
623@node Task Deletion, Task Manager Directives, Notepad Locations, Task Manager Operations
624@end ifinfo
625@subsection Task Deletion
626
627RTEMS provides the task_delete directive to allow a task to
628delete itself or any other task.  This directive removes all
629RTEMS references to the task, frees the task's control block,
630removes it from resource wait queues, and deallocates its stack
631as well as the optional floating point context.  The task's name
632and ID become inactive at this time, and any subsequent
633references to either of them is invalid.  In fact, RTEMS may
634reuse the task ID for another task which is created later in the
635application.
636
637Unexpired delay timers (i.e. those used by task_wake_after and
638task_wake_when) and timeout timers associated with the task are
639automatically deleted, however, other resources dynamically
640allocated by the task are NOT automatically returned to RTEMS.
641Therefore, before a task is deleted, all of its dynamically
642allocated resources should be deallocated by the user.  This may
643be accomplished by instructing the task to delete itself rather
644than directly deleting the task.  Other tasks may instruct a
645task to delete itself by sending a "delete self" message, event,
646or signal, or by restarting the task with special arguments
647which instruct the task to delete itself.
648
649@ifinfo
650@node Task Manager Directives, TASK_CREATE - Create a task, Task Deletion, Task Manager
651@end ifinfo
652
653@section Directives
654
655@ifinfo
656@menu
657* TASK_CREATE - Create a task::
658* TASK_IDENT - Get ID of a task::
659* TASK_START - Start a task::
660* TASK_RESTART - Restart a task::
661* TASK_DELETE - Delete a task::
662* TASK_SUSPEND - Suspend a task::
663* TASK_RESUME - Resume a task::
664* TASK_SET_PRIORITY - Set task priority::
665* TASK_MODE - Change current task's mode::
666* TASK_GET_NOTE - Get task notepad entry::
667* TASK_SET_NOTE - Set task notepad entry::
668* TASK_WAKE_AFTER - Wake up after interval::
669* TASK_WAKE_WHEN - Wake up when specified::
670@end menu
671@end ifinfo
672
673This section details the task manager's directives.  A
674subsection is dedicated to each of this manager's directives and
675describes the calling sequence, related constants, usage, and
676status codes.
677
678@page
679
680@ifinfo
681@node TASK_CREATE - Create a task, TASK_IDENT - Get ID of a task, Task Manager Directives, Task Manager Directives
682@end ifinfo
683@subsection TASK_CREATE - Create a task
684
685@subheading CALLING SEQUENCE:
686
687@ifset is-C
688@example
689rtems_status_code rtems_task_create(
690  rtems_name           name,
691  rtems_task_priority  initial_priority,
692  rtems_unsigned32     stack_size,
693  rtems_mode           initial_modes,
694  rtems_attribute      attribute_set,
695  rtems_id            *id
696);
697@end example
698@end ifset
699
700@ifset is-Ada
701@example
702procedure Task_Create (
703   Name             : in     RTEMS.Name;
704   Initial_Priority : in     RTEMS.Task_Priority;
705   Stack_Size       : in     RTEMS.Unsigned32;
706   Initial_Modes    : in     RTEMS.Mode;
707   Attribute_Set    : in     RTEMS.Attribute;
708   ID               :    out RTEMS.ID;
709   Result           :    out RTEMS.Status_Codes
710);
711@end example
712@end ifset
713
714@subheading DIRECTIVE STATUS CODES:
715@code{SUCCESSFUL} - task created successfully@*
716@code{INVALID_NAME} - invalid task name@*
717@code{INVALID_SIZE} - stack too small@*
718@code{INVALID_PRIORITY} - invalid task priority@*
719@code{MP_NOT_CONFIGURED} - multiprocessing not configured@*
720@code{TOO_MANY} - too many tasks created@*
721@code{UNSATISFIED} - not enough memory for stack/FP context@*
722@code{TOO_MANY} - too many global objects
723
724@subheading DESCRIPTION:
725This directive creates a task which resides on the local node.
726It  allocates and initializes a TCB, a stack, and an optional
727floating point context area.  The mode parameter contains values
728which sets the task's initial execution mode.  The
729@code{FLOATING_POINT} attribute should be specified if the created task
730is to use a numeric coprocessor.  For performance reasons, it is
731recommended that tasks not using the numeric coprocessor should
732specify the @code{NO_FLOATING_POINT} attribute.  If the GLOBAL
733attribute is specified, the task can be accessed from remote
734nodes.  The task id, returned in id, is used in other task
735related directives to access the task.  When created, a task is
736placed in the dormant state and can only be made ready to
737execute using the directive task_start.
738
739@subheading NOTES:
740This directive will not cause the calling task to be preempted.
741
742Valid task priorities range from a high of 1 to a low of 255.
743
744RTEMS supports a maximum of 256 interrupt levels which are
745mapped onto the interrupt levels actually supported by the
746target processor.
747
748The requested stack size should be at least @code{MINIMUM_STACK_SIZE}
749bytes.  The value of @code{MINIMUM_STACK_SIZE} is processor dependent.
750Application developers should consider the stack usage of the
751device drivers when calculating the stack size required for
752tasks which utilize the driver.
753
754The following task attribute constants are defined by RTEMS:
755
756@itemize @bullet
757@item @code{NO_FLOATING_POINT} - does not use coprocessor (default)
758@item @code{FLOATING_POINT} - uses numeric coprocessor
759@item @code{LOCAL} - local task (default)
760@item @code{GLOBAL} - global task
761@end itemize
762
763The following task mode constants are defined by RTEMS:
764
765@itemize  @bullet
766@item @code{PREEMPT} - enable preemption (default)
767@item @code{NO_PREEMPT} - disable preemption
768@item @code{NO_TIMESLICE} - disable timeslicing (default)
769@item @code{TIMESLICE} - enable timeslicing
770@item @code{ASR} - enable ASR processing (default)
771@item @code{NO_ASR} - disable ASR processing
772@item @code{INTERRUPT_LEVEL(0)} - enable all interrupts (default)
773@item @code{INTERRUPT_LEVEL(n)} - execute at interrupt level n
774@end itemize
775
776Tasks should not be made global unless remote tasks must
777interact with them.  This avoids the system overhead incurred by
778the creation of a global task.  When a global task is created,
779the task's name and id must be transmitted to every node in the
780system for insertion in the local copy of the global object
781table.
782
783The total number of global objects, including tasks, is limited
784by the maximum_global_objects field in the Configuration Table.
785
786@page
787
788@ifinfo
789@node TASK_IDENT - Get ID of a task, TASK_START - Start a task, TASK_CREATE - Create a task, Task Manager Directives
790@end ifinfo
791@subsection TASK_IDENT - Get ID of a task
792
793@subheading CALLING SEQUENCE:
794
795@ifset is-C
796@example
797rtems_status_code rtems_task_ident(
798  rtems_name        name,
799  rtems_unsigned32  node,
800  rtems_id         *id
801);
802@end example
803@end ifset
804
805@ifset is-Ada
806@example
807procedure Task_Ident (
808   Name   : in     RTEMS.Name;
809   Node   : in     RTEMS.Node;
810   ID     :    out RTEMS.ID;
811   Result :    out RTEMS.Status_Codes
812);
813@end example
814@end ifset
815
816@subheading DIRECTIVE STATUS CODES:
817@code{SUCCESSFUL} - task identified successfully@*
818@code{INVALID_NAME} - invalid task name@*
819@code{INVALID_NODE} - invalid node id
820
821@subheading DESCRIPTION:
822This directive obtains the task id associated with the task name
823specified in name.  A task may obtain its own id by specifying
824@code{SELF} or its own task name in name.  If the task name is not
825unique, then the task id returned will match one of the tasks
826with that name.  However, this task id is not guaranteed to
827correspond to the desired task.  The task id, returned in id, is
828used in other task related directives to access the task.
829
830@subheading NOTES:
831This directive will not cause the running task to be preempted.
832
833If node is @code{SEARCH_ALL_NODES}, all nodes are searched with the
834local node being searched first.  All other nodes are searched
835with the lowest numbered node searched first.
836
837If node is a valid node number which does not represent the
838local node, then only the tasks exported by the designated node
839are searched.
840
841This directive does not generate activity on remote nodes.  It
842accesses only the local copy of the global object table.
843
844@page
845
846@ifinfo
847@node TASK_START - Start a task, TASK_RESTART - Restart a task, TASK_IDENT - Get ID of a task, Task Manager Directives
848@end ifinfo
849@subsection TASK_START - Start a task
850
851@subheading CALLING SEQUENCE:
852@ifset is-C
853@example
854rtems_status_code rtems_task_start(
855  rtems_id            id,
856  rtems_task_entry    entry_point,
857  rtems_task_argument argument
858);
859@end example
860@end ifset
861
862@ifset is-Ada
863@example
864procedure Task_Start (
865   ID          : in     RTEMS.ID;
866   Entry_Point : in     System.Address;
867   Argument    : in     RTEMS.Task_Argument_PTR;
868   Result      :    out RTEMS.Status_Codes
869);
870@end example
871@end ifset
872
873@subheading DIRECTIVE STATUS CODES:
874@code{SUCCESSFUL} - ask started successfully@*
875@code{INVALID_ADDRESS} - invalid task entry point@*
876@code{INVALID_ID} - invalid task id@*
877@code{INCORRECT_STATE} - task not in the dormant state@*
878@code{ILLEGAL_ON_REMOTE_OBJECT} - cannot start remote task
879
880@subheading DESCRIPTION:
881This directive readies the task, specified by tid, for execution
882based on the priority and execution mode specified when the task
883was created.  The starting address of the task is given in
884entry_point.  The task's starting argument is contained in
885argument.  This argument can be a single value or used as an
886index into an array of parameter blocks.
887
888@subheading NOTES:
889The calling task will be preempted if its preemption mode is
890enabled and the task being started has a higher priority.
891
892Any actions performed on a dormant task such as suspension or
893change of priority are nullified when the task is initiated via
894the task_start directive.
895
896@page
897
898@ifinfo
899@node TASK_RESTART - Restart a task, TASK_DELETE - Delete a task, TASK_START - Start a task, Task Manager Directives
900@end ifinfo
901@subsection TASK_RESTART - Restart a task
902
903@subheading CALLING SEQUENCE:
904@ifset is-C
905@example
906rtems_status_code rtems_task_restart(
907  rtems_id            id,
908  rtems_task_argument argument
909);
910@end example
911@end ifset
912
913@ifset is-Ada
914@example
915procedure Task_Restart (
916   ID       : in     RTEMS.ID;
917   Argument : in     RTEMS.Task_Argument_PTR;
918   Result   :    out RTEMS.Status_Codes
919);
920@end example
921@end ifset
922
923@subheading DIRECTIVE STATUS CODES:
924@code{SUCCESSFUL} - task restarted successfully@*
925@code{INVALID_ID} - task id invalid@*
926@code{INCORRECT_STATE} - task never started@*
927@code{ILLEGAL_ON_REMOTE_OBJECT} - cannot restart remote task
928
929@subheading DESCRIPTION:
930This directive resets the task specified by id to begin
931execution at its original starting address.  The task's priority
932and execution mode are set to the original creation values.  If
933the task is currently blocked, RTEMS automatically makes the
934task ready.  A task can be restarted from any state, except the
935dormant state.
936
937The task's starting argument is contained in argument.  This
938argument can be a single value or an index into an array of
939parameter blocks.  This new argument may be used to distinguish
940between the initial task_start of the task and any ensuing calls
941to task_restart of the task.  This can be beneficial in deleting
942a task.  Instead of deleting a task using the task_delete
943directive, a task can delete another task by restarting that
944task, and allowing that task to release resources back to RTEMS
945and then delete itself.
946
947@subheading NOTES:
948If id is @code{SELF}, the calling task will be restarted and will not
949return from this directive.
950
951The calling task will be preempted if its preemption mode is
952enabled and the task being restarted has a higher priority.
953
954The task must reside on the local node, even if the task was
955created with the GLOBAL option.
956
957@page
958
959@ifinfo
960@node TASK_DELETE - Delete a task, TASK_SUSPEND - Suspend a task, TASK_RESTART - Restart a task, Task Manager Directives
961@end ifinfo
962@subsection TASK_DELETE - Delete a task
963
964@subheading CALLING SEQUENCE:
965@ifset is-C
966@example
967rtems_status_code rtems_task_delete(
968  rtems_id id
969);
970@end example
971@end ifset
972
973@ifset is-Ada
974@example
975procedure Task_Delete (
976   ID     : in     RTEMS.ID;
977   Result :    out RTEMS.Status_Codes
978);
979@end example
980@end ifset
981
982@subheading DIRECTIVE STATUS CODES:
983@code{SUCCESSFUL} - task restarted successfully@*
984@code{INVALID_ID} - task id invalid@*
985@code{ILLEGAL_ON_REMOTE_OBJECT} - cannot restart remote task
986
987@subheading DESCRIPTION:
988This directive deletes a task, either the calling task or
989another task, as specified by id.  RTEMS stops the execution of
990the task and reclaims the stack memory, any allocated delay or
991timeout timers, the TCB, and, if the task is @code{FLOATING_POINT}, its
992floating point context area.  RTEMS does not reclaim the
993following resources: region segments, partition buffers,
994semaphores, timers, or rate monotonic periods.
995
996@subheading NOTES:
997A task is responsible for releasing its resources back to RTEMS
998before deletion.  To insure proper deallocation of resources, a
999task should not be deleted unless it is unable to execute or
1000does not hold any RTEMS resources.  If a task holds RTEMS
1001resources, the task should be allowed to deallocate its
1002resources before deletion.  A task can be directed to release
1003its resources and delete itself by restarting it with a special
1004argument or by sending it a message, an event, or a signal.
1005
1006Deletion of the current task (@code{SELF}) will force RTEMS to select
1007another task to execute.
1008
1009When a global task is deleted, the task id must be transmitted
1010to every node in the system for deletion from the local copy of
1011the global object table.
1012
1013The task must reside on the local node, even if the task was
1014created with the GLOBAL option.
1015
1016@page
1017
1018@ifinfo
1019@node TASK_SUSPEND - Suspend a task, TASK_RESUME - Resume a task, TASK_DELETE - Delete a task, Task Manager Directives
1020@end ifinfo
1021@subsection TASK_SUSPEND - Suspend a task
1022
1023@subheading CALLING SEQUENCE:
1024@ifset is-C
1025@example
1026rtems_status_code rtems_task_suspend(
1027  rtems_id id
1028);
1029@end example
1030@end ifset
1031
1032@ifset is-Ada
1033@example
1034procedure Task_Suspend (
1035   ID     : in     RTEMS.ID;
1036   Result :    out RTEMS.Status_Codes
1037);
1038@end example
1039@end ifset
1040
1041@subheading DIRECTIVE STATUS CODES:
1042@code{SUCCESSFUL} - task restarted successfully@*
1043@code{INVALID_ID} - task id invalid@*
1044@code{ALREADY_SUSPENDED} - task already suspended
1045
1046@subheading DESCRIPTION:
1047This directive suspends the task specified by id from further
1048execution by placing it in the suspended state.  This state is
1049additive to any other blocked state that the task may already be
1050in.  The task will not execute again until another task issues
1051the task_resume directive for this task and any blocked state
1052has been removed.
1053
1054@subheading NOTES:
1055The requesting task can suspend itself by specifying @code{SELF} as id.
1056In this case, the task will be suspended and a successful
1057return code will be returned when the task is resumed.
1058
1059Suspending a global task which does not reside on the local node
1060will generate a request to the remote node to suspend the
1061specified task.
1062
1063@page
1064
1065@ifinfo
1066@node TASK_RESUME - Resume a task, TASK_SET_PRIORITY - Set task priority, TASK_SUSPEND - Suspend a task, Task Manager Directives
1067@end ifinfo
1068@subsection TASK_RESUME - Resume a task
1069
1070@subheading CALLING SEQUENCE:
1071@ifset is-C
1072@example
1073rtems_status_code rtems_task_resume(
1074  rtems_id id
1075);
1076@end example
1077@end ifset
1078
1079@ifset is-Ada
1080@example
1081procedure Task_Resume (
1082   ID     : in     RTEMS.ID;
1083   Result :    out RTEMS.Status_Codes
1084);
1085@end example
1086@end ifset
1087
1088@subheading DIRECTIVE STATUS CODES:
1089@code{SUCCESSFUL} - task restarted successfully@*
1090@code{INVALID_ID} - task id invalid@*
1091@code{INCORRECT_STATE} - task not suspended
1092
1093@subheading DESCRIPTION:
1094This directive removes the task specified by id from the
1095suspended state.  If the task is in the ready state after the
1096suspension is removed, then it will be scheduled to run.  If the
1097task is still in a blocked state after the suspension is
1098removed, then it will remain in that blocked state.
1099
1100@subheading NOTES:
1101The running task may be preempted if its preemption mode is
1102enabled and the local task being resumed has a higher priority.
1103
1104Resuming a global task which does not reside on the local node
1105will generate a request to the remote node to resume the
1106specified task.
1107
1108@page
1109
1110@ifinfo
1111@node TASK_SET_PRIORITY - Set task priority, TASK_MODE - Change current task's mode, TASK_RESUME - Resume a task, Task Manager Directives
1112@end ifinfo
1113@subsection TASK_SET_PRIORITY - Set task priority
1114
1115@subheading CALLING SEQUENCE:
1116@ifset is-C
1117@example
1118rtems_status_code rtems_task_set_priority(
1119  rtems_id             id,
1120  rtems_task_priority  new_priority,
1121  rtems_task_priority *old_priority
1122);
1123@end example
1124@end ifset
1125
1126@ifset is-Ada
1127@example
1128procedure Task_Set_Priority (
1129   ID           : in     RTEMS.ID;
1130   New_Priority : in     RTEMS.Task_Priority;
1131   Old_Priority :    out RTEMS.Task_Priority;
1132   Result       :    out RTEMS.Status_Codes
1133);
1134@end example
1135@end ifset
1136
1137@subheading DIRECTIVE STATUS CODES:
1138@code{SUCCESSFUL} - task priority set successfully@*
1139@code{INVALID_ID} - invalid task id@*
1140@code{INVALID_PRIORITY} - invalid task priority
1141
1142@subheading DESCRIPTION:
1143This directive manipulates the priority of the task specified by
1144id.  An id of @code{SELF} is used to indicate the calling task.  When
1145new_priority is not equal to CURRENT_PRIORITY, the specified
1146task's previous priority is returned in old_priority.  When
1147new_priority is CURRENT_PRIORITY, the specified task's current
1148priority is returned in old_priority.  Valid priorities range
1149from a high of 1 to a low of 255.
1150
1151@subheading NOTES:
1152The calling task may be preempted if its preemption mode is
1153enabled and it lowers its own priority or raises another task's
1154priority.
1155
1156Setting the priority of a global task which does not reside on
1157the local node will generate a request to the remote node to
1158change the priority of the specified task.
1159
1160If the task specified by id is currently holding any binary
1161semaphores which use the priority inheritance algorithm, then
1162the task's priority cannot be lowered immediately.  If the
1163task's priority were lowered immediately, then priority
1164inversion results.  The requested lowering of the task's
1165priority will occur when the task has released all priority
1166inheritance binary semaphores.  The task's priority can be
1167increased regardless of the task's use of priority inheritance
1168binary semaphores.
1169
1170@page
1171
1172@ifinfo
1173@node TASK_MODE - Change current task's mode, TASK_GET_NOTE - Get task notepad entry, TASK_SET_PRIORITY - Set task priority, Task Manager Directives
1174@end ifinfo
1175@subsection TASK_MODE - Change current task's mode
1176
1177@subheading CALLING SEQUENCE:
1178@ifset is-C
1179@example
1180rtems_status_code rtems_task_mode(
1181  rtems_mode  mode_set,
1182  rtems_mode  mask,
1183  rtems_mode *previous_mode_set
1184);
1185@end example
1186@end ifset
1187
1188@ifset is-Ada
1189@example
1190procedure Task_Delete (
1191   Mode_Set          : in     RTEMS.Mode;
1192   Mask              : in     RTEMS.Mode;
1193   Previous_Mode_Set : in     RTEMS.Mode;
1194   Result            :    out RTEMS.Status_Codes
1195);
1196@end example
1197@end ifset
1198
1199@subheading DIRECTIVE STATUS CODES:
1200@code{SUCCESSFUL} - task mode set successfully
1201
1202@subheading DESCRIPTION:
1203This directive manipulates the execution mode of the calling
1204task.  A task's execution mode enables and disables preemption,
1205timeslicing, asynchronous signal processing, as well as
1206specifying the current interrupt level.  To modify an execution
1207mode, the mode class(es) to be changed must be specified in the
1208mask parameter and the desired mode(s) must be specified in the
1209mode parameter. 
1210
1211@subheading NOTES:
1212The calling task will be preempted if it enables preemption and
1213a higher priority task is ready to run.
1214
1215Enabling timeslicing has no effect if preemption is enabled.
1216
1217A task can obtain its current execution mode, without modifying
1218it, by calling this directive with a mask value of CURRENT_MODE.
1219
1220To temporarily disable the processing of a valid ASR, a task
1221should call this directive with the NO_ASR indicator specified
1222in mode.
1223
1224The set of task mode constants and each mode's corresponding
1225mask constant is provided in the following table:
1226
1227@ifset use-ascii
1228@itemize @bullet
1229@item PREEMPT is masked by PREEMPT_MASK and enables preemption
1230@item NO_PREEMPT is masked by PREEMPT_MASK and disables preemption
1231@item NO_TIMESLICE is masked by TIMESLICE_MASK and disables timeslicing
1232@item TIMESLICE is masked by TIMESLICE_MASK and enables timeslicing
1233@item ASR is masked by ASR_MASK and enables ASR processing
1234@item NO_ASR is masked by ASR_MASK and disables ASR processing
1235@item INTERRUPT_LEVEL(0) is masked by INTERRUPT_MASK and enables all interrupts
1236@item INTERRUPT_LEVEL(n) is masked by INTERRUPT_MASK and sets interrupts level n
1237 
1238@end itemize
1239@end ifset
1240 
1241@ifset use-tex
1242@sp 1
1243@c this is temporary
1244@itemize @bullet
1245@item PREEMPT is masked by PREEMPT_MASK and enables preemption
1246@item NO_PREEMPT is masked by PREEMPT_MASK and disables preemption
1247@item NO_TIMESLICE is masked by TIMESLICE_MASK and disables timeslicing
1248@item TIMESLICE is masked by TIMESLICE_MASK and enables timeslicing
1249@item ASR is masked by ASR_MASK and enables ASR processing
1250@item NO_ASR is masked by ASR_MASK and disables ASR processing
1251@item INTERRUPT_LEVEL(0) is masked by INTERRUPT_MASK and enables all interrupts
1252@item INTERRUPT_LEVEL(n) is masked by INTERRUPT_MASK and sets interrupts level n
1253 
1254@end itemize
1255 
1256@tex
1257@end tex
1258@end ifset
1259 
1260@ifset use-html
1261@html
1262<CENTER>
1263  <TABLE COLS=3 WIDTH="80%" BORDER=2>
1264<TR><TD ALIGN=center><STRONG>Mode Constant</STRONG></TD>
1265    <TD ALIGN=center><STRONG>Mask Constant</STRONG></TD>
1266    <TD ALIGN=center><STRONG>Description</STRONG></TD></TR>
1267<TR><TD ALIGN=center>PREEMPT</TD>
1268    <TD ALIGN=center>PREEMPT_MASK</TD>
1269    <TD ALIGN=center>enables preemption</TD></TR>
1270<TR><TD ALIGN=center>NO_PREEMPT</TD>
1271    <TD ALIGN=center>PREEMPT_MASK</TD>
1272    <TD ALIGN=center>disables preemption</TD></TR>
1273<TR><TD ALIGN=center>NO_TIMESLICE</TD>
1274    <TD ALIGN=center>TIMESLICE_MASK</TD>
1275    <TD ALIGN=center>disables timeslicing</TD></TR>
1276<TR><TD ALIGN=center>TIMESLICE</TD>
1277    <TD ALIGN=center>TIMESLICE_MASK</TD>
1278    <TD ALIGN=center>enables timeslicing</TD></TR>
1279<TR><TD ALIGN=center>ASR</TD>
1280    <TD ALIGN=center>ASR_MASK</TD>
1281    <TD ALIGN=center>enables ASR processing</TD></TR>
1282<TR><TD ALIGN=center>NO_ASR</TD>
1283    <TD ALIGN=center>ASR_MASK</TD>
1284    <TD ALIGN=center>disables ASR processing</TD></TR>
1285<TR><TD ALIGN=center>INTERRUPT_LEVEL(0)</TD>
1286    <TD ALIGN=center>INTERRUPT_MASK</TD>
1287    <TD ALIGN=center>enables all interrupts</TD></TR>
1288<TR><TD ALIGN=center>INTERRUPT_LEVEL(n)</TD>
1289    <TD ALIGN=center>INTERRUPT_MASK</TD>
1290    <TD ALIGN=center>sets interrupts level n</TD></TR>
1291  </TABLE>
1292</CENTER>
1293@end html
1294@end ifset
1295
1296@page
1297
1298@ifinfo
1299@node TASK_GET_NOTE - Get task notepad entry, TASK_SET_NOTE - Set task notepad entry, TASK_MODE - Change current task's mode, Task Manager Directives
1300@end ifinfo
1301@subsection TASK_GET_NOTE - Get task notepad entry
1302
1303@subheading CALLING SEQUENCE:
1304@ifset is-C
1305@example
1306rtems_status_code rtems_task_get_note(
1307  rtems_id          id,
1308  rtems_unsigned32  notepad,
1309  rtems_unsigned32 *note
1310);
1311@end example
1312@end ifset
1313
1314@ifset is-Ada
1315@example
1316procedure Task_Get_Note (
1317   ID      : in     RTEMS.ID;
1318   Notepad : in     RTEMS.Notepad_Index;
1319   Note    :    out RTEMS.Unsigned32;
1320   Result  :    out RTEMS.Status_Codes
1321);
1322@end example
1323@end ifset
1324
1325@subheading DIRECTIVE STATUS CODES:
1326@code{SUCCESSFUL} - note obtained successfully@*
1327@code{INVALID_ID} - invalid task id@*
1328@code{INVALID_NUMBER} - invalid notepad location
1329
1330@subheading DESCRIPTION:
1331This directive returns the note contained in the notepad
1332location of the task specified by id.
1333
1334@subheading NOTES:
1335This directive will not cause the running task to be preempted.
1336
1337If id is set to @code{SELF}, the calling task accesses its own notepad.
1338
1339@c This version of the paragraph avoids the overfull hbox error.
1340@c The constants NOTEPAD_0 through NOTEPAD_15 can be used to access the
1341@c sixteen notepad locations.
1342
1343The sixteen notepad locations can be accessed using the constants
1344@code{NOTEPAD_0} through @code{NOTEPAD_15}.
1345
1346Getting a note of a global task which does not reside on the
1347local node will generate a request to the remote node to obtain
1348the notepad entry of the specified task.
1349
1350@page
1351
1352@ifinfo
1353@node TASK_SET_NOTE - Set task notepad entry, TASK_WAKE_AFTER - Wake up after interval, TASK_GET_NOTE - Get task notepad entry, Task Manager Directives
1354@end ifinfo
1355@subsection TASK_SET_NOTE - Set task notepad entry
1356
1357@subheading CALLING SEQUENCE:
1358@ifset is-C
1359@example
1360rtems_status_code rtems_task_set_note(
1361  rtems_id         id,
1362  rtems_unsigned32 notepad,
1363  rtems_unsigned32 note
1364);
1365@end example
1366@end ifset
1367
1368@ifset is-Ada
1369@example
1370procedure Task_Set_Note (
1371   ID      : in     RTEMS.ID;
1372   Notepad : in     RTEMS.Notepad_Index;
1373   Note    : in     RTEMS.Unsigned32;
1374   Result  :    out RTEMS.Status_Codes
1375);
1376@end example
1377@end ifset
1378
1379@subheading DIRECTIVE STATUS CODES:
1380@code{SUCCESSFUL} - task's note set successfully@*
1381@code{INVALID_ID} - invalid task id@*
1382@code{INVALID_NUMBER} - invalid notepad location
1383
1384@subheading DESCRIPTION:
1385This directive sets the notepad entry for the task specified by
1386id to the value note.
1387
1388@subheading NOTES:
1389If id is set to @code{SELF}, the calling task accesses its own notepad
1390locations.
1391
1392This directive will not cause the running task to be preempted.
1393
1394@c This version of the paragraph avoids the overfull hbox error.
1395@c The constants NOTEPAD_0 through NOTEPAD_15 can be used to access the
1396@c sixteen notepad locations.
1397
1398The sixteen notepad locations can be accessed using the constants
1399@code{NOTEPAD_0} through @code{NOTEPAD_15}.
1400
1401Setting a notepad location of a global task which does not
1402reside on the local node will generate a request to the remote
1403node to set the specified notepad entry.
1404
1405@page
1406
1407@ifinfo
1408@node TASK_WAKE_AFTER - Wake up after interval, TASK_WAKE_WHEN - Wake up when specified, TASK_SET_NOTE - Set task notepad entry, Task Manager Directives
1409@end ifinfo
1410@subsection TASK_WAKE_AFTER - Wake up after interval
1411
1412@subheading CALLING SEQUENCE:
1413@ifset is-C
1414@example
1415rtems_status_code rtems_task_wake_after(
1416  rtems_interval ticks
1417);
1418@end example
1419@end ifset
1420
1421@ifset is-Ada
1422@example
1423procedure Task_Wake_After (
1424   Ticks  : in     RTEMS.Interval;
1425   Result :    out RTEMS.Status_Codes
1426);
1427@end example
1428@end ifset
1429
1430@subheading DIRECTIVE STATUS CODES:
1431@code{SUCCESSFUL} - always successful
1432
1433@subheading DESCRIPTION:
1434This directive blocks the calling task for the specified number
1435of system clock ticks.  When the requested interval has elapsed,
1436the task is made ready.  The clock_tick directive automatically
1437updates the delay period.
1438
1439@subheading NOTES:
1440Setting the system date and time with the clock_set directive
1441has no effect on a task_wake_after blocked task.
1442
1443A task may give up the processor and remain in the ready state
1444by specifying a value of @code{YIELD_PROCESSOR} in ticks.
1445
1446The maximum timer interval that can be specified is the maximum
1447value which can be represented by the rtems_unsigned32 type.
1448
1449@page
1450
1451@ifinfo
1452@node TASK_WAKE_WHEN - Wake up when specified, Interrupt Manager, TASK_WAKE_AFTER - Wake up after interval, Task Manager Directives
1453@end ifinfo
1454@subsection TASK_WAKE_WHEN - Wake up when specified
1455
1456@subheading CALLING SEQUENCE:
1457
1458@ifset is-C
1459@example
1460rtems_status_code rtems_task_wake_when(
1461  rtems_time_of_day *time_buffer
1462);
1463@end example
1464@end ifset
1465
1466@ifset is-Ada
1467@example
1468procedure Task_Wake_When (
1469   Time_Buffer : in     RTEMS.Time_Of_Day;
1470   Result      :    out RTEMS.Status_Codes
1471);
1472@end example
1473@end ifset
1474
1475@subheading DIRECTIVE STATUS CODES:
1476@code{SUCCESSFUL} - awakened at date/time successfully@*
1477@code{INVALID_TIME_OF_DAY} - invalid time buffer@*
1478@code{NOT_DEFINED} - system date and time is not set
1479
1480@subheading DESCRIPTION:
1481This directive blocks a task until the date and time specified
1482in time_buffer.  At the requested date and time, the calling
1483task will be unblocked and made ready to execute.
1484
1485@subheading NOTES:
1486The ticks portion of time_buffer @value{STRUCTURE} is ignored.  The
1487timing granularity of this directive is a second.
Note: See TracBrowser for help on using the repository browser.