Skip to content
Open
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
4 changes: 3 additions & 1 deletion src/include/sof/lib/dai-zephyr.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ void dai_release_llp_slot(struct dai_data *dd);
/**
* \brief Retrieve a pointer to the Zephyr device structure for a DAI of a given type and index.
*/
const struct device *dai_get_device(enum sof_ipc_dai_type type, uint32_t index);
__syscall const struct device *dai_get_device(enum sof_ipc_dai_type type, uint32_t index);

/**
* \brief Retrieve the list of all DAI devices.
Expand All @@ -319,4 +319,6 @@ const struct device *dai_get_device(enum sof_ipc_dai_type type, uint32_t index);
const struct device **dai_get_device_list(size_t *count);
/** @}*/

#include <zephyr/syscalls/dai-zephyr.h>

#endif /* __SOF_LIB_DAI_ZEPHYR_H__ */
2 changes: 1 addition & 1 deletion src/lib/dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static int sof_dai_type_to_zephyr(uint32_t type)
}
}

const struct device *dai_get_device(enum sof_ipc_dai_type type, uint32_t index)
const struct device *z_impl_dai_get_device(enum sof_ipc_dai_type type, uint32_t index)
{
struct dai_config cfg;
int z_type;
Expand Down
2 changes: 2 additions & 0 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,8 @@ zephyr_syscall_header(${SOF_SRC_PATH}/include/sof/audio/module_adapter/module/ge
zephyr_syscall_header(${SOF_SRC_PATH}/include/sof/lib/fast-get.h)
zephyr_syscall_header(include/rtos/alloc.h)
zephyr_library_sources_ifdef(CONFIG_SOF_USERSPACE_INTERFACE_ALLOC syscall/alloc.c)
zephyr_syscall_header(${SOF_SRC_PATH}/include/sof/lib/dai-zephyr.h)
zephyr_library_sources_ifdef(CONFIG_USERSPACE syscall/dai.c)
Comment on lines +625 to +626

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is ok, userspace is a Zephyr Kconfig and any target enabling it will be using native drivers, so this requirement can be implicit.


zephyr_library_link_libraries(SOF)
target_link_libraries(SOF INTERFACE zephyr_interface)
Expand Down
19 changes: 19 additions & 0 deletions zephyr/syscall/dai.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2026 Intel Corporation.

#include <sof/lib/dai.h>
#include <zephyr/kernel.h>
#include <zephyr/internal/syscall_handler.h>

static inline const struct device *z_vrfy_dai_get_device(enum sof_ipc_dai_type type,
uint32_t index)
{
const struct device *dev = z_impl_dai_get_device(type, index);

if (dev && !k_object_is_valid(dev, K_OBJ_DRIVER_DAI))
return NULL;

return dev;
}
#include <zephyr/syscalls/dai_get_device_mrsh.c>
Loading