@@ -188,8 +188,19 @@ void *mod_balloc_align(struct processing_module *mod, size_t size, size_t alignm
188188 return NULL ;
189189 }
190190
191- /* Allocate buffer memory for module */
191+ #if CONFIG_SOF_PACOVR
192+ /* do we need to use the dynamic heap or the static heap? */
193+ if (mod -> priv .state != MODULE_INITIALIZED ) {
194+ /* static allocator */
195+ ptr = pacovr_static_alloc (mod -> dev -> pipeline -> pacovr , size );
196+ } else {
197+ /* dynamic allocator */
198+ ptr = pacovr_dynamic_alloc_align (mod -> dev -> pipeline -> pacovr , size , alignment );
199+ }
200+ #else
201+ /* Allocate memory for module */
192202 ptr = rballoc_align (SOF_MEM_FLAG_USER , size , alignment );
203+ #endif
193204
194205 if (!ptr ) {
195206 comp_err (mod -> dev , "Failed to alloc %zu bytes %zu alignment for comp %#x." ,
@@ -238,8 +249,19 @@ void *mod_alloc_align(struct processing_module *mod, size_t size, size_t alignme
238249 return NULL ;
239250 }
240251
252+ #if CONFIG_SOF_PACOVR
253+ /* do we need to use the dynamic heap or the static heap? */
254+ if (mod -> priv .state != MODULE_INITIALIZED ) {
255+ /* static allocator */
256+ ptr = pacovr_static_alloc (mod -> dev -> pipeline -> pacovr , size );
257+ } else {
258+ /* dynamic allocator */
259+ ptr = pacovr_dynamic_alloc_align (mod -> dev -> pipeline -> pacovr , size , alignment );
260+ }
261+ #else
241262 /* Allocate memory for module */
242263 ptr = rmalloc_align (SOF_MEM_FLAG_USER , size , alignment );
264+ #endif
243265
244266 if (!ptr ) {
245267 comp_err (mod -> dev , "Failed to alloc %zu bytes %zu alignment for comp %#x." ,
@@ -340,7 +362,18 @@ static int free_contents(struct processing_module *mod, struct module_resource *
340362
341363 switch (container -> type ) {
342364 case MOD_RES_HEAP :
365+ #if CONFIG_SOF_PACOVR
366+ /* do we need to use the scratch heap or the batch heap? */
367+ if (mod -> priv .state != MODULE_INITIALIZED ) {
368+ /* static allocator */
369+ pacovr_static_free (mod -> dev -> pipeline -> pacovr , container -> ptr );
370+ } else {
371+ /* dynamic allocator */
372+ pacovr_dynamic_free (mod -> dev -> pipeline -> pacovr , container -> ptr );
373+ }
374+ #else
343375 rfree (container -> ptr );
376+ #endif
344377 res -> heap_usage -= container -> size ;
345378 return 0 ;
346379#if CONFIG_COMP_BLOB
0 commit comments