RTEMS
tasks.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 
11 /*
12  * Copyright (C) 2013, 2020 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  * Do not manually edit this file. It is part of the RTEMS quality process
39  * and was automatically generated.
40  *
41  * If you find something that needs to be fixed or worded better please
42  * post a report to an RTEMS mailing list or raise a bug report:
43  *
44  * https://docs.rtems.org/branches/master/user/support/bugs.html
45  *
46  * For information on updating and regenerating please refer to:
47  *
48  * https://docs.rtems.org/branches/master/eng/req/howto.html
49  */
50 
51 /* Generated from spec:/rtems/task/if/header */
52 
53 #ifndef _RTEMS_RTEMS_TASKS_H
54 #define _RTEMS_RTEMS_TASKS_H
55 
56 #include <stdbool.h>
57 #include <stddef.h>
58 #include <stdint.h>
59 #include <sys/cpuset.h>
60 #include <rtems/rtems/attr.h>
61 #include <rtems/rtems/modes.h>
62 #include <rtems/rtems/status.h>
63 #include <rtems/rtems/types.h>
64 #include <rtems/score/basedefs.h>
65 #include <rtems/score/context.h>
66 #include <rtems/score/cpu.h>
67 #include <rtems/score/object.h>
68 #include <rtems/score/smp.h>
69 #include <rtems/score/stack.h>
71 
72 #ifdef __cplusplus
73 extern "C" {
74 #endif
75 
76 /* Generated from spec:/rtems/task/if/group */
77 
87 /* Generated from spec:/rtems/task/if/priority */
88 
94 typedef uint32_t rtems_task_priority;
95 
96 /* Generated from spec:/rtems/task/if/task */
97 
103 typedef void rtems_task;
104 
105 /* Generated from spec:/rtems/task/if/argument */
106 
116 
117 /* Generated from spec:/rtems/task/if/tcb */
118 
124 typedef struct _Thread_Control rtems_tcb;
125 
126 /* Generated from spec:/rtems/task/if/config */
127 
134 typedef struct {
139 
144 
158 
165  size_t storage_size;
166 
191 
202  void ( *storage_free )( void * );
203 
208 
214 
215 /* Generated from spec:/rtems/task/if/entry */
216 
223 
224 /* Generated from spec:/rtems/task/if/visitor */
225 
231 typedef bool( *rtems_task_visitor )( rtems_tcb *, void * );
232 
233 /* Generated from spec:/score/if/maximum-priority */
234 
239 
240 /* Generated from spec:/rtems/task/if/current-priority */
241 
248 #define RTEMS_CURRENT_PRIORITY 0
249 
250 /* Generated from spec:/rtems/scheduler/if/add-processor */
251 
279  rtems_id scheduler_id,
280  uint32_t cpu_index
281 );
282 
283 /* Generated from spec:/rtems/scheduler/if/get-maximum-priority */
284 
303  rtems_id scheduler_id,
304  rtems_task_priority *priority
305 );
306 
307 /* Generated from spec:/rtems/scheduler/if/get-processor */
308 
329 #define rtems_scheduler_get_processor() _SMP_Get_current_processor()
330 
331 /* Generated from spec:/rtems/scheduler/if/get-processor-maximum */
332 
350 #define rtems_scheduler_get_processor_maximum() _SMP_Get_processor_maximum()
351 
352 /* Generated from spec:/rtems/scheduler/if/get-processor-set */
353 
380  rtems_id scheduler_id,
381  size_t cpusetsize,
382  cpu_set_t *cpuset
383 );
384 
385 /* Generated from spec:/rtems/scheduler/if/ident */
386 
407 
408 /* Generated from spec:/rtems/scheduler/if/ident-by-processor */
409 
431  uint32_t cpu_index,
432  rtems_id *id
433 );
434 
435 /* Generated from spec:/rtems/scheduler/if/ident-by-processor-set */
436 
469  size_t cpusetsize,
470  const cpu_set_t *cpuset,
471  rtems_id *id
472 );
473 
474 /* Generated from spec:/rtems/scheduler/if/map-priority-from-posix */
475 
500  rtems_id scheduler_id,
501  int posix_priority,
502  rtems_task_priority *priority
503 );
504 
505 /* Generated from spec:/rtems/scheduler/if/map-priority-to-posix */
506 
531  rtems_id scheduler_id,
532  rtems_task_priority priority,
533  int *posix_priority
534 );
535 
536 /* Generated from spec:/rtems/scheduler/if/remove-processor */
537 
565  rtems_id scheduler_id,
566  uint32_t cpu_index
567 );
568 
569 /* Generated from spec:/rtems/task/if/configured-minimum-stack-size */
570 
576 #define RTEMS_CONFIGURED_MINIMUM_STACK_SIZE 0
577 
578 /* Generated from spec:/rtems/task/if/construct */
579 
654  const rtems_task_config *config,
655  rtems_id *id
656 );
657 
658 /* Generated from spec:/rtems/task/if/create */
659 
722  rtems_name name,
723  rtems_task_priority initial_priority,
724  size_t stack_size,
725  rtems_mode initial_modes,
726  rtems_attribute attribute_set,
727  rtems_id *id
728 );
729 
730 /* Generated from spec:/rtems/task/if/delete */
731 
740 
741 /* Generated from spec:/rtems/task/if/exit */
742 
748 RTEMS_NO_RETURN void rtems_task_exit( void );
749 
750 /* Generated from spec:/rtems/task/if/get-affinity */
751 
764  rtems_id id,
765  size_t cpusetsize,
766  cpu_set_t *cpuset
767 );
768 
769 /* Generated from spec:/rtems/task/if/get-priority */
770 
783  rtems_id task_id,
784  rtems_id scheduler_id,
785  rtems_task_priority *priority
786 );
787 
788 /* Generated from spec:/rtems/task/if/get-scheduler */
789 
800  rtems_id task_id,
801  rtems_id *scheduler_id
802 );
803 
804 /* Generated from spec:/rtems/task/if/ident */
805 
861  rtems_name name,
862  uint32_t node,
863  rtems_id *id
864 );
865 
866 /* Generated from spec:/rtems/task/if/initialization-table */
867 
873 typedef struct {
880 
886  size_t stack_size;
887 
894 
901 
908 
915 
923 
924 /* Generated from spec:/rtems/task/if/is-suspended */
925 
934 
935 /* Generated from spec:/rtems/task/if/iterate */
936 
946 void rtems_task_iterate( rtems_task_visitor visitor, void *arg );
947 
948 /* Generated from spec:/rtems/task/if/maximum-priority */
949 
955 #define RTEMS_MAXIMUM_PRIORITY _RTEMS_Maximum_priority()
956 
957 /* Generated from spec:/rtems/task/if/minimum-priority */
958 
964 #define RTEMS_MINIMUM_PRIORITY 1
965 
966 /* Generated from spec:/rtems/task/if/minimum-stack-size */
967 
973 #define RTEMS_MINIMUM_STACK_SIZE STACK_MINIMUM_SIZE
974 
975 /* Generated from spec:/rtems/task/if/mode */
976 
989  rtems_mode mode_set,
990  rtems_mode mask,
991  rtems_mode *previous_mode_set
992 );
993 
994 /* Generated from spec:/rtems/task/if/no-priority */
995 
1001 #define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY
1002 
1003 /* Generated from spec:/rtems/task/if/restart */
1004 
1015  rtems_id id,
1016  rtems_task_argument argument
1017 );
1018 
1019 /* Generated from spec:/rtems/task/if/resume */
1020 
1029 
1030 /* Generated from spec:/rtems/task/if/self */
1031 
1037 rtems_id rtems_task_self( void );
1038 
1039 /* Generated from spec:/rtems/task/if/self-define */
1040 
1046 #define RTEMS_SELF OBJECTS_ID_OF_SELF
1047 
1048 /* Generated from spec:/rtems/task/if/set-affinity */
1049 
1062  rtems_id id,
1063  size_t cpusetsize,
1064  const cpu_set_t *cpuset
1065 );
1066 
1067 /* Generated from spec:/rtems/task/if/set-priority */
1068 
1081  rtems_id id,
1082  rtems_task_priority new_priority,
1083  rtems_task_priority *old_priority
1084 );
1085 
1086 /* Generated from spec:/rtems/task/if/set-scheduler */
1087 
1100  rtems_id task_id,
1101  rtems_id scheduler_id,
1102  rtems_task_priority priority
1103 );
1104 
1105 /* Generated from spec:/rtems/task/if/start */
1106 
1119  rtems_id id,
1120  rtems_task_entry entry_point,
1121  rtems_task_argument argument
1122 );
1123 
1124 /* Generated from spec:/rtems/task/if/storage-alignment */
1125 
1135 #define RTEMS_TASK_STORAGE_ALIGNMENT CPU_HEAP_ALIGNMENT
1136 
1137 /* Generated from spec:/rtems/task/if/storage-size */
1138 
1153 #if CPU_ALL_TASKS_ARE_FP == TRUE
1154  #define RTEMS_TASK_STORAGE_SIZE( _size, _attributes ) \
1155  ( ( _size ) + CONTEXT_FP_SIZE )
1156 #else
1157  #define RTEMS_TASK_STORAGE_SIZE( _size, _attributes ) \
1158  ( ( _size ) + \
1159  ( ( ( _attributes ) & RTEMS_FLOATING_POINT ) != 0 ? \
1160  CONTEXT_FP_SIZE : 0 ) )
1161 #endif
1162 
1163 /* Generated from spec:/rtems/task/if/suspend */
1164 
1173 
1174 /* Generated from spec:/rtems/task/if/wake-after */
1175 
1184 
1185 /* Generated from spec:/rtems/task/if/wake-when */
1186 
1195 
1196 /* Generated from spec:/rtems/task/if/yield-processor */
1197 
1203 #define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT
1204 
1205 #ifdef __cplusplus
1206 }
1207 #endif
1208 
1209 #endif /* _RTEMS_RTEMS_TASKS_H */
rtems_status_code rtems_scheduler_ident_by_processor_set(size_t cpusetsize, const cpu_set_t *cpuset, rtems_id *id)
Identifies a scheduler instance by a processor set.
rtems_status_code rtems_task_get_priority(rtems_id task_id, rtems_id scheduler_id, rtems_task_priority *priority)
%
rtems_status_code rtems_scheduler_get_processor_set(rtems_id scheduler_id, size_t cpusetsize, cpu_set_t *cpuset)
Gets the set of processors owned by the scheduler instance.
This header file defines types provided by the Classic API.
rtems_status_code rtems_task_is_suspended(rtems_id id)
%
Information About Each Thread&#39;s Context.
rtems_mode initial_modes
This member defines the initial modes of the task.
Definition: tasks.h:207
This header file defines the task modes of the Task Manager API.
rtems_status_code rtems_scheduler_map_priority_from_posix(rtems_id scheduler_id, int posix_priority, rtems_task_priority *priority)
Maps a POSIX thread priority to the corresponding Classic API task priority.
rtems_status_code rtems_task_get_affinity(rtems_id id, size_t cpusetsize, cpu_set_t *cpuset)
%
uint32_t rtems_name
This type is used to represent a Classic API object name.
Definition: types.h:227
rtems_status_code rtems_task_set_affinity(rtems_id id, size_t cpusetsize, const cpu_set_t *cpuset)
%
rtems_status_code rtems_task_ident(rtems_name name, uint32_t node, rtems_id *id)
Identifies a task object by the specified object name.
Definition: taskident.c:45
Constants and Structures Associated with the Object Handler.
rtems_name name
This member defines the name of the task.
Definition: tasks.h:138
rtems_task_argument argument
%
Definition: tasks.h:921
rtems_status_code rtems_task_delete(rtems_id id)
%
Definition: taskdelete.c:24
rtems_status_code rtems_scheduler_ident_by_processor(uint32_t cpu_index, rtems_id *id)
Identifies a scheduler instance by a processor index.
This structure defines the configuration of a task constructed by rtems_task_construct().
Definition: tasks.h:134
rtems_attribute attribute_set
%
Definition: tasks.h:900
rtems_status_code rtems_task_start(rtems_id id, rtems_task_entry entry_point, rtems_task_argument argument)
%
Definition: taskstart.c:25
rtems_id rtems_task_self(void)
%
Definition: taskself.c:23
void rtems_task
%
Definition: tasks.h:103
This header file defines the status codes and support functions of the Classic API.
rtems_status_code rtems_task_wake_when(rtems_time_of_day *time_buffer)
%
CPU_Uint32ptr rtems_task_argument
This type is used to represent task argument values.
Definition: tasks.h:115
SuperCore SMP Support API.
uint32_t rtems_task_priority
%
Definition: tasks.h:94
rtems_status_code rtems_task_resume(rtems_id id)
%
Definition: taskresume.c:24
bool(* rtems_task_visitor)(rtems_tcb *, void *)
%
Definition: tasks.h:231
void rtems_task_iterate(rtems_task_visitor visitor, void *arg)
%
rtems_status_code rtems_scheduler_add_processor(rtems_id scheduler_id, uint32_t cpu_index)
Adds the processor to the set of processors owned by the scheduler instance.
This type is used to represent the calendar time in the Classic API.
Definition: types.h:258
rtems_status_code rtems_scheduler_ident(rtems_name name, rtems_id *id)
Identifies a scheduler instance by its name.
rtems_status_code rtems_scheduler_map_priority_to_posix(rtems_id scheduler_id, rtems_task_priority priority, int *posix_priority)
Maps a Classic API task priority to the corresponding POSIX thread priority.
#define RTEMS_NO_RETURN
Tells the compiler in a function declaration that this function does not return.
Definition: basedefs.h:207
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
rtems_status_code rtems_task_suspend(rtems_id id)
%
Definition: tasksuspend.c:24
This header file defines attributes provided by the Classic API.
rtems_task_priority initial_priority
%
Definition: tasks.h:893
uintptr_t CPU_Uint32ptr
Definition: cpu.h:1141
rtems_task_entry entry_point
%
Definition: tasks.h:907
rtems_status_code rtems_task_set_priority(rtems_id id, rtems_task_priority new_priority, rtems_task_priority *old_priority)
%
rtems_task(* rtems_task_entry)(rtems_task_argument)
This type defines the entry point of an RTEMS task.
Definition: tasks.h:222
rtems_status_code rtems_scheduler_get_maximum_priority(rtems_id scheduler_id, rtems_task_priority *priority)
Gets the maximum task priority of the scheduler instance.
rtems_task_priority initial_priority
This member defines the initial priority of the task.
Definition: tasks.h:143
rtems_status_code rtems_task_wake_after(rtems_interval ticks)
%
Definition: taskwakeafter.c:25
SPARC CPU Department Source.
uint32_t rtems_attribute
This type is used to represent Classic API attributes.
Definition: attr.h:91
rtems_task_priority _RTEMS_Maximum_priority(void)
Returns the maximum priority of the scheduler with index zero.
uint32_t rtems_mode
This type is used to represent a task mode set.
Definition: modes.h:90
rtems_status_code rtems_task_get_scheduler(rtems_id task_id, rtems_id *scheduler_id)
%
Watchdog_Interval rtems_interval
This type is used to represent clock tick intervals.
Definition: types.h:90
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)
Creates a task object.
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
rtems_status_code rtems_scheduler_remove_processor(rtems_id scheduler_id, uint32_t cpu_index)
Removes a processor from set of processors owned by the scheduler instance.
rtems_status_code rtems_task_restart(rtems_id id, rtems_task_argument argument)
%
Definition: taskrestart.c:24
Constants for the watchdog ticks.
This header file provides basic definitions used by the API and the implementation.
rtems_status_code rtems_task_construct(const rtems_task_config *config, rtems_id *id)
Constructs a task from the specified the task configuration.
Definition: taskconstruct.c:73
rtems_status_code rtems_task_set_scheduler(rtems_id task_id, rtems_id scheduler_id, rtems_task_priority priority)
%
rtems_attribute attributes
This member defines the attributes of the task.
Definition: tasks.h:212
Information About the Thread Stack Handler.
RTEMS_NO_RETURN void rtems_task_exit(void)
%
size_t maximum_thread_local_storage_size
This member defines the maximum thread-local storage size supported by the task storage area...
Definition: tasks.h:190
size_t storage_size
This member defines size of the task storage area in bytes.
Definition: tasks.h:165
void * storage_area
This member shall point to the task storage area begin.
Definition: tasks.h:157
rtems_status_code rtems_task_mode(rtems_mode mode_set, rtems_mode mask, rtems_mode *previous_mode_set)
%