source: rtems/cpukit/include/rtems/rtems/tasks.h @ 1567d927

Last change on this file since 1567d927 was 1567d927, checked in by Sebastian Huber <sebastian.huber@…>, on 09/15/21 at 11:56:16

rtems: Add header files to Doxygen groups

  • Property mode set to 100644
File size: 81.5 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @ingroup RTEMSImplClassicTask
7 *
8 * @brief This header file defines the main parts of the Tasks Manager API.
9 */
10
11/*
12 * Copyright (C) 2013, 2021 embedded brains GmbH (http://www.embedded-brains.de)
13 * Copyright (C) 1988, 2017 On-Line Applications Research Corporation (OAR)
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 *    notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 *    notice, this list of conditions and the following disclaimer in the
22 *    documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37/*
38 * This file is part of the RTEMS quality process and was automatically
39 * generated.  If you find something that needs to be fixed or
40 * worded better please post a report or patch to an RTEMS mailing list
41 * or raise a bug report:
42 *
43 * https://www.rtems.org/bugs.html
44 *
45 * For information on updating and regenerating please refer to the How-To
46 * section in the Software Requirements Engineering chapter of the
47 * RTEMS Software Engineering manual.  The manual is provided as a part of
48 * a release.  For development sources please refer to the online
49 * documentation at:
50 *
51 * https://docs.rtems.org
52 */
53
54/* Generated from spec:/rtems/task/if/header */
55
56#ifndef _RTEMS_RTEMS_TASKS_H
57#define _RTEMS_RTEMS_TASKS_H
58
59#include <stdbool.h>
60#include <stddef.h>
61#include <stdint.h>
62#include <sys/cpuset.h>
63#include <rtems/rtems/attr.h>
64#include <rtems/rtems/modes.h>
65#include <rtems/rtems/status.h>
66#include <rtems/rtems/types.h>
67#include <rtems/score/basedefs.h>
68#include <rtems/score/context.h>
69#include <rtems/score/cpu.h>
70#include <rtems/score/object.h>
71#include <rtems/score/smp.h>
72#include <rtems/score/stack.h>
73#include <rtems/score/watchdogticks.h>
74
75#ifdef __cplusplus
76extern "C" {
77#endif
78
79/* Generated from spec:/rtems/scheduler/if/group */
80
81/**
82 * @defgroup RTEMSAPIClassicScheduler Scheduler Manager
83 *
84 * @ingroup RTEMSAPIClassic
85 *
86 * @brief The scheduling concepts relate to the allocation of processing time
87 *   for tasks.
88 *
89 * The concept of scheduling in real-time systems dictates the ability to
90 * provide an immediate response to specific external events, particularly the
91 * necessity of scheduling tasks to run within a specified time limit after the
92 * occurrence of an event. For example, software embedded in life-support
93 * systems used to monitor hospital patients must take instant action if a
94 * change in the patient’s status is detected.
95 *
96 * The component of RTEMS responsible for providing this capability is
97 * appropriately called the scheduler. The scheduler’s sole purpose is to
98 * allocate the all important resource of processor time to the various tasks
99 * competing for attention.
100 */
101
102/* Generated from spec:/rtems/task/if/group */
103
104/**
105 * @defgroup RTEMSAPIClassicTasks Task Manager
106 *
107 * @ingroup RTEMSAPIClassic
108 *
109 * @brief The Task Manager provides a comprehensive set of directives to
110 *   create, delete, and administer tasks.
111 */
112
113/* Generated from spec:/rtems/task/if/argument */
114
115/**
116 * @ingroup RTEMSAPIClassicTasks
117 *
118 * @brief This integer type represents task argument values.
119 *
120 * @par Notes
121 * The type is an architecture-specific unsigned integer type which is large
122 * enough to represent pointer values and 32-bit unsigned integers.
123 */
124typedef CPU_Uint32ptr rtems_task_argument;
125
126/* Generated from spec:/rtems/task/if/config */
127
128/**
129 * @ingroup RTEMSAPIClassicTasks
130 *
131 * @brief This structure defines the configuration of a task constructed by
132 *   rtems_task_construct().
133 */
134typedef struct {
135  /**
136   * @brief This member defines the name of the task.
137   */
138  rtems_name name;
139
140  /**
141   * @brief This member defines the initial priority of the task.
142   */
143  rtems_task_priority initial_priority;
144
145  /**
146   * @brief This member shall point to the task storage area begin.
147   *
148   * The task storage area will contain the task stack, the thread-local storage,
149   * and the floating-point context on architectures with a separate
150   * floating-point context.
151   *
152   * The task storage area begin address and size should be aligned by
153   * #RTEMS_TASK_STORAGE_ALIGNMENT.  To avoid memory waste, use RTEMS_ALIGNED()
154   * and #RTEMS_TASK_STORAGE_ALIGNMENT to enforce the recommended alignment of a
155   * statically allocated task storage area.
156   */
157  void *storage_area;
158
159  /**
160   * @brief This member defines size of the task storage area in bytes.
161   *
162   * Use the RTEMS_TASK_STORAGE_SIZE() macro to determine the recommended task
163   * storage area size.
164   */
165  size_t storage_size;
166
167  /**
168   * @brief This member defines the maximum thread-local storage size supported
169   *   by the task storage area.
170   *
171   * Use RTEMS_ALIGN_UP() and #RTEMS_TASK_STORAGE_ALIGNMENT to adjust the size to
172   * meet the minimum alignment requirement of a thread-local storage area used
173   * to construct a task.
174   *
175   * If the value is less than the actual thread-local storage size, then the
176   * task construction by rtems_task_construct() fails.
177   *
178   * If the is less than the task storage area size, then the task construction
179   * by rtems_task_construct() fails.
180   *
181   * The actual thread-local storage size is determined when the application
182   * executable is linked.  The ``rtems-exeinfo`` command line tool included in
183   * the RTEMS Tools can be used to obtain the thread-local storage size and
184   * alignment of an application executable.
185   *
186   * The application may configure the maximum thread-local storage size for all
187   * threads explicitly through the #CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE
188   * configuration option.
189   */
190  size_t maximum_thread_local_storage_size;
191
192  /**
193   * @brief This member defines the optional handler to free the task storage
194   *   area.
195   *
196   * It is called on exactly two mutually exclusive occasions.  Firstly, when the
197   * task construction aborts due to a failed task create extension, or secondly,
198   * when the task is deleted.  It is called from task context under protection
199   * of the object allocator lock.  It is allowed to call free() in this handler.
200   * If handler is NULL, then no action will be performed.
201   */
202  void ( *storage_free )( void * );
203
204  /**
205   * @brief This member defines the initial modes of the task.
206   */
207  rtems_mode initial_modes;
208
209  /**
210   * @brief This member defines the attributes of the task.
211   */
212  rtems_attribute attributes;
213} rtems_task_config;
214
215/* Generated from spec:/rtems/task/if/configured-minimum-stack-size */
216
217/**
218 * @ingroup RTEMSAPIClassicTasks
219 *
220 * @brief This constant can be used to indicate that the task should be created
221 *   with the configured minimum stack size.
222 *
223 * Using this constant when specifying the task stack size indicates that this
224 * task is to be created with a stack size of the minimum stack size that was
225 * configured by the application. If not explicitly configured by the
226 * application, the default configured minimum stack size is
227 * #RTEMS_MINIMUM_STACK_SIZE which depends on the target architecture. Since
228 * this uses the configured minimum stack size value, you may get a stack size
229 * that is smaller or larger than the recommended minimum. This can be used to
230 * provide large stacks for all tasks on complex applications or small stacks
231 * on applications that are trying to conserve memory.
232 */
233#define RTEMS_CONFIGURED_MINIMUM_STACK_SIZE 0
234
235/* Generated from spec:/rtems/task/if/current-priority */
236
237/**
238 * @ingroup RTEMSAPIClassicTasks
239 *
240 * @brief This constant is passed to rtems_task_set_priority() when the caller
241 *   wants to obtain the current priority.
242 */
243#define RTEMS_CURRENT_PRIORITY 0
244
245/* Generated from spec:/rtems/task/if/task */
246
247/**
248 * @ingroup RTEMSAPIClassicTasks
249 *
250 * @brief This type defines the return type of task entry points.
251 *
252 * This type can be used to document task entry points in the source code.
253 */
254typedef void rtems_task;
255
256/* Generated from spec:/rtems/task/if/entry */
257
258/**
259 * @ingroup RTEMSAPIClassicTasks
260 *
261 * @brief This type defines the entry point of an RTEMS task.
262 */
263typedef rtems_task ( *rtems_task_entry )( rtems_task_argument );
264
265/* Generated from spec:/rtems/task/if/initialization-table */
266
267/**
268 * @ingroup RTEMSAPIClassicTasks
269 *
270 * @brief This structure defines the properties of the Classic API user
271 *   initialization task.
272 */
273typedef struct {
274  /**
275   * @brief This member defines the task name.
276   */
277  rtems_name name;
278
279  /**
280   * @brief This member defines the task stack size in bytes.
281   */
282  size_t stack_size;
283
284  /**
285   * @brief This member defines the initial task priority.
286   */
287  rtems_task_priority initial_priority;
288
289  /**
290   * @brief This member defines the attribute set of the task.
291   */
292  rtems_attribute attribute_set;
293
294  /**
295   * @brief This member defines the entry point of the task.
296   */
297  rtems_task_entry entry_point;
298
299  /**
300   * @brief This member defines the initial modes of the task.
301   */
302  rtems_mode mode_set;
303
304  /**
305   * @brief This member defines the entry point argument of the task.
306   */
307  rtems_task_argument argument;
308} rtems_initialization_tasks_table;
309
310/* Generated from spec:/rtems/task/if/minimum-priority */
311
312/**
313 * @ingroup RTEMSAPIClassicTasks
314 *
315 * @brief This compile time constant provides the highest (most important) task
316 *   priority settable by the API.
317 */
318#define RTEMS_MINIMUM_PRIORITY 1
319
320/* Generated from spec:/rtems/task/if/minimum-stack-size */
321
322/**
323 * @ingroup RTEMSAPIClassicTasks
324 *
325 * @brief This compile time constant provides the minimum task stack size
326 *   recommended for the target architecture.
327 *
328 * It is the minimum stack size recommended for use on this processor.  This
329 * value is selected by the RTEMS maintainers conservatively to minimize the
330 * risk of blown stacks for most user applications.  Using this constant when
331 * specifying the task stack size, indicates that the stack size will be at
332 * least RTEMS_MINIMUM_STACK_SIZE bytes in size.  If the user configured
333 * minimum stack size (see #CONFIGURE_MINIMUM_TASK_STACK_SIZE) is larger than
334 * the recommended minimum, then it will be used.
335 */
336#define RTEMS_MINIMUM_STACK_SIZE STACK_MINIMUM_SIZE
337
338/* Generated from spec:/rtems/task/if/no-priority */
339
340/**
341 * @ingroup RTEMSAPIClassicTasks
342 *
343 * @brief This compile time constant may be used for the
344 *   rtems_task_set_priority() directive to get the current task priority.
345 */
346#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY
347
348/* Generated from spec:/rtems/task/if/self-define */
349
350/**
351 * @ingroup RTEMSAPIClassicTasks
352 *
353 * @brief This compile time constant may be used to identify the calling task
354 *   in task related directives.
355 */
356#define RTEMS_SELF OBJECTS_ID_OF_SELF
357
358/* Generated from spec:/rtems/task/if/storage-alignment */
359
360/**
361 * @ingroup RTEMSAPIClassicTasks
362 *
363 * @brief This compile time constant defines the recommended alignment of a
364 *   task storage area in bytes.
365 *
366 * @par Notes
367 * Use it with RTEMS_ALIGNED() to define the alignment of a statically
368 * allocated task storage area.
369 */
370#define RTEMS_TASK_STORAGE_ALIGNMENT CPU_STACK_ALIGNMENT
371
372/* Generated from spec:/rtems/task/if/storage-size */
373
374/**
375 * @ingroup RTEMSAPIClassicTasks
376 *
377 * @brief Gets the recommended task storage area size for the size and task
378 *   attributes.
379 *
380 * @param _size is the size dedicated to the task stack and thread-local
381 *   storage in bytes.
382 *
383 * @param _attributes is the attribute set of the task using the storage area.
384 *
385 * @return Returns the recommended task storage area size calculated from the
386 *   input parameters.
387 */
388#if CPU_ALL_TASKS_ARE_FP == TRUE
389  #define RTEMS_TASK_STORAGE_SIZE( _size, _attributes ) \
390    ( ( _size ) + CONTEXT_FP_SIZE )
391#else
392  #define RTEMS_TASK_STORAGE_SIZE( _size, _attributes ) \
393    ( ( _size ) + \
394      ( ( ( _attributes ) & RTEMS_FLOATING_POINT ) != 0 ? \
395        CONTEXT_FP_SIZE : 0 ) )
396#endif
397
398/* Generated from spec:/rtems/task/if/tcb */
399
400/**
401 * @ingroup RTEMSAPIClassicTasks
402 *
403 * @brief This structure represents the TCB.
404 */
405typedef struct _Thread_Control rtems_tcb;
406
407/* Generated from spec:/rtems/task/if/visitor */
408
409/**
410 * @ingroup RTEMSAPIClassicTasks
411 *
412 * @brief Visitor routines invoked by rtems_task_iterate() shall have this
413 *   type.
414 */
415typedef bool( *rtems_task_visitor )( rtems_tcb *, void * );
416
417/* Generated from spec:/rtems/task/if/yield-processor */
418
419/**
420 * @ingroup RTEMSAPIClassicTasks
421 *
422 * @brief This compile time constant may be passed to the
423 *   rtems_task_wake_after() directive as the interval when a task wishes to
424 *   yield the processor.
425 */
426#define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT
427
428/* Generated from spec:/score/if/maximum-priority */
429
430/**
431 * @brief Returns the maximum priority of the scheduler with index zero.
432 */
433rtems_task_priority _RTEMS_Maximum_priority( void );
434
435/* Generated from spec:/rtems/task/if/maximum-priority */
436
437/**
438 * @ingroup RTEMSAPIClassicTasks
439 *
440 * @brief This constant variable provides the lowest (least important) task
441 *   priority of the first configured scheduler.
442 */
443#define RTEMS_MAXIMUM_PRIORITY _RTEMS_Maximum_priority()
444
445/* Generated from spec:/rtems/scheduler/if/ident */
446
447/**
448 * @ingroup RTEMSAPIClassicScheduler
449 *
450 * @brief Identifies a scheduler by the object name.
451 *
452 * @param name is the scheduler name to look up.
453 *
454 * @param[out] id is the pointer to an ::rtems_id object.  When the directive
455 *   call is successful, the identifier of the scheduler will be stored in this
456 *   object.
457 *
458 * This directive obtains a scheduler identifier associated with the scheduler
459 * name specified in ``name``.
460 *
461 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
462 *
463 * @retval ::RTEMS_INVALID_NAME There was no scheduler associated with the
464 *   name.
465 *
466 * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL.
467 *
468 * @par Notes
469 * @parblock
470 * The scheduler name is determined by the scheduler configuration.
471 *
472 * The scheduler identifier is used with other scheduler related directives to
473 * access the scheduler.
474 * @endparblock
475 *
476 * @par Constraints
477 * @parblock
478 * The following constraints apply to this directive:
479 *
480 * * The directive may be called from within any runtime context.
481 *
482 * * The directive will not cause the calling task to be preempted.
483 * @endparblock
484 */
485rtems_status_code rtems_scheduler_ident( rtems_name name, rtems_id *id );
486
487/* Generated from spec:/rtems/scheduler/if/ident-by-processor */
488
489/**
490 * @ingroup RTEMSAPIClassicScheduler
491 *
492 * @brief Identifies a scheduler by the processor index.
493 *
494 * @param cpu_index is the processor index to identify the scheduler.
495 *
496 * @param[out] id is the pointer to an ::rtems_id object.  When the directive
497 *   call is successful, the identifier of the scheduler will be stored in this
498 *   object.
499 *
500 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
501 *
502 * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL.
503 *
504 * @retval ::RTEMS_INVALID_NAME The processor index was invalid.
505 *
506 * @retval ::RTEMS_INCORRECT_STATE The processor index was valid, however, the
507 *   corresponding processor was not owned by a scheduler.
508 *
509 * @par Constraints
510 * @parblock
511 * The following constraints apply to this directive:
512 *
513 * * The directive may be called from within any runtime context.
514 *
515 * * The directive will not cause the calling task to be preempted.
516 * @endparblock
517 */
518rtems_status_code rtems_scheduler_ident_by_processor(
519  uint32_t  cpu_index,
520  rtems_id *id
521);
522
523/* Generated from spec:/rtems/scheduler/if/ident-by-processor-set */
524
525/**
526 * @ingroup RTEMSAPIClassicScheduler
527 *
528 * @brief Identifies a scheduler by the processor set.
529 *
530 * @param cpusetsize is the size of the processor set referenced by ``cpuset``
531 *   in bytes.  The size shall be positive.
532 *
533 * @param cpuset is the pointer to a cpu_set_t.  The referenced processor set
534 *   will be used to identify the scheduler.
535 *
536 * @param[out] id is the pointer to an ::rtems_id object.  When the directive
537 *   call is successful, the identifier of the scheduler will be stored in this
538 *   object.
539 *
540 * The scheduler is selected according to the highest numbered online processor
541 * in the specified processor set.
542 *
543 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
544 *
545 * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL.
546 *
547 * @retval ::RTEMS_INVALID_ADDRESS The ``cpuset`` parameter was NULL.
548 *
549 * @retval ::RTEMS_INVALID_SIZE The processor set size was invalid.
550 *
551 * @retval ::RTEMS_INVALID_NAME The processor set contained no online
552 *   processor.
553 *
554 * @retval ::RTEMS_INCORRECT_STATE The processor set was valid, however, the
555 *   highest numbered online processor in the processor set was not owned by a
556 *   scheduler.
557 *
558 * @par Constraints
559 * @parblock
560 * The following constraints apply to this directive:
561 *
562 * * The directive may be called from within any runtime context.
563 *
564 * * The directive will not cause the calling task to be preempted.
565 * @endparblock
566 */
567rtems_status_code rtems_scheduler_ident_by_processor_set(
568  size_t           cpusetsize,
569  const cpu_set_t *cpuset,
570  rtems_id        *id
571);
572
573/* Generated from spec:/rtems/scheduler/if/get-maximum-priority */
574
575/**
576 * @ingroup RTEMSAPIClassicScheduler
577 *
578 * @brief Gets the maximum task priority of the scheduler.
579 *
580 * @param scheduler_id is the scheduler identifier.
581 *
582 * @param[out] priority is the pointer to an ::rtems_task_priority object.
583 *   When the directive the maximum priority of the scheduler will be stored in
584 *   this object.
585 *
586 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
587 *
588 * @retval ::RTEMS_INVALID_ID There was no scheduler associated with the
589 *   identifier specified by ``scheduler_id``.
590 *
591 * @retval ::RTEMS_INVALID_ADDRESS The ``priority`` parameter was NULL.
592 *
593 * @par Constraints
594 * @parblock
595 * The following constraints apply to this directive:
596 *
597 * * The directive may be called from within any runtime context.
598 *
599 * * The directive will not cause the calling task to be preempted.
600 * @endparblock
601 */
602rtems_status_code rtems_scheduler_get_maximum_priority(
603  rtems_id             scheduler_id,
604  rtems_task_priority *priority
605);
606
607/* Generated from spec:/rtems/scheduler/if/map-priority-to-posix */
608
609/**
610 * @ingroup RTEMSAPIClassicScheduler
611 *
612 * @brief Maps a Classic API task priority to the corresponding POSIX thread
613 *   priority.
614 *
615 * @param scheduler_id is the scheduler identifier.
616 *
617 * @param priority is the Classic API task priority to map.
618 *
619 * @param[out] posix_priority is the pointer to an ``int`` object.  When the
620 *   directive call is successful, the POSIX thread priority value
621 *   corresponding to the specified Classic API task priority value will be
622 *   stored in this object.
623 *
624 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
625 *
626 * @retval ::RTEMS_INVALID_ADDRESS The ``posix_priority`` parameter was NULL.
627 *
628 * @retval ::RTEMS_INVALID_ID There was no scheduler associated with the
629 *   identifier specified by ``scheduler_id``.
630 *
631 * @retval ::RTEMS_INVALID_PRIORITY The Classic API task priority was invalid.
632 *
633 * @par Constraints
634 * @parblock
635 * The following constraints apply to this directive:
636 *
637 * * The directive may be called from within any runtime context.
638 *
639 * * The directive will not cause the calling task to be preempted.
640 * @endparblock
641 */
642rtems_status_code rtems_scheduler_map_priority_to_posix(
643  rtems_id            scheduler_id,
644  rtems_task_priority priority,
645  int                *posix_priority
646);
647
648/* Generated from spec:/rtems/scheduler/if/map-priority-from-posix */
649
650/**
651 * @ingroup RTEMSAPIClassicScheduler
652 *
653 * @brief Maps a POSIX thread priority to the corresponding Classic API task
654 *   priority.
655 *
656 * @param scheduler_id is the scheduler identifier.
657 *
658 * @param posix_priority is the POSIX thread priority to map.
659 *
660 * @param[out] priority is the pointer to an ::rtems_task_priority object.
661 *   When the directive call is successful, the Classic API task priority value
662 *   corresponding to the specified POSIX thread priority value will be stored
663 *   in this object.
664 *
665 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
666 *
667 * @retval ::RTEMS_INVALID_ADDRESS The ``priority`` parameter was NULL.
668 *
669 * @retval ::RTEMS_INVALID_ID There was no scheduler associated with the
670 *   identifier specified by ``scheduler_id``.
671 *
672 * @retval ::RTEMS_INVALID_PRIORITY The POSIX thread priority was invalid.
673 *
674 * @par Constraints
675 * @parblock
676 * The following constraints apply to this directive:
677 *
678 * * The directive may be called from within any runtime context.
679 *
680 * * The directive will not cause the calling task to be preempted.
681 * @endparblock
682 */
683rtems_status_code rtems_scheduler_map_priority_from_posix(
684  rtems_id             scheduler_id,
685  int                  posix_priority,
686  rtems_task_priority *priority
687);
688
689/* Generated from spec:/rtems/scheduler/if/get-processor */
690
691/**
692 * @ingroup RTEMSAPIClassicScheduler
693 *
694 * @brief Returns the index of the current processor.
695 *
696 * Where the system was built with SMP support disabled, this directive
697 * evaluates to a compile time constant of zero.
698 *
699 * Where the system was built with SMP support enabled, this directive returns
700 * the index of the current processor.  The set of processor indices is the
701 * range of integers starting with zero up to
702 * rtems_scheduler_get_processor_maximum() minus one.
703 *
704 * @return Returns the index of the current processor.
705 *
706 * @par Notes
707 * Outside of sections with disabled thread dispatching the current processor
708 * index may change after every instruction since the thread may migrate from
709 * one processor to another.  Sections with disabled interrupts are sections
710 * with thread dispatching disabled.
711 *
712 * @par Constraints
713 * @parblock
714 * The following constraints apply to this directive:
715 *
716 * * The directive may be called from within any runtime context.
717 *
718 * * The directive will not cause the calling task to be preempted.
719 * @endparblock
720 */
721uint32_t rtems_scheduler_get_processor( void );
722
723/* Generated from spec:/rtems/scheduler/if/get-processor-macro */
724#define rtems_scheduler_get_processor() _SMP_Get_current_processor()
725
726/* Generated from spec:/rtems/scheduler/if/get-processor-maximum */
727
728/**
729 * @ingroup RTEMSAPIClassicScheduler
730 *
731 * @brief Returns the processor maximum supported by the system.
732 *
733 * Where the system was built with SMP support disabled, this directive
734 * evaluates to a compile time constant of one.
735 *
736 * Where the system was built with SMP support enabled, this directive returns
737 * the minimum of the processors (physically or virtually) available at the
738 * target and the configured processor maximum (see
739 * #CONFIGURE_MAXIMUM_PROCESSORS).  Not all processors in the range from
740 * processor index zero to the last processor index (which is the processor
741 * maximum minus one) may be configured to be used by a scheduler or may be
742 * online (online processors have a scheduler assigned).
743 *
744 * @return Returns the processor maximum supported by the system.
745 *
746 * @par Constraints
747 * @parblock
748 * The following constraints apply to this directive:
749 *
750 * * The directive may be called from within any runtime context.
751 *
752 * * The directive will not cause the calling task to be preempted.
753 * @endparblock
754 */
755uint32_t rtems_scheduler_get_processor_maximum( void );
756
757/* Generated from spec:/rtems/scheduler/if/get-processor-maximum-macro */
758#define rtems_scheduler_get_processor_maximum() _SMP_Get_processor_maximum()
759
760/* Generated from spec:/rtems/scheduler/if/get-processor-set */
761
762/**
763 * @ingroup RTEMSAPIClassicScheduler
764 *
765 * @brief Gets the set of processors owned by the scheduler.
766 *
767 * @param scheduler_id is the scheduler identifier.
768 *
769 * @param cpusetsize is the size of the processor set referenced by ``cpuset``
770 *   in bytes.
771 *
772 * @param[out] cpuset is the pointer to a cpu_set_t object.  When the directive
773 *   call is successful, the processor set of the scheduler will be stored in
774 *   this object.  A set bit in the processor set means that the corresponding
775 *   processor is owned by the scheduler, otherwise the bit is cleared.
776 *
777 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
778 *
779 * @retval ::RTEMS_INVALID_ADDRESS The ``cpuset`` parameter was NULL.
780 *
781 * @retval ::RTEMS_INVALID_ID There was no scheduler associated with the
782 *   identifier specified by ``scheduler_id``.
783 *
784 * @retval ::RTEMS_INVALID_SIZE The provided processor set was too small for
785 *   the set of processors owned by the scheduler.
786 *
787 * @par Constraints
788 * @parblock
789 * The following constraints apply to this directive:
790 *
791 * * The directive may be called from within any runtime context.
792 *
793 * * The directive will not cause the calling task to be preempted.
794 * @endparblock
795 */
796rtems_status_code rtems_scheduler_get_processor_set(
797  rtems_id   scheduler_id,
798  size_t     cpusetsize,
799  cpu_set_t *cpuset
800);
801
802/* Generated from spec:/rtems/scheduler/if/add-processor */
803
804/**
805 * @ingroup RTEMSAPIClassicScheduler
806 *
807 * @brief Adds the processor to the set of processors owned by the scheduler.
808 *
809 * @param scheduler_id is the scheduler identifier.
810 *
811 * @param cpu_index is the index of the processor to add.
812 *
813 * This directive adds the processor specified by the ``cpu_index`` to the
814 * scheduler specified by ``scheduler_id``.
815 *
816 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
817 *
818 * @retval ::RTEMS_INVALID_ID There was no scheduler associated with the
819 *   identifier specified by ``scheduler_id``.
820 *
821 * @retval ::RTEMS_NOT_CONFIGURED The processor was not configured to be used
822 *   by the application.
823 *
824 * @retval ::RTEMS_INCORRECT_STATE The processor was configured to be used by
825 *   the application, however, it was not online.
826 *
827 * @retval ::RTEMS_RESOURCE_IN_USE The processor was already assigned to a
828 *   scheduler.
829 *
830 * @par Constraints
831 * @parblock
832 * The following constraints apply to this directive:
833 *
834 * * The directive may be called from within device driver initialization
835 *   context.
836 *
837 * * The directive may be called from within task context.
838 *
839 * * The directive may obtain and release the object allocator mutex.  This may
840 *   cause the calling task to be preempted.
841 * @endparblock
842 */
843rtems_status_code rtems_scheduler_add_processor(
844  rtems_id scheduler_id,
845  uint32_t cpu_index
846);
847
848/* Generated from spec:/rtems/scheduler/if/remove-processor */
849
850/**
851 * @ingroup RTEMSAPIClassicScheduler
852 *
853 * @brief Removes the processor from the set of processors owned by the
854 *   scheduler.
855 *
856 * @param scheduler_id is the scheduler identifier.
857 *
858 * @param cpu_index is the index of the processor to remove.
859 *
860 * This directive removes the processor specified by the ``cpu_index`` from the
861 * scheduler specified by ``scheduler_id``.
862 *
863 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
864 *
865 * @retval ::RTEMS_INVALID_ID There was no scheduler associated with the
866 *   identifier specified by ``scheduler_id``.
867 *
868 * @retval ::RTEMS_INVALID_NUMBER The processor was not owned by the scheduler.
869 *
870 * @retval ::RTEMS_RESOURCE_IN_USE The set of processors owned by the scheduler
871 *   would have been empty after the processor removal and there was at least
872 *   one non-idle task that used this scheduler as its home scheduler.
873 *
874 * @par Notes
875 * Removing a processor from a scheduler is a complex operation that involves
876 * all tasks of the system.
877 *
878 * @par Constraints
879 * @parblock
880 * The following constraints apply to this directive:
881 *
882 * * The directive may be called from within device driver initialization
883 *   context.
884 *
885 * * The directive may be called from within task context.
886 *
887 * * The directive may obtain and release the object allocator mutex.  This may
888 *   cause the calling task to be preempted.
889 * @endparblock
890 */
891rtems_status_code rtems_scheduler_remove_processor(
892  rtems_id scheduler_id,
893  uint32_t cpu_index
894);
895
896/* Generated from spec:/rtems/task/if/create */
897
898/**
899 * @ingroup RTEMSAPIClassicTasks
900 *
901 * @brief Creates a task.
902 *
903 * @param name is the object name of the task.
904 *
905 * @param initial_priority is the initial task priority.
906 *
907 * @param stack_size is the task stack size in bytes.
908 *
909 * @param initial_modes is the initial mode set of the task.
910 *
911 * @param attribute_set is the attribute set of the task.
912 *
913 * @param[out] id is the pointer to an ::rtems_id object.  When the directive
914 *   call is successful, the identifier of the created task will be stored in
915 *   this object.
916 *
917 * This directive creates a task which resides on the local node.  The task has
918 * the user-defined object name specified in ``name``.  The assigned object
919 * identifier is returned in ``id``.  This identifier is used to access the
920 * task with other task related directives.
921 *
922 * The **initial priority** of the task is specified in ``initial_priority``.
923 * The scheduler of the created task is the scheduler of the calling task at
924 * some point during the task creation.  The initial task priority specified in
925 * ``initial_priority`` shall be valid for this scheduler.
926 *
927 * The **stack size** of the task is specified in ``stack_size``.  If the
928 * requested stack size is less than the configured minimum stack size, then
929 * RTEMS will use the configured minimum as the stack size for this task.  The
930 * configured minimum stack size is defined by the
931 * #CONFIGURE_MINIMUM_TASK_STACK_SIZE application configuration option.  In
932 * addition to being able to specify the task stack size as a integer, there
933 * are two constants which may be specified:
934 *
935 * * The #RTEMS_MINIMUM_STACK_SIZE constant can be specified to use the
936 *   **recommended minimum stack size** for the target processor.  This value
937 *   is selected by the RTEMS maintainers conservatively to minimize the risk
938 *   of blown stacks for most user applications.  Using this constant when
939 *   specifying the task stack size, indicates that the stack size will be at
940 *   least #RTEMS_MINIMUM_STACK_SIZE bytes in size.  If the user configured
941 *   minimum stack size is larger than the recommended minimum, then it will be
942 *   used.
943 *
944 * * The #RTEMS_CONFIGURED_MINIMUM_STACK_SIZE constant can be specified to use
945 *   the minimum stack size that was configured by the application.  If not
946 *   explicitly configured by the application, the default configured minimum
947 *   stack size is the target processor dependent value
948 *   #RTEMS_MINIMUM_STACK_SIZE.  Since this uses the configured minimum stack
949 *   size value, you may get a stack size that is smaller or larger than the
950 *   recommended minimum.  This can be used to provide large stacks for all
951 *   tasks on complex applications or small stacks on applications that are
952 *   trying to conserve memory.
953 *
954 * The **initial mode set** specified in ``initial_modes`` is built through a
955 * *bitwise or* of the mode constants described below.  Not all combinations of
956 * modes are allowed.  Some modes are mutually exclusive.  If mutually
957 * exclusive modes are combined, the behaviour is undefined.  Default task
958 * modes can be selected by using the #RTEMS_DEFAULT_MODES constant.  The task
959 * mode set defines
960 *
961 * * the preemption mode of the task: #RTEMS_PREEMPT (default) or
962 *   #RTEMS_NO_PREEMPT,
963 *
964 * * the timeslicing mode of the task: #RTEMS_TIMESLICE or #RTEMS_NO_TIMESLICE
965 *   (default),
966 *
967 * * the ASR processing mode of the task: #RTEMS_ASR (default) or
968 *   #RTEMS_NO_ASR,
969 *
970 * * the interrupt level of the task: RTEMS_INTERRUPT_LEVEL() with a default of
971 *   ``RTEMS_INTERRUPT_LEVEL( 0 )`` which is associated with enabled
972 *   interrupts.
973 *
974 * The **initial preemption mode** of the task is enabled or disabled.
975 *
976 * * An **enabled preemption** is the default and can be emphasized through the
977 *   use of the #RTEMS_PREEMPT mode constant.
978 *
979 * * A **disabled preemption** is set by the #RTEMS_NO_PREEMPT mode constant.
980 *
981 * The **initial timeslicing mode** of the task is enabled or disabled.
982 *
983 * * A **disabled timeslicing** is the default and can be emphasized through
984 *   the use of the #RTEMS_NO_TIMESLICE mode constant.
985 *
986 * * An **enabled timeslicing** is set by the #RTEMS_TIMESLICE mode constant.
987 *
988 * The **initial ASR processing mode** of the task is enabled or disabled.
989 *
990 * * An **enabled ASR processing** is the default and can be emphasized through
991 *   the use of the #RTEMS_ASR mode constant.
992 *
993 * * A **disabled ASR processing** is set by the #RTEMS_NO_ASR mode constant.
994 *
995 * The **initial interrupt level mode** of the task is defined by
996 * RTEMS_INTERRUPT_LEVEL().
997 *
998 * * Task execution with **interrupts enabled** the default and can be
999 *   emphasized through the use of the RTEMS_INTERRUPT_LEVEL() mode macro with
1000 *   a value of zero (0) for the parameter.  An interrupt level of zero is
1001 *   associated with enabled interrupts on all target processors.
1002 *
1003 * * Task execution at a **non-zero interrupt level** can be specified by the
1004 *   RTEMS_INTERRUPT_LEVEL() mode macro with a non-zero value for the
1005 *   parameter.  The interrupt level portion of the task mode supports a
1006 *   maximum of 256 interrupt levels.  These levels are mapped onto the
1007 *   interrupt levels actually supported by the target processor in a processor
1008 *   dependent fashion.
1009 *
1010 * The **attribute set** specified in ``attribute_set`` is built through a
1011 * *bitwise or* of the attribute constants described below.  Not all
1012 * combinations of attributes are allowed.  Some attributes are mutually
1013 * exclusive.  If mutually exclusive attributes are combined, the behaviour is
1014 * undefined.  Attributes not mentioned below are not evaluated by this
1015 * directive and have no effect.  Default attributes can be selected by using
1016 * the #RTEMS_DEFAULT_ATTRIBUTES constant.  The attribute set defines
1017 *
1018 * * the scope of the task: #RTEMS_LOCAL (default) or #RTEMS_GLOBAL and
1019 *
1020 * * the floating-point unit use of the task: #RTEMS_FLOATING_POINT or
1021 *   #RTEMS_NO_FLOATING_POINT (default).
1022 *
1023 * The task has a local or global **scope** in a multiprocessing network (this
1024 * attribute does not refer to SMP systems).  The scope is selected by the
1025 * mutually exclusive #RTEMS_LOCAL and #RTEMS_GLOBAL attributes.
1026 *
1027 * * A **local scope** is the default and can be emphasized through the use of
1028 *   the #RTEMS_LOCAL attribute.  A local task can be only used by the node
1029 *   which created it.
1030 *
1031 * * A **global scope** is established if the #RTEMS_GLOBAL attribute is set.
1032 *   Setting the global attribute in a single node system has no effect.the
1033 *
1034 * The **use of the floating-point unit** is selected by the mutually exclusive
1035 * #RTEMS_FLOATING_POINT and #RTEMS_NO_FLOATING_POINT attributes.  On some
1036 * target processors, the use of the floating-point unit can be enabled or
1037 * disabled for each task.  Other target processors may have no hardware
1038 * floating-point unit or enable the use of the floating-point unit for all
1039 * tasks.  Consult the *RTEMS CPU Architecture Supplement* for the details.
1040 *
1041 * * A **disabled floating-point unit** is the default and can be emphasized
1042 *   through use of the #RTEMS_NO_FLOATING_POINT attribute.  For performance
1043 *   reasons, it is recommended that tasks not using the floating-point unit
1044 *   should specify this attribute.
1045 *
1046 * * An **enabled floating-point unit** is selected by the
1047 *   #RTEMS_FLOATING_POINT attribute.
1048 *
1049 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
1050 *
1051 * @retval ::RTEMS_INVALID_NAME The ``name`` parameter was invalid.
1052 *
1053 * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL.
1054 *
1055 * @retval ::RTEMS_INVALID_PRIORITY The ``initial_priority`` was invalid.
1056 *
1057 * @retval ::RTEMS_TOO_MANY There was no inactive object available to create a
1058 *   task.  The number of tasks available to the application is configured
1059 *   through the #CONFIGURE_MAXIMUM_TASKS application configuration option.
1060 *
1061 * @retval ::RTEMS_TOO_MANY In multiprocessing configurations, there was no
1062 *   inactive global object available to create a global task.  The number of
1063 *   global objects available to the application is configured through the
1064 *   #CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS application configuration option.
1065 *
1066 * @retval ::RTEMS_UNSATISFIED There was not enough memory to allocate the task
1067 *   storage area.  The task storage area contains the task stack, the
1068 *   thread-local storage, and the floating point context.
1069 *
1070 * @retval ::RTEMS_UNSATISFIED One of the task create extensions failed to
1071 *   create the task.
1072 *
1073 * @retval ::RTEMS_UNSATISFIED In SMP configurations, the non-preemption mode
1074 *   was not supported.
1075 *
1076 * @retval ::RTEMS_UNSATISFIED In SMP configurations, the interrupt level mode
1077 *   was not supported.
1078 *
1079 * @par Notes
1080 * @parblock
1081 * The task processor affinity is initialized to the set of online processors.
1082 *
1083 * When created, a task is placed in the dormant state and can only be made
1084 * ready to execute using the directive rtems_task_start().
1085 *
1086 * Application developers should consider the stack usage of the device drivers
1087 * when calculating the stack size required for tasks which utilize the driver.
1088 * The task stack size shall account for an target processor dependent
1089 * interrupt stack frame which may be placed on the stack of the interrupted
1090 * task while servicing an interrupt.  The stack checker may be used to monitor
1091 * the stack usage, see #CONFIGURE_STACK_CHECKER_ENABLED.
1092 *
1093 * For control and maintenance of the task, RTEMS allocates a TCB from the
1094 * local TCB free pool and initializes it.
1095 *
1096 * The TCB for a global task is allocated on the local node.  Task should not
1097 * be made global unless remote tasks must interact with the task.  This is to
1098 * avoid the system overhead incurred by the creation of a global task.  When a
1099 * global task is created, the task's name and identifier must be transmitted
1100 * to every node in the system for insertion in the local copy of the global
1101 * object table.
1102 * @endparblock
1103 *
1104 * @par Constraints
1105 * @parblock
1106 * The following constraints apply to this directive:
1107 *
1108 * * The directive may be called from within device driver initialization
1109 *   context.
1110 *
1111 * * The directive may be called from within task context.
1112 *
1113 * * The directive may obtain and release the object allocator mutex.  This may
1114 *   cause the calling task to be preempted.
1115 *
1116 * * When the directive operates on a global object, the directive sends a
1117 *   message to remote nodes.  This may preempt the calling task.
1118 *
1119 * * The number of tasks available to the application is configured through the
1120 *   #CONFIGURE_MAXIMUM_TASKS application configuration option.
1121 *
1122 * * Where the object class corresponding to the directive is configured to use
1123 *   unlimited objects, the directive may allocate memory from the RTEMS
1124 *   Workspace.
1125 *
1126 * * The number of global objects available to the application is configured
1127 *   through the #CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS application configuration
1128 *   option.
1129 * @endparblock
1130 */
1131rtems_status_code rtems_task_create(
1132  rtems_name          name,
1133  rtems_task_priority initial_priority,
1134  size_t              stack_size,
1135  rtems_mode          initial_modes,
1136  rtems_attribute     attribute_set,
1137  rtems_id           *id
1138);
1139
1140/* Generated from spec:/rtems/task/if/construct */
1141
1142/**
1143 * @ingroup RTEMSAPIClassicTasks
1144 *
1145 * @brief Constructs a task from the specified task configuration.
1146 *
1147 * @param config is the task configuration.
1148 *
1149 * @param[out] id is the pointer to an ::rtems_id object.  When the directive
1150 *   call is successful, the identifier of the constructed task will be stored
1151 *   in this object.
1152 *
1153 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
1154 *
1155 * @retval ::RTEMS_INVALID_ADDRESS The ``config`` parameter was NULL.
1156 *
1157 * @retval ::RTEMS_INVALID_NAME The task name was invalid.
1158 *
1159 * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL.
1160 *
1161 * @retval ::RTEMS_INVALID_PRIORITY The initial task priority was invalid.
1162 *
1163 * @retval ::RTEMS_INVALID_SIZE The thread-local storage size is greater than
1164 *   the maximum thread-local storage size specified in the task configuration.
1165 *   The thread-local storage size is determined by the thread-local variables
1166 *   used by the application and #CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE.
1167 *
1168 * @retval ::RTEMS_INVALID_SIZE The task storage area was too small to provide
1169 *   a task stack of the configured minimum size, see
1170 *   #CONFIGURE_MINIMUM_TASK_STACK_SIZE. The task storage area contains the
1171 *   task stack, the thread-local storage, and the floating-point context on
1172 *   architectures with a separate floating-point context.
1173 *
1174 * @retval ::RTEMS_TOO_MANY There was no inactive task object available to
1175 *   construct a task.
1176 *
1177 * @retval ::RTEMS_TOO_MANY In multiprocessing configurations, there was no
1178 *   inactive global object available to construct a global task.
1179 *
1180 * @retval ::RTEMS_UNSATISFIED One of the task create extensions failed during
1181 *   the task construction.
1182 *
1183 * @retval ::RTEMS_UNSATISFIED In SMP configurations, the non-preemption mode
1184 *   was not supported.
1185 *
1186 * @retval ::RTEMS_UNSATISFIED In SMP configurations, the interrupt level mode
1187 *   was not supported.
1188 *
1189 * @par Notes
1190 * @parblock
1191 * In contrast to tasks created by rtems_task_create(), the tasks constructed
1192 * by this directive use a user-provided task storage area.  The task storage
1193 * area contains the task stack, the thread-local storage, and the
1194 * floating-point context on architectures with a separate floating-point
1195 * context.
1196 *
1197 * This directive is intended for applications which do not want to use the
1198 * RTEMS Workspace and instead statically allocate all operating system
1199 * resources.  It is not recommended to use rtems_task_create() and
1200 * rtems_task_construct() together in an application.  It is also not
1201 * recommended to use rtems_task_construct() for drivers or general purpose
1202 * libraries.  The reason for these recommendations is that the task
1203 * configuration needs settings which can be only given with a through
1204 * knowledge of the application resources.
1205 *
1206 * An application based solely on static allocation can avoid any runtime
1207 * memory allocators.  This can simplify the application architecture as well
1208 * as any analysis that may be required.
1209 *
1210 * The stack space estimate done by <rtems/confdefs.h> assumes that all tasks
1211 * are created by rtems_task_create().  The estimate can be adjusted to take
1212 * user-provided task storage areas into account through the
1213 * #CONFIGURE_MINIMUM_TASKS_WITH_USER_PROVIDED_STORAGE application
1214 * configuration option.
1215 *
1216 * The #CONFIGURE_MAXIMUM_TASKS should include tasks constructed by
1217 * rtems_task_construct().
1218 * @endparblock
1219 *
1220 * @par Constraints
1221 * @parblock
1222 * The following constraints apply to this directive:
1223 *
1224 * * The directive may be called from within device driver initialization
1225 *   context.
1226 *
1227 * * The directive may be called from within task context.
1228 *
1229 * * The directive may obtain and release the object allocator mutex.  This may
1230 *   cause the calling task to be preempted.
1231 *
1232 * * When the directive operates on a global object, the directive sends a
1233 *   message to remote nodes.  This may preempt the calling task.
1234 *
1235 * * The number of tasks available to the application is configured through the
1236 *   #CONFIGURE_MAXIMUM_TASKS application configuration option.
1237 *
1238 * * Where the object class corresponding to the directive is configured to use
1239 *   unlimited objects, the directive may allocate memory from the RTEMS
1240 *   Workspace.
1241 *
1242 * * The number of global objects available to the application is configured
1243 *   through the #CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS application configuration
1244 *   option.
1245 * @endparblock
1246 */
1247rtems_status_code rtems_task_construct(
1248  const rtems_task_config *config,
1249  rtems_id                *id
1250);
1251
1252/* Generated from spec:/rtems/task/if/ident */
1253
1254/**
1255 * @ingroup RTEMSAPIClassicTasks
1256 *
1257 * @brief Identifies a task by the object name.
1258 *
1259 * @param name is the object name to look up.
1260 *
1261 * @param node is the node or node set to search for a matching object.
1262 *
1263 * @param[out] id is the pointer to an ::rtems_id object.  When the directive
1264 *   call is successful, the object identifier of an object with the specified
1265 *   name will be stored in this object.
1266 *
1267 * This directive obtains a task identifier associated with the task name
1268 * specified in ``name``.
1269 *
1270 * A task may obtain its own identifier by specifying #RTEMS_SELF for the name.
1271 *
1272 * The node to search is specified in ``node``.  It shall be
1273 *
1274 * * a valid node number,
1275 *
1276 * * the constant #RTEMS_SEARCH_ALL_NODES to search in all nodes,
1277 *
1278 * * the constant #RTEMS_SEARCH_LOCAL_NODE to search in the local node only, or
1279 *
1280 * * the constant #RTEMS_SEARCH_OTHER_NODES to search in all nodes except the
1281 *   local node.
1282 *
1283 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
1284 *
1285 * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL.
1286 *
1287 * @retval ::RTEMS_INVALID_NAME There was no object with the specified name on
1288 *   the specified nodes.
1289 *
1290 * @retval ::RTEMS_INVALID_NODE In multiprocessing configurations, the
1291 *   specified node was invalid.
1292 *
1293 * @par Notes
1294 * @parblock
1295 * If the task name is not unique, then the task identifier will match the
1296 * first task with that name in the search order.  However, this task
1297 * identifier is not guaranteed to correspond to the desired task.
1298 *
1299 * The objects are searched from lowest to the highest index.  If ``node`` is
1300 * #RTEMS_SEARCH_ALL_NODES, all nodes are searched with the local node being
1301 * searched first.  All other nodes are searched from lowest to the highest
1302 * node number.
1303 *
1304 * If node is a valid node number which does not represent the local node, then
1305 * only the tasks exported by the designated node are searched.
1306 *
1307 * This directive does not generate activity on remote nodes.  It accesses only
1308 * the local copy of the global object table.
1309 *
1310 * The task identifier is used with other task related directives to access the
1311 * task.
1312 * @endparblock
1313 *
1314 * @par Constraints
1315 * @parblock
1316 * The following constraints apply to this directive:
1317 *
1318 * * The directive may be called from within any runtime context.
1319 *
1320 * * The directive will not cause the calling task to be preempted.
1321 * @endparblock
1322 */
1323rtems_status_code rtems_task_ident(
1324  rtems_name name,
1325  uint32_t   node,
1326  rtems_id  *id
1327);
1328
1329/* Generated from spec:/rtems/task/if/self */
1330
1331/**
1332 * @ingroup RTEMSAPIClassicTasks
1333 *
1334 * @brief Gets the task identifier of the calling task.
1335 *
1336 * This directive returns the task identifier of the calling task.
1337 *
1338 * @return Returns the task identifier of the calling task.
1339 *
1340 * @par Constraints
1341 * @parblock
1342 * The following constraints apply to this directive:
1343 *
1344 * * The directive may be called from within device driver initialization
1345 *   context.
1346 *
1347 * * The directive may be called from within task context.
1348 *
1349 * * The directive will not cause the calling task to be preempted.
1350 * @endparblock
1351 */
1352rtems_id rtems_task_self( void );
1353
1354/* Generated from spec:/rtems/task/if/start */
1355
1356/**
1357 * @ingroup RTEMSAPIClassicTasks
1358 *
1359 * @brief Starts the task.
1360 *
1361 * @param id is the task identifier.  The constant #RTEMS_SELF may be used to
1362 *   specify the calling task.
1363 *
1364 * @param entry_point is the task entry point.
1365 *
1366 * @param argument is the task entry point argument.
1367 *
1368 * This directive readies the task, specified by ``id``, for execution based on
1369 * the priority and execution mode specified when the task was created.  The
1370 * entry point of the task is given in ``entry_point``. The task's entry point
1371 * argument is contained in ``argument``.
1372 *
1373 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
1374 *
1375 * @retval ::RTEMS_INVALID_ADDRESS The ``entry_point`` parameter was NULL.
1376 *
1377 * @retval ::RTEMS_INVALID_ID There was no task associated with the identifier
1378 *   specified by ``id``.
1379 *
1380 * @retval ::RTEMS_INCORRECT_STATE The task was not in the dormant state.
1381 *
1382 * @retval ::RTEMS_ILLEGAL_ON_REMOTE_OBJECT The task resided on a remote node.
1383 *
1384 * @par Notes
1385 * @parblock
1386 * The type of the entry point argument is an unsigned integer type.  However,
1387 * the integer type has the property that any valid pointer to ``void`` can be
1388 * converted to this type and then converted back to a pointer to ``void``.
1389 * The result will compare equal to the original pointer.  The type can
1390 * represent at least 32 bits.  Some applications use the entry point argument
1391 * as an index into a parameter table to get task-specific parameters.
1392 *
1393 * Any actions performed on a dormant task such as suspension or change of
1394 * priority are nullified when the task is initiated via the rtems_task_start()
1395 * directive.
1396 * @endparblock
1397 *
1398 * @par Constraints
1399 * @parblock
1400 * The following constraints apply to this directive:
1401 *
1402 * * The directive may be called from within interrupt context.
1403 *
1404 * * The directive may be called from within device driver initialization
1405 *   context.
1406 *
1407 * * The directive may be called from within task context.
1408 *
1409 * * The directive may unblock a task.  This may cause the calling task to be
1410 *   preempted.
1411 * @endparblock
1412 */
1413rtems_status_code rtems_task_start(
1414  rtems_id            id,
1415  rtems_task_entry    entry_point,
1416  rtems_task_argument argument
1417);
1418
1419/* Generated from spec:/rtems/task/if/restart */
1420
1421/**
1422 * @ingroup RTEMSAPIClassicTasks
1423 *
1424 * @brief Restarts the task.
1425 *
1426 * @param id is the task identifier.  The constant #RTEMS_SELF may be used to
1427 *   specify the calling task.
1428 *
1429 * @param argument is the task entry point argument.
1430 *
1431 * This directive resets the task specified by ``id`` to begin execution at its
1432 * original entry point.  The task's priority and execution mode are set to the
1433 * original creation values.  If the task is currently blocked, RTEMS
1434 * automatically makes the task ready.  A task can be restarted from any state,
1435 * except the dormant state.  The task's entry point argument is contained in
1436 * ``argument``.
1437 *
1438 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
1439 *
1440 * @retval ::RTEMS_INVALID_ID There was no task associated with the identifier
1441 *   specified by ``id``.
1442 *
1443 * @retval ::RTEMS_INCORRECT_STATE The task never started.
1444 *
1445 * @retval ::RTEMS_ILLEGAL_ON_REMOTE_OBJECT The task resided on a remote node.
1446 *
1447 * @par Notes
1448 * @parblock
1449 * The type of the entry point argument is an unsigned integer type.  However,
1450 * the integer type has the property that any valid pointer to ``void`` can be
1451 * converted to this type and then converted back to a pointer to ``void``.
1452 * The result will compare equal to the original pointer.  The type can
1453 * represent at least 32 bits.  Some applications use the entry point argument
1454 * as an index into a parameter table to get task-specific parameters.
1455 *
1456 * A new entry point argument may be used to distinguish between the initial
1457 * rtems_task_start() of the task and any ensuing calls to rtems_task_restart()
1458 * of the task.  This can be beneficial in deleting a task.  Instead of
1459 * deleting a task using the rtems_task_delete() directive, a task can delete
1460 * another task by restarting that task, and allowing that task to release
1461 * resources back to RTEMS and then delete itself.
1462 * @endparblock
1463 *
1464 * @par Constraints
1465 * @parblock
1466 * The following constraints apply to this directive:
1467 *
1468 * * The directive may be called from within interrupt context.
1469 *
1470 * * The directive may be called from within device driver initialization
1471 *   context.
1472 *
1473 * * The directive may be called from within task context.
1474 *
1475 * * The directive may change the priority of a task.  This may cause the
1476 *   calling task to be preempted.
1477 *
1478 * * The directive may unblock a task.  This may cause the calling task to be
1479 *   preempted.
1480 * @endparblock
1481 */
1482rtems_status_code rtems_task_restart(
1483  rtems_id            id,
1484  rtems_task_argument argument
1485);
1486
1487/* Generated from spec:/rtems/task/if/delete */
1488
1489/**
1490 * @ingroup RTEMSAPIClassicTasks
1491 *
1492 * @brief Deletes the task.
1493 *
1494 * @param id is the task identifier.  The constant #RTEMS_SELF may be used to
1495 *   specify the calling task.
1496 *
1497 * This directive deletes the task, either the calling task or another task, as
1498 * specified by ``id``.
1499 *
1500 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
1501 *
1502 * @retval ::RTEMS_INVALID_ID There was no task associated with the identifier
1503 *   specified by ``id``.
1504 *
1505 * @retval ::RTEMS_CALLED_FROM_ISR The directive was called from within
1506 *   interrupt context.
1507 *
1508 * @retval ::RTEMS_ILLEGAL_ON_REMOTE_OBJECT The task resided on a remote node.
1509 *
1510 * @par Notes
1511 * @parblock
1512 * RTEMS stops the execution of the task and reclaims the stack memory, any
1513 * allocated delay or timeout timers, the TCB, and, if the task is
1514 * #RTEMS_FLOATING_POINT, its floating point context area. RTEMS explicitly
1515 * does not reclaim the following resources: region segments, partition
1516 * buffers, semaphores, timers, or rate monotonic periods.
1517 *
1518 * A task is responsible for releasing its resources back to RTEMS before
1519 * deletion.  To insure proper deallocation of resources, a task should not be
1520 * deleted unless it is unable to execute or does not hold any RTEMS resources.
1521 * If a task holds RTEMS resources, the task should be allowed to deallocate
1522 * its resources before deletion.  A task can be directed to release its
1523 * resources and delete itself by restarting it with a special argument or by
1524 * sending it a message, an event, or a signal.
1525 *
1526 * Deletion of the current task (#RTEMS_SELF) will force RTEMS to select
1527 * another task to execute.
1528 *
1529 * The TCB for the deleted task is reclaimed by RTEMS.
1530 *
1531 * When a global task is deleted, the task identifier must be transmitted to
1532 * every node in the system for deletion from the local copy of the global
1533 * object table.
1534 *
1535 * The task must reside on the local node, even if the task was created with
1536 * the #RTEMS_GLOBAL attribute.
1537 * @endparblock
1538 *
1539 * @par Constraints
1540 * @parblock
1541 * The following constraints apply to this directive:
1542 *
1543 * * The directive may be called from within device driver initialization
1544 *   context.
1545 *
1546 * * The directive may be called from within task context.
1547 *
1548 * * The directive may obtain and release the object allocator mutex.  This may
1549 *   cause the calling task to be preempted.
1550 *
1551 * * When the directive operates on a global object, the directive sends a
1552 *   message to remote nodes.  This may preempt the calling task.
1553 *
1554 * * The calling task does not have to be the task that created the object.
1555 *   Any local task that knows the object identifier can delete the object.
1556 *
1557 * * Where the object class corresponding to the directive is configured to use
1558 *   unlimited objects, the directive may free memory to the RTEMS Workspace.
1559 * @endparblock
1560 */
1561rtems_status_code rtems_task_delete( rtems_id id );
1562
1563/* Generated from spec:/rtems/task/if/exit */
1564
1565/**
1566 * @ingroup RTEMSAPIClassicTasks
1567 *
1568 * @brief Deletes the calling task.
1569 *
1570 * This directive deletes the calling task.
1571 *
1572 * @par Notes
1573 * @parblock
1574 * The directive is an optimized variant of the following code sequences, see
1575 * also rtems_task_delete():
1576 *
1577 * @code
1578 * #include <pthread.h>
1579 * #include <rtems.h>
1580 *
1581 * void classic_delete_self( void )
1582 * {
1583 *   (void) rtems_task_delete( RTEMS_SELF );
1584 * }
1585 *
1586 * void posix_delete_self( void )
1587 * {
1588 *   (void) pthread_detach( pthread_self() );
1589 *   (void) pthread_exit( NULL);
1590 * }
1591 * @endcode
1592 * @endparblock
1593 *
1594 * @par Constraints
1595 * @parblock
1596 * The following constraints apply to this directive:
1597 *
1598 * * The directive may be called from within task context.
1599 *
1600 * * The directive will not return to the caller.
1601 *
1602 * * While thread dispatching is disabled, if the directive performs a thread
1603 *   dispatch, then the fatal error with the fatal source INTERNAL_ERROR_CORE
1604 *   and the fatal code INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL will
1605 *   occur.
1606 * @endparblock
1607 */
1608RTEMS_NO_RETURN void rtems_task_exit( void );
1609
1610/* Generated from spec:/rtems/task/if/suspend */
1611
1612/**
1613 * @ingroup RTEMSAPIClassicTasks
1614 *
1615 * @brief Suspends the task.
1616 *
1617 * @param id is the task identifier.  The constant #RTEMS_SELF may be used to
1618 *   specify the calling task.
1619 *
1620 * This directive suspends the task specified by ``id`` from further execution
1621 * by placing it in the suspended state.  This state is additive to any other
1622 * blocked state that the task may already be in.  The task will not execute
1623 * again until another task issues the rtems_task_resume() directive for this
1624 * task and any blocked state has been removed.  The rtems_task_restart()
1625 * directive will also remove the suspended state.
1626 *
1627 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
1628 *
1629 * @retval ::RTEMS_INVALID_ID There was no task associated with the identifier
1630 *   specified by ``id``.
1631 *
1632 * @retval ::RTEMS_ALREADY_SUSPENDED The task was already suspended.
1633 *
1634 * @retval ::RTEMS_ILLEGAL_ON_REMOTE_OBJECT The task resided on a remote node.
1635 *
1636 * @par Notes
1637 * The requesting task can suspend itself for example by specifying #RTEMS_SELF
1638 * as ``id``.  In this case, the task will be suspended and a successful return
1639 * code will be returned when the task is resumed.
1640 *
1641 * @par Constraints
1642 * @parblock
1643 * The following constraints apply to this directive:
1644 *
1645 * * The directive may be called from within interrupt context.
1646 *
1647 * * The directive may be called from within device driver initialization
1648 *   context.
1649 *
1650 * * The directive may be called from within task context.
1651 *
1652 * * When the directive operates on a remote object, the directive sends a
1653 *   message to the remote node and waits for a reply.  This will preempt the
1654 *   calling task.
1655 * @endparblock
1656 */
1657rtems_status_code rtems_task_suspend( rtems_id id );
1658
1659/* Generated from spec:/rtems/task/if/resume */
1660
1661/**
1662 * @ingroup RTEMSAPIClassicTasks
1663 *
1664 * @brief Resumes the task.
1665 *
1666 * @param id is the task identifier.
1667 *
1668 * This directive removes the task specified by ``id`` from the suspended
1669 * state.  If the task is in the ready state after the suspension is removed,
1670 * then it will be scheduled to run.  If the task is still in a blocked state
1671 * after the suspension is removed, then it will remain in that blocked state.
1672 *
1673 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
1674 *
1675 * @retval ::RTEMS_INVALID_ID There was no task associated with the identifier
1676 *   specified by ``id``.
1677 *
1678 * @retval ::RTEMS_INCORRECT_STATE The task was not suspended.
1679 *
1680 * @par Constraints
1681 * @parblock
1682 * The following constraints apply to this directive:
1683 *
1684 * * The directive may be called from within interrupt context.
1685 *
1686 * * The directive may be called from within device driver initialization
1687 *   context.
1688 *
1689 * * The directive may be called from within task context.
1690 *
1691 * * The directive may unblock a task.  This may cause the calling task to be
1692 *   preempted.
1693 *
1694 * * When the directive operates on a remote object, the directive sends a
1695 *   message to the remote node and waits for a reply.  This will preempt the
1696 *   calling task.
1697 * @endparblock
1698 */
1699rtems_status_code rtems_task_resume( rtems_id id );
1700
1701/* Generated from spec:/rtems/task/if/is-suspended */
1702
1703/**
1704 * @ingroup RTEMSAPIClassicTasks
1705 *
1706 * @brief Checks if the task is suspended.
1707 *
1708 * @param id is the task identifier.  The constant #RTEMS_SELF may be used to
1709 *   specify the calling task.
1710 *
1711 * This directive returns a status code indicating whether or not the task
1712 * specified by ``id`` is currently suspended.
1713 *
1714 * @retval ::RTEMS_SUCCESSFUL The task was **not** suspended.
1715 *
1716 * @retval ::RTEMS_INVALID_ID There was no task associated with the identifier
1717 *   specified by ``id``.
1718 *
1719 * @retval ::RTEMS_ALREADY_SUSPENDED The task was suspended.
1720 *
1721 * @retval ::RTEMS_ILLEGAL_ON_REMOTE_OBJECT The task resided on a remote node.
1722 *
1723 * @par Constraints
1724 * @parblock
1725 * The following constraints apply to this directive:
1726 *
1727 * * The directive may be called from within interrupt context.
1728 *
1729 * * The directive may be called from within device driver initialization
1730 *   context.
1731 *
1732 * * The directive may be called from within task context.
1733 *
1734 * * The directive will not cause the calling task to be preempted.
1735 * @endparblock
1736 */
1737rtems_status_code rtems_task_is_suspended( rtems_id id );
1738
1739/* Generated from spec:/rtems/task/if/set-priority */
1740
1741/**
1742 * @ingroup RTEMSAPIClassicTasks
1743 *
1744 * @brief Sets the real priority or gets the current priority of the task.
1745 *
1746 * @param id is the task identifier.  The constant #RTEMS_SELF may be used to
1747 *   specify the calling task.
1748 *
1749 * @param new_priority is the new real priority or #RTEMS_CURRENT_PRIORITY to
1750 *   get the current priority.
1751 *
1752 * @param[out] old_priority is the pointer to an ::rtems_task_priority object.
1753 *   When the directive call is successful, the current or previous priority of
1754 *   the task with respect to its home scheduler will be stored in this object.
1755 *
1756 * This directive manipulates the priority of the task specified by ``id``.
1757 * When ``new_priority`` is not equal to #RTEMS_CURRENT_PRIORITY, the specified
1758 * task's previous priority is returned in ``old_priority``.  When
1759 * ``new_priority`` is #RTEMS_CURRENT_PRIORITY, the specified task's current
1760 * priority is returned in ``old_priority``.
1761 *
1762 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
1763 *
1764 * @retval ::RTEMS_INVALID_ADDRESS The ``old_priority`` parameter was NULL.
1765 *
1766 * @retval ::RTEMS_INVALID_ID There was no task associated with the identifier
1767 *   specified by ``id``.
1768 *
1769 * @retval ::RTEMS_INVALID_PRIORITY The task priority specified in
1770 *   ``new_priority`` was invalid with respect to the home scheduler of the
1771 *   task.
1772 *
1773 * @par Notes
1774 * @parblock
1775 * Valid priorities range from one to a maximum value which depends on the
1776 * configured scheduler.  The lower the priority value the higher is the
1777 * importance of the task.
1778 *
1779 * If the task is currently holding any binary semaphores which use a locking
1780 * protocol, then the task's priority cannot be lowered immediately.  If the
1781 * task's priority were lowered immediately, then this could violate properties
1782 * of the locking protocol and may result in priority inversion.  The requested
1783 * lowering of the task's priority will occur when the task has released all
1784 * binary semaphores which make the task more important.  The task's priority
1785 * can be increased regardless of the task's use of binary semaphores with
1786 * locking protocols.
1787 * @endparblock
1788 *
1789 * @par Constraints
1790 * @parblock
1791 * The following constraints apply to this directive:
1792 *
1793 * * The directive may be called from within interrupt context.
1794 *
1795 * * The directive may be called from within device driver initialization
1796 *   context.
1797 *
1798 * * The directive may be called from within task context.
1799 *
1800 * * The directive may change the priority of a task.  This may cause the
1801 *   calling task to be preempted.
1802 *
1803 * * When the directive operates on a remote object, the directive sends a
1804 *   message to the remote node and waits for a reply.  This will preempt the
1805 *   calling task.
1806 * @endparblock
1807 */
1808rtems_status_code rtems_task_set_priority(
1809  rtems_id             id,
1810  rtems_task_priority  new_priority,
1811  rtems_task_priority *old_priority
1812);
1813
1814/* Generated from spec:/rtems/task/if/get-priority */
1815
1816/**
1817 * @ingroup RTEMSAPIClassicTasks
1818 *
1819 * @brief Gets the current priority of the task with respect to the scheduler.
1820 *
1821 * @param task_id is the task identifier.  The constant #RTEMS_SELF may be used
1822 *   to specify the calling task.
1823 *
1824 * @param scheduler_id is the scheduler identifier.
1825 *
1826 * @param[out] priority is the pointer to an ::rtems_task_priority object.
1827 *   When the directive call is successful, the current priority of the task
1828 *   with respect to the specified scheduler will be stored in this object.
1829 *
1830 * This directive returns the current priority in ``priority`` of the task
1831 * specified by ``task_id`` with respect to the scheduler specified by
1832 * ``scheduler_id``.
1833 *
1834 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
1835 *
1836 * @retval ::RTEMS_INVALID_ADDRESS The ``priority`` parameter was NULL.
1837 *
1838 * @retval ::RTEMS_INVALID_ID There was no task associated with the identifier
1839 *   specified by ``task_id``.
1840 *
1841 * @retval ::RTEMS_INVALID_ID There was no scheduler associated with the
1842 *   identifier specified by ``scheduler_id``.
1843 *
1844 * @retval ::RTEMS_NOT_DEFINED The task had no priority with respect to the
1845 *   scheduler.
1846 *
1847 * @retval ::RTEMS_ILLEGAL_ON_REMOTE_OBJECT The task resided on a remote node.
1848 *
1849 * @par Notes
1850 * The current priority reflects temporary priority adjustments due to locking
1851 * protocols, the rate-monotonic period objects on some schedulers such as EDF,
1852 * and the POSIX sporadic server.
1853 *
1854 * @par Constraints
1855 * @parblock
1856 * The following constraints apply to this directive:
1857 *
1858 * * The directive may be called from within interrupt context.
1859 *
1860 * * The directive may be called from within device driver initialization
1861 *   context.
1862 *
1863 * * The directive may be called from within task context.
1864 *
1865 * * The directive will not cause the calling task to be preempted.
1866 * @endparblock
1867 */
1868rtems_status_code rtems_task_get_priority(
1869  rtems_id             task_id,
1870  rtems_id             scheduler_id,
1871  rtems_task_priority *priority
1872);
1873
1874/* Generated from spec:/rtems/task/if/mode */
1875
1876/**
1877 * @ingroup RTEMSAPIClassicTasks
1878 *
1879 * @brief Gets and optionally sets the mode of the calling task.
1880 *
1881 * @param mode_set is the mode set to apply to the calling task.  When ``mask``
1882 *   is set to #RTEMS_CURRENT_MODE, the value of this parameter is ignored.
1883 *   Only modes requested by ``mask`` are applied to the calling task.
1884 *
1885 * @param mask is the mode mask which specifies which modes in ``mode_set`` are
1886 *   applied to the calling task.  When the value is #RTEMS_CURRENT_MODE, the
1887 *   mode of the calling task is not changed.
1888 *
1889 * @param previous_mode_set is the pointer to an ::rtems_mode object.  When the
1890 *   directive call is successful, the mode of the task before any mode changes
1891 *   done by the directive call will be stored in this object.
1892 *
1893 * This directive queries and optionally manipulates the execution mode of the
1894 * calling task.  A task's execution mode enables and disables preemption,
1895 * timeslicing, asynchronous signal processing, as well as specifying the
1896 * interrupt level.  To modify an execution mode, the mode class(es) to be
1897 * changed must be specified in the ``mask`` parameter and the desired mode(s)
1898 * must be specified in the ``mode_set`` parameter.
1899 *
1900 * A task can obtain its current execution mode, without modifying it, by
1901 * calling this directive with a ``mask`` value of #RTEMS_CURRENT_MODE.
1902 *
1903 * The **mode set** specified in ``mode_set`` is built through a *bitwise or*
1904 * of the mode constants described below.  Not all combinations of modes are
1905 * allowed.  Some modes are mutually exclusive.  If mutually exclusive modes
1906 * are combined, the behaviour is undefined.  Default task modes can be
1907 * selected by using the #RTEMS_DEFAULT_MODES constant.  The task mode set
1908 * defines
1909 *
1910 * * the preemption mode of the task: #RTEMS_PREEMPT (default) or
1911 *   #RTEMS_NO_PREEMPT,
1912 *
1913 * * the timeslicing mode of the task: #RTEMS_TIMESLICE or #RTEMS_NO_TIMESLICE
1914 *   (default),
1915 *
1916 * * the ASR processing mode of the task: #RTEMS_ASR (default) or
1917 *   #RTEMS_NO_ASR,
1918 *
1919 * * the interrupt level of the task: RTEMS_INTERRUPT_LEVEL() with a default of
1920 *   ``RTEMS_INTERRUPT_LEVEL( 0 )`` which is associated with enabled
1921 *   interrupts.
1922 *
1923 * The **mode mask** specified in ``mask`` is built through a *bitwise or* of
1924 * the mode mask constants described below.
1925 *
1926 * When the #RTEMS_PREEMPT_MASK is set in ``mask``, the **preemption mode** of
1927 * the calling task is
1928 *
1929 * * enabled by using the #RTEMS_PREEMPT mode constant in ``mode_set`` and
1930 *
1931 * * disabled by using the #RTEMS_NO_PREEMPT mode constant in ``mode_set``.
1932 *
1933 * When the #RTEMS_TIMESLICE_MASK is set in ``mask``, the **timeslicing mode**
1934 * of the calling task is
1935 *
1936 * * enabled by using the #RTEMS_TIMESLICE mode constant in ``mode_set`` and
1937 *
1938 * * disabled by using the #RTEMS_NO_TIMESLICE mode constant in ``mode_set``.
1939 *
1940 * Enabling timeslicing has no effect if preemption is disabled.  For a task to
1941 * be timesliced, that task must have both preemption and timeslicing enabled.
1942 *
1943 * When the #RTEMS_ASR_MASK is set in ``mask``, the **ASR processing mode** of
1944 * the calling task is
1945 *
1946 * * enabled by using the #RTEMS_ASR mode constant in ``mode_set`` and
1947 *
1948 * * disabled by using the #RTEMS_NO_ASR mode constant in ``mode_set``.
1949 *
1950 * When the #RTEMS_INTERRUPT_MASK is set in ``mask``, **interrupts** of the
1951 * calling task are
1952 *
1953 * * enabled by using the RTEMS_INTERRUPT_LEVEL() mode macro with a value of
1954 *   zero (0) in ``mode_set`` and
1955 *
1956 * * disabled up to the specified level by using the RTEMS_INTERRUPT_LEVEL()
1957 *   mode macro with a positive value in ``mode_set``.
1958 *
1959 * An interrupt level of zero is associated with enabled interrupts on all
1960 * target processors.  The interrupt level portion of the task mode supports a
1961 * maximum of 256 interrupt levels.  These levels are mapped onto the interrupt
1962 * levels actually supported by the target processor in a processor dependent
1963 * fashion.
1964 *
1965 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
1966 *
1967 * @retval ::RTEMS_NOT_IMPLEMENTED The #RTEMS_NO_PREEMPT was set in
1968 *   ``mode_set`` and setting the preemption mode was requested by
1969 *   #RTEMS_PREEMPT_MASK in ``mask`` and the system configuration had no
1970 *   implementation for this mode.
1971 *
1972 * @retval ::RTEMS_NOT_IMPLEMENTED The RTEMS_INTERRUPT_LEVEL() was set to a
1973 *   positive level in ``mode_set`` and setting the interrupt level was
1974 *   requested by #RTEMS_INTERRUPT_MASK in ``mask`` and the system
1975 *   configuration had no implementation for this mode.
1976 *
1977 * @par Constraints
1978 * @parblock
1979 * The following constraints apply to this directive:
1980 *
1981 * * The directive may be called from within task context.
1982 *
1983 * * When the directive enables preemption for the calling task, another task
1984 *   may preempt the calling task.
1985 *
1986 * * While thread dispatching is disabled, if the directive performs a thread
1987 *   dispatch, then the fatal error with the fatal source INTERNAL_ERROR_CORE
1988 *   and the fatal code INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL will
1989 *   occur.
1990 * @endparblock
1991 */
1992rtems_status_code rtems_task_mode(
1993  rtems_mode  mode_set,
1994  rtems_mode  mask,
1995  rtems_mode *previous_mode_set
1996);
1997
1998/* Generated from spec:/rtems/task/if/wake-after */
1999
2000/**
2001 * @ingroup RTEMSAPIClassicTasks
2002 *
2003 * @brief Wakes up after an interval in clock ticks or yields the processor.
2004 *
2005 * @param ticks is the interval in clock ticks to delay the task or
2006 *   #RTEMS_YIELD_PROCESSOR to yield the processor.
2007 *
2008 * This directive blocks the calling task for the specified ``ticks`` of clock
2009 * ticks if the value is not equal to #RTEMS_YIELD_PROCESSOR.  When the
2010 * requested interval has elapsed, the task is made ready.  The clock tick
2011 * directives automatically updates the delay period.  The calling task may
2012 * give up the processor and remain in the ready state by specifying a value of
2013 * #RTEMS_YIELD_PROCESSOR in ``ticks``.
2014 *
2015 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
2016 *
2017 * @par Notes
2018 * Setting the system date and time with the rtems_clock_set() directive and
2019 * similar directives which set CLOCK_REALTIME have no effect on a
2020 * rtems_task_wake_after() blocked task.
2021 *
2022 * @par Constraints
2023 * @parblock
2024 * The following constraints apply to this directive:
2025 *
2026 * * The directive may be called from within task context.
2027 *
2028 * * The directive requires a Clock Driver.
2029 *
2030 * * While thread dispatching is disabled, if the directive performs a thread
2031 *   dispatch, then the fatal error with the fatal source INTERNAL_ERROR_CORE
2032 *   and the fatal code INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL will
2033 *   occur.
2034 * @endparblock
2035 */
2036rtems_status_code rtems_task_wake_after( rtems_interval ticks );
2037
2038/* Generated from spec:/rtems/task/if/wake-when */
2039
2040/**
2041 * @ingroup RTEMSAPIClassicTasks
2042 *
2043 * @brief Wakes up when specified.
2044 *
2045 * @param time_buffer is the date and time to wake up.
2046 *
2047 * This directive blocks a task until the date and time specified in
2048 * ``time_buffer``.  At the requested date and time, the calling task will be
2049 * unblocked and made ready to execute.
2050 *
2051 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
2052 *
2053 * @retval ::RTEMS_NOT_DEFINED The system date and time was not set.
2054 *
2055 * @retval ::RTEMS_INVALID_ADDRESS The ``time_buffer`` parameter was NULL.
2056 *
2057 * @retval ::RTEMS_INVALID_CLOCK The time of day was invalid.
2058 *
2059 * @par Notes
2060 * The ticks portion of ``time_buffer`` structure is ignored.  The timing
2061 * granularity of this directive is a second.
2062 *
2063 * @par Constraints
2064 * @parblock
2065 * The following constraints apply to this directive:
2066 *
2067 * * The directive may be called from within task context.
2068 *
2069 * * The directive requires a Clock Driver.
2070 *
2071 * * While thread dispatching is disabled, if the directive performs a thread
2072 *   dispatch, then the fatal error with the fatal source INTERNAL_ERROR_CORE
2073 *   and the fatal code INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL will
2074 *   occur.
2075 * @endparblock
2076 */
2077rtems_status_code rtems_task_wake_when( const rtems_time_of_day *time_buffer );
2078
2079/* Generated from spec:/rtems/task/if/get-scheduler */
2080
2081/**
2082 * @ingroup RTEMSAPIClassicTasks
2083 *
2084 * @brief Gets the home scheduler of the task.
2085 *
2086 * @param task_id is the task identifier.  The constant #RTEMS_SELF may be used
2087 *   to specify the calling task.
2088 *
2089 * @param[out] scheduler_id is the pointer to an ::rtems_id object.  When the
2090 *   directive call is successful, the identifier of the home scheduler of the
2091 *   task will be stored in this object.
2092 *
2093 * This directive returns the identifier of the home scheduler of the task
2094 * specified by ``task_id`` in ``scheduler_id``.
2095 *
2096 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
2097 *
2098 * @retval ::RTEMS_INVALID_ADDRESS The ``scheduler_id`` parameter was NULL.
2099 *
2100 * @retval ::RTEMS_INVALID_ID There was no task associated with the identifier
2101 *   specified by ``task_id``.
2102 *
2103 * @retval ::RTEMS_ILLEGAL_ON_REMOTE_OBJECT The task resided on a remote node.
2104 *
2105 * @par Constraints
2106 * @parblock
2107 * The following constraints apply to this directive:
2108 *
2109 * * The directive may be called from within interrupt context.
2110 *
2111 * * The directive may be called from within device driver initialization
2112 *   context.
2113 *
2114 * * The directive may be called from within task context.
2115 *
2116 * * The directive will not cause the calling task to be preempted.
2117 * @endparblock
2118 */
2119rtems_status_code rtems_task_get_scheduler(
2120  rtems_id  task_id,
2121  rtems_id *scheduler_id
2122);
2123
2124/* Generated from spec:/rtems/task/if/set-scheduler */
2125
2126/**
2127 * @ingroup RTEMSAPIClassicTasks
2128 *
2129 * @brief Sets the home scheduler for the task.
2130 *
2131 * @param task_id is the task identifier.  The constant #RTEMS_SELF may be used
2132 *   to specify the calling task.
2133 *
2134 * @param scheduler_id is the scheduler identifier of the new home scheduler
2135 *   for the task specified by ``task_id``.
2136 *
2137 * @param priority is the new real priority for the task with respect to the
2138 *   scheduler specified by ``scheduler_id``.
2139 *
2140 * This directive sets the home scheduler to the scheduler specified by
2141 * ``scheduler_id`` for the task specified by ``task_id``.
2142 *
2143 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
2144 *
2145 * @retval ::RTEMS_INVALID_ID There was no scheduler associated with the
2146 *   identifier specified by ``scheduler_id``.
2147 *
2148 * @retval ::RTEMS_INVALID_PRIORITY The task priority specified by ``priority``
2149 *   was invalid with respect to the scheduler specified by ``scheduler_id``.
2150 *
2151 * @retval ::RTEMS_INVALID_ID There was no task associated with the identifier
2152 *   specified by ``task_id``.
2153 *
2154 * @retval ::RTEMS_RESOURCE_IN_USE The task specified by ``task_id`` was
2155 *   enqueued on a wait queue.
2156 *
2157 * @retval ::RTEMS_RESOURCE_IN_USE The task specified by ``task_id`` had a
2158 *   current priority which consisted of more than the real priority.
2159 *
2160 * @retval ::RTEMS_RESOURCE_IN_USE The task specified by ``task_id`` had a
2161 *   helping scheduler.
2162 *
2163 * @retval ::RTEMS_RESOURCE_IN_USE The task specified by ``task_id`` was
2164 *   pinned.
2165 *
2166 * @retval ::RTEMS_UNSATISFIED The scheduler specified by ``scheduler_id``
2167 *   owned no processor.
2168 *
2169 * @retval ::RTEMS_UNSATISFIED The scheduler specified by ``scheduler_id`` did
2170 *   not support the affinity set of the task specified by ``task_id``.
2171 *
2172 * @retval ::RTEMS_ILLEGAL_ON_REMOTE_OBJECT The task resided on a remote node.
2173 *
2174 * @par Constraints
2175 * @parblock
2176 * The following constraints apply to this directive:
2177 *
2178 * * The directive may be called from within interrupt context.
2179 *
2180 * * The directive may be called from within device driver initialization
2181 *   context.
2182 *
2183 * * The directive may be called from within task context.
2184 *
2185 * * The directive may change the priority of a task.  This may cause the
2186 *   calling task to be preempted.
2187 * @endparblock
2188 */
2189rtems_status_code rtems_task_set_scheduler(
2190  rtems_id            task_id,
2191  rtems_id            scheduler_id,
2192  rtems_task_priority priority
2193);
2194
2195/* Generated from spec:/rtems/task/if/get-affinity */
2196
2197/**
2198 * @ingroup RTEMSAPIClassicTasks
2199 *
2200 * @brief Gets the processor affinity of the task.
2201 *
2202 * @param id is the task identifier.  The constant #RTEMS_SELF may be used to
2203 *   specify the calling task.
2204 *
2205 * @param cpusetsize is the size of the processor set referenced by ``cpuset``
2206 *   in bytes.
2207 *
2208 * @param[out] cpuset is the pointer to a cpu_set_t object.  When the directive
2209 *   call is successful, the processor affinity set of the task will be stored
2210 *   in this object.  A set bit in the processor set means that the
2211 *   corresponding processor is in the processor affinity set of the task,
2212 *   otherwise the bit is cleared.
2213 *
2214 * This directive returns the processor affinity of the task in ``cpuset`` of
2215 * the task specified by ``id``.
2216 *
2217 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
2218 *
2219 * @retval ::RTEMS_INVALID_ADDRESS The ``cpuset`` parameter was NULL.
2220 *
2221 * @retval ::RTEMS_INVALID_ID There was no task associated with the identifier
2222 *   specified by ``id``.
2223 *
2224 * @retval ::RTEMS_INVALID_SIZE The size specified by ``cpusetsize`` of the
2225 *   processor set was too small for the processor affinity set of the task.
2226 *
2227 * @retval ::RTEMS_ILLEGAL_ON_REMOTE_OBJECT The task resided on a remote node.
2228 *
2229 * @par Constraints
2230 * @parblock
2231 * The following constraints apply to this directive:
2232 *
2233 * * The directive may be called from within interrupt context.
2234 *
2235 * * The directive may be called from within device driver initialization
2236 *   context.
2237 *
2238 * * The directive may be called from within task context.
2239 *
2240 * * The directive will not cause the calling task to be preempted.
2241 * @endparblock
2242 */
2243rtems_status_code rtems_task_get_affinity(
2244  rtems_id   id,
2245  size_t     cpusetsize,
2246  cpu_set_t *cpuset
2247);
2248
2249/* Generated from spec:/rtems/task/if/set-affinity */
2250
2251/**
2252 * @ingroup RTEMSAPIClassicTasks
2253 *
2254 * @brief Sets the processor affinity of the task.
2255 *
2256 * @param id is the task identifier.  The constant #RTEMS_SELF may be used to
2257 *   specify the calling task.
2258 *
2259 * @param cpusetsize is the size of the processor set referenced by ``cpuset``
2260 *   in bytes.
2261 *
2262 * @param cpuset is the pointer to a cpu_set_t object.  The processor set
2263 *   defines the new processor affinity set of the task.  A set bit in the
2264 *   processor set means that the corresponding processor shall be in the
2265 *   processor affinity set of the task, otherwise the bit shall be cleared.
2266 *
2267 * This directive sets the processor affinity of the task specified by ``id``.
2268 *
2269 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
2270 *
2271 * @retval ::RTEMS_INVALID_ADDRESS The ``cpuset`` parameter was NULL.
2272 *
2273 * @retval ::RTEMS_INVALID_ID There was no task associated with the identifier
2274 *   specified by ``id``.
2275 *
2276 * @retval ::RTEMS_INVALID_NUMBER The referenced processor set was not a valid
2277 *   new processor affinity set for the task.
2278 *
2279 * @retval ::RTEMS_ILLEGAL_ON_REMOTE_OBJECT The task resided on a remote node.
2280 *
2281 * @par Constraints
2282 * @parblock
2283 * The following constraints apply to this directive:
2284 *
2285 * * The directive may be called from within interrupt context.
2286 *
2287 * * The directive may be called from within device driver initialization
2288 *   context.
2289 *
2290 * * The directive may be called from within task context.
2291 *
2292 * * The directive may change the processor affinity of a task.  This may cause
2293 *   the calling task to be preempted.
2294 * @endparblock
2295 */
2296rtems_status_code rtems_task_set_affinity(
2297  rtems_id         id,
2298  size_t           cpusetsize,
2299  const cpu_set_t *cpuset
2300);
2301
2302/* Generated from spec:/rtems/task/if/iterate */
2303
2304/**
2305 * @ingroup RTEMSAPIClassicTasks
2306 *
2307 * @brief Iterates over all tasks and invokes the visitor routine for each
2308 *   task.
2309 *
2310 * @param visitor is the visitor routine invoked for each task.
2311 *
2312 * @param arg is the argument passed to each visitor routine invocation during
2313 *   the iteration.
2314 *
2315 * This directive iterates over all tasks in the system.  This operation covers
2316 * all tasks of all APIs.  The user should be careful in accessing the contents
2317 * of the TCB.  The visitor argument ``arg`` is passed to all invocations of
2318 * ``visitor`` in addition to the TCB. The iteration stops immediately in case
2319 * the visitor routine returns true.
2320 *
2321 * @par Notes
2322 * The visitor routine is invoked while owning the objects allocator lock.  It
2323 * is allowed to perform blocking operations in the visitor routine, however,
2324 * care must be taken so that no deadlocks via the object allocator lock can
2325 * occur.
2326 *
2327 * @par Constraints
2328 * @parblock
2329 * The following constraints apply to this directive:
2330 *
2331 * * The directive may be called from within device driver initialization
2332 *   context.
2333 *
2334 * * The directive may be called from within task context.
2335 *
2336 * * The directive may obtain and release the object allocator mutex.  This may
2337 *   cause the calling task to be preempted.
2338 * @endparblock
2339 */
2340void rtems_task_iterate( rtems_task_visitor visitor, void *arg );
2341
2342#ifdef __cplusplus
2343}
2344#endif
2345
2346#endif /* _RTEMS_RTEMS_TASKS_H */
Note: See TracBrowser for help on using the repository browser.