RTEMS 6.1-rc6
Loading...
Searching...
No Matches
tasks.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (C) 2020, 2021 embedded brains GmbH & Co. KG
13 * Copyright (C) 1988, 2023 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>
68#include <rtems/score/context.h>
69#include <rtems/score/cpu.h>
70#include <rtems/score/object.h>
71#include <rtems/score/stack.h>
73
74#ifdef __cplusplus
75extern "C" {
76#endif
77
78/* Generated from spec:/rtems/task/if/group */
79
89/* Generated from spec:/rtems/task/if/argument */
90
101
102/* Generated from spec:/rtems/task/if/config */
103
110typedef struct {
115
120
134
142
167
178 void ( *storage_free )( void * );
179
184
190
191/* Generated from spec:/rtems/task/if/configured-minimum-stack-size */
192
209#define RTEMS_CONFIGURED_MINIMUM_STACK_SIZE 0
210
211/* Generated from spec:/rtems/task/if/current-priority */
212
219#define RTEMS_CURRENT_PRIORITY 0
220
221/* Generated from spec:/rtems/task/if/task */
222
230typedef void rtems_task;
231
232/* Generated from spec:/rtems/task/if/entry */
233
240
241/* Generated from spec:/rtems/task/if/initialization-table */
242
249typedef struct {
254
259
264
269
274
279
285
286/* Generated from spec:/rtems/task/if/maximum-priority-impl */
287
294
295/* Generated from spec:/rtems/task/if/maximum-priority */
296
303#define RTEMS_MAXIMUM_PRIORITY _RTEMS_Maximum_priority()
304
305/* Generated from spec:/rtems/task/if/minimum-priority */
306
313#define RTEMS_MINIMUM_PRIORITY 1
314
315/* Generated from spec:/rtems/task/if/minimum-stack-size */
316
331#define RTEMS_MINIMUM_STACK_SIZE STACK_MINIMUM_SIZE
332
333/* Generated from spec:/rtems/task/if/no-priority */
334
341#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY
342
343/* Generated from spec:/rtems/task/if/self-define */
344
351#define RTEMS_SELF OBJECTS_ID_OF_SELF
352
353/* Generated from spec:/rtems/task/if/storage-alignment */
354
365#define RTEMS_TASK_STORAGE_ALIGNMENT CPU_STACK_ALIGNMENT
366
367/* Generated from spec:/rtems/task/if/storage-size */
368
383#if CPU_ALL_TASKS_ARE_FP == TRUE
384 #define RTEMS_TASK_STORAGE_SIZE( _size, _attributes ) \
385 ( ( _size ) + CONTEXT_FP_SIZE )
386#else
387 #define RTEMS_TASK_STORAGE_SIZE( _size, _attributes ) \
388 ( ( _size ) + \
389 ( ( ( _attributes ) & RTEMS_FLOATING_POINT ) != 0 ? \
390 CONTEXT_FP_SIZE : 0 ) )
391#endif
392
393/* Generated from spec:/rtems/task/if/tcb */
394
401
402/* Generated from spec:/rtems/task/if/visitor */
403
410typedef bool( *rtems_task_visitor )( rtems_tcb *, void * );
411
412/* Generated from spec:/rtems/task/if/yield-processor */
413
421#define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT
422
423/* Generated from spec:/rtems/task/if/create */
424
659 rtems_name name,
660 rtems_task_priority initial_priority,
661 size_t stack_size,
662 rtems_mode initial_modes,
663 rtems_attribute attribute_set,
664 rtems_id *id
665);
666
667/* Generated from spec:/rtems/task/if/construct */
668
778 rtems_id *id
779);
780
781/* Generated from spec:/rtems/task/if/ident */
782
854 rtems_name name,
855 uint32_t node,
856 rtems_id *id
857);
858
859/* Generated from spec:/rtems/task/if/self */
860
883
884/* Generated from spec:/rtems/task/if/start */
885
944 rtems_id id,
945 rtems_task_entry entry_point,
946 rtems_task_argument argument
947);
948
949/* Generated from spec:/rtems/task/if/restart */
950
1013 rtems_id id,
1014 rtems_task_argument argument
1015);
1016
1017/* Generated from spec:/rtems/task/if/delete */
1018
1106
1107/* Generated from spec:/rtems/task/if/exit */
1108
1152RTEMS_NO_RETURN void rtems_task_exit( void );
1153
1154/* Generated from spec:/rtems/task/if/suspend */
1155
1202
1203/* Generated from spec:/rtems/task/if/resume */
1204
1244
1245/* Generated from spec:/rtems/task/if/is-suspended */
1246
1282
1283/* Generated from spec:/rtems/task/if/set-priority */
1284
1353 rtems_id id,
1354 rtems_task_priority new_priority,
1355 rtems_task_priority *old_priority
1356);
1357
1358/* Generated from spec:/rtems/task/if/get-priority */
1359
1413 rtems_id task_id,
1414 rtems_id scheduler_id,
1415 rtems_task_priority *priority
1416);
1417
1418/* Generated from spec:/rtems/task/if/mode */
1419
1537 rtems_mode mode_set,
1538 rtems_mode mask,
1539 rtems_mode *previous_mode_set
1540);
1541
1542/* Generated from spec:/rtems/task/if/wake-after */
1543
1586
1587/* Generated from spec:/rtems/task/if/wake-when */
1588
1627
1628/* Generated from spec:/rtems/task/if/get-scheduler */
1629
1669 rtems_id task_id,
1670 rtems_id *scheduler_id
1671);
1672
1673/* Generated from spec:/rtems/task/if/set-scheduler */
1674
1739 rtems_id task_id,
1740 rtems_id scheduler_id,
1741 rtems_task_priority priority
1742);
1743
1744/* Generated from spec:/rtems/task/if/get-affinity */
1745
1793 rtems_id id,
1794 size_t cpusetsize,
1795 cpu_set_t *cpuset
1796);
1797
1798/* Generated from spec:/rtems/task/if/set-affinity */
1799
1846 rtems_id id,
1847 size_t cpusetsize,
1848 const cpu_set_t *cpuset
1849);
1850
1851/* Generated from spec:/rtems/task/if/iterate */
1852
1889void rtems_task_iterate( rtems_task_visitor visitor, void *arg );
1890
1891#ifdef __cplusplus
1892}
1893#endif
1894
1895#endif /* _RTEMS_RTEMS_TASKS_H */
This header file provides Classic API directive attributes.
This header file provides basic definitions used by the API and the implementation.
This header file provides the interfaces of the Context Handler.
This header file provides types used by the Classic API.
This header file provides interfaces of the Stack Handler which are used by the implementation and th...
#define RTEMS_NO_RETURN
Tells the compiler in a function declaration that this function does not return.
Definition: basedefs.h:386
uint32_t rtems_attribute
This type represents Classic API attributes.
Definition: attr.h:96
uint32_t rtems_mode
This type represents a Classic API task mode set.
Definition: modes.h:174
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
rtems_status_code rtems_task_suspend(rtems_id id)
Suspends the task.
Definition: tasksuspend.c:45
rtems_status_code rtems_task_set_scheduler(rtems_id task_id, rtems_id scheduler_id, rtems_task_priority priority)
Sets the home scheduler for the task.
Definition: tasksetscheduler.c:45
rtems_status_code rtems_task_construct(const rtems_task_config *config, rtems_id *id)
Constructs a task from the specified task configuration.
Definition: taskconstruct.c:120
rtems_status_code rtems_task_set_affinity(rtems_id id, size_t cpusetsize, const cpu_set_t *cpuset)
Sets the processor affinity of the task.
Definition: tasksetaffinity.c:47
rtems_task(* rtems_task_entry)(rtems_task_argument)
This type defines the task entry point of an RTEMS task.
Definition: tasks.h:239
rtems_status_code rtems_task_restart(rtems_id id, rtems_task_argument argument)
Restarts the task.
Definition: taskrestart.c:46
rtems_status_code rtems_task_resume(rtems_id id)
Resumes the task.
Definition: taskresume.c:45
bool(* rtems_task_visitor)(rtems_tcb *, void *)
Visitor routines invoked by rtems_task_iterate() shall have this type.
Definition: tasks.h:410
rtems_status_code rtems_task_is_suspended(rtems_id id)
Checks if the task is suspended.
Definition: taskissuspended.c:45
rtems_status_code rtems_task_wake_after(rtems_interval ticks)
Wakes up after a count of clock ticks have occurred or yields the processor.
Definition: taskwakeafter.c:46
void rtems_task_iterate(rtems_task_visitor visitor, void *arg)
Iterates over all tasks and invokes the visitor routine for each task.
Definition: taskiterate.c:45
rtems_status_code rtems_task_ident(rtems_name name, uint32_t node, rtems_id *id)
Identifies a task by the object name.
Definition: taskident.c:47
RTEMS_NO_RETURN void rtems_task_exit(void)
Deletes the calling task.
Definition: taskexit.c:44
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.
Definition: taskcreate.c:66
rtems_status_code rtems_task_start(rtems_id id, rtems_task_entry entry_point, rtems_task_argument argument)
Starts the task.
Definition: taskstart.c:46
rtems_status_code rtems_task_get_priority(rtems_id task_id, rtems_id scheduler_id, rtems_task_priority *priority)
Gets the current priority of the task with respect to the scheduler.
Definition: taskgetpriority.c:45
rtems_status_code rtems_task_mode(rtems_mode mode_set, rtems_mode mask, rtems_mode *previous_mode_set)
Gets and optionally sets the mode of the calling task.
Definition: taskmode.c:50
void rtems_task
This type defines the return type of task entry points.
Definition: tasks.h:230
rtems_status_code rtems_task_get_scheduler(rtems_id task_id, rtems_id *scheduler_id)
Gets the home scheduler of the task.
Definition: taskgetscheduler.c:44
rtems_id rtems_task_self(void)
Gets the task identifier of the calling task.
rtems_status_code rtems_task_wake_when(const rtems_time_of_day *time_buffer)
Wakes up when specified.
Definition: taskwakewhen.c:48
rtems_status_code rtems_task_set_priority(rtems_id id, rtems_task_priority new_priority, rtems_task_priority *old_priority)
Sets the real priority or gets the current priority of the task.
Definition: tasksetpriority.c:82
CPU_Uint32ptr rtems_task_argument
This integer type represents task argument values.
Definition: tasks.h:100
rtems_status_code rtems_task_get_affinity(rtems_id id, size_t cpusetsize, cpu_set_t *cpuset)
Gets the processor affinity of the task.
Definition: taskgetaffinity.c:47
rtems_status_code rtems_task_delete(rtems_id id)
Deletes the task.
Definition: taskdelete.c:46
uint32_t rtems_name
This type represents Classic API object names.
Definition: types.h:226
uint32_t rtems_task_priority
This integer type represents task priorities of the Classic API.
Definition: types.h:257
Objects_Id rtems_id
This type represents RTEMS object identifiers.
Definition: types.h:94
Watchdog_Interval rtems_interval
This type represents clock tick intervals.
Definition: types.h:114
rtems_task_priority _RTEMS_Maximum_priority(void)
Returns the maximum priority of the scheduler with index zero.
Definition: rtemsmaxprio.c:44
uintptr_t CPU_Uint32ptr
Definition: cpu.h:557
This header file provides the task modes API of the Task Manager.
This header file provides the status codes of Classic API directives and support functions.
This header file provides interfaces of the Object Handler which are used by the implementation and t...
Definition: thread.h:837
Definition: deflate.c:114
This structure defines the properties of the Classic API user initialization task.
Definition: tasks.h:249
rtems_task_entry entry_point
This member defines the entry point of the task.
Definition: tasks.h:273
rtems_task_priority initial_priority
This member defines the initial task priority.
Definition: tasks.h:263
rtems_name name
This member defines the task name.
Definition: tasks.h:253
rtems_mode mode_set
This member defines the initial modes of the task.
Definition: tasks.h:278
rtems_attribute attribute_set
This member defines the attribute set of the task.
Definition: tasks.h:268
size_t stack_size
This member defines the task stack size in bytes.
Definition: tasks.h:258
rtems_task_argument argument
This member defines the entry point argument of the task.
Definition: tasks.h:283
This structure defines the configuration of a task constructed by rtems_task_construct().
Definition: tasks.h:110
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:166
rtems_task_priority initial_priority
This member defines the initial priority of the task.
Definition: tasks.h:119
rtems_mode initial_modes
This member defines the initial modes of the task.
Definition: tasks.h:183
size_t storage_size
This member defines size of the task storage area in bytes.
Definition: tasks.h:141
void * storage_area
This member shall point to the task storage area begin.
Definition: tasks.h:133
rtems_attribute attributes
This member defines the attributes of the task.
Definition: tasks.h:188
rtems_name name
This member defines the name of the task.
Definition: tasks.h:114
This type represents Classic API calendar times.
Definition: types.h:266
This header file provides the interfaces of the Watchdog Handler related to watchdog ticks which are ...