File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -133,6 +133,13 @@ static inline uint32_t user_get_partition_attr(uintptr_t ptr)
133133 */
134134void user_grant_dai_access_all (struct k_thread * thread );
135135
136+ /**
137+ * Grant DMA device access to a user-space thread.
138+ *
139+ * @param thread user-space thread for which DMA access is granted
140+ */
141+ void user_grant_dma_access_all (struct k_thread * thread );
142+
136143#else
137144
138145static inline int user_access_to_mailbox (struct k_mem_domain * domain , k_tid_t thread_id )
Original file line number Diff line number Diff line change 1515#include <stdint.h>
1616
1717#include <rtos/alloc.h>
18+ #include <rtos/sof.h>
1819#include <rtos/userspace_helper.h>
1920#include <sof/audio/module_adapter/module/generic.h>
2021#include <sof/audio/module_adapter/library/userspace_proxy.h>
2122#include <sof/lib/mailbox.h>
2223#include <sof/lib/dai.h>
24+ #include <sof/lib/dma.h>
2325
2426#define MODULE_DRIVER_HEAP_CACHED CONFIG_SOF_ZEPHYR_HEAP_CACHED
2527
@@ -146,6 +148,17 @@ void user_grant_dai_access_all(struct k_thread *thread)
146148 LOG_DBG ("Granted DAI access to thread %p for %zu devices" , thread , count );
147149}
148150
151+ void user_grant_dma_access_all (struct k_thread * thread )
152+ {
153+ const struct dma_info * info = dma_info_get ();
154+ struct sof_dma * d ;
155+
156+ for (d = info -> dma_array ; d < info -> dma_array + info -> num_dmas ; d ++ ) {
157+ k_thread_access_grant (thread , d -> z_dev );
158+ LOG_DBG ("Granted DMA device access: %s to thread %p" , d -> z_dev -> name , thread );
159+ }
160+ }
161+
149162#else /* CONFIG_USERSPACE */
150163
151164void * user_stack_allocate (size_t stack_size , uint32_t options )
You can’t perform that action at this time.
0 commit comments