source: rtems/doc/user/task.t @ 5599d6e

4.104.114.84.95
Last change on this file since 5599d6e was 1ca951ce, checked in by Joel Sherrill <joel.sherrill@…>, on 08/04/97 at 20:05:48

Added information based on comments from Katsu Shibuya.

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