Skip to content

Commit 4c3adef

Browse files
Daniel BalutaDaniel Baluta
authored andcommitted
[PARTIAL CHERRYPICK]alloc: userspace: Introduce MMU shared memory heap
Partially cherry-pick header modifications in the alloc.h files from 82b2c2a ("alloc: userspace: Introduce MMU shared memory heap") to help with easier port of bugfixes.
1 parent b9787ff commit 4c3adef

2 files changed

Lines changed: 35 additions & 14 deletions

File tree

posix/include/rtos/alloc.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,21 @@
3333
*/
3434

3535
/** \brief Indicates we should return DMA-able memory. */
36-
#define SOF_MEM_FLAG_DMA BIT(0)
36+
#define SOF_MEM_FLAG_DMA BIT(0)
3737
/** \brief Indicates that original content should not be copied by realloc. */
38-
#define SOF_MEM_FLAG_NO_COPY BIT(1)
38+
#define SOF_MEM_FLAG_NO_COPY BIT(1)
3939
/** \brief Indicates that if we should return uncached address. */
40-
#define SOF_MEM_FLAG_COHERENT BIT(2)
40+
#define SOF_MEM_FLAG_COHERENT BIT(2)
4141
/** \brief Indicates that if we should return L3 address. */
42-
#define SOF_MEM_FLAG_L3 BIT(3)
42+
#define SOF_MEM_FLAG_L3 BIT(3)
4343
/** \brief Indicates that if we should return Low power memory address. */
44-
#define SOF_MEM_FLAG_LOW_POWER BIT(4)
44+
#define SOF_MEM_FLAG_LOW_POWER BIT(4)
4545
/** \brief Indicates that if we should return kernel memory address. */
46-
#define SOF_MEM_FLAG_KERNEL BIT(5)
46+
#define SOF_MEM_FLAG_KERNEL BIT(5)
4747
/** \brief Indicates that if we should return user memory address. */
48-
#define SOF_MEM_FLAG_USER BIT(6)
48+
#define SOF_MEM_FLAG_USER BIT(6)
49+
/** \brief Indicates that if we should return shared user memory address. */
50+
#define SOF_MEM_FLAG_USER_SHARED_BUFFER BIT(7)
4951

5052
/** @} */
5153

zephyr/include/rtos/alloc.h

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,21 @@
2424
*/
2525

2626
/** \brief Indicates we should return DMA-able memory. */
27-
#define SOF_MEM_FLAG_DMA BIT(0)
27+
#define SOF_MEM_FLAG_DMA BIT(0)
2828
/** \brief Indicates that original content should not be copied by realloc. */
29-
#define SOF_MEM_FLAG_NO_COPY BIT(1)
29+
#define SOF_MEM_FLAG_NO_COPY BIT(1)
3030
/** \brief Indicates that if we should return uncached address. */
31-
#define SOF_MEM_FLAG_COHERENT BIT(2)
31+
#define SOF_MEM_FLAG_COHERENT BIT(2)
3232
/** \brief Indicates that if we should return L3 address. */
33-
#define SOF_MEM_FLAG_L3 BIT(3)
33+
#define SOF_MEM_FLAG_L3 BIT(3)
3434
/** \brief Indicates that if we should return Low power memory address. */
35-
#define SOF_MEM_FLAG_LOW_POWER BIT(4)
35+
#define SOF_MEM_FLAG_LOW_POWER BIT(4)
3636
/** \brief Indicates that if we should return kernel memory address. */
37-
#define SOF_MEM_FLAG_KERNEL BIT(5)
37+
#define SOF_MEM_FLAG_KERNEL BIT(5)
3838
/** \brief Indicates that if we should return user memory address. */
39-
#define SOF_MEM_FLAG_USER BIT(6)
39+
#define SOF_MEM_FLAG_USER BIT(6)
40+
/** \brief Indicates that if we should return shared user memory address. */
41+
#define SOF_MEM_FLAG_USER_SHARED_BUFFER BIT(7)
4042

4143
/** @} */
4244

@@ -111,4 +113,21 @@ static inline void heap_trace_all(int force) {}
111113

112114
/** @}*/
113115

116+
#if CONFIG_USERSPACE
117+
/**
118+
* Returns the start address of shared memory heap for buffers.
119+
*
120+
* @return pointer to shared memory heap start
121+
*/
122+
uintptr_t get_shared_buffer_heap_start(void);
123+
124+
/**
125+
* Returns the size of shared memory heap for buffers.
126+
*
127+
* @return size of shared memory heap start
128+
*/
129+
size_t get_shared_buffer_heap_size(void);
130+
131+
#endif
132+
114133
#endif /* __ZEPHYR_RTOS_ALLOC_H__ */

0 commit comments

Comments
 (0)