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 | |
---|
35 | The task manager provides a comprehensive set of directives to |
---|
36 | create, delete, and administer tasks. The directives provided |
---|
37 | by 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 | |
---|
82 | Many definitions of a task have been proposed in computer |
---|
83 | literature. Unfortunately, none of these definitions |
---|
84 | encompasses all facets of the concept in a manner which is |
---|
85 | operating system independent. Several of the more common |
---|
86 | definitions are provided to enable each user to select a |
---|
87 | definition which best matches their own experience and |
---|
88 | understanding 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 |
---|
100 | concurrently with other computational sequences. |
---|
101 | |
---|
102 | @end itemize |
---|
103 | |
---|
104 | From RTEMS' perspective, a task is the smallest thread of |
---|
105 | execution which can compete on its own for system resources. A |
---|
106 | task 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 | |
---|
114 | The Task Control Block (TCB) is an RTEMS defined data structure |
---|
115 | which contains all the information that is pertinent to the |
---|
116 | execution of a task. During system initialization, RTEMS |
---|
117 | reserves a TCB for each task configured. A TCB is allocated |
---|
118 | upon creation of the task and is returned to the TCB free list |
---|
119 | upon deletion of the task. |
---|
120 | |
---|
121 | The TCB's elements are modified as a result of system calls made |
---|
122 | by the application in response to external and internal stimuli. |
---|
123 | TCBs are the only RTEMS internal data structure that can be |
---|
124 | accessed by an application via user extension routines. The TCB |
---|
125 | contains a task's name, ID, current priority, current and |
---|
126 | starting states, execution mode, set of notepad locations, TCB |
---|
127 | user extension pointer, scheduling control structures, as well |
---|
128 | as data required by a blocked task. |
---|
129 | |
---|
130 | A task's context is stored in the TCB when a task switch occurs. |
---|
131 | When the task regains control of the processor, its context is |
---|
132 | restored from the TCB. When a task is restarted, the initial |
---|
133 | state of the task is restored from the starting context area in |
---|
134 | the 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 | |
---|
141 | A 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 | |
---|
151 | An active task may occupy the executing, ready, blocked or |
---|
152 | dormant state, otherwise the task is considered non-existent. |
---|
153 | One or more tasks may be active in the system simultaneously. |
---|
154 | Multiple tasks communicate, synchronize, and compete for system |
---|
155 | resources with each other via system calls. The multiple tasks |
---|
156 | appear to execute in parallel, but actually each is dispatched |
---|
157 | to the CPU for periods of time determined by the RTEMS |
---|
158 | scheduling algorithm. The scheduling of a task is based on its |
---|
159 | current 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 | |
---|
166 | A task's priority determines its importance in relation to the |
---|
167 | other tasks executing on the same processor. RTEMS supports 255 |
---|
168 | levels of priority ranging from 1 to 255. Tasks of numerically |
---|
169 | smaller priority values are more important tasks than tasks of |
---|
170 | numerically larger priority values. For example, a task at |
---|
171 | priority level 5 is of higher privilege than a task at priority |
---|
172 | level 10. There is no limit to the number of tasks assigned to |
---|
173 | the same priority. |
---|
174 | |
---|
175 | Each task has a priority associated with it at all times. The |
---|
176 | initial value of this priority is assigned at task creation |
---|
177 | time. The priority of a task may be changed at any subsequent |
---|
178 | time. |
---|
179 | |
---|
180 | Priorities are used by the scheduler to determine which ready |
---|
181 | task will be allowed to execute. In general, the higher the |
---|
182 | logical priority of a task, the more likely it is to receive |
---|
183 | processor 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 | |
---|
190 | A 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 | |
---|
199 | It is used to modify RTEMS' scheduling process and to alter the |
---|
200 | execution environment of the task. |
---|
201 | |
---|
202 | The preemption component allows a task to determine when control |
---|
203 | of the processor is relinquished. If preemption is disabled |
---|
204 | (NO_PREEMPT), the task will retain control of the processor as |
---|
205 | long as it is in the executing state -- even if a higher |
---|
206 | priority task is made ready. If preemption is enabled (PREEMPT) |
---|
207 | and a higher priority task is made ready, then the processor |
---|
208 | will be taken away from the current task immediately and given |
---|
209 | to the higher priority task. |
---|
210 | |
---|
211 | The timeslicing component is used by the RTEMS scheduler to |
---|
212 | determine how the processor is allocated to tasks of equal |
---|
213 | priority. If timeslicing is enabled (TIMESLICE), then RTEMS |
---|
214 | will limit the amount of time the task can execute before the |
---|
215 | processor is allocated to another ready task of equal priority. |
---|
216 | The length of the timeslice is application dependent and |
---|
217 | specified in the Configuration Table. If timeslicing is |
---|
218 | disabled (NO_TIMESLICE), then the task will be allowed to |
---|
219 | execute until a task of higher priority is made ready. If |
---|
220 | NO_PREEMPT is selected, then the timeslicing component is |
---|
221 | ignored by the scheduler. |
---|
222 | |
---|
223 | The asynchronous signal processing component is used to |
---|
224 | determine when received signals are to be processed by the task. |
---|
225 | If signal processing is enabled (ASR), then signals sent to the |
---|
226 | task will be processed the next time the task executes. If |
---|
227 | signal processing is disabled (NO_ASR), then all signals |
---|
228 | received by the task will remain posted until signal processing |
---|
229 | is enabled. This component affects only tasks which have |
---|
230 | established a routine to process asynchronous signals. |
---|
231 | |
---|
232 | The interrupt level component is used to determine which |
---|
233 | interrupts will be enabled when the task is executing. |
---|
234 | INTERRUPT_LEVEL(n) specifies that the task will execute at |
---|
235 | interrupt 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 | |
---|
253 | All RTEMS tasks are invoked with a single argument which is |
---|
254 | specified when they are started or restarted. The argument is |
---|
255 | commonly used to communicate startup information to the task. |
---|
256 | The simplest manner in which to define a task which accesses it |
---|
257 | argument is: |
---|
258 | |
---|
259 | @ifset is-C |
---|
260 | @example |
---|
261 | rtems_task user_task( |
---|
262 | rtems_task_argument argument |
---|
263 | ); |
---|
264 | @end example |
---|
265 | @end ifset |
---|
266 | |
---|
267 | @ifset is-Ada |
---|
268 | @example |
---|
269 | procedure User_Task ( |
---|
270 | Argument : in RTEMS.Task_Argument_Ptr |
---|
271 | ); |
---|
272 | @end example |
---|
273 | @end ifset |
---|
274 | |
---|
275 | Application tasks requiring more information may view this |
---|
276 | single 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 | |
---|
283 | Creating a task with the @code{FLOATING_POINT} flag results in |
---|
284 | additional memory being allocated for the TCB to store the state |
---|
285 | of the numeric coprocessor during task switches. This |
---|
286 | additional memory is @b{NOT} allocated for @code{NO_FLOATING_POINT} tasks. |
---|
287 | Saving and restoring the context of a @code{FLOATING_POINT} task takes |
---|
288 | longer than that of a @code{NO_FLOATING_POINT} task because of the |
---|
289 | relatively large amount of time required for the numeric |
---|
290 | coprocessor to save or restore its computational state. |
---|
291 | |
---|
292 | Since RTEMS was designed specifically for embedded military |
---|
293 | applications which are floating point intensive, the executive |
---|
294 | is optimized to avoid unnecessarily saving and restoring the |
---|
295 | state of the numeric coprocessor. The state of the numeric |
---|
296 | coprocessor is only saved when a @code{FLOATING_POINT} task is |
---|
297 | dispatched and that task was not the last task to utilize the |
---|
298 | coprocessor. In a system with only one @code{FLOATING_POINT} task, the |
---|
299 | state of the numeric coprocessor will never be saved or |
---|
300 | restored. |
---|
301 | |
---|
302 | Although the overhead imposed by @code{FLOATING_POINT} tasks is |
---|
303 | minimal, some applications may wish to completely avoid the |
---|
304 | overhead associated with @code{FLOATING_POINT} tasks and still utilize |
---|
305 | a numeric coprocessor. By preventing a task from being |
---|
306 | preempted while performing a sequence of floating point |
---|
307 | operations, a @code{NO_FLOATING_POINT} task can utilize the numeric |
---|
308 | coprocessor without incurring the overhead of a @code{FLOATING_POINT} |
---|
309 | context switch. This approach also avoids the allocation of a |
---|
310 | floating point context area. However, if this approach is taken |
---|
311 | by the application designer, NO tasks should be created as |
---|
312 | @code{FLOATING_POINT} tasks. Otherwise, the floating point context |
---|
313 | will not be correctly maintained because RTEMS assumes that the |
---|
314 | state of the numeric coprocessor will not be altered by |
---|
315 | @code{NO_FLOATING_POINT} tasks. |
---|
316 | |
---|
317 | If the supported processor type does not have hardware floating |
---|
318 | capabilities or a standard numeric coprocessor, RTEMS will not |
---|
319 | provide built-in support for hardware floating point on that |
---|
320 | processor. 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 |
---|
323 | library must be utilized for floating point operations. |
---|
324 | |
---|
325 | On some processors, it is possible to disable the floating point |
---|
326 | unit dynamically. If this capability is supported by the target |
---|
327 | processor, then RTEMS will utilize this capability to enable the |
---|
328 | floating 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 |
---|
331 | unit is CPU dependent but will i general result in an exception |
---|
332 | condition. |
---|
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 | |
---|
339 | In general, an attribute set is built by a bitwise OR of the |
---|
340 | desired components. The set of valid task attribute components |
---|
341 | is 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 | |
---|
350 | Attribute values are specifically designed to be mutually |
---|
351 | exclusive, therefore bitwise OR and addition operations are |
---|
352 | equivalent as long as each attribute appears exactly once in the |
---|
353 | component list. A component listed as a default is not required |
---|
354 | to appear in the component list, although it is a good |
---|
355 | programming practice to specify default components. If all |
---|
356 | defaults are desired, then @code{DEFAULT_ATTRIBUTES} should be used. |
---|
357 | |
---|
358 | This example demonstrates the attribute_set parameter needed to |
---|
359 | create a local task which utilizes the numeric coprocessor. The |
---|
360 | attribute_set parameter could be @code{FLOATING_POINT} or |
---|
361 | @code{LOCAL @value{OR} FLOATING_POINT}. |
---|
362 | The attribute_set parameter can be set to |
---|
363 | @code{FLOATING_POINT} because @code{LOCAL} is the default for all created |
---|
364 | tasks. If the task were global and used the numeric |
---|
365 | coprocessor, 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 | |
---|
373 | In general, a mode and its corresponding mask is built by a |
---|
374 | bitwise OR of the desired components. The set of valid mode |
---|
375 | constants and each mode's corresponding mask constant is |
---|
376 | listed 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 | |
---|
449 | Mode values are specifically designed to be mutually exclusive, |
---|
450 | therefore bitwise OR and addition operations are equivalent as |
---|
451 | long as each mode appears exactly once in the component list. A |
---|
452 | mode component listed as a default is not required to appear in |
---|
453 | the mode component list, although it is a good programming |
---|
454 | practice to specify default components. If all defaults are |
---|
455 | desired, the mode @code{DEFAULT_MODES} and the mask @code{ALL_MODE_MASKS} |
---|
456 | should be used. |
---|
457 | |
---|
458 | The following example demonstrates the mode and mask parameters |
---|
459 | used with the task_mode directive to place a task at interrupt |
---|
460 | level 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 |
---|
462 | preemption mode and interrupt level, while the mask parameter |
---|
463 | should be set to @code{INTERRUPT_MASK @value{RTEMSOR} NO_PREEMPT_MASK} |
---|
464 | to indicate that the calling task's interrupt level and preemption mode are |
---|
465 | being 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 | |
---|
492 | The task_create directive creates a task by allocating a task |
---|
493 | control block, assigning the task a user-specified name, |
---|
494 | allocating it a stack and floating point context area, setting a |
---|
495 | user-specified initial priority, setting a user-specified |
---|
496 | initial mode, and assigning it a task ID. Newly created tasks |
---|
497 | are initially placed in the dormant state. All RTEMS tasks |
---|
498 | execute 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 | |
---|
505 | When a task is created, RTEMS generates a unique task ID and |
---|
506 | assigns it to the created task until it is deleted. The task ID |
---|
507 | may be obtained by either of two methods. First, as the result |
---|
508 | of an invocation of the task_create directive, the task ID is |
---|
509 | stored in a user provided location. Second, the task ID may be |
---|
510 | obtained later using the task_ident directive. The task ID is |
---|
511 | used 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 | |
---|
518 | The task_start directive is used to place a dormant task in the |
---|
519 | ready state. This enables the task to compete, based on its |
---|
520 | current priority, for the processor and other system resources. |
---|
521 | Any actions, such as suspension or change of priority, performed |
---|
522 | on a task prior to starting it are nullified when the task is |
---|
523 | started. |
---|
524 | |
---|
525 | With the task_start directive the user specifies the task's |
---|
526 | starting address and argument. The argument is used to |
---|
527 | communicate some startup information to the task. As part of |
---|
528 | this directive, RTEMS initializes the task's stack based upon |
---|
529 | the task's initial execution mode and start address. The |
---|
530 | starting argument is passed to the task in accordance with the |
---|
531 | target processor's calling convention. |
---|
532 | |
---|
533 | The task_restart directive restarts a task at its initial |
---|
534 | starting address with its original priority and execution mode, |
---|
535 | but with a possibly different argument. The new argument may be |
---|
536 | used to distinguish between the original invocation of the task |
---|
537 | and subsequent invocations. The task's stack and control block |
---|
538 | are modified to reflect their original creation values. |
---|
539 | Although references to resources that have been requested are |
---|
540 | cleared, resources allocated by the task are NOT automatically |
---|
541 | returned to RTEMS. A task cannot be restarted unless it has |
---|
542 | previously been started (i.e. dormant tasks cannot be |
---|
543 | restarted). 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 | |
---|
550 | The task_suspend directive is used to place either the caller or |
---|
551 | another task into a suspended state. The task remains suspended |
---|
552 | until a task_resume directive is issued. This implies that a |
---|
553 | task may be suspended as well as blocked waiting either to |
---|
554 | acquire a resource or for the expiration of a timer. |
---|
555 | |
---|
556 | The task_resume directive is used to remove another task from |
---|
557 | the suspended state. If the task is not also blocked, resuming |
---|
558 | it will place it in the ready state, allowing it to once again |
---|
559 | compete for the processor and resources. If the task was |
---|
560 | blocked as well as suspended, this directive clears the |
---|
561 | suspension and leaves the task in the blocked state. |
---|
562 | |
---|
563 | Suspending a task which is already suspended or resuming a |
---|
564 | task 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 | |
---|
571 | The task_wake_after directive creates a sleep timer which allows |
---|
572 | a task to go to sleep for a specified interval. The task is |
---|
573 | blocked until the delay interval has elapsed, at which time the |
---|
574 | task is unblocked. A task calling the task_wake_after directive |
---|
575 | with a delay interval of @code{YIELD_PROCESSOR} ticks will yield the |
---|
576 | processor to any other ready task of equal or greater priority |
---|
577 | and remain ready to execute. |
---|
578 | |
---|
579 | The task_wake_when directive creates a sleep timer which allows |
---|
580 | a task to go to sleep until a specified date and time. The |
---|
581 | calling task is blocked until the specified date and time has |
---|
582 | occurred, 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 | |
---|
589 | The task_set_priority directive is used to obtain or change the |
---|
590 | current priority of either the calling task or another task. If |
---|
591 | the new priority requested is CURRENT_PRIORITY or the task's |
---|
592 | actual priority, then the current priority will be returned and |
---|
593 | the task's priority will remain unchanged. If the task's |
---|
594 | priority is altered, then the task will be scheduled according |
---|
595 | to its new priority. |
---|
596 | |
---|
597 | The task_restart directive resets the priority of a task to its |
---|
598 | original 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 | |
---|
605 | The task_mode directive is used to obtain or change the current |
---|
606 | execution mode of the calling task. A task's execution mode is |
---|
607 | used to enable preemption, timeslicing, ASR processing, and to |
---|
608 | set the task's interrupt level. |
---|
609 | |
---|
610 | The task_restart directive resets the mode of a task to its |
---|
611 | original value. |
---|
612 | |
---|
613 | @ifinfo |
---|
614 | @node Notepad Locations, Task Deletion, Changing Task Mode, Task Manager Operations |
---|
615 | @end ifinfo |
---|
616 | @subsection Notepad Locations |
---|
617 | |
---|
618 | RTEMS provides sixteen notepad locations for each task. Each |
---|
619 | notepad location may contain a note consisting of four bytes of |
---|
620 | information. RTEMS provides two directives, task_set_note and |
---|
621 | task_get_note, that enable a user to access and change the |
---|
622 | notepad locations. The task_set_note directive enables the user |
---|
623 | to set a task's notepad entry to a specified note. The |
---|
624 | task_get_note directive allows the user to obtain the note |
---|
625 | contained 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 | |
---|
632 | RTEMS provides the task_delete directive to allow a task to |
---|
633 | delete itself or any other task. This directive removes all |
---|
634 | RTEMS references to the task, frees the task's control block, |
---|
635 | removes it from resource wait queues, and deallocates its stack |
---|
636 | as well as the optional floating point context. The task's name |
---|
637 | and ID become inactive at this time, and any subsequent |
---|
638 | references to either of them is invalid. In fact, RTEMS may |
---|
639 | reuse the task ID for another task which is created later in the |
---|
640 | application. |
---|
641 | |
---|
642 | Unexpired delay timers (i.e. those used by task_wake_after and |
---|
643 | task_wake_when) and timeout timers associated with the task are |
---|
644 | automatically deleted, however, other resources dynamically |
---|
645 | allocated by the task are NOT automatically returned to RTEMS. |
---|
646 | Therefore, before a task is deleted, all of its dynamically |
---|
647 | allocated resources should be deallocated by the user. This may |
---|
648 | be accomplished by instructing the task to delete itself rather |
---|
649 | than directly deleting the task. Other tasks may instruct a |
---|
650 | task to delete itself by sending a "delete self" message, event, |
---|
651 | or signal, or by restarting the task with special arguments |
---|
652 | which 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 | |
---|
678 | This section details the task manager's directives. A |
---|
679 | subsection is dedicated to each of this manager's directives and |
---|
680 | describes the calling sequence, related constants, usage, and |
---|
681 | status 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 |
---|
694 | rtems_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 |
---|
707 | procedure 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: |
---|
730 | This directive creates a task which resides on the local node. |
---|
731 | It allocates and initializes a TCB, a stack, and an optional |
---|
732 | floating point context area. The mode parameter contains values |
---|
733 | which sets the task's initial execution mode. The |
---|
734 | @code{FLOATING_POINT} attribute should be specified if the created task |
---|
735 | is to use a numeric coprocessor. For performance reasons, it is |
---|
736 | recommended that tasks not using the numeric coprocessor should |
---|
737 | specify the @code{NO_FLOATING_POINT} attribute. If the GLOBAL |
---|
738 | attribute is specified, the task can be accessed from remote |
---|
739 | nodes. The task id, returned in id, is used in other task |
---|
740 | related directives to access the task. When created, a task is |
---|
741 | placed in the dormant state and can only be made ready to |
---|
742 | execute using the directive task_start. |
---|
743 | |
---|
744 | @subheading NOTES: |
---|
745 | This directive will not cause the calling task to be preempted. |
---|
746 | |
---|
747 | Valid task priorities range from a high of 1 to a low of 255. |
---|
748 | |
---|
749 | RTEMS supports a maximum of 256 interrupt levels which are |
---|
750 | mapped onto the interrupt levels actually supported by the |
---|
751 | target processor. |
---|
752 | |
---|
753 | The requested stack size should be at least @code{MINIMUM_STACK_SIZE} |
---|
754 | bytes. The value of @code{MINIMUM_STACK_SIZE} is processor dependent. |
---|
755 | Application developers should consider the stack usage of the |
---|
756 | device drivers when calculating the stack size required for |
---|
757 | tasks which utilize the driver. |
---|
758 | |
---|
759 | The 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 | |
---|
768 | The 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 | |
---|
781 | Tasks should not be made global unless remote tasks must |
---|
782 | interact with them. This avoids the system overhead incurred by |
---|
783 | the creation of a global task. When a global task is created, |
---|
784 | the task's name and id must be transmitted to every node in the |
---|
785 | system for insertion in the local copy of the global object |
---|
786 | table. |
---|
787 | |
---|
788 | The total number of global objects, including tasks, is limited |
---|
789 | by 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 |
---|
802 | rtems_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 |
---|
812 | procedure 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: |
---|
827 | This directive obtains the task id associated with the task name |
---|
828 | specified 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 |
---|
830 | unique, then the task id returned will match one of the tasks |
---|
831 | with that name. However, this task id is not guaranteed to |
---|
832 | correspond to the desired task. The task id, returned in id, is |
---|
833 | used in other task related directives to access the task. |
---|
834 | |
---|
835 | @subheading NOTES: |
---|
836 | This directive will not cause the running task to be preempted. |
---|
837 | |
---|
838 | If node is @code{SEARCH_ALL_NODES}, all nodes are searched with the |
---|
839 | local node being searched first. All other nodes are searched |
---|
840 | with the lowest numbered node searched first. |
---|
841 | |
---|
842 | If node is a valid node number which does not represent the |
---|
843 | local node, then only the tasks exported by the designated node |
---|
844 | are searched. |
---|
845 | |
---|
846 | This directive does not generate activity on remote nodes. It |
---|
847 | accesses 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 |
---|
859 | rtems_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 |
---|
869 | procedure 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: |
---|
886 | This directive readies the task, specified by tid, for execution |
---|
887 | based on the priority and execution mode specified when the task |
---|
888 | was created. The starting address of the task is given in |
---|
889 | entry_point. The task's starting argument is contained in |
---|
890 | argument. This argument can be a single value or used as an |
---|
891 | index into an array of parameter blocks. |
---|
892 | |
---|
893 | @subheading NOTES: |
---|
894 | The calling task will be preempted if its preemption mode is |
---|
895 | enabled and the task being started has a higher priority. |
---|
896 | |
---|
897 | Any actions performed on a dormant task such as suspension or |
---|
898 | change of priority are nullified when the task is initiated via |
---|
899 | the 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 |
---|
911 | rtems_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 |
---|
920 | procedure 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: |
---|
935 | This directive resets the task specified by id to begin |
---|
936 | execution at its original starting address. The task's priority |
---|
937 | and execution mode are set to the original creation values. If |
---|
938 | the task is currently blocked, RTEMS automatically makes the |
---|
939 | task ready. A task can be restarted from any state, except the |
---|
940 | dormant state. |
---|
941 | |
---|
942 | The task's starting argument is contained in argument. This |
---|
943 | argument can be a single value or an index into an array of |
---|
944 | parameter blocks. This new argument may be used to distinguish |
---|
945 | between the initial task_start of the task and any ensuing calls |
---|
946 | to task_restart of the task. This can be beneficial in deleting |
---|
947 | a task. Instead of deleting a task using the task_delete |
---|
948 | directive, a task can delete another task by restarting that |
---|
949 | task, and allowing that task to release resources back to RTEMS |
---|
950 | and then delete itself. |
---|
951 | |
---|
952 | @subheading NOTES: |
---|
953 | If id is @code{SELF}, the calling task will be restarted and will not |
---|
954 | return from this directive. |
---|
955 | |
---|
956 | The calling task will be preempted if its preemption mode is |
---|
957 | enabled and the task being restarted has a higher priority. |
---|
958 | |
---|
959 | The task must reside on the local node, even if the task was |
---|
960 | created 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 |
---|
972 | rtems_status_code rtems_task_delete( |
---|
973 | rtems_id id |
---|
974 | ); |
---|
975 | @end example |
---|
976 | @end ifset |
---|
977 | |
---|
978 | @ifset is-Ada |
---|
979 | @example |
---|
980 | procedure 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: |
---|
993 | This directive deletes a task, either the calling task or |
---|
994 | another task, as specified by id. RTEMS stops the execution of |
---|
995 | the task and reclaims the stack memory, any allocated delay or |
---|
996 | timeout timers, the TCB, and, if the task is @code{FLOATING_POINT}, its |
---|
997 | floating point context area. RTEMS does not reclaim the |
---|
998 | following resources: region segments, partition buffers, |
---|
999 | semaphores, timers, or rate monotonic periods. |
---|
1000 | |
---|
1001 | @subheading NOTES: |
---|
1002 | A task is responsible for releasing its resources back to RTEMS |
---|
1003 | before deletion. To insure proper deallocation of resources, a |
---|
1004 | task should not be deleted unless it is unable to execute or |
---|
1005 | does not hold any RTEMS resources. If a task holds RTEMS |
---|
1006 | resources, the task should be allowed to deallocate its |
---|
1007 | resources before deletion. A task can be directed to release |
---|
1008 | its resources and delete itself by restarting it with a special |
---|
1009 | argument or by sending it a message, an event, or a signal. |
---|
1010 | |
---|
1011 | Deletion of the current task (@code{SELF}) will force RTEMS to select |
---|
1012 | another task to execute. |
---|
1013 | |
---|
1014 | When a global task is deleted, the task id must be transmitted |
---|
1015 | to every node in the system for deletion from the local copy of |
---|
1016 | the global object table. |
---|
1017 | |
---|
1018 | The task must reside on the local node, even if the task was |
---|
1019 | created 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 |
---|
1031 | rtems_status_code rtems_task_suspend( |
---|
1032 | rtems_id id |
---|
1033 | ); |
---|
1034 | @end example |
---|
1035 | @end ifset |
---|
1036 | |
---|
1037 | @ifset is-Ada |
---|
1038 | @example |
---|
1039 | procedure 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: |
---|
1052 | This directive suspends the task specified by id from further |
---|
1053 | execution by placing it in the suspended state. This state is |
---|
1054 | additive to any other blocked state that the task may already be |
---|
1055 | in. The task will not execute again until another task issues |
---|
1056 | the task_resume directive for this task and any blocked state |
---|
1057 | has been removed. |
---|
1058 | |
---|
1059 | @subheading NOTES: |
---|
1060 | The requesting task can suspend itself by specifying @code{SELF} as id. |
---|
1061 | In this case, the task will be suspended and a successful |
---|
1062 | return code will be returned when the task is resumed. |
---|
1063 | |
---|
1064 | Suspending a global task which does not reside on the local node |
---|
1065 | will generate a request to the remote node to suspend the |
---|
1066 | specified task. |
---|
1067 | |
---|
1068 | If the task specified by id is already suspended, then the |
---|
1069 | ALREADY_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 |
---|
1081 | rtems_status_code rtems_task_resume( |
---|
1082 | rtems_id id |
---|
1083 | ); |
---|
1084 | @end example |
---|
1085 | @end ifset |
---|
1086 | |
---|
1087 | @ifset is-Ada |
---|
1088 | @example |
---|
1089 | procedure 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: |
---|
1102 | This directive removes the task specified by id from the |
---|
1103 | suspended state. If the task is in the ready state after the |
---|
1104 | suspension is removed, then it will be scheduled to run. If the |
---|
1105 | task is still in a blocked state after the suspension is |
---|
1106 | removed, then it will remain in that blocked state. |
---|
1107 | |
---|
1108 | @subheading NOTES: |
---|
1109 | The running task may be preempted if its preemption mode is |
---|
1110 | enabled and the local task being resumed has a higher priority. |
---|
1111 | |
---|
1112 | Resuming a global task which does not reside on the local node |
---|
1113 | will generate a request to the remote node to resume the |
---|
1114 | specified task. |
---|
1115 | |
---|
1116 | If the task specified by id is not suspended, then the |
---|
1117 | INCORRECT_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 |
---|
1129 | rtems_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 |
---|
1139 | procedure 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: |
---|
1154 | This directive manipulates the priority of the task specified by |
---|
1155 | id. An id of @code{SELF} is used to indicate the calling task. When |
---|
1156 | new_priority is not equal to CURRENT_PRIORITY, the specified |
---|
1157 | task's previous priority is returned in old_priority. When |
---|
1158 | new_priority is CURRENT_PRIORITY, the specified task's current |
---|
1159 | priority is returned in old_priority. Valid priorities range |
---|
1160 | from a high of 1 to a low of 255. |
---|
1161 | |
---|
1162 | @subheading NOTES: |
---|
1163 | The calling task may be preempted if its preemption mode is |
---|
1164 | enabled and it lowers its own priority or raises another task's |
---|
1165 | priority. |
---|
1166 | |
---|
1167 | Setting the priority of a global task which does not reside on |
---|
1168 | the local node will generate a request to the remote node to |
---|
1169 | change the priority of the specified task. |
---|
1170 | |
---|
1171 | If the task specified by id is currently holding any binary |
---|
1172 | semaphores which use the priority inheritance algorithm, then |
---|
1173 | the task's priority cannot be lowered immediately. If the |
---|
1174 | task's priority were lowered immediately, then priority |
---|
1175 | inversion results. The requested lowering of the task's |
---|
1176 | priority will occur when the task has released all priority |
---|
1177 | inheritance binary semaphores. The task's priority can be |
---|
1178 | increased regardless of the task's use of priority inheritance |
---|
1179 | binary 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 |
---|
1191 | rtems_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 |
---|
1201 | procedure 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: |
---|
1214 | This directive manipulates the execution mode of the calling |
---|
1215 | task. A task's execution mode enables and disables preemption, |
---|
1216 | timeslicing, asynchronous signal processing, as well as |
---|
1217 | specifying the current interrupt level. To modify an execution |
---|
1218 | mode, the mode class(es) to be changed must be specified in the |
---|
1219 | mask parameter and the desired mode(s) must be specified in the |
---|
1220 | mode parameter. |
---|
1221 | |
---|
1222 | @subheading NOTES: |
---|
1223 | The calling task will be preempted if it enables preemption and |
---|
1224 | a higher priority task is ready to run. |
---|
1225 | |
---|
1226 | Enabling timeslicing has no effect if preemption is enabled. |
---|
1227 | |
---|
1228 | A task can obtain its current execution mode, without modifying |
---|
1229 | it, by calling this directive with a mask value of CURRENT_MODE. |
---|
1230 | |
---|
1231 | To temporarily disable the processing of a valid ASR, a task |
---|
1232 | should call this directive with the NO_ASR indicator specified |
---|
1233 | in mode. |
---|
1234 | |
---|
1235 | The set of task mode constants and each mode's corresponding |
---|
1236 | mask 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 |
---|
1317 | rtems_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 |
---|
1327 | procedure 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: |
---|
1342 | This directive returns the note contained in the notepad |
---|
1343 | location of the task specified by id. |
---|
1344 | |
---|
1345 | @subheading NOTES: |
---|
1346 | This directive will not cause the running task to be preempted. |
---|
1347 | |
---|
1348 | If 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 | |
---|
1354 | The sixteen notepad locations can be accessed using the constants |
---|
1355 | @code{NOTEPAD_0} through @code{NOTEPAD_15}. |
---|
1356 | |
---|
1357 | Getting a note of a global task which does not reside on the |
---|
1358 | local node will generate a request to the remote node to obtain |
---|
1359 | the 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 |
---|
1371 | rtems_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 |
---|
1381 | procedure 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: |
---|
1396 | This directive sets the notepad entry for the task specified by |
---|
1397 | id to the value note. |
---|
1398 | |
---|
1399 | @subheading NOTES: |
---|
1400 | If id is set to @code{SELF}, the calling task accesses its own notepad |
---|
1401 | locations. |
---|
1402 | |
---|
1403 | This 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 | |
---|
1409 | The sixteen notepad locations can be accessed using the constants |
---|
1410 | @code{NOTEPAD_0} through @code{NOTEPAD_15}. |
---|
1411 | |
---|
1412 | Setting a notepad location of a global task which does not |
---|
1413 | reside on the local node will generate a request to the remote |
---|
1414 | node 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 |
---|
1426 | rtems_status_code rtems_task_wake_after( |
---|
1427 | rtems_interval ticks |
---|
1428 | ); |
---|
1429 | @end example |
---|
1430 | @end ifset |
---|
1431 | |
---|
1432 | @ifset is-Ada |
---|
1433 | @example |
---|
1434 | procedure 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: |
---|
1445 | This directive blocks the calling task for the specified number |
---|
1446 | of system clock ticks. When the requested interval has elapsed, |
---|
1447 | the task is made ready. The clock_tick directive automatically |
---|
1448 | updates the delay period. |
---|
1449 | |
---|
1450 | @subheading NOTES: |
---|
1451 | Setting the system date and time with the clock_set directive |
---|
1452 | has no effect on a task_wake_after blocked task. |
---|
1453 | |
---|
1454 | A task may give up the processor and remain in the ready state |
---|
1455 | by specifying a value of @code{YIELD_PROCESSOR} in ticks. |
---|
1456 | |
---|
1457 | The maximum timer interval that can be specified is the maximum |
---|
1458 | value which can be represented by the rtems_unsigned32 type. |
---|
1459 | |
---|
1460 | A 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 |
---|
1473 | rtems_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 |
---|
1481 | procedure 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: |
---|
1494 | This directive blocks a task until the date and time specified |
---|
1495 | in time_buffer. At the requested date and time, the calling |
---|
1496 | task will be unblocked and made ready to execute. |
---|
1497 | |
---|
1498 | @subheading NOTES: |
---|
1499 | The ticks portion of time_buffer @value{STRUCTURE} is ignored. The |
---|
1500 | timing granularity of this directive is a second. |
---|
1501 | |
---|
1502 | A clock tick is required to support the functionality of this directive. |
---|