Skip to content

Commit ffc2f57

Browse files
committed
lib: dma: add user-space support for dma_suspend/resume calls
Extend coverage of the Zephyr DAI interface to include dma_suspend() and dma_resume() calls exposed as syscalls. This allows e.g. to run the DAI module in a user thread. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent a2acad1 commit ffc2f57

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

zephyr/include/sof/lib/sof_dma.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ __syscall int sof_dma_get_status(struct sof_dma *dma, uint32_t channel, struct d
5151

5252
__syscall int sof_dma_reload(struct sof_dma *dma, uint32_t channel, size_t size);
5353

54+
__syscall int sof_dma_suspend(struct sof_dma *dma, uint32_t channel);
55+
56+
__syscall int sof_dma_resume(struct sof_dma *dma, uint32_t channel);
57+
5458
static inline int z_impl_sof_dma_get_attribute(struct sof_dma *dma, uint32_t type, uint32_t *value)
5559
{
5660
return dma_get_attribute(dma->z_dev, type, value);
@@ -95,6 +99,16 @@ static inline int z_impl_sof_dma_reload(struct sof_dma *dma, uint32_t channel, s
9599
return dma_reload(dma->z_dev, channel, 0, 0, size);
96100
}
97101

102+
static inline int z_impl_sof_dma_suspend(struct sof_dma *dma, uint32_t channel)
103+
{
104+
return dma_suspend(dma->z_dev, channel);
105+
}
106+
107+
static inline int z_impl_sof_dma_resume(struct sof_dma *dma, uint32_t channel)
108+
{
109+
return dma_resume(dma->z_dev, channel);
110+
}
111+
98112
#ifdef CONFIG_SOF_USERSPACE_INTERFACE_DMA
99113

100114
/* include definitions from generated file */
@@ -164,6 +178,16 @@ static inline int sof_dma_reload(struct sof_dma *dma, uint32_t channel, size_t s
164178
return z_impl_sof_dma_reload(dma, channel, size);
165179
}
166180

181+
static inline int sof_dma_suspend(struct sof_dma *dma, uint32_t channel)
182+
{
183+
return z_impl_sof_dma_suspend(dma, channel);
184+
}
185+
186+
static inline int sof_dma_resume(struct sof_dma *dma, uint32_t channel)
187+
{
188+
return z_impl_sof_dma_resume(dma, channel);
189+
}
190+
167191
#endif /* CONFIG_SOF_USERSPACE_INTERFACE_DMA */
168192

169193
#endif

zephyr/syscall/sof_dma.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,20 @@ static inline int z_vrfy_sof_dma_reload(struct sof_dma *dma, uint32_t channel, s
235235
}
236236
#include <zephyr/syscalls/sof_dma_reload_mrsh.c>
237237

238+
static inline int z_vrfy_sof_dma_suspend(struct sof_dma *dma, uint32_t channel)
239+
{
240+
K_OOPS(!sof_dma_is_valid(dma));
241+
242+
return z_impl_sof_dma_suspend(dma, channel);
243+
}
244+
#include <zephyr/syscalls/sof_dma_suspend_mrsh.c>
245+
246+
static inline int z_vrfy_sof_dma_resume(struct sof_dma *dma, uint32_t channel)
247+
{
248+
K_OOPS(!sof_dma_is_valid(dma));
249+
250+
return z_impl_sof_dma_resume(dma, channel);
251+
}
252+
#include <zephyr/syscalls/sof_dma_resume_mrsh.c>
253+
238254
#endif /* CONFIG_SOF_USERSPACE_INTERFACE_DMA */

0 commit comments

Comments
 (0)