14#ifndef __SOF_SCHEDULE_SCHEDULE_H__
15#define __SOF_SCHEDULE_SCHEDULE_H__
20#include <sof/trace/trace.h>
76#define SOF_SCHEDULER_FREE_IRQ_ONLY BIT(0)
113 uint64_t period,
struct task *before);
127 uint64_t period,
struct task *after);
170#if CONFIG_SOF_BOOT_TEST_STANDALONE || CONFIG_LIBRARY
178 void (*scheduler_free)(
void *
data, uint32_t flags);
189 struct k_thread *(*scheduler_init_context)(
void *
data,
struct task *
task);
333 uint64_t period,
struct task *before)
337 if (!
task || !before)
363 uint64_t period,
struct task *after)
434#if CONFIG_SOF_BOOT_TEST_STANDALONE || CONFIG_LIBRARY
439static inline void schedule_free(uint32_t flags)
447 if (sch->
ops->scheduler_free)
448 sch->
ops->scheduler_free(sch->
data, flags);
493 void *
data, uint16_t core, uint32_t flags);
518 uint32_t *data_off_size,
struct list_item *tasks);
IPC4 Base Firmware parameters, memory configuration, and status definitions.
#define container_of(ptr, type, member)
Definition common.h:117
static int schedule_task_before(struct task *task, uint64_t start, uint64_t period, struct task *before)
Schedule a task to execute before a specified reference task.
Definition schedule.h:332
static void * scheduler_list_get_data(struct schedulers *schedulers, uint16_t type)
Lookup scheduler private context data by scheduler type from a schedulers container.
Definition schedule.h:244
void scheduler_init(int type, const struct scheduler_ops *ops, void *data)
Register a scheduler type instance with its operations table and private context data.
int schedule_task_init(struct task *task, const struct sof_uuid_entry *uid, uint16_t type, int16_t priority, enum task_state(*run)(void *data), void *data, uint16_t core, uint32_t flags)
Initialize a scheduling task and bind it to the registered scheduler for its type and core.
static struct k_thread * scheduler_init_context(struct task *task)
Initialize thread execution context for a task.
Definition schedule.h:458
static void * scheduler_get_user_data(uint16_t type)
Retrieve private data of a registered user-space scheduler on the current core.
Definition schedule.h:276
task_state
Lifecycle and execution states of an SOF task.
Definition task.h:48
void scheduler_get_task_info(struct scheduler_props *scheduler_props, uint32_t *data_off_size, struct list_item *tasks)
Extract scheduler task telemetry and properties for IPC4 base firmware.
static int schedule_task_free(struct task *task)
Free scheduler resources associated with a task.
Definition schedule.h:421
static int reschedule_task(struct task *task, uint64_t start)
Reschedule an already scheduled task with an updated start time.
Definition schedule.h:385
static int schedule_task_cancel(struct task *task)
Cancel a scheduled or queued task.
Definition schedule.h:404
static int schedule_task(struct task *task, uint64_t start, uint64_t period)
Schedule a task for execution with start delay and period.
Definition schedule.h:306
static int schedule_task_after(struct task *task, uint64_t start, uint64_t period, struct task *after)
Schedule a task to execute after a specified reference task.
Definition schedule.h:362
static void * scheduler_get_data(uint16_t type)
Retrieve private data of a registered kernel scheduler on the current core.
Definition schedule.h:266
static int schedule_task_running(struct task *task)
Notify the scheduler that a task is transitioning to the running state.
Definition schedule.h:286
struct schedulers ** arch_schedulers_get(void)
Retrieve the array of registered kernel-space schedulers for the current core.
struct schedulers ** arch_user_schedulers_get(void)
Retrieve registered schedulers for user-space threads on the current core.
struct schedulers ** arch_user_schedulers_get_for_core(int core)
Retrieve registered schedulers for user-space threads on a specific core.
@ SOF_SCHEDULE_LL_DMA
Low Latency DMA interrupt domain scheduler.
Definition schedule.h:53
@ SOF_SCHEDULE_LL_TIMER
Low Latency timer domain scheduler.
Definition schedule.h:47
@ SOF_SCHEDULE_COUNT
Indicates total number of scheduler types.
Definition schedule.h:72
@ SOF_SCHEDULE_TWB
Tasks With Budget (TWB) scheduler.
Definition schedule.h:68
@ SOF_SCHEDULE_EDF
Earliest Deadline First (EDF) scheduler.
Definition schedule.h:41
@ SOF_SCHEDULE_DP
Data Processing (DP) worker thread scheduler.
Definition schedule.h:60
#define list_for_item(item, list)
Definition list.h:92
#define assert(x)
Definition panic.h:19
User-space ABI log levels and binary trace packet header definitions.
Descriptor container representing a registered scheduler instance.
Definition schedule.h:195
struct list_item list
List node linking this scheduler into the per-core schedulers list.
Definition schedule.h:196
int type
Scheduler type identifier (SOF_SCHEDULE_*).
Definition schedule.h:197
void * data
Pointer to scheduler-specific private context data.
Definition schedule.h:199
const struct scheduler_ops * ops
Pointer to scheduler operations table.
Definition schedule.h:198
Scheduler operations interface table.
Definition schedule.h:85
int(* schedule_task_before)(void *data, struct task *task, uint64_t start, uint64_t period, struct task *before)
Schedule a task to execute before a specified reference task.
Definition schedule.h:112
int(* schedule_task_after)(void *data, struct task *task, uint64_t start, uint64_t period, struct task *after)
Schedule a task to execute after a specified reference task.
Definition schedule.h:126
struct k_thread *(* scheduler_init_context)(void *data, struct task *task)
Initialize execution thread context for a scheduled task.
Definition schedule.h:189
int(* schedule_task)(void *data, struct task *task, uint64_t start, uint64_t period)
Schedule a task with the given timing parameters.
Definition schedule.h:98
int(* schedule_task_cancel)(void *data, struct task *task)
Cancel a previously scheduled task.
Definition schedule.h:158
int(* schedule_task_free)(void *data, struct task *task)
Free scheduler resources associated with a task.
Definition schedule.h:168
int(* schedule_task_running)(void *data, struct task *task)
Transition a task to running state and perform scheduler-specific execution hooks.
Definition schedule.h:137
int(* reschedule_task)(void *data, struct task *task, uint64_t start)
Reschedule an already scheduled task with an updated start delay.
Definition schedule.h:148
Core scheduler properties and scheduled tasks.
Definition base_fw.h:685
Container holding the linked list of all registered schedulers on a core.
Definition schedule.h:205
struct list_item list
Head of the linked list of registered schedulers.
Definition schedule.h:206
Connects UUID with component description.
Definition uuid.h:77
Core task structure managed by SOF schedulers.
Definition task.h:81
struct schedule_data * sch
Pointer to scheduler instance bound to this task.
Definition task.h:88
Core task descriptor, task operations, and task execution state machine.