|
ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems) 0.1.0
Preemptive Real-Time Operating System for ARM Cortex-M7
|
ICARUS Task Management Implementation. More...
#include "icarus/task.h"#include "icarus/kernel.h"#include "icarus/scheduler.h"#include <string.h>#include <stdio.h>Go to the source code of this file.
Functions | |
| void | os_create_task (icarus_task_t *task, void(*function)(void), uint32_t *stack, uint32_t stack_size, uint32_t *data, const char *name) |
| Create a task with explicit stack allocation. | |
| void | __os_register_task (void(*function)(void), const char *name) |
| Privileged implementation of os_register_task. | |
| void | __os_exit_task (void) |
| Privileged implementation of os_exit_task. | |
| void | __os_kill_process (uint8_t task_index) |
| Privileged implementation of os_kill_process. | |
| void | __os_task_suicide (void) |
| Privileged implementation of os_task_suicide. | |
| void | __os_restart_task (uint8_t task_index) |
| Privileged implementation of os_restart_task. | |
ICARUS Task Management Implementation.
Task creation, registration, and lifecycle management.
Definition in file task.c.
| void __os_exit_task | ( | void | ) |
Privileged implementation of os_exit_task.
Definition at line 90 of file task.c.
References __os_yield(), cleanup_task_idx, current_cleanup_task_idx, current_task_index, ICARUS_MAX_TASKS, running_task_count, task_list, icarus_task_t::task_state, and TASK_STATE_FINISHED.
Referenced by os_exit_task(), and SVC_Handler_C().
| void __os_kill_process | ( | uint8_t | task_index | ) |
Privileged implementation of os_kill_process.
Definition at line 110 of file task.c.
References __os_yield(), cleanup_task_idx, current_cleanup_task_idx, current_task_index, ICARUS_MAX_TASKS, num_created_tasks, running_task_count, task_list, icarus_task_t::task_state, and TASK_STATE_KILLED.
Referenced by __os_task_suicide(), os_kill_process(), and SVC_Handler_C().
| void __os_register_task | ( | void(*)(void) | function, |
| const char * | name | ||
| ) |
Privileged implementation of os_register_task.
Definition at line 74 of file task.c.
References __kernel_get_data(), __kernel_get_stack(), ICARUS_STACK_WORDS, num_created_tasks, os_create_task(), and task_list.
Referenced by __os_init(), os_register_task(), and SVC_Handler_C().
| void __os_restart_task | ( | uint8_t | task_index | ) |
Privileged implementation of os_restart_task.
Re-initializes a killed/finished task's stack frame from its original function pointer and stack base. The task re-enters the scheduler as if freshly created — no new stack slot is allocated, no memory is leaked.
| task_index | Index of the task to restart (1-based). |
Definition at line 154 of file task.c.
References icarus_task_t::dispatch_count, icarus_task_t::function, icarus_task_t::global_tick_paused, num_created_tasks, os_exit_task(), running_task_count, icarus_task_t::stack_base, icarus_task_t::stack_pointer, icarus_task_t::stack_size, icarus_task_t::stack_watermark, task_list, icarus_task_t::task_state, TASK_STATE_COLD, TASK_STATE_FINISHED, TASK_STATE_KILLED, and icarus_task_t::ticks_to_pause.
Referenced by os_restart_task(), and SVC_Handler_C().
| void __os_task_suicide | ( | void | ) |
Privileged implementation of os_task_suicide.
Definition at line 136 of file task.c.
References __os_kill_process(), current_task_index, and task_list.
Referenced by os_task_suicide(), and SVC_Handler_C().
| void os_create_task | ( | icarus_task_t * | task, |
| void(*)(void) | function, | ||
| uint32_t * | stack, | ||
| uint32_t | stack_size, | ||
| uint32_t * | data, | ||
| const char * | name | ||
| ) |
Create a task with explicit stack allocation.
| task | TCB to initialize |
| function | Task entry point |
| stack | Stack memory (8-byte aligned) |
| stack_size | Stack size in 32-bit words |
| name | Task name |
Definition at line 27 of file task.c.
References icarus_task_t::data_pointer, icarus_task_t::dispatch_count, icarus_task_t::function, icarus_task_t::global_tick_paused, ICARUS_MAX_TASK_NAME_LEN, ICARUS_MAX_TASKS, icarus_task_t::name, num_created_tasks, os_exit_task(), running_task_count, icarus_task_t::stack_base, icarus_task_t::stack_pointer, icarus_task_t::stack_size, icarus_task_t::stack_watermark, icarus_task_t::task_priority, TASK_PRIORITY_LOW, icarus_task_t::task_state, TASK_STATE_COLD, and icarus_task_t::ticks_to_pause.
Referenced by __os_register_task().