Functions for managing tasks. More...
Modules |
|
| Task manager. configuration | |
Macros |
|
| #define | TASK_ID_INVALID (( task_id_t )(-1)) |
|
Invalid task ID.
|
|
Typedefs |
|
| typedef void(* | task_main_t )(void *p_context) |
|
Main function of the task.
|
|
| typedef uint8_t | task_id_t |
|
Task ID.
|
|
Functions |
|
| void | task_manager_start ( task_main_t idle_task, void *p_idle_task_context) |
|
Start task manager.
More...
|
|
| task_id_t | task_create ( task_main_t task, char const *p_task_name, void *p_context) |
|
Create new task.
More...
|
|
| void | task_yield (void) |
|
Yield CPU to other tasks.
|
|
| void | task_exit (void) |
|
Complete current task.
More...
|
|
| uint32_t | task_events_wait (uint32_t evt_mask) |
|
Wait for events. Set events are cleared after this function returns.
More...
|
|
| void | task_events_set ( task_id_t task_id, uint32_t evt_mask) |
|
Set events for given task.
More...
|
|
| uint32_t | task_stack_max_usage_get ( task_id_t task_id) |
|
Returns maximum depth of task stack.
More...
|
|
| task_id_t | task_id_get (void) |
|
Returns ID of currently running task.
More...
|
|
| char const * | task_name_get ( task_id_t task_id) |
|
Set events for given task.
More...
|
|
Detailed Description
Functions for managing tasks.
Function Documentation
| task_id_t task_create | ( | task_main_t | task , |
| char const * | p_task_name , | ||
| void * | p_context | ||
| ) |
Create new task.
- Parameters
-
[in] task Function which become main procedure of new task. [in] p_task_name Task name. [in] p_context Context passed to task procedure.
- Returns
- ID of the task on success, otherwise TASK_ID_INVALID.
| void task_events_set | ( | task_id_t | task_id , |
| uint32_t | evt_mask | ||
| ) |
Set events for given task.
- Parameters
-
[in] task_id Id of the task which shall receive events. [in] evt_mask Events for the task.
| uint32_t task_events_wait | ( | uint32_t | evt_mask | ) |
Wait for events. Set events are cleared after this function returns.
- Parameters
-
[in] evt_mask Mask of events to wait
- Returns
- Mask with set events (can be a subset of evt_mask).
| void task_exit | ( | void | ) |
Complete current task.
Task stack returns to the pool of available stacks.
| task_id_t task_id_get | ( | void | ) |
Returns ID of currently running task.
- Returns
- ID of active task.
| void task_manager_start | ( | task_main_t | idle_task , |
| void * | p_idle_task_context | ||
| ) |
Start task manager.
This function starts the task manager and configures given function as idle task. This function never returns.
- Parameters
-
[in] idle_task Main function of the task scheduled when no other tasks could be run. [in] p_idle_task_context Context passed to idle task.
| char const* task_name_get | ( | task_id_t | task_id | ) |
Set events for given task.
- Parameters
-
[in] task_id Id of the task which name will be returned.
- Returns
- Task name
| uint32_t task_stack_max_usage_get | ( | task_id_t | task_id | ) |
Returns maximum depth of task stack.
- Parameters
-
[in] task_id Id of the task (use TASK_ID_INVALID for current task).
- Returns
- Number of bytes ever used on task stack.