ca13734bf0
Add kernel (Cortex-M0/M3/M4, Tricore, S32K, RISC-V ports), drivers, middleware (CAN stack, diagnostics, safety), applications, board support, build/test tooling, and documentation.
59 lines
1.3 KiB
C
59 lines
1.3 KiB
C
/**
|
|
* @file task.h
|
|
* @brief Task management interface
|
|
*/
|
|
|
|
#ifndef TASK_H
|
|
#define TASK_H
|
|
|
|
#include "kernel.h"
|
|
|
|
/* Internal Task Control Block */
|
|
struct TaskControlBlock {
|
|
/* Task Identification */
|
|
char name[MAX_TASK_NAME_LENGTH];
|
|
TaskHandle_t self;
|
|
uint32_t task_id;
|
|
|
|
/* Task Function */
|
|
TaskFunction_t function;
|
|
void* parameters;
|
|
|
|
/* Stack Management */
|
|
uint32_t* stack_pointer;
|
|
uint32_t* stack_base;
|
|
uint32_t stack_size;
|
|
uint32_t stack_high_water_mark;
|
|
|
|
/* Scheduling Information */
|
|
TaskPriority_t priority;
|
|
TaskState_t state;
|
|
TickType_t period_ticks;
|
|
TickType_t last_wake_time;
|
|
TickType_t deadline_ticks;
|
|
|
|
/* Blocking Information */
|
|
TickType_t block_timeout;
|
|
void* blocked_on;
|
|
|
|
/* Statistics */
|
|
TaskStatistics_t statistics;
|
|
|
|
/* List Management */
|
|
struct TaskControlBlock* next;
|
|
struct TaskControlBlock* prev;
|
|
|
|
/* Architecture Specific */
|
|
uint32_t context[32]; /* CPU register context */
|
|
};
|
|
|
|
/* Internal Task Management Functions */
|
|
void task_init(void);
|
|
void task_switch_context(TaskHandle_t next_task);
|
|
TaskHandle_t task_get_idle_task(void);
|
|
void task_update_statistics(void);
|
|
void task_check_stack_overflow(void);
|
|
bool task_is_ready(TaskHandle_t task);
|
|
|
|
#endif /* TASK_H */
|