Sound Open Firmware
Loading...
Searching...
No Matches
dp_schedule.h File Reference
Include dependency graph for dp_schedule.h:

Go to the source code of this file.

Data Structures

union  scheduler_dp_thread_ipc_param

Enumerations

enum  { DP_TASK_EVENT_PROCESS = BIT(0) , DP_TASK_EVENT_CANCEL = BIT(1) , DP_TASK_EVENT_IPC = BIT(2) , DP_TASK_EVENT_IPC_DONE = BIT(3) }

Functions

int scheduler_dp_init (void)
 DP scheduler is a scheduler that creates a separate preemptible Zephyr thread for each SOF task.
int scheduler_dp_task_init (struct task **task, const struct sof_uuid_entry *uid, const struct task_ops *ops, struct processing_module *mod, uint16_t core, size_t stack_size, uint32_t options)
 initialize a DP task and add it to scheduling It must be called on core the task is declared to run on
void scheduler_dp_ll_tick (void)
void scheduler_get_task_info_dp (struct scheduler_props *scheduler_props, uint32_t *data_off_size)
 Extract information about scheduler's tasks.
static int scheduler_dp_thread_ipc (struct processing_module *pmod, unsigned int cmd, const union scheduler_dp_thread_ipc_param *param)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DP_TASK_EVENT_PROCESS 
DP_TASK_EVENT_CANCEL 
DP_TASK_EVENT_IPC 
DP_TASK_EVENT_IPC_DONE 

Function Documentation

◆ scheduler_dp_init()

int scheduler_dp_init ( void )

DP scheduler is a scheduler that creates a separate preemptible Zephyr thread for each SOF task.

The task execution may be delayed and task may be re-scheduled periodically NOTE: delayed start and rescheduling takes place in sync with LL scheduler, meaning the DP scheduler is triggered on each core after all LL task have been completed

Task run() may return: SOF_TASK_STATE_RESCHEDULE - the task will be rescheduled as specified in scheduler period note that task won't ever be rescheduled if LL is not running SOF_TASK_STATE_COMPLETED - the task will be removed from scheduling, calling schedule_task will add the task to processing again task_complete() will be called SOF_TASK_STATE_CANCEL - the task will be removed from scheduling, calling schedule_task will add the task to processing again task_complete() won't be called other statuses - assert will go off

NOTE: task - means a SOF task thread - means a Zephyr preemptible thread

TODO - EDF: Threads run on the same priority, lower than thread running LL tasks. Zephyr EDF mechanism is used for decision which thread/task is to be scheduled next. The DP scheduler calculates the task deadline and set it in Zephyr thread properties, the final scheduling decision is made by Zephyr.

Each time tick the scheduler iterates through the list of all active tasks and calculates a deadline based on

  • knowledge how the modules are bound
  • declared time required by a task to complete processing
  • the deadline of the last module

Init the Data Processing scheduler

◆ scheduler_dp_ll_tick()

void scheduler_dp_ll_tick ( void )

◆ scheduler_dp_task_init()

int scheduler_dp_task_init ( struct task ** task,
const struct sof_uuid_entry * uid,
const struct task_ops * ops,
struct processing_module * mod,
uint16_t core,
size_t stack_size,
uint32_t options )

initialize a DP task and add it to scheduling It must be called on core the task is declared to run on

Parameters
[out]taskpointer, pointer to allocated task structure will be return
[in]uidpointer to UUID of the task
[in]opspointer to task functions
[in]modpointer to the module to be run
[in]coreCPU the thread should run on
[in]stack_sizesize of stack for a zephyr task
[in]optionstask options used for creation

◆ scheduler_dp_thread_ipc()

int scheduler_dp_thread_ipc ( struct processing_module * pmod,
unsigned int cmd,
const union scheduler_dp_thread_ipc_param * param )
inlinestatic

◆ scheduler_get_task_info_dp()

void scheduler_get_task_info_dp ( struct scheduler_props * scheduler_props,
uint32_t * data_off_size )

Extract information about scheduler's tasks.

Parameters
scheduler_propsStructure to be filled
data_off_sizePointer to the current size of the scheduler_props, to be updated