From 3f8de64cfce7cbb852f159ed943f33315c796f04 Mon Sep 17 00:00:00 2001 From: Adrian Bonislawski Date: Tue, 18 Jun 2024 11:58:36 +0200 Subject: [PATCH] [TEST] ipc: switch IPC tak scheduler to TWB This will change scheduler type for IPC task Signed-off-by: Adrian Bonislawski --- src/include/sof/ipc/common.h | 4 ++++ src/ipc/ipc-common.c | 4 ++++ src/ipc/ipc-zephyr.c | 15 +++++++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/include/sof/ipc/common.h b/src/include/sof/ipc/common.h index ef2e8c8d7f3c..097de6bb8b18 100644 --- a/src/include/sof/ipc/common.h +++ b/src/include/sof/ipc/common.h @@ -65,7 +65,11 @@ struct ipc { struct list_item comp_list; /* list of component devices */ /* processing task */ +#if CONFIG_ZEPHYR_TWB_SCHEDULER + struct task *ipc_task; +#else struct task ipc_task; +#endif #ifdef __ZEPHYR__ struct k_work_delayable z_delayed_work; diff --git a/src/ipc/ipc-common.c b/src/ipc/ipc-common.c index fab5d6e4cdef..c2a8c3af7b14 100644 --- a/src/ipc/ipc-common.c +++ b/src/ipc/ipc-common.c @@ -260,7 +260,11 @@ static void ipc_work_handler(struct k_work *work) void ipc_schedule_process(struct ipc *ipc) { +#if CONFIG_ZEPHYR_TWB_SCHEDULER + schedule_task(ipc->ipc_task, 0, IPC_PERIOD_USEC); +#else schedule_task(&ipc->ipc_task, 0, IPC_PERIOD_USEC); +#endif } int ipc_init(struct sof *sof) diff --git a/src/ipc/ipc-zephyr.c b/src/ipc/ipc-zephyr.c index 49a448850a99..0afff11d3408 100644 --- a/src/ipc/ipc-zephyr.c +++ b/src/ipc/ipc-zephyr.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -162,9 +163,14 @@ static int ipc_device_resume_handler(const struct device *dev, void *arg) intel_adsp_ipc_set_message_handler(INTEL_ADSP_IPC_HOST_DEV, message_handler, ipc); /* schedule task */ +#if CONFIG_ZEPHYR_TWB_SCHEDULER + scheduler_twb_task_init(&ipc->ipc_task, SOF_UUID(ipc_task_uuid), + &ipc_task_ops, ipc, 0, "IPC", ZEPHYR_TWB_STACK_SIZE, + CONFIG_TWB_THREAD_MEDIUM_PRIORITY, 5); +#else schedule_task_init_edf(&ipc->ipc_task, SOF_UUID(ipc_task_uuid), &ipc_task_ops, ipc, 0, 0); - +#endif return 0; } #endif /* CONFIG_PM_DEVICE */ @@ -280,9 +286,14 @@ int platform_ipc_init(struct ipc *ipc) ipc_set_drvdata(ipc, NULL); /* schedule task */ +#if CONFIG_ZEPHYR_TWB_SCHEDULER + scheduler_twb_task_init(&ipc->ipc_task, SOF_UUID(ipc_task_uuid), + &ipc_task_ops, ipc, 0, "IPC", ZEPHYR_TWB_STACK_SIZE, + CONFIG_TWB_THREAD_MEDIUM_PRIORITY, 5); +#else schedule_task_init_edf(&ipc->ipc_task, SOF_UUID(ipc_task_uuid), &ipc_task_ops, ipc, 0, 0); - +#endif /* configure interrupt - work is done internally by Zephyr API */ /* attach handlers */