From f1949fbcfe6dcf61a0b3d8a498bc4976307c3f29 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Mon, 21 Mar 2022 21:37:21 +0200 Subject: [PATCH 1/2] xtos-wrapper: Add Zephyr kernel.h replica with k_[mu]sleep() for XTOS The commit adds kernel.h header at the top level of xtos-wrapper include directory. The idea is to be able to write OS agnostic code using Zephyr kernel API calls and simply including kernel.h without worrying if we are building for XTOS or Zephyr. This first commit contains Zephyr API style k_msleep() and k_usleep() implementations. The functions in fact call the old wait_delay-functions. More implementations and declarations following Zephyr kernel.h content can be added as needed. Signed-off-by: Jyri Sarha --- src/arch/xtos-wrapper/include/kernel.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/arch/xtos-wrapper/include/kernel.h diff --git a/src/arch/xtos-wrapper/include/kernel.h b/src/arch/xtos-wrapper/include/kernel.h new file mode 100644 index 000000000000..8b41787d2383 --- /dev/null +++ b/src/arch/xtos-wrapper/include/kernel.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright(c) 2022 Intel Corporation. All rights reserved. + * + * Author: Jyri Sarha + */ + +#ifndef __XTOS_WRAPPER_KERNEL_H__ +#define __XTOS_WRAPPER_KERNEL_H__ + +#include + +#include + +static inline void k_msleep(int32_t ms) +{ + wait_delay_ms(ms); +} + +static inline void k_usleep(int32_t us) +{ + wait_delay_us(us); +} + +#endif /* __XTOS_WRAPPER_KERNEL_H__ */ From a4d2d85ce7b0500cbf6d7266b846f4f387e6533f Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Mon, 2 May 2022 23:28:56 +0300 Subject: [PATCH 2/2] pipeline: Use Zephyr API k_msleep() instead of obsolete wait_delay_ms() Use Zephyr API k_msleep() instead of obsolete wait_delay_ms(). In XTOS build the k_msleep() is implemented in xtos-wrapper/include/kernel.h and it actually calls the wait_delay_ms(). Signed-off-by: Jyri Sarha --- src/audio/pipeline/pipeline-stream.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/audio/pipeline/pipeline-stream.c b/src/audio/pipeline/pipeline-stream.c index 952c8e5c6dd4..06e7771134c3 100644 --- a/src/audio/pipeline/pipeline-stream.c +++ b/src/audio/pipeline/pipeline-stream.c @@ -15,6 +15,9 @@ #include #include #include + +#include + #include #include #include @@ -430,7 +433,7 @@ int pipeline_trigger_run(struct pipeline *p, struct comp_dev *host, int cmd) list_init(&walk_ctx.pipelines); if (data.delay_ms) - wait_delay_ms(data.delay_ms); + k_msleep(data.delay_ms); ret = walk_ctx.comp_func(host, NULL, &walk_ctx, host->direction); if (ret < 0)