6#ifndef __ZEPHYR_RTOS_ALLOC_H__
7#define __ZEPHYR_RTOS_ALLOC_H__
12#include <sof/trace/trace.h>
33#define SOF_MEM_FLAG_DMA BIT(2)
35#define SOF_MEM_FLAG_NO_COPY BIT(3)
37#define SOF_MEM_FLAG_COHERENT BIT(4)
39#define SOF_MEM_FLAG_L3 BIT(5)
41#define SOF_MEM_FLAG_LOW_POWER BIT(6)
43#define SOF_MEM_FLAG_KERNEL BIT(7)
45#define SOF_MEM_FLAG_USER BIT(8)
47#define SOF_MEM_FLAG_USER_SHARED_BUFFER BIT(9)
49#define SOF_MEM_FLAG_LARGE_BUFFER BIT(10)
66void *
rmalloc(uint32_t flags,
size_t bytes);
71void *
rzalloc(uint32_t flags,
size_t bytes);
86static inline void *
rballoc(uint32_t flags,
size_t bytes)
106#ifdef CONFIG_SOF_USERSPACE_INTERFACE_ALLOC
107__syscall
void *
sof_heap_alloc(
struct k_heap *heap, uint32_t flags,
size_t bytes,
109__syscall
void sof_heap_free(
struct k_heap *heap,
void *addr);
110#include <zephyr/syscalls/alloc.h>
117#if CONFIG_SOF_FULL_ZEPHYR_APPLICATION
148#if CONFIG_SOF_USERSPACE_USE_SHARED_HEAP
154uintptr_t get_shared_buffer_heap_start(
void);
161size_t get_shared_buffer_heap_size(
void);
186 size_t size,
size_t alignment)
188 if (!ctx || !ctx->
vreg)
206 size_t size,
size_t alignment)
211 memset(ptr, 0, size);
226 if (ctx && ctx->
vreg)
static void sof_ctx_free(struct mod_alloc_ctx *ctx, void *ptr)
Free memory allocated from a mod_alloc_ctx context.
Definition alloc.h:221
static void * sof_ctx_zalloc(struct mod_alloc_ctx *ctx, uint32_t flags, size_t size, size_t alignment)
Allocate zero-initialized memory from a mod_alloc_ctx context.
Definition alloc.h:205
static void * sof_ctx_alloc(struct mod_alloc_ctx *ctx, uint32_t flags, size_t size, size_t alignment)
Allocate memory from a mod_alloc_ctx context.
Definition alloc.h:185
void * rmalloc_align(uint32_t flags, size_t bytes, uint32_t alignment)
Allocates memory block.
static void heap_trace_all(int force)
Definition alloc.h:144
void l3_heap_save(void)
Save L3 heap over DSP reset.
void * rzalloc(uint32_t flags, size_t bytes)
Similar to rmalloc(), guarantees that returned block is zeroed.
static struct k_heap * sof_sys_heap_get(void)
Definition alloc.h:121
void * sof_heap_alloc(struct k_heap *heap, uint32_t flags, size_t bytes, size_t alignment)
void rfree(void *ptr)
Frees the memory block.
void * rballoc_align(uint32_t flags, size_t bytes, uint32_t alignment)
Allocates memory block.
static void * rballoc(uint32_t flags, size_t bytes)
Similar to rballoc_align(), returns buffer aligned to PLATFORM_DCACHE_ALIGN.
Definition alloc.h:86
void * rmalloc(uint32_t flags, size_t bytes)
Similar to rmalloc_align(), but no alignment can be specified.
struct k_heap * sof_sys_user_heap_get(void)
Returns heap object to use for SOF heap allocations for audio application code.
#define SOF_MEM_FLAG_COHERENT
Allocate uncached address.
Definition alloc.h:37
void sof_heap_free(struct k_heap *heap, void *addr)
struct vregion * vreg
Definition alloc.h:169
struct k_heap * heap
Definition alloc.h:168
static void * vregion_alloc_coherent_align(struct vregion *vr, size_t size, size_t alignment)
Definition vregion.h:188
static void * vregion_alloc_align(struct vregion *vr, size_t size, size_t alignment)
Definition vregion.h:184
static void vregion_free(struct vregion *vr, void *ptr)
Definition vregion.h:193