diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-06-15 11:10:02 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-12-16 07:15:51 +0100 |
commit | a6c428e16896eeaf39370351001dc1c3a64fccff (patch) | |
tree | a8f0889cc6e76127d116c9a2104eb1da92f7a0ae | |
parent | 31d4605fcb9f426d5aac2aed6e67bb95bff71491 (diff) |
rtems: Generate <rtems/rtems/tasks.h>
Change license to BSD-2-Clause according to file histories and
documentation re-licensing agreement.
Update #3899.
Update #3993.
-rw-r--r-- | cpukit/include/rtems/rtems/tasks.h | 1349 |
1 files changed, 793 insertions, 556 deletions
diff --git a/cpukit/include/rtems/rtems/tasks.h b/cpukit/include/rtems/rtems/tasks.h index 4e2e38d829..d1734558da 100644 --- a/cpukit/include/rtems/rtems/tasks.h +++ b/cpukit/include/rtems/rtems/tasks.h @@ -1,231 +1,447 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * - * @ingroup ClassicTasks - * - * @brief Classic Task Manager API + * @brief This header file defines the main parts of the Tasks Manager API. + */ + +/* + * Copyright (C) 2013, 2020 embedded brains GmbH (http://www.embedded-brains.de) + * Copyright (C) 1988, 2017 On-Line Applications Research Corporation (OAR) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ /* - * COPYRIGHT (c) 1989-2014. - * On-Line Applications Research Corporation (OAR). + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://docs.rtems.org/branches/master/user/support/bugs.html * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * For information on updating and regenerating please refer to: + * + * https://docs.rtems.org/branches/master/eng/req/howto.html */ +/* Generated from spec:/rtems/task/if/header */ + #ifndef _RTEMS_RTEMS_TASKS_H #define _RTEMS_RTEMS_TASKS_H +#include <stdbool.h> +#include <stddef.h> +#include <stdint.h> +#include <sys/cpuset.h> #include <rtems/rtems/attr.h> +#include <rtems/rtems/modes.h> #include <rtems/rtems/status.h> #include <rtems/rtems/types.h> +#include <rtems/score/basedefs.h> #include <rtems/score/context.h> +#include <rtems/score/cpu.h> +#include <rtems/score/object.h> #include <rtems/score/smp.h> #include <rtems/score/stack.h> +#include <rtems/score/watchdogticks.h> #ifdef __cplusplus extern "C" { #endif +/* Generated from spec:/rtems/task/if/group */ + /** - * @defgroup ClassicTasks Tasks + * @defgroup RTEMSAPIClassicTasks Task Manager * - * @ingroup RTEMSAPIClassic + * @ingroup RTEMSAPIClassic * - * This encapsulates the functionality of the Classic API Task Manager. - * This functionality includes task services such as creation, deletion, - * delays, suspend/resume, and manipulation of execution mode and priority. + * @brief The Task Manager provides a comprehensive set of directives to + * create, delete, and administer tasks. */ -/**@{*/ -/** - * Constant to be used as the ID of current task - */ -#define RTEMS_SELF OBJECTS_ID_OF_SELF +/* Generated from spec:/rtems/scheduler/if/add-processor */ /** - * This constant is passed to the rtems_task_wake_after directive as the - * interval when a task wishes to yield the CPU. + * @ingroup RTEMSAPIClassicTasks + * + * @brief Adds the processor to the set of processors owned by the scheduler + * instance. + * + * This directive shall be called from task context. It obtains and releases + * the objects allocator lock. + * + * @param scheduler_id is the scheduler instance identifier. + * + * @param cpu_index is the index of the processor to add. + * + * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. + * + * @retval ::RTEMS_INCORRECT_STATE The processor was configured to be used by + * the application, however, it was not online. + * + * @retval ::RTEMS_INVALID_ID There was no scheduler associated with the + * identifier specified by ``scheduler_id``. + * + * @retval ::RTEMS_NOT_CONFIGURED The processor was not configured to be used + * by the application. + * + * @retval ::RTEMS_RESOURCE_IN_USE The processor was already assigned to a + * scheduler instance. */ -#define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT +rtems_status_code rtems_scheduler_add_processor( + rtems_id scheduler_id, + uint32_t cpu_index +); + +/* Generated from spec:/rtems/scheduler/if/get-processor */ /** - * @brief Minimum stack size which every thread must exceed. + * @ingroup RTEMSAPIClassicTasks + * + * @brief Returns the index of the current processor. + * + * In uniprocessor configurations, this macro evaluates to a compile time + * constant of zero. * - * It is the minimum stack size recommended for use on this processor. This - * value is selected by the RTEMS developers conservatively to minimize the - * risk of blown stacks for most user applications. Using this constant when - * specifying the task stack size, indicates that the stack size will be at - * least RTEMS_MINIMUM_STACK_SIZE bytes in size. If the user configured minimum - * stack size is larger than the recommended minimum, then it will be used. + * In SMP configurations, an architecture-specific method is used to obtain the + * index of the current processor in the system. The set of processor indices + * is the range of integers starting with zero up to + * rtems_scheduler_get_processor_maximum() minus one. + * + * Outside of sections with disabled thread dispatching the current processor + * index may change after every instruction since the thread may migrate from + * one processor to another. Sections with disabled interrupts are sections + * with thread dispatching disabled. + * + * @return The index of the current processor is returned. */ -#define RTEMS_MINIMUM_STACK_SIZE STACK_MINIMUM_SIZE +#define rtems_scheduler_get_processor() _SMP_Get_current_processor() + +/* Generated from spec:/rtems/scheduler/if/get-processor-maximum */ /** - * @brief Specifies that the task should be created with the configured minimum - * stack size. + * @ingroup RTEMSAPIClassicTasks + * + * @brief Returns the processor maximum supported by the system. + * + * In uniprocessor configurations, this macro evaluates to a compile time + * constant of one. + * + * In SMP configurations, this macro returns the minimum of the processors + * (physically or virtually) available by the platform and the configured + * processor maximum. Not all processors in the range from processor index + * zero to the last processor index (which is the processor maximum minus one) + * may be configured to be used by a scheduler or may be online (online + * processors have a scheduler assigned). * - * Using this constant when specifying the task stack size indicates that this - * task is to be created with a stack size of the minimum stack size that was - * configured by the application. If not explicitly configured by the - * application, the default configured minimum stack size is the processor - * dependent value RTEMS_MINIMUM_STACK_SIZE. Since this uses the configured - * minimum stack size value, you may get a stack size that is smaller or larger - * than the recommended minimum. This can be used to provide large stacks for - * all tasks on complex applications or small stacks on applications that are - * trying to conserve memory. + * @return The processor maximum supported by the system is returned. */ -#define RTEMS_CONFIGURED_MINIMUM_STACK_SIZE 0 +#define rtems_scheduler_get_processor_maximum() _SMP_Get_processor_maximum() -/** - * Define the type for an RTEMS API task priority. - */ -typedef uint32_t rtems_task_priority; +/* Generated from spec:/rtems/scheduler/if/get-processor-set */ /** - * This is the constant used with the rtems_task_set_priority - * directive to indicate that the caller wants to obtain its - * current priority rather than set it as the name of the - * directive indicates. + * @ingroup RTEMSAPIClassicTasks + * + * @brief Gets the set of processors owned by the scheduler instance. + * + * @param scheduler_id is the scheduler instance identifier. + * + * @param cpusetsize is the size of the referenced processor set variable in + * bytes. This value shall be positive. + * + * @param[out] cpuset is the pointer to a processor set variable. The + * processor set of the scheduler instance will be stored in this variable, + * in case of a successful operation. A set bit in the processor set means + * that the corresponding processor is owned by the scheduler instance, + * otherwise the bit is cleared. + * + * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. + * + * @retval ::RTEMS_INVALID_ADDRESS The ``cpuset`` parameter was NULL. + * + * @retval ::RTEMS_INVALID_ID There was no scheduler associated with the + * identifier specified by ``scheduler_id``. + * + * @retval ::RTEMS_INVALID_NUMBER The provided processor set was too small for + * the set of processors owned by the scheduler instance. */ -#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY +rtems_status_code rtems_scheduler_get_processor_set( + rtems_id scheduler_id, + size_t cpusetsize, + cpu_set_t *cpuset +); + +/* Generated from spec:/rtems/scheduler/if/ident */ /** - * This constant is the least valid value for a Classic API - * task priority. + * @ingroup RTEMSAPIClassicTasks + * + * @brief Identifies a scheduler instance by its name. + * + * The scheduler name is determined by the scheduler configuration. + * + * @param name is the scheduler name. + * + * @param[out] id is the pointer to an object identifier variable. The + * identifier of the scheduler instance will be stored in this variable, in + * case of a successful operation. + * + * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. + * + * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL. + * + * @retval ::RTEMS_INVALID_NAME The scheduler name was invalid. */ -#define RTEMS_MINIMUM_PRIORITY 1 +rtems_status_code rtems_scheduler_ident( rtems_name name, rtems_id *id ); -rtems_task_priority _RTEMS_Maximum_priority( void ); +/* Generated from spec:/rtems/scheduler/if/ident-by-processor */ /** - * This run-time constant is the maximum valid value for a Classic API - * task priority. + * @ingroup RTEMSAPIClassicTasks * - * @note This is actually the priority of the IDLE thread so - * using this priority will result in having a task - * which never executes. This could be useful if you - * want to ensure that a task does not executes during - * certain operations such as a system mode change. + * @brief Identifies a scheduler instance by a processor index. + * + * @param cpu_index is the processor index to identify the scheduler instance. + * + * @param[out] id is the pointer to an object identifier variable. The + * identifier of the scheduler instance will be stored in this variable, in + * case of a successful operation. + * + * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. + * + * @retval ::RTEMS_INCORRECT_STATE The processor index was valid, however, the + * corresponding processor was not owned by a scheduler instance. + * + * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL. + * + * @retval ::RTEMS_INVALID_NAME The processor index was invalid. */ -#define RTEMS_MAXIMUM_PRIORITY _RTEMS_Maximum_priority() +rtems_status_code rtems_scheduler_ident_by_processor( + uint32_t cpu_index, + rtems_id *id +); + +/* Generated from spec:/rtems/scheduler/if/ident-by-processor-set */ /** - * The following constant is passed to rtems_task_set_priority when the - * caller wants to obtain the current priority. + * @ingroup RTEMSAPIClassicTasks + * + * @brief Identifies a scheduler instance by a processor set. + * + * The scheduler instance is selected according to the highest numbered online + * processor in the specified processor set. + * + * @param cpusetsize is the size of the referenced processor set variable in + * bytes. This value shall be positive. + * + * @param cpuset is the pointer to a processor set variable. The referenced + * processor set will be used to identify the scheduler instance. + * + * @param[out] id is the pointer to an object identifier variable. The + * identifier of the scheduler instance will be stored in this variable, in + * case of a successful operation. + * + * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. + * + * @retval ::RTEMS_INCORRECT_STATE The processor set was valid, however, the + * highest numbered online processor in the processor set was not owned by a + * scheduler instance. + * + * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL. + * + * @retval ::RTEMS_INVALID_NAME The processor set contained no online + * processor. + * + * @retval ::RTEMS_INVALID_SIZE The processor set size was invalid. */ -#define RTEMS_CURRENT_PRIORITY 0 +rtems_status_code rtems_scheduler_ident_by_processor_set( + size_t cpusetsize, + const cpu_set_t *cpuset, + rtems_id *id +); -struct _Thread_Control; +/* Generated from spec:/rtems/scheduler/if/remove-processor */ /** - * External API name for Thread_Control + * @ingroup RTEMSAPIClassicTasks + * + * @brief Removes a processor from set of processors owned by the scheduler + * instance. + * + * This directive shall be called from task context. It obtains and releases + * the objects allocator lock. Removing a processor from a scheduler instance + * is a complex operation that involves all tasks of the system. + * + * @param scheduler_id is the scheduler instance identifier. + * + * @param cpu_index is the index of the processor to remove. + * + * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. + * + * @retval ::RTEMS_INVALID_ID There was no scheduler associated with the + * identifier specified by ``scheduler_id``. + * + * @retval ::RTEMS_INVALID_NUMBER The processor was not owned by the specified + * scheduler instance. + * + * @retval ::RTEMS_RESOURCE_IN_USE The set of processors owned by the specified + * scheduler instance would have been empty after the processor removal and + * there was at least one non-idle task that used this scheduler instance as + * its home scheduler instance. */ -typedef struct _Thread_Control rtems_tcb; +rtems_status_code rtems_scheduler_remove_processor( + rtems_id scheduler_id, + uint32_t cpu_index +); -/** - * The following defines the "return type" of an RTEMS task. - */ -typedef void rtems_task; +/* Generated from spec:/rtems/task/if/argument */ /** - * The following defines the argument to an RTEMS task. + * @ingroup RTEMSAPIClassicTasks + * + * @brief This type is used to represent task argument values. + * + * The type is an architecture-specific unsigned integer type which is large + * enough to represent pointer values and 32-bit unsigned integers. */ typedef CPU_Uint32ptr rtems_task_argument; +/* Generated from spec:/rtems/task/if/current-priority */ + /** - * The following defines the type for the entry point of an RTEMS task. + * @ingroup RTEMSAPIClassicTasks + * + * @brief This constant is passed to {set-priority:/name}() when the caller + * wants to obtain the current priority. */ -typedef rtems_task ( *rtems_task_entry )( - rtems_task_argument - ); +#define RTEMS_CURRENT_PRIORITY 0 + +/* Generated from spec:/rtems/task/if/priority */ /** - * The following records define the Initialization Tasks Table. - * Each entry contains the information required by RTEMS to - * create and start a user task automatically at executive - * initialization time. + * @ingroup RTEMSAPIClassicTasks + * + * @brief % */ -typedef struct { - /** This is the Initialization Task's name. */ - rtems_name name; - /** This is the Initialization Task's stack size. */ - size_t stack_size; - /** This is the Initialization Task's priority. */ - rtems_task_priority initial_priority; - /** This is the Initialization Task's attributes. */ - rtems_attribute attribute_set; - /** This is the Initialization Task's entry point. */ - rtems_task_entry entry_point; - /** This is the Initialization Task's initial mode. */ - rtems_mode mode_set; - /** This is the Initialization Task's argument. */ - rtems_task_argument argument; -} rtems_initialization_tasks_table; +typedef uint32_t rtems_task_priority; + +/* Generated from spec:/rtems/scheduler/if/get-maximum-priority */ /** - * @brief RTEMS Task Create + * @ingroup RTEMSAPIClassicTasks * - * This routine implements the rtems_task_create directive. The task - * will have the name name. The attribute_set can be used to indicate - * that the task will be globally accessible or utilize floating point. - * The task's stack will be stack_size bytes. The task will begin - * execution with initial_priority and initial_modes. It returns the - * id of the created task in ID. + * @brief Gets the maximum task priority of the scheduler instance. * - * @param[in] name is the user defined thread name - * @param[in] initial_priority is the thread priority - * @param[in] stack_size is the stack size in bytes - * @param[in] initial_modes is the initial thread mode - * @param[in] attribute_set is the thread attributes - * @param[in] id is the pointer to thread id + * @param scheduler_id is the scheduler instance identifier. * - * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful - * and *id thread id filled in + * @param[out] priority is the pointer to a task priority variable. The + * maximum priority of the scheduler instance will be stored in this + * variable, if the operation is successful. + * + * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. + * + * @retval ::RTEMS_INVALID_ADDRESS The ``priority`` parameter was NULL. + * + * @retval ::RTEMS_INVALID_ID There was no scheduler associated with the + * identifier specified by ``scheduler_id``. */ -rtems_status_code rtems_task_create( - rtems_name name, - rtems_task_priority initial_priority, - size_t stack_size, - rtems_mode initial_modes, - rtems_attribute attribute_set, - rtems_id *id +rtems_status_code rtems_scheduler_get_maximum_priority( + rtems_id scheduler_id, + rtems_task_priority *priority ); +/* Generated from spec:/rtems/scheduler/if/map-priority-from-posix */ + /** - * @brief This constant defines the recommended alignment of a task storage - * area in bytes. + * @ingroup RTEMSAPIClassicTasks * - * Use it with RTEMS_ALIGNED() to define the alignment of a statically - * allocated task storage area. + * @brief Maps a POSIX thread priority to the corresponding Classic API task + * priority. + * + * @param scheduler_id is the scheduler instance identifier. + * + * @param posix_priority is the POSIX thread priority to map. + * + * @param[out] priority is the pointer to a Classic API task priority variable. + * The Classic API task priority value corresponding to the specified POSIX + * thread priority value will be stored in this variable, in case of a + * successful operation. + * + * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. + * + * @retval ::RTEMS_INVALID_ADDRESS The ``priority`` parameter was NULL. + * + * @retval ::RTEMS_INVALID_ID There was no scheduler associated with the + * identifier specified by ``scheduler_id``. + * + * @retval ::RTEMS_INVALID_PRIORITY The POSIX thread priority was invalid. */ -#define RTEMS_TASK_STORAGE_ALIGNMENT CPU_HEAP_ALIGNMENT +rtems_status_code rtems_scheduler_map_priority_from_posix( + rtems_id scheduler_id, + int posix_priority, + rtems_task_priority *priority +); + +/* Generated from spec:/rtems/scheduler/if/map-priority-to-posix */ /** - * @brief Returns the recommended task storage area size for the specified size - * and task attributes. + * @ingroup RTEMSAPIClassicTasks * - * @param _size is the size dedicated to the task stack and thread-local - * storage in bytes. + * @brief Maps a Classic API task priority to the corresponding POSIX thread + * priority. * - * @param _attributes is the attribute set of the task using the storage area. + * @param scheduler_id is the scheduler instance identifier. * - * @return The recommended task storage area size calculated from the input - * parameters is returned. + * @param priority is the Classic API task priority to map. + * + * @param[out] posix_priority is the pointer to a POSIX thread priority + * variable. The POSIX thread priority value corresponding to the specified + * Classic API task priority value will be stored in this variable, in case + * of a successful operation. + * + * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. + * + * @retval ::RTEMS_INVALID_ADDRESS The ``posix_priority`` parameter was NULL. + * + * @retval ::RTEMS_INVALID_ID There was no scheduler associated with the + * identifier specified by ``scheduler_id``. + * + * @retval ::RTEMS_INVALID_PRIORITY The Classic API task priority was invalid. */ -#if CPU_ALL_TASKS_ARE_FP == TRUE - #define RTEMS_TASK_STORAGE_SIZE( _size, _attributes ) \ - ( ( _size ) + CONTEXT_FP_SIZE ) -#else - #define RTEMS_TASK_STORAGE_SIZE( _size, _attributes ) \ - ( ( _size ) + \ - ( ( ( _attributes ) & RTEMS_FLOATING_POINT ) != 0 ? \ - CONTEXT_FP_SIZE : 0 ) ) -#endif +rtems_status_code rtems_scheduler_map_priority_to_posix( + rtems_id scheduler_id, + rtems_task_priority priority, + int *posix_priority +); + +/* Generated from spec:/rtems/task/if/config */ /** + * @ingroup RTEMSAPIClassicTasks + * * @brief This structure defines the configuration of a task constructed by * rtems_task_construct(). */ @@ -310,7 +526,20 @@ typedef struct { rtems_attribute attributes; } rtems_task_config; +/* Generated from spec:/rtems/task/if/configured-minimum-stack-size */ + +/** + * @ingroup RTEMSAPIClassicTasks + * + * @brief % + */ +#define RTEMS_CONFIGURED_MINIMUM_STACK_SIZE 0 + +/* Generated from spec:/rtems/task/if/construct */ + /** + * @ingroup RTEMSAPIClassicTasks + * * @brief Constructs a task from the specified the task configuration. * * In contrast to tasks created by rtems_task_create(), the tasks constructed @@ -349,7 +578,7 @@ typedef struct { * * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. * - * @retval ::RTEMS_INVALID_ADDRESS The id parameter was NULL. + * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL. * * @retval ::RTEMS_INVALID_NAME The task name was invalid. * @@ -386,166 +615,147 @@ rtems_status_code rtems_task_construct( rtems_id *id ); +/* Generated from spec:/rtems/task/if/create */ + /** - * @brief RTEMS Task Name to Id + * @ingroup RTEMSAPIClassicTasks * - * This routine implements the rtems_task_ident directive. - * This directive returns the task ID associated with name. - * If more than one task is named name, then the task to - * which the ID belongs is arbitrary. node indicates the - * extent of the search for the ID of the task named name. - * The search can be limited to a particular node or allowed to - * encompass all nodes. + * @brief Creates a task object. * - * @param[in] name is the user defined thread name - * @param[in] node is(are) the node(s) to be searched - * @param[in] id is the pointer to thread id + * This directive creates a task which resides on the local node. It allocates + * and initializes a TCB, a stack, and an optional floating point context area. + * The mode parameter contains values which sets the task’s initial execution + * mode. The RTEMS_FLOATING_POINT attribute should be specified if the created + * task is to use a numeric coprocessor. For performance reasons, it is + * recommended that tasks not using the numeric coprocessor should specify the + * RTEMS_NO_FLOATING_POINT attribute. If the RTEMS_GLOBAL attribute is + * specified, the task can be accessed from remote nodes. The task id, returned + * in id, is used in other task related directives to access the task. When + * created, a task is placed in the dormant state and can only be made ready to + * execute using the directive rtems_task_start(). * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. If successful, the id will - * be filled in with the thread id. - */ -rtems_status_code rtems_task_ident( - rtems_name name, - uint32_t node, - rtems_id *id -); - -/** - * @brief RTEMS Delete Task + * @param name is the user-defined task name. + * + * @param initial_priority is the initial task priority. + * + * @param stack_size is the task stack size in bytes. + * + * @param initial_modes is the initial task mode. * - * This routine implements the rtems_task_delete directive. The - * task indicated by ID is deleted. The executive halts execution - * of the thread and frees the thread control block. + * @param attribute_set is the task attribute set. * - * @param[in] id is the thread id + * @param[out] id is the pointer to an object identifier variable. The object + * identifier of the new task will be stored in this variable, in case of a + * successful operation. + * + * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. + * + * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL. + * + * @retval ::RTEMS_INVALID_NAME The task name was invalid. + * + * @retval ::RTEMS_INVALID_PRIORITY The initial task priority was invalid. * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error and id is not the requesting thread. Status code is - * returned indicating the source of the error. Nothing - * is returned if id is the requesting thread (always succeeds). + * @retval ::RTEMS_MP_NOT_CONFIGURED The multiprocessing support was not + * configured. + * + * @retval ::RTEMS_TOO_MANY There was no inactive task object available to + * create a new task. + * + * @retval ::RTEMS_TOO_MANY In multiprocessing configurations, there was no + * inactive global object available to create a new global task. + * + * @retval ::RTEMS_UNSATISFIED There was not enough memory to allocate the task + * storage area. The task storage area contains the task stack, the + * thread-local storage, and the floating point context. + * + * @retval ::RTEMS_UNSATISFIED One of the task create extensions failed to + * create the new task. + * + * @retval ::RTEMS_UNSATISFIED In SMP configurations, the non-preemption mode + * was not supported. + * + * @retval ::RTEMS_UNSATISFIED In SMP configurations, the interrupt level mode + * was not supported. */ -rtems_status_code rtems_task_delete( - rtems_id id +rtems_status_code rtems_task_create( + rtems_name name, + rtems_task_priority initial_priority, + size_t stack_size, + rtems_mode initial_modes, + rtems_attribute attribute_set, + rtems_id *id ); -RTEMS_NO_RETURN void rtems_task_exit( void ); +/* Generated from spec:/rtems/task/if/delete */ /** - * @brief RTEMS Task Mode - * - * This routine implements the rtems_task_mode directive. The current - * values of the modes indicated by mask of the calling task are changed - * to that indicated in mode_set. The former mode of the task is - * returned in mode_set. + * @ingroup RTEMSAPIClassicTasks * - * @param[in] mode_set is the new mode - * @param[in] mask is the mask - * @param[in] previous_mode_set is the address of previous mode set + * @brief % * - * @retval RTEMS_SUCCESSFUL and previous_mode_set filled in with the - * previous mode set + * @param id % */ -rtems_status_code rtems_task_mode( - rtems_mode mode_set, - rtems_mode mask, - rtems_mode *previous_mode_set -); +rtems_status_code rtems_task_delete( rtems_id id ); + +/* Generated from spec:/rtems/task/if/task */ /** - * @brief RTEMS Task Restart - * - * This routine implements the rtems_task_restart directive. The - * task associated with ID is restarted at its initial entry - * point with the new argument. - * - * @param[in] id is the thread id - * @param[in] argument is the thread argument + * @ingroup RTEMSAPIClassicTasks * - * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful + * @brief % */ -rtems_status_code rtems_task_restart( - rtems_id id, - rtems_task_argument argument -); +typedef void rtems_task; + +/* Generated from spec:/rtems/task/if/entry */ /** - * @brief RTEMS Suspend Task - * - * This routine implements the rtems_task_suspend directive. The - * SUSPENDED state is set for task associated with ID. Note that the - * suspended state can be in addition to other waiting states. + * @ingroup RTEMSAPIClassicTasks * - * @param[in] id is the thread id - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. + * @brief This type defines the entry point of an RTEMS task. */ -rtems_status_code rtems_task_suspend( - rtems_id id -); +typedef rtems_task ( *rtems_task_entry )( rtems_task_argument ); + +/* Generated from spec:/rtems/task/if/exit */ /** - * @brief RTEMS Resume Task - * - * This routine implements the rtems_task_resume Directive. The - * SUSPENDED state is cleared for task associated with ID. + * @ingroup RTEMSAPIClassicTasks * - * @param[in] id is the thread id - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. + * @brief % */ -rtems_status_code rtems_task_resume( - rtems_id id -); +RTEMS_NO_RETURN void rtems_task_exit( void ); + +/* Generated from spec:/rtems/task/if/get-affinity */ /** - * @brief RTEMS Set Task Priority + * @ingroup RTEMSAPIClassicTasks * - * This routine implements the rtems_task_set_priority directive. The - * current priority of the task associated with ID is set to - * new_priority. The former priority of that task is returned - * in old_priority. + * @brief % * - * @param[in] id is the thread to extract - * @param[in] new_priority is the thread to extract - * @param[in] old_priority is the thread to extract + * @param id % * - * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful and - * and *old_priority filled in with the previous previous priority + * @param cpusetsize % + * + * @param cpuset % */ -rtems_status_code rtems_task_set_priority( - rtems_id id, - rtems_task_priority new_priority, - rtems_task_priority *old_priority +rtems_status_code rtems_task_get_affinity( + rtems_id id, + size_t cpusetsize, + cpu_set_t *cpuset ); +/* Generated from spec:/rtems/task/if/get-priority */ + /** - * @brief Gets the current priority of the specified task with respect to the - * specified scheduler instance. + * @ingroup RTEMSAPIClassicTasks * - * The current priority reflects temporary priority adjustments due to locking - * protocols, the rate-monotonic period objects on some schedulers and other - * mechanisms. + * @brief % * - * @param[in] task_id Identifier of the task. Use @ref RTEMS_SELF to select - * the executing task. - * @param[in] scheduler_id Identifier of the scheduler instance. - * @param[out] priority Returns the current priority of the specified task with - * respect to the specified scheduler instance. + * @param task_id % * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_ILLEGAL_ON_REMOTE_OBJECT Directive is illegal on remote tasks. - * @retval RTEMS_INVALID_ADDRESS The priority parameter is @c NULL. - * @retval RTEMS_INVALID_ID Invalid task or scheduler identifier. - * @retval RTEMS_NOT_DEFINED The task has no priority within the specified - * scheduler instance. This error is only possible on SMP configurations. + * @param scheduler_id % * - * @see rtems_scheduler_ident(). + * @param priority % */ rtems_status_code rtems_task_get_priority( rtems_id task_id, @@ -553,423 +763,450 @@ rtems_status_code rtems_task_get_priority( rtems_task_priority *priority ); +/* Generated from spec:/rtems/task/if/get-scheduler */ + /** - * @brief RTEMS Start Task + * @ingroup RTEMSAPIClassicTasks * - * RTEMS Task Manager + * @brief % * - * This routine implements the rtems_task_start directive. The - * starting execution point of the task associated with ID is - * set to entry_point with the initial argument. + * @param task_id % + * + * @param scheduler_id % */ -rtems_status_code rtems_task_start( - rtems_id id, - rtems_task_entry entry_point, - rtems_task_argument argument +rtems_status_code rtems_task_get_scheduler( + rtems_id task_id, + rtems_id *scheduler_id ); +/* Generated from spec:/rtems/task/if/ident */ + /** - * @brief RTEMS Task Wake When + * @ingroup RTEMSAPIClassicTasks + * + * @brief Identifies a task object by the specified object name. + * + * This directive obtains the task identifier associated with the task name + * specified in ``name``. + * + * A task may obtain its own identifier by specifying #RTEMS_SELF for the name. + * + * The node to search is specified in ``node``. It shall be + * + * * a valid node number, + * + * * the constant #RTEMS_SEARCH_ALL_NODES to search in all nodes, * - * This routine implements the rtems_task_wake_when directive. The - * calling task is blocked until the current time of day is - * equal to that indicated by time_buffer. + * * the constant #RTEMS_SEARCH_LOCAL_NODE to search in the local node only, or * - * @param[in] time_buffer is the pointer to the time and date structure + * * the constant #RTEMS_SEARCH_OTHER_NODES to search in all nodes except the + * local node. * - * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful + * If the task name is not unique, then the task identifier will match the + * first task with that name in the search order. However, this task + * identifier is not guaranteed to correspond to the desired task. The task + * identifier is used with other task related directives to access the task. + * + * If node is #RTEMS_SEARCH_ALL_NODES, all nodes are searched with the local + * node being searched first. All other nodes are searched with the lowest + * numbered node searched first. + * + * If node is a valid node number which does not represent the local node, then + * only the tasks exported by the designated node are searched. + * + * This directive does not generate activity on remote nodes. It accesses only + * the local copy of the global object table. + * + * @param name is the object name to look up. + * + * @param node is the node or node set to search for a matching object. + * + * @param[out] id is the pointer to an object identifier variable. The object + * identifier of an object with the specified name will be stored in this + * variable, in case of a successful operation. + * + * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. + * + * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL. + * + * @retval ::RTEMS_INVALID_NAME There was no object with the specified name on + * the specified nodes. + * + * @retval ::RTEMS_INVALID_NODE In multiprocessing configurations, the + * specified node was invalid. */ -rtems_status_code rtems_task_wake_when( - rtems_time_of_day *time_buffer +rtems_status_code rtems_task_ident( + rtems_name name, + uint32_t node, + rtems_id *id ); +/* Generated from spec:/rtems/task/if/initialization-table */ + /** - * @brief RTEMS Task Wake After - * - * This routine implements the rtems_task_wake_after directive. The - * calling task is blocked until the indicated number of clock - * ticks have occurred. + * @ingroup RTEMSAPIClassicTasks * - * @param[in] ticks is the number of ticks to wait - * @retval RTEMS_SUCCESSFUL + * @brief % */ -rtems_status_code rtems_task_wake_after( - rtems_interval ticks -); +typedef struct { + /** + * @brief % + * + * % + */ + rtems_name name; + + /** + * @brief % + * + * % + */ + size_t stack_size; + + /** + * @brief % + * + * % + */ + rtems_task_priority initial_priority; + + /** + * @brief % + * + * % + */ + rtems_attribute attribute_set; + + /** + * @brief % + * + * % + */ + rtems_task_entry entry_point; + + /** + * @brief % + * + * % + */ + rtems_mode mode_set; + + /** + * @brief % + * + * % + */ + rtems_task_argument argument; +} rtems_initialization_tasks_table; + +/* Generated from spec:/rtems/task/if/is-suspended */ /** - * @brief rtems_task_is_suspended + * @ingroup RTEMSAPIClassicTasks + * + * @brief % * - * This directive returns a status indicating whether or not - * the specified task is suspended. + * @param id % */ -rtems_status_code rtems_task_is_suspended( - rtems_id id -); +rtems_status_code rtems_task_is_suspended( rtems_id id ); + +/* Generated from spec:/rtems/task/if/minimum-priority */ /** - * @brief Gets the processor affinity set of a task. + * @ingroup RTEMSAPIClassicTasks * - * @param[in] id Identifier of the task. Use @ref RTEMS_SELF to select the - * executing task. - * @param[in] cpusetsize Size of the specified affinity set buffer in - * bytes. This value must be positive. - * @param[out] cpuset The current processor affinity set of the task. A set - * bit in the affinity set means that the task can execute on this processor - * and a cleared bit means the opposite. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ADDRESS The @a cpuset parameter is @c NULL. - * @retval RTEMS_INVALID_ID Invalid task identifier. - * @retval RTEMS_INVALID_NUMBER The affinity set buffer is too small for the - * current processor affinity set of the task. + * @brief % */ -rtems_status_code rtems_task_get_affinity( - rtems_id id, - size_t cpusetsize, - cpu_set_t *cpuset -); +#define RTEMS_MINIMUM_PRIORITY 1 + +/* Generated from spec:/rtems/task/if/minimum-stack-size */ /** - * @brief Sets the processor affinity set of a task. - * - * This function will not change the scheduler of the task. The intersection - * of the processor affinity set and the set of processors owned by the - * scheduler of the task must be non-empty. It is not an error if the - * processor affinity set contains processors that are not part of the set of - * processors owned by the scheduler instance of the task. A task will simply - * not run under normal circumstances on these processors since the scheduler - * ignores them. Some locking protocols may temporarily use processors that - * are not included in the processor affinity set of the task. It is also not - * an error if the processor affinity set contains processors that are not part - * of the system. - * - * @param[in] id Identifier of the task. Use @ref RTEMS_SELF to select the - * executing task. - * @param[in] cpusetsize Size of the specified affinity set buffer in - * bytes. This value must be positive. - * @param[in] cpuset The new processor affinity set for the task. A set bit in - * the affinity set means that the task can execute on this processor and a - * cleared bit means the opposite. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ADDRESS The @a cpuset parameter is @c NULL. - * @retval RTEMS_INVALID_ID Invalid task identifier. - * @retval RTEMS_INVALID_NUMBER Invalid processor affinity set. + * @ingroup RTEMSAPIClassicTasks + * + * @brief % */ -rtems_status_code rtems_task_set_affinity( - rtems_id id, - size_t cpusetsize, - const cpu_set_t *cpuset -); +#define RTEMS_MINIMUM_STACK_SIZE STACK_MINIMUM_SIZE + +/* Generated from spec:/rtems/task/if/mode */ /** - * @brief Gets the scheduler of a task. + * @ingroup RTEMSAPIClassicTasks + * + * @brief % * - * @param[in] task_id Identifier of the task. Use @ref RTEMS_SELF to select - * the executing task. - * @param[out] scheduler_id Identifier of the scheduler instance. + * @param mode_set % * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ADDRESS The @a scheduler_id parameter is @c NULL. - * @retval RTEMS_INVALID_ID Invalid task identifier. + * @param mask % + * + * @param previous_mode_set % */ -rtems_status_code rtems_task_get_scheduler( - rtems_id task_id, - rtems_id *scheduler_id +rtems_status_code rtems_task_mode( + rtems_mode mode_set, + rtems_mode mask, + rtems_mode *previous_mode_set ); +/* Generated from spec:/rtems/task/if/no-priority */ + /** - * @brief Sets the scheduler instance of a task. + * @ingroup RTEMSAPIClassicTasks * - * Initially, the scheduler instance of a task is set to the scheduler instance - * of the task that created it. This directive allows to move a task from its - * current scheduler instance to another specified by the scheduler identifier. + * @brief % + */ +#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY + +/* Generated from spec:/rtems/task/if/restart */ + +/** + * @ingroup RTEMSAPIClassicTasks * - * @param[in] task_id Identifier of the task. Use @ref RTEMS_SELF to select - * the executing task. - * @param[in] scheduler_id Identifier of the scheduler instance. - * @param[in] priority The task priority with respect to the new scheduler - * instance. The real and initial priority of the task is set to this value. - * The initial priority is used by rtems_task_restart() for example. + * @brief % * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_ILLEGAL_ON_REMOTE_OBJECT Directive is illegal on remote tasks. - * @retval RTEMS_INVALID_ID Invalid task or scheduler identifier. - * @retval RTEMS_INVALID_PRIORITY Invalid priority. - * @retval RTEMS_RESOURCE_IN_USE The task owns resources which deny a scheduler - * change. + * @param id % * - * @see rtems_scheduler_ident(). + * @param argument % */ -rtems_status_code rtems_task_set_scheduler( - rtems_id task_id, - rtems_id scheduler_id, - rtems_task_priority priority +rtems_status_code rtems_task_restart( + rtems_id id, + rtems_task_argument argument ); +/* Generated from spec:/rtems/task/if/resume */ + /** - * @brief RTEMS Get Self Task Id + * @ingroup RTEMSAPIClassicTasks * - * This directive returns the ID of the currently executing task. + * @brief % + * + * @param id % */ -rtems_id rtems_task_self(void); +rtems_status_code rtems_task_resume( rtems_id id ); + +/* Generated from spec:/rtems/task/if/self */ /** - * @brief Task visitor. + * @ingroup RTEMSAPIClassicTasks * - * @param[in] tcb The task control block. - * @param[in] arg The visitor argument. - * - * @retval true Stop the iteration. - * @retval false Otherwise. + * @brief % + */ +rtems_id rtems_task_self( void ); + +/* Generated from spec:/rtems/task/if/self-define */ + +/** + * @ingroup RTEMSAPIClassicTasks * - * @see rtems_task_iterate(). + * @brief % */ -typedef bool ( *rtems_task_visitor )( rtems_tcb *tcb, void *arg ); +#define RTEMS_SELF OBJECTS_ID_OF_SELF + +/* Generated from spec:/rtems/task/if/set-affinity */ /** - * @brief Iterates over all tasks in the system. + * @ingroup RTEMSAPIClassicTasks + * + * @brief % * - * This operation covers all tasks of all APIs. + * @param id % * - * Must be called from task context. This operation obtains and releases the - * objects allocator lock. The task visitor is called while owning the objects - * allocator lock. It is possible to perform blocking operations in the task - * visitor, however, take care that no deadlocks via the object allocator lock - * can occur. + * @param cpusetsize % * - * @param[in] visitor The task visitor. - * @param[in] arg The visitor argument. + * @param cpuset % */ -void rtems_task_iterate( - rtems_task_visitor visitor, - void *arg +rtems_status_code rtems_task_set_affinity( + rtems_id id, + size_t cpusetsize, + const cpu_set_t *cpuset ); +/* Generated from spec:/rtems/task/if/set-priority */ + /** - * @brief Identifies a scheduler by its name. + * @ingroup RTEMSAPIClassicTasks * - * The scheduler name is determined by the scheduler configuration. + * @brief % * - * @param[in] name The scheduler name. - * @param[out] id The scheduler identifier associated with the name. + * @param id % * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ADDRESS The @a id parameter is @c NULL. - * @retval RTEMS_INVALID_NAME Invalid scheduler name. + * @param new_priority % + * + * @param old_priority % */ -rtems_status_code rtems_scheduler_ident( - rtems_name name, - rtems_id *id +rtems_status_code rtems_task_set_priority( + rtems_id id, + rtems_task_priority new_priority, + rtems_task_priority *old_priority ); +/* Generated from spec:/rtems/task/if/set-scheduler */ + /** - * @brief Identifies a scheduler by a processor index. + * @ingroup RTEMSAPIClassicTasks + * + * @brief % + * + * @param task_id % * - * @param[in] cpu_index The processor index. - * @param[out] id The scheduler identifier associated with the processor index. + * @param scheduler_id % * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ADDRESS The @a id parameter is @c NULL. - * @retval RTEMS_INVALID_NAME Invalid processor index. - * @retval RTEMS_INCORRECT_STATE The processor index is valid, however, this - * processor is not owned by a scheduler. + * @param priority % */ -rtems_status_code rtems_scheduler_ident_by_processor( - uint32_t cpu_index, - rtems_id *id +rtems_status_code rtems_task_set_scheduler( + rtems_id task_id, + rtems_id scheduler_id, + rtems_task_priority priority ); +/* Generated from spec:/rtems/task/if/start */ + /** - * @brief Identifies a scheduler by a processor set. + * @ingroup RTEMSAPIClassicTasks * - * The scheduler is selected according to the highest numbered online processor - * in the specified processor set. + * @brief % * - * @param[in] cpusetsize Size of the specified processor set buffer in - * bytes. This value must be positive. - * @param[out] cpuset The processor set to identify the scheduler. - * @param[out] id The scheduler identifier associated with the processor set. + * @param id % * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ADDRESS The @a id parameter is @c NULL. - * @retval RTEMS_INVALID_SIZE Invalid processor set size. - * @retval RTEMS_INVALID_NAME The processor set contains no online processor. - * @retval RTEMS_INCORRECT_STATE The processor set is valid, however, the - * highest numbered online processor in the specified processor set is not - * owned by a scheduler. + * @param entry_point % + * + * @param argument % */ -rtems_status_code rtems_scheduler_ident_by_processor_set( - size_t cpusetsize, - const cpu_set_t *cpuset, - rtems_id *id +rtems_status_code rtems_task_start( + rtems_id id, + rtems_task_entry entry_point, + rtems_task_argument argument ); +/* Generated from spec:/rtems/task/if/storage-alignment */ + /** - * @brief Returns the index of the current processor. - * - * In uniprocessor configurations, a value of zero will be returned. + * @ingroup RTEMSAPIClassicTasks * - * In SMP configurations, an architecture specific method is used to obtain the - * index of the current processor in the system. The set of processor indices - * is the range of integers starting with zero up to the processor count minus - * one. - * - * Outside of sections with disabled thread dispatching the current processor - * index may change after every instruction since the thread may migrate from - * one processor to another. Sections with disabled interrupts are sections - * with thread dispatching disabled. + * @brief This constant defines the recommended alignment of a task storage + * area in bytes. * - * @return The index of the current processor. + * Use it with RTEMS_ALIGNED() to define the alignment of a statically + * allocated task storage area. */ -#define rtems_scheduler_get_processor() _SMP_Get_current_processor() +#define RTEMS_TASK_STORAGE_ALIGNMENT CPU_HEAP_ALIGNMENT + +/* Generated from spec:/rtems/task/if/storage-size */ /** - * @brief Returns the processor maximum supported by the system. + * @ingroup RTEMSAPIClassicTasks * - * In uniprocessor configurations, a value of one will be returned. + * @brief Returns the recommended task storage area size for the specified size + * and task attributes. * - * In SMP configurations, this function returns the minimum of the processors - * (physically or virtually) available by the platform and the configured - * processor maximum. Not all processors in the range from processor index - * zero to the last processor index (which is the processor maximum minus one) - * may be configured to be used by a scheduler or online (online processors - * have a scheduler assigned). + * @param _size is the size dedicated to the task stack and thread-local + * storage in bytes. * - * @return The processor maximum supported by the system. + * @param _attributes is the attribute set of the task using the storage area. * - * @see rtems_scheduler_add_processor() and rtems_scheduler_remove_processor(). + * @return The recommended task storage area size calculated from the input + * parameters is returned. */ -#define rtems_scheduler_get_processor_maximum() _SMP_Get_processor_maximum() +#if CPU_ALL_TASKS_ARE_FP == TRUE + #define RTEMS_TASK_STORAGE_SIZE( _size, _attributes ) \ + ( ( _size ) + CONTEXT_FP_SIZE ) +#else + #define RTEMS_TASK_STORAGE_SIZE( _size, _attributes ) \ + ( ( _size ) + \ + ( ( ( _attributes ) & RTEMS_FLOATING_POINT ) != 0 ? \ + CONTEXT_FP_SIZE : 0 ) ) +#endif + +/* Generated from spec:/rtems/task/if/suspend */ /** - * @brief Gets the set of processors owned by the specified scheduler instance. + * @ingroup RTEMSAPIClassicTasks * - * @param[in] scheduler_id Identifier of the scheduler instance. - * @param[in] cpusetsize Size of the specified processor set buffer in - * bytes. This value must be positive. - * @param[out] cpuset The processor set owned by the scheduler. A set bit in - * the processor set means that this processor is owned by the scheduler and a - * cleared bit means the opposite. + * @brief % * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ADDRESS The @a cpuset parameter is @c NULL. - * @retval RTEMS_INVALID_ID Invalid scheduler instance identifier. - * @retval RTEMS_INVALID_NUMBER The processor set buffer is too small for the - * set of processors owned by the scheduler. + * @param id % */ -rtems_status_code rtems_scheduler_get_processor_set( - rtems_id scheduler_id, - size_t cpusetsize, - cpu_set_t *cpuset -); +rtems_status_code rtems_task_suspend( rtems_id id ); + +/* Generated from spec:/rtems/task/if/tcb */ /** - * @brief Adds a processor to the set of processors owned by the specified - * scheduler instance. + * @ingroup RTEMSAPIClassicTasks * - * Must be called from task context. This operation obtains and releases the - * objects allocator lock. - * - * @param[in] scheduler_id Identifier of the scheduler instance. - * @param[in] cpu_index Index of the processor to add. + * @brief % + */ +typedef struct _Thread_Control rtems_tcb; + +/* Generated from spec:/rtems/task/if/visitor */ + +/** + * @ingroup RTEMSAPIClassicTasks * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ID Invalid scheduler instance identifier. - * @retval RTEMS_NOT_CONFIGURED The processor is not configured to be used by - * the application. - * @retval RTEMS_INCORRECT_STATE The processor is configured to be used by - * the application, however, it is not online. - * @retval RTEMS_RESOURCE_IN_USE The processor is already assigned to a - * scheduler instance. + * @brief % */ -rtems_status_code rtems_scheduler_add_processor( - rtems_id scheduler_id, - uint32_t cpu_index -); +typedef bool( *rtems_task_visitor )( rtems_tcb *, void * ); + +/* Generated from spec:/rtems/task/if/iterate */ /** - * @brief Removes a processor from set of processors owned by the specified - * scheduler instance. + * @ingroup RTEMSAPIClassicTasks * - * Must be called from task context. This operation obtains and releases the - * objects allocator lock. Removing a processor from a scheduler is a complex - * operation that involves all tasks of the system. + * @brief % * - * @param[in] scheduler_id Identifier of the scheduler instance. - * @param[in] cpu_index Index of the processor to add. + * @param visitor % * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ID Invalid scheduler instance identifier. - * @retval RTEMS_INVALID_NUMBER The processor is not owned by the specified - * scheduler instance. - * @retval RTEMS_RESOURCE_IN_USE The set of processors owned by the specified - * scheduler instance would be empty after the processor removal and there - * exists a non-idle task that uses this scheduler instance as its home - * scheduler instance. + * @param arg % */ -rtems_status_code rtems_scheduler_remove_processor( - rtems_id scheduler_id, - uint32_t cpu_index -); +void rtems_task_iterate( rtems_task_visitor visitor, void *arg ); + +/* Generated from spec:/rtems/task/if/wake-after */ /** - * @brief Gets the maximum task priority of the specified scheduler instance. + * @ingroup RTEMSAPIClassicTasks * - * @param[in] scheduler_id Identifier of the scheduler instance. - * @param[out] priority Pointer to a task priority value. + * @brief % * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ADDRESS The @a priority parameter is @c NULL. - * @retval RTEMS_INVALID_ID Invalid scheduler instance identifier. + * @param ticks % */ -rtems_status_code rtems_scheduler_get_maximum_priority( - rtems_id scheduler_id, - rtems_task_priority *priority -); +rtems_status_code rtems_task_wake_after( rtems_interval ticks ); + +/* Generated from spec:/rtems/task/if/wake-when */ /** - * @brief Map a task priority to the corresponding POSIX thread priority. + * @ingroup RTEMSAPIClassicTasks * - * @param scheduler_id Identifier of the scheduler instance. - * @param priority The task priority to map. - * @param[out] posix_priority Pointer to a POSIX thread priority value. + * @brief % * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ADDRESS The @a posix_priority parameter is @c NULL. - * @retval RTEMS_INVALID_ID Invalid scheduler instance identifier. - * @retval RTEMS_INVALID_PRIORITY Invalid task priority. + * @param time_buffer % */ -rtems_status_code rtems_scheduler_map_priority_to_posix( - rtems_id scheduler_id, - rtems_task_priority priority, - int *posix_priority -); +rtems_status_code rtems_task_wake_when( rtems_time_of_day *time_buffer ); + +/* Generated from spec:/rtems/task/if/yield-processor */ /** - * @brief Map a POSIX thread priority to the corresponding task priority. - * - * @param scheduler_id Identifier of the scheduler instance. - * @param posix_priority The POSIX thread priority to map. - * @param[out] priority Pointer to a task priority value. + * @ingroup RTEMSAPIClassicTasks * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ADDRESS The @a priority parameter is @c NULL. - * @retval RTEMS_INVALID_ID Invalid scheduler instance identifier. - * @retval RTEMS_INVALID_PRIORITY Invalid POSIX thread priority. + * @brief % */ -rtems_status_code rtems_scheduler_map_priority_from_posix( - rtems_id scheduler_id, - int posix_priority, - rtems_task_priority *priority -); +#define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT -/**@}*/ +/* Generated from spec:/score/if/maximum-priority */ + +/** + * @brief Returns the maximum priority of the scheduler with index zero. + */ +rtems_task_priority _RTEMS_Maximum_priority( void ); + +/* Generated from spec:/rtems/task/if/maximum-priority */ + +/** + * @ingroup RTEMSAPIClassicTasks + * + * @brief % + */ +#define RTEMS_MAXIMUM_PRIORITY _RTEMS_Maximum_priority() #ifdef __cplusplus } #endif -#endif -/* end of include file */ +#endif /* _RTEMS_RTEMS_TASKS_H */ |