Skip to content

Commit 35a1373

Browse files
committed
audio: dp: create the thread early
We need to move IPC processing for DP scheduled components into their thread context. For that the thread has to be started early. Create it immediately when creating DP task context. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent e0fbd58 commit 35a1373

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/schedule/zephyr_dp_schedule.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,6 @@ static int scheduler_dp_task_shedule(void *data, struct task *task, uint64_t sta
391391
return -EINVAL;
392392
}
393393

394-
/* create a zephyr thread for the task */
395-
pdata->thread_id = k_thread_create(&pdata->thread, (__sparse_force void *)pdata->p_stack,
396-
pdata->stack_size, dp_thread_fn, task, NULL, NULL,
397-
CONFIG_DP_THREAD_PRIORITY, K_USER, K_FOREVER);
398-
399394
/* pin the thread to specific core */
400395
ret = k_thread_cpu_pin(pdata->thread_id, task->core);
401396
if (ret < 0) {
@@ -521,22 +516,28 @@ int scheduler_dp_task_init(struct task **task,
521516
goto err;
522517
}
523518

519+
struct task_dp_pdata *pdata = &task_memory->pdata;
520+
524521
/* initialize other task structures */
525522
task_memory->task.ops.complete = ops->complete;
526523
task_memory->task.ops.get_deadline = ops->get_deadline;
527524
task_memory->task.state = SOF_TASK_STATE_INIT;
528525
task_memory->task.core = core;
526+
task_memory->task.priv_data = pdata;
529527

530528
/* initialize semaprhore */
531-
k_sem_init(&task_memory->pdata.sem, 0, 1);
529+
k_sem_init(&pdata->sem, 0, 1);
532530

533531
/* success, fill the structures */
534-
task_memory->task.priv_data = &task_memory->pdata;
535-
task_memory->pdata.p_stack = p_stack;
536-
task_memory->pdata.stack_size = stack_size;
537-
task_memory->pdata.mod = mod;
532+
pdata->p_stack = p_stack;
533+
pdata->stack_size = stack_size;
534+
pdata->mod = mod;
538535
*task = &task_memory->task;
539536

537+
/* create a zephyr thread for the task */
538+
pdata->thread_id = k_thread_create(&pdata->thread, (__sparse_force void *)p_stack,
539+
stack_size, dp_thread_fn, &task_memory->task, NULL, NULL,
540+
CONFIG_DP_THREAD_PRIORITY, K_USER, K_FOREVER);
540541

541542
return 0;
542543
err:

0 commit comments

Comments
 (0)