14#ifndef __ZEPHYR_RTOS_TASK_H__
15#define __ZEPHYR_RTOS_TASK_H__
33#define SOF_TASK_PRI_HIGH 0
34#define SOF_TASK_PRI_MED 4
35#define SOF_TASK_PRI_LOW 9
38#define SOF_TASK_DEADLINE_IDLE UINT64_MAX
39#define SOF_TASK_DEADLINE_ALMOST_IDLE (SOF_TASK_DEADLINE_IDLE - 1)
40#define SOF_TASK_DEADLINE_NOW 0
43#define SOF_TASK_SKIP_COUNT 0xFFFFu
98#if CONFIG_PERFORMANCE_COUNTERS
task_state
Lifecycle and execution states of an SOF task.
Definition task.h:48
int start_complete(void)
Signal completion of system startup.
int task_main_start(struct sof *sof)
Start the main SOF background task.
static uint64_t task_get_deadline(struct task *task)
Retrieve a task's deadline timestamp.
Definition task.h:149
static bool task_is_active(struct task *task)
Check whether a task is active (queued, running, pending, or rescheduling).
Definition task.h:108
static void task_complete(struct task *task)
Execute a task's complete callback, if registered.
Definition task.h:138
static enum task_state task_run(struct task *task)
Execute a task's run callback.
Definition task.h:127
@ SOF_TASK_STATE_INIT
Task allocated and initialized, not yet scheduled.
Definition task.h:50
@ SOF_TASK_STATE_FREE
Task resources released.
Definition task.h:62
@ SOF_TASK_STATE_RUNNING
Task actively executing in thread or timer/DMA handler.
Definition task.h:56
@ SOF_TASK_STATE_COMPLETED
Task execution finished; removed from active scheduling.
Definition task.h:60
@ SOF_TASK_STATE_PENDING
Task waiting for preconditions, audio data, or buffer space.
Definition task.h:54
@ SOF_TASK_STATE_CANCEL
Task cancelled, pending removal from scheduler.
Definition task.h:64
@ SOF_TASK_STATE_QUEUED
Task queued in scheduler run list awaiting tick or trigger.
Definition task.h:52
@ SOF_TASK_STATE_PREEMPTED
Task preempted by higher priority thread or ISR.
Definition task.h:58
@ SOF_TASK_STATE_RESCHEDULE
Return code from run callback requesting rescheduling in next period.
Definition task.h:66
RTOS kernel threading and privilege helpers.
#define assert(x)
Definition panic.h:19
Performance counter data, without the timer based helpers.
Audio component base device "class" used by all other component types.
Definition component.h:587
Definition perf_cnt_data.h:21
Descriptor container representing a registered scheduler instance.
Definition schedule.h:195
Connects UUID with component description.
Definition uuid.h:77
General firmware context.
Definition sof.h:50
Operations and callbacks associated with a scheduling task.
Definition task.h:72
enum task_state(* run)(void *data)
Task's main execution callback function.
Definition task.h:73
uint64_t(* get_deadline)(void *data)
Optional callback returning current task deadline timestamp.
Definition task.h:75
void(* complete)(void *data)
Optional callback executed on task completion.
Definition task.h:74
Core task structure managed by SOF schedulers.
Definition task.h:81
uint32_t cycles_sum
Cumulative execution cycles.
Definition task.h:95
const struct sof_uuid_entry * uid
UUID identifying the task or associated component.
Definition task.h:83
struct list_item list
List node linking task into scheduler run queue.
Definition task.h:91
struct schedule_data * sch
Pointer to scheduler instance bound to this task.
Definition task.h:88
uint32_t cycles_max
Maximum cycle count recorded in a single run.
Definition task.h:96
uint16_t core
Execution core ID affinity.
Definition task.h:86
enum task_state state
Current task lifecycle state.
Definition task.h:89
uint16_t type
Scheduler type identifier (SOF_SCHEDULE_*).
Definition task.h:84
void * data
Custom context pointer passed to task operations.
Definition task.h:90
struct task_ops ops
Task operations callbacks table.
Definition task.h:93
int16_t priority
Priority of the task (lower values run first).
Definition task.h:85
struct k_work_delayable z_delayed_work
Zephyr delayable work item (used by legacy EDF).
Definition task.h:94
void * priv_data
Scheduler-specific private task context.
Definition task.h:92
uint64_t start
Scheduler/domain-specific start state (e.g.
Definition task.h:82
uint16_t flags
Custom task flags.
Definition task.h:87
uint32_t cycles_cnt
Number of completed execution runs.
Definition task.h:97