RTEMS: cpukit/include/rtems/rtems/tasks.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
tasks.h
Go to the documentation of this file.
1
9/*
10 * COPYRIGHT (c) 1989-2014.
11 * On-Line Applications Research Corporation (OAR).
12 *
13 * The license and distribution terms for this file may be
14 * found in the file LICENSE in this distribution or at
15 * http://www.rtems.org/license/LICENSE.
16 */
17
18#ifndef _RTEMS_RTEMS_TASKS_H
19#define _RTEMS_RTEMS_TASKS_H
20
21#include <rtems/rtems/attr.h>
22#include <rtems/rtems/status.h>
23#include <rtems/rtems/types.h>
24#include <rtems/score/smp.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
44#define RTEMS_SELF OBJECTS_ID_OF_SELF
45
50#define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT
51
55 typedef uint32_t rtems_task_priority;
56
63#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY
64
69#define RTEMS_MINIMUM_PRIORITY 1
70
71 rtems_task_priority _RTEMS_Maximum_priority( void );
72
83#define RTEMS_MAXIMUM_PRIORITY _RTEMS_Maximum_priority()
84
89#define RTEMS_CURRENT_PRIORITY 0
90
91struct _Thread_Control;
92
96 typedef struct _Thread_Control rtems_tcb;
97
101 typedef void rtems_task;
102
106 typedef CPU_Uint32ptr rtems_task_argument;
107
111 typedef rtems_task ( *rtems_task_entry )(
112 rtems_task_argument
113 );
114
121 typedef struct {
123 rtems_name name;
125 size_t stack_size;
127 rtems_task_priority initial_priority;
129 rtems_attribute attribute_set;
131 rtems_task_entry entry_point;
133 rtems_mode mode_set;
135 rtems_task_argument argument;
136} rtems_initialization_tasks_table;
137
158 rtems_status_code rtems_task_create(
159 rtems_name name,
160 rtems_task_priority initial_priority,
161 size_t stack_size,
162 rtems_mode initial_modes,
163 rtems_attribute attribute_set,
164 rtems_id *id
165);
166
187 rtems_status_code rtems_task_ident(
188 rtems_name name,
189 uint32_t node,
190 rtems_id *id
191);
192
207 rtems_status_code rtems_task_delete(
208 rtems_id id
209);
210
211void rtems_task_exit( void ) RTEMS_NO_RETURN;
212
228 rtems_status_code rtems_task_mode(
229 rtems_mode mode_set,
230 rtems_mode mask,
231 rtems_mode *previous_mode_set
232);
233
246 rtems_status_code rtems_task_restart(
247 rtems_id id,
248 rtems_task_argument argument
249);
250
264 rtems_status_code rtems_task_suspend(
265 rtems_id id
266);
267
280 rtems_status_code rtems_task_resume(
281 rtems_id id
282);
283
299 rtems_status_code rtems_task_set_priority(
300 rtems_id id,
301 rtems_task_priority new_priority,
302 rtems_task_priority *old_priority
303);
304
328 rtems_status_code rtems_task_get_priority(
329 rtems_id task_id,
330 rtems_id scheduler_id,
331 rtems_task_priority *priority
332);
333
343 rtems_status_code rtems_task_start(
344 rtems_id id,
345 rtems_task_entry entry_point,
346 rtems_task_argument argument
347);
348
360 rtems_status_code rtems_task_wake_when(
361 rtems_time_of_day *time_buffer
362);
363
374 rtems_status_code rtems_task_wake_after(
375 rtems_interval ticks
376);
377
384 rtems_status_code rtems_task_is_suspended(
385 rtems_id id
386);
387
405 rtems_status_code rtems_task_get_affinity(
406 rtems_id id,
407 size_t cpusetsize,
408 cpu_set_t *cpuset
409);
410
438 rtems_status_code rtems_task_set_affinity(
439 rtems_id id,
440 size_t cpusetsize,
441 const cpu_set_t *cpuset
442);
443
455 rtems_status_code rtems_task_get_scheduler(
456 rtems_id task_id,
457 rtems_id *scheduler_id
458);
459
483 rtems_status_code rtems_task_set_scheduler(
484 rtems_id task_id,
485 rtems_id scheduler_id,
486 rtems_task_priority priority
487);
488
494 rtems_id rtems_task_self(void);
495
507 typedef bool ( *rtems_task_visitor )( rtems_tcb *tcb, void *arg );
508
523void rtems_task_iterate(
524 rtems_task_visitor visitor,
525 void *arg
526);
527
540 rtems_status_code rtems_scheduler_ident(
541 rtems_name name,
542 rtems_id *id
543);
544
557 rtems_status_code rtems_scheduler_ident_by_processor(
558 uint32_t cpu_index,
559 rtems_id *id
560);
561
581 rtems_status_code rtems_scheduler_ident_by_processor_set(
582 size_t cpusetsize,
583 const cpu_set_t *cpuset,
584 rtems_id *id
585);
586
604#define rtems_scheduler_get_processor() _SMP_Get_current_processor()
605
615RTEMS_DEPRECATED RTEMS_INLINE_ROUTINE uint32_t
616rtems_get_current_processor( void )
617{
618 return rtems_scheduler_get_processor();
619}
620
637#define rtems_scheduler_get_processor_maximum() _SMP_Get_processor_maximum()
638
648RTEMS_DEPRECATED RTEMS_INLINE_ROUTINE uint32_t
649rtems_get_processor_count( void )
650{
651 return rtems_scheduler_get_processor_maximum();
652}
653
670 rtems_status_code rtems_scheduler_get_processor_set(
671 rtems_id scheduler_id,
672 size_t cpusetsize,
673 cpu_set_t *cpuset
674);
675
695 rtems_status_code rtems_scheduler_add_processor(
696 rtems_id scheduler_id,
697 uint32_t cpu_index
698);
699
720 rtems_status_code rtems_scheduler_remove_processor(
721 rtems_id scheduler_id,
722 uint32_t cpu_index
723);
724
735 rtems_status_code rtems_scheduler_get_maximum_priority(
736 rtems_id scheduler_id,
737 rtems_task_priority *priority
738);
739
752 rtems_status_code rtems_scheduler_map_priority_to_posix(
753 rtems_id scheduler_id,
754 rtems_task_priority priority,
755 int *posix_priority
756);
757
770 rtems_status_code rtems_scheduler_map_priority_from_posix(
771 rtems_id scheduler_id,
772 int posix_priority,
773 rtems_task_priority *priority
774);
775
778#ifdef __cplusplus
779}
780#endif
781
782#endif
783/* end of include file */
attr.h
types.h
rtems_attribute
uint32_t rtems_attribute
Definition: attr.h:41
rtems_mode
uint32_t rtems_mode
Definition: modes.h:41
rtems_status_code
rtems_status_code
Classic API Status.
Definition: status.h:43
rtems_task_visitor
bool(* rtems_task_visitor)(rtems_tcb *tcb, void *arg)
Task visitor.
Definition: tasks.h:507
rtems_scheduler_remove_processor
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 specified scheduler instance.
Definition: schedulerremoveprocessor.c:64
rtems_get_processor_count
RTEMS_DEPRECATED RTEMS_INLINE_ROUTINE uint32_t rtems_get_processor_count(void)
Returns the processor maximum supported by the system.
Definition: tasks.h:649
rtems_task_suspend
rtems_status_code rtems_task_suspend(rtems_id id)
RTEMS Suspend Task.
Definition: tasksuspend.c:24
rtems_task_set_scheduler
rtems_status_code rtems_task_set_scheduler(rtems_id task_id, rtems_id scheduler_id, rtems_task_priority priority)
Sets the scheduler instance of a task.
Definition: tasksetscheduler.c:23
rtems_get_current_processor
RTEMS_DEPRECATED RTEMS_INLINE_ROUTINE uint32_t rtems_get_current_processor(void)
Returns the index of the current processor.
Definition: tasks.h:616
rtems_task_set_affinity
rtems_status_code rtems_task_set_affinity(rtems_id id, size_t cpusetsize, const cpu_set_t *cpuset)
Sets the processor affinity set of a task.
Definition: tasksetaffinity.c:26
rtems_scheduler_get_processor_maximum
#define rtems_scheduler_get_processor_maximum()
Returns the processor maximum supported by the system.
Definition: tasks.h:637
rtems_scheduler_add_processor
rtems_status_code rtems_scheduler_add_processor(rtems_id scheduler_id, uint32_t cpu_index)
Adds a processor to the set of processors owned by the specified scheduler instance.
Definition: scheduleraddprocessor.c:24
rtems_task_entry
rtems_task(* rtems_task_entry)(rtems_task_argument)
Definition: tasks.h:111
rtems_task_restart
rtems_status_code rtems_task_restart(rtems_id id, rtems_task_argument argument)
RTEMS Task Restart.
Definition: taskrestart.c:24
rtems_scheduler_map_priority_from_posix
rtems_status_code rtems_scheduler_map_priority_from_posix(rtems_id scheduler_id, int posix_priority, rtems_task_priority *priority)
Map a POSIX thread priority to the corresponding task priority.
Definition: schedulermapfromposix.c:43
rtems_name
uint32_t rtems_name
Classic API object name type.
Definition: types.h:77
rtems_task_resume
rtems_status_code rtems_task_resume(rtems_id id)
RTEMS Resume Task.
Definition: taskresume.c:24
rtems_task_is_suspended
rtems_status_code rtems_task_is_suspended(rtems_id id)
rtems_task_is_suspended
Definition: taskissuspended.c:25
rtems_scheduler_get_processor_set
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 specified scheduler instance.
Definition: schedulergetprocessorset.c:22
rtems_task_wake_after
rtems_status_code rtems_task_wake_after(rtems_interval ticks)
RTEMS Task Wake After.
Definition: taskwakeafter.c:25
rtems_task_iterate
void rtems_task_iterate(rtems_task_visitor visitor, void *arg)
Iterates over all tasks in the system.
Definition: taskiterate.c:23
rtems_scheduler_ident_by_processor_set
rtems_status_code rtems_scheduler_ident_by_processor_set(size_t cpusetsize, const cpu_set_t *cpuset, rtems_id *id)
Identifies a scheduler by a processor set.
Definition: scheduleridentbyprocessorset.c:23
rtems_scheduler_ident
rtems_status_code rtems_scheduler_ident(rtems_name name, rtems_id *id)
Identifies a scheduler by its name.
Definition: schedulerident.c:22
rtems_scheduler_map_priority_to_posix
rtems_status_code rtems_scheduler_map_priority_to_posix(rtems_id scheduler_id, rtems_task_priority priority, int *posix_priority)
Map a task priority to the corresponding POSIX thread priority.
Definition: schedulermaptoposix.c:43
rtems_task_ident
rtems_status_code rtems_task_ident(rtems_name name, uint32_t node, rtems_id *id)
RTEMS Task Name to Id.
Definition: taskident.c:29
rtems_task_priority
uint32_t rtems_task_priority
Definition: tasks.h:55
rtems_id
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:83
rtems_scheduler_get_maximum_priority
rtems_status_code rtems_scheduler_get_maximum_priority(rtems_id scheduler_id, rtems_task_priority *priority)
Gets the maximum task priority of the specified scheduler instance.
Definition: schedulergetmaxprio.c:35
rtems_task_create
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 Task Create.
Definition: taskcreate.c:36
rtems_scheduler_get_processor
#define rtems_scheduler_get_processor()
Returns the index of the current processor.
Definition: tasks.h:604
rtems_task_start
rtems_status_code rtems_task_start(rtems_id id, rtems_task_entry entry_point, rtems_task_argument argument)
RTEMS Start Task.
Definition: taskstart.c:25
rtems_task_get_priority
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 specified task with respect to the specified scheduler instance.
Definition: taskgetpriority.c:23
rtems_scheduler_ident_by_processor
rtems_status_code rtems_scheduler_ident_by_processor(uint32_t cpu_index, rtems_id *id)
Identifies a scheduler by a processor index.
Definition: scheduleridentbyprocessor.c:23
rtems_interval
Watchdog_Interval rtems_interval
Used to manage and manipulate intervals specified by clock ticks.
Definition: types.h:127
rtems_task_wake_when
rtems_status_code rtems_task_wake_when(rtems_time_of_day *time_buffer)
RTEMS Task Wake When.
Definition: taskwakewhen.c:27
rtems_task_mode
rtems_status_code rtems_task_mode(rtems_mode mode_set, rtems_mode mask, rtems_mode *previous_mode_set)
RTEMS Task Mode.
Definition: taskmode.c:30
rtems_task
void rtems_task
Definition: tasks.h:101
rtems_task_get_scheduler
rtems_status_code rtems_task_get_scheduler(rtems_id task_id, rtems_id *scheduler_id)
Gets the scheduler of a task.
Definition: taskgetscheduler.c:22
rtems_task_self
rtems_id rtems_task_self(void)
RTEMS Get Self Task Id.
Definition: taskself.c:23
rtems_task_set_priority
rtems_status_code rtems_task_set_priority(rtems_id id, rtems_task_priority new_priority, rtems_task_priority *old_priority)
RTEMS Set Task Priority.
Definition: tasksetpriority.c:61
rtems_task_argument
CPU_Uint32ptr rtems_task_argument
Definition: tasks.h:106
rtems_task_get_affinity
rtems_status_code rtems_task_get_affinity(rtems_id id, size_t cpusetsize, cpu_set_t *cpuset)
Gets the processor affinity set of a task.
Definition: taskgetaffinity.c:26
rtems_task_delete
rtems_status_code rtems_task_delete(rtems_id id)
RTEMS Delete Task.
Definition: taskdelete.c:24
RTEMS_NO_RETURN
#define RTEMS_NO_RETURN
Definition: basedefs.h:102
RTEMS_INLINE_ROUTINE
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
CPU_Uint32ptr
uintptr_t CPU_Uint32ptr
Definition: cpu.h:662
status.h
smp.h
SuperCore SMP Support API.
_Thread_Control
Definition: thread.h:732
rtems_initialization_tasks_table
Definition: tasks.h:121
rtems_initialization_tasks_table::entry_point
rtems_task_entry entry_point
Definition: tasks.h:131
rtems_initialization_tasks_table::initial_priority
rtems_task_priority initial_priority
Definition: tasks.h:127
rtems_initialization_tasks_table::name
rtems_name name
Definition: tasks.h:123
rtems_initialization_tasks_table::mode_set
rtems_mode mode_set
Definition: tasks.h:133
rtems_initialization_tasks_table::attribute_set
rtems_attribute attribute_set
Definition: tasks.h:129
rtems_initialization_tasks_table::stack_size
size_t stack_size
Definition: tasks.h:125
rtems_initialization_tasks_table::argument
rtems_task_argument argument
Definition: tasks.h:135
rtems_time_of_day
Data structure to manage and manipulate calendar time.
Definition: types.h:141