2828 * @{
2929 */
3030
31- /**
32- * \brief Heap Memory Zones
33- *
34- * The heap has three different zones from where memory can be allocated :-
35- *
36- * 1) System Zone. Fixed size heap where alloc always succeeds and is never
37- * freed. Used by any init code that will never give up the memory.
38- *
39- * 2) System Runtime Zone. Heap zone intended for runtime objects allocated
40- * by the kernel part of the code.
41- *
42- * 3) Runtime Zone. Main and larger heap zone where allocs are not guaranteed to
43- * succeed. Memory can be freed here.
44- *
45- * 4) Buffer Zone. Largest heap zone intended for audio buffers.
46- *
47- * 5) Runtime Shared Zone. Similar to Runtime Zone, but content may be used and
48- * fred from any enabled core.
49- *
50- * 6) System Shared Zone. Similar to System Zone, but content may be used from
51- * any enabled core.
52- *
53- * See platform/memory.h for heap size configuration and mappings.
54- */
55- enum mem_zone {
56- SOF_MEM_ZONE_SYS = 0 , /**< System zone */
57- SOF_MEM_ZONE_SYS_RUNTIME , /**< System-runtime zone */
58- SOF_MEM_ZONE_RUNTIME , /**< Runtime zone */
59- SOF_MEM_ZONE_BUFFER , /**< Buffer zone */
60- SOF_MEM_ZONE_RUNTIME_SHARED , /**< Runtime shared zone */
61- SOF_MEM_ZONE_SYS_SHARED , /**< System shared zone */
62- };
63-
6431/** \name Heap zone flags
6532 * @{
6633 */
6734
35+ /** \brief Indicates we should return DMA-able memory. */
36+ #define SOF_MEM_FLAG_DMA BIT(0)
6837/** \brief Indicates that original content should not be copied by realloc. */
6938#define SOF_MEM_FLAG_NO_COPY BIT(1)
7039/** \brief Indicates that if we should return uncached address. */
71- #define SOF_MEM_FLAG_COHERENT BIT(2)
40+ #define SOF_MEM_FLAG_COHERENT BIT(2)
41+ /** \brief Indicates that if we should return L3 address. */
42+ #define SOF_MEM_FLAG_L3 BIT(3)
43+ /** \brief Indicates that if we should return Low power memory address. */
44+ #define SOF_MEM_FLAG_LOW_POWER BIT(4)
45+ /** \brief Indicates that if we should return kernel memory address. */
46+ #define SOF_MEM_FLAG_KERNEL BIT(5)
47+ /** \brief Indicates that if we should return user memory address. */
48+ #define SOF_MEM_FLAG_USER BIT(6)
7249
7350/** @} */
7451
@@ -83,15 +60,15 @@ enum mem_zone {
8360 * @note Do not use for buffers (SOF_MEM_ZONE_BUFFER zone).
8461 * Use rballoc(), rballoc_align() to allocate memory for buffers.
8562 */
86- void * rmalloc (enum mem_zone zone , uint32_t flags , uint32_t caps , size_t bytes );
63+ void * rmalloc (uint32_t flags , size_t bytes );
8764
8865/**
8966 * Similar to rmalloc(), guarantees that returned block is zeroed.
9067 *
9168 * @note Do not use for buffers (SOF_MEM_ZONE_BUFFER zone).
9269 * rballoc(), rballoc_align() to allocate memory for buffers.
9370 */
94- void * rzalloc (enum mem_zone zone , uint32_t flags , uint32_t caps , size_t bytes );
71+ void * rzalloc (uint32_t flags , size_t bytes );
9572
9673/**
9774 * Allocates memory block from SOF_MEM_ZONE_BUFFER.
@@ -101,15 +78,15 @@ void *rzalloc(enum mem_zone zone, uint32_t flags, uint32_t caps, size_t bytes);
10178 * @param alignment Alignment in bytes.
10279 * @return Pointer to the allocated memory or NULL if failed.
10380 */
104- void * rballoc_align (uint32_t flags , uint32_t caps , size_t bytes ,
81+ void * rballoc_align (uint32_t flags , size_t bytes ,
10582 uint32_t alignment );
10683
10784/**
10885 * Similar to rballoc_align(), returns buffer aligned to PLATFORM_DCACHE_ALIGN.
10986 */
110- static inline void * rballoc (uint32_t flags , uint32_t caps , size_t bytes )
87+ static inline void * rballoc (uint32_t flags , size_t bytes )
11188{
112- return rballoc_align (flags , caps , bytes , PLATFORM_DCACHE_ALIGN );
89+ return rballoc_align (flags , bytes , PLATFORM_DCACHE_ALIGN );
11390}
11491
11592/**
@@ -122,17 +99,17 @@ static inline void *rballoc(uint32_t flags, uint32_t caps, size_t bytes)
12299 * @param alignment Alignment in bytes.
123100 * @return Pointer to the resized memory of NULL if failed.
124101 */
125- void * rbrealloc_align (void * ptr , uint32_t flags , uint32_t caps , size_t bytes ,
102+ void * rbrealloc_align (void * ptr , uint32_t flags , size_t bytes ,
126103 size_t old_bytes , uint32_t alignment );
127104
128105/**
129106 * Similar to rballoc_align(), returns resized buffer aligned to
130107 * PLATFORM_DCACHE_ALIGN.
131108 */
132- static inline void * rbrealloc (void * ptr , uint32_t flags , uint32_t caps ,
109+ static inline void * rbrealloc (void * ptr , uint32_t flags ,
133110 size_t bytes , size_t old_bytes )
134111{
135- return rbrealloc_align (ptr , flags , caps , bytes , old_bytes ,
112+ return rbrealloc_align (ptr , flags , bytes , old_bytes ,
136113 PLATFORM_DCACHE_ALIGN );
137114}
138115
0 commit comments