zephyr: edf_schedule: add support for repeating EDF tasks

Extend the EDF scheduler adaptation to Zephyr to allow repeating
tasks. This allows SOF code to use the per core threads used by
EDF for more usages.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
This commit is contained in:
Kai Vehmanen 2022-08-26 19:43:51 +03:00 committed by Liam Girdwood
parent e29572bb2d
commit 4abda50153
1 changed files with 18 additions and 3 deletions

View File

@ -27,11 +27,26 @@ static void edf_work_handler(struct k_work *work)
struct task *task = CONTAINER_OF(work, struct task, z_delayed_work); struct task *task = CONTAINER_OF(work, struct task, z_delayed_work);
task->state = SOF_TASK_STATE_RUNNING; task->state = SOF_TASK_STATE_RUNNING;
task_run(task);
task->state = task_run(task);
if (task->state == SOF_TASK_STATE_RESCHEDULE) {
uint64_t deadline = task_get_deadline(task);
uint64_t now = k_uptime_ticks();
k_timeout_t timeout = K_MSEC(0);
if (deadline > now)
timeout = K_TICKS(deadline - now);
k_work_reschedule_for_queue(&edf_workq,
&task->z_delayed_work,
timeout);
task->state = SOF_TASK_STATE_QUEUED;
} else {
task_complete(task); task_complete(task);
task->state = SOF_TASK_STATE_COMPLETED; task->state = SOF_TASK_STATE_COMPLETED;
} }
}
/* schedule task */ /* schedule task */
static int schedule_edf_task(void *data, struct task *task, uint64_t start, static int schedule_edf_task(void *data, struct task *task, uint64_t start,