Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/arch/xtos-wrapper/include/kernel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2022 Intel Corporation. All rights reserved.
*
* Author: Jyri Sarha <jyri.sarha@intel.com>
*/

#ifndef __XTOS_WRAPPER_KERNEL_H__
#define __XTOS_WRAPPER_KERNEL_H__

#include <sof/lib/wait.h>

#include <stdint.h>

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__ */
5 changes: 4 additions & 1 deletion src/audio/pipeline/pipeline-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#include <sof/string.h>
#include <ipc/stream.h>
#include <ipc/topology.h>

#include <kernel.h>

#include <errno.h>
#include <stdbool.h>
#include <stddef.h>
Expand Down Expand Up @@ -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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note, that this might incur a context switch now, IIUC. Before it was a busy loop, now under Zephyr this can actually cause a context switch. Although this path is only taken for DMA-driven pipelines and only when that delay is non-zero... And there might not be any other threads to switch to. So in practice this should be harmless and have no effect in 99.99% of the cases

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, this is intended - and we do need to rework the DMA driver scheduling at some point.


ret = walk_ctx.comp_func(host, NULL, &walk_ctx, host->direction);
if (ret < 0)
Expand Down