12#ifndef __ZEPHYR_LIB_USERSPACE_HELPER_H__
13#define __ZEPHYR_LIB_USERSPACE_HELPER_H__
15#include <zephyr/kernel.h>
17#ifndef CONFIG_USERSPACE
20#define APP_SYSUSER_BSS
21#define APP_SYSUSER_DATA
23#include <zephyr/cache.h>
24#include <zephyr/app_memory/app_memdomain.h>
26#define USER_MOD_HEAP_SIZE ALIGN_UP(CONFIG_SOF_ZEPHYR_USERSPACE_MODULE_HEAP_SIZE, \
27 CONFIG_MM_DRV_PAGE_SIZE)
28#define APP_TASK_BSS K_APP_BMEM(common_partition)
29#define APP_TASK_DATA K_APP_DMEM(common_partition)
31#ifdef CONFIG_SOF_USERSPACE_LL
32#define APP_SYSUSER_BSS K_APP_BMEM(sysuser_partition)
33#define APP_SYSUSER_DATA K_APP_DMEM(sysuser_partition)
35#define APP_SYSUSER_BSS
36#define APP_SYSUSER_DATA
39struct processing_module;
40struct userspace_context;
53struct k_heap *module_driver_heap_init(
void);
65int user_memory_attach_common_partition(
struct k_mem_domain *dom);
106#ifdef CONFIG_USERSPACE
122static inline uint32_t user_get_partition_cache_attr(uintptr_t ptr)
124 return sys_cache_is_ptr_cached(UINT_TO_POINTER(ptr)) ? XTENSA_MMU_CACHED_WB : 0;
132void user_grant_dai_access_all(
struct k_thread *thread);
139void user_grant_dma_access_all(
struct k_thread *thread);
150#ifdef CONFIG_SOF_USERSPACE_LL
static int user_access_to_mailbox(struct k_mem_domain *domain, k_tid_t thread_id)
Definition userspace_helper.h:143
static int user_memory_attach_system_user_partition(struct k_mem_domain *dom)
Attach SOF system user memory partition to a memory domain.
Definition userspace_helper.h:166
void * user_stack_allocate(size_t stack_size, uint32_t options)
Allocates thread stack memory.
int user_stack_free(void *p_stack)
Free thread stack memory.
void module_driver_heap_remove(struct k_heap *mod_drv_heap)
Free private processing module heap.