@@ -14,6 +14,21 @@ extern "C" {
1414
1515struct vregion ;
1616
17+ /**
18+ * @brief Memory types for virtual region allocations.
19+ * Used to specify the type of memory allocation within a virtual region.
20+ *
21+ * @note
22+ * - interim: allocation that can be freed i.e. get/set large config, kcontrols.
23+ * - lifetime: allocation that cannot be freed i.e. init data, pipeline data.
24+ */
25+ enum vregion_mem_type {
26+ VREGION_MEM_TYPE_INTERIM , /* interim allocation that can be freed */
27+ VREGION_MEM_TYPE_LIFETIME , /* lifetime allocation */
28+ };
29+
30+ #if CONFIG_SOF_VREGIONS
31+
1732/**
1833 * @brief Create a new virtual region instance.
1934 *
@@ -35,19 +50,6 @@ struct vregion *vregion_create(size_t lifetime_size, size_t interim_size);
3550 */
3651void vregion_destroy (struct vregion * vr );
3752
38- /**
39- * @brief Memory types for virtual region allocations.
40- * Used to specify the type of memory allocation within a virtual region.
41- *
42- * @note
43- * - interim: allocation that can be freed i.e. get/set large config, kcontrols.
44- * - lifetime: allocation that cannot be freed i.e. init data, pipeline data.
45- */
46- enum vregion_mem_type {
47- VREGION_MEM_TYPE_INTERIM , /* interim allocation that can be freed */
48- VREGION_MEM_TYPE_LIFETIME , /* lifetime allocation */
49- };
50-
5153/**
5254 * @brief Allocate memory from the specified virtual region.
5355 *
@@ -109,6 +111,42 @@ void vregion_info(struct vregion *vr);
109111 */
110112void vregion_mem_info (struct vregion * vr , size_t * size , uintptr_t * start );
111113
114+ #else /* CONFIG_SOF_VREGIONS */
115+
116+ static inline struct vregion * vregion_create (size_t lifetime_size , size_t interim_size )
117+ {
118+ return NULL ;
119+ }
120+ static inline void vregion_destroy (struct vregion * vr ) {}
121+ static inline void * vregion_alloc (struct vregion * vr , enum vregion_mem_type type , size_t size )
122+ {
123+ return NULL ;
124+ }
125+ static inline void * vregion_alloc_coherent (struct vregion * vr , enum vregion_mem_type type ,
126+ size_t size )
127+ {
128+ return NULL ;
129+ }
130+ static inline void * vregion_alloc_align (struct vregion * vr , enum vregion_mem_type type ,
131+ size_t size , size_t alignment )
132+ {
133+ return NULL ;
134+ }
135+ static inline void * vregion_alloc_coherent_align (struct vregion * vr , enum vregion_mem_type type ,
136+ size_t size , size_t alignment )
137+ {
138+ return NULL ;
139+ }
140+ static inline void vregion_free (struct vregion * vr , void * ptr ) {}
141+ static inline void vregion_info (struct vregion * vr ) {}
142+ static inline void vregion_mem_info (struct vregion * vr , size_t * size , uintptr_t * start )
143+ {
144+ if (size )
145+ * size = 0 ;
146+ }
147+
148+ #endif /* CONFIG_SOF_VREGIONS */
149+
112150#ifdef __cplusplus
113151}
114152#endif
0 commit comments