-
Notifications
You must be signed in to change notification settings - Fork 9.9k
drivers: dai: add ability to use dai.h from user threads #99811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
de7218c
8241782
70f5e6f
3c5607b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,145 @@ | ||||||||||||||||||||||||
| /* | ||||||||||||||||||||||||
| * Copyright (c) 2025 Intel Corporation | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * SPDX-License-Identifier: Apache-2.0 | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| #include <zephyr/drivers/dai.h> | ||||||||||||||||||||||||
| #include <zephyr/internal/syscall_handler.h> | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Maximum size of bespoke objects passed to DAI driver. | ||||||||||||||||||||||||
| * The objects get allocated temporarily on stack for validation, | ||||||||||||||||||||||||
| * so size needs to be limited. | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| #define DAI_MAX_BESPOKE_CFG_SIZE 256 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| static inline int z_vrfy_dai_probe(const struct device *dev) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| K_OOPS(K_SYSCALL_DRIVER_DAI(dev, probe)); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| return z_impl_dai_probe(dev); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| #include <zephyr/syscalls/dai_probe_mrsh.c> | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| static inline int z_vrfy_dai_remove(const struct device *dev) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| K_OOPS(K_SYSCALL_DRIVER_DAI(dev, remove)); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| return z_impl_dai_remove(dev); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| #include <zephyr/syscalls/dai_remove_mrsh.c> | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| static inline int z_vrfy_dai_config_set(const struct device *dev, | ||||||||||||||||||||||||
| const struct dai_config *cfg, | ||||||||||||||||||||||||
| const void *bespoke_cfg, | ||||||||||||||||||||||||
| size_t size) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| uint8_t bespoke_cfg_kernel[DAI_MAX_BESPOKE_CFG_SIZE]; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if (size > DAI_MAX_BESPOKE_CFG_SIZE) { | ||||||||||||||||||||||||
| return -EINVAL; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| K_OOPS(K_SYSCALL_DRIVER_DAI(dev, config_set)); | ||||||||||||||||||||||||
| K_OOPS(k_usermode_from_copy(bespoke_cfg_kernel, bespoke_cfg, size)); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| return z_impl_dai_config_set(dev, cfg, bespoke_cfg_kernel, size); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
Comment on lines
+45
to
+48
|
||||||||||||||||||||||||
| K_OOPS(k_usermode_from_copy(bespoke_cfg_kernel, bespoke_cfg, size)); | |
| return z_impl_dai_config_set(dev, cfg, bespoke_cfg_kernel, size); | |
| } | |
| if (size > 0) { | |
| K_OOPS(k_usermode_from_copy(bespoke_cfg_kernel, bespoke_cfg, size)); | |
| return z_impl_dai_config_set(dev, cfg, bespoke_cfg_kernel, size); | |
| } else { | |
| /* No bespoke config to copy, pass NULL */ | |
| return z_impl_dai_config_set(dev, cfg, NULL, 0); | |
| } |
Uh oh!
There was an error while loading. Please reload this page.