Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
softwarecki committed Sep 2, 2024
1 parent 0628acf commit e200f37
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions zephyr/lib/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,17 @@ void *rballoc_align(uint32_t flags, uint32_t caps, size_t bytes,
uint32_t align)
{
struct k_heap *heap;
void *ret;

/* choose a heap */
if (caps & SOF_MEM_CAPS_L3) {
#if CONFIG_L3_HEAP
heap = &l3_heap;
return (__sparse_force void *)l3_heap_alloc_aligned(heap, align, bytes);
ret = l3_heap_alloc_aligned(heap, align, bytes);
if (!ret)
tr_err(&zephyr_tr, "!l3_heap_alloc_aligned");

return (__sparse_force void *)ret;
#else
tr_err(&zephyr_tr, "L3_HEAP not available.");
return NULL;
Expand All @@ -498,14 +503,25 @@ void *rballoc_align(uint32_t flags, uint32_t caps, size_t bytes,

#if CONFIG_VIRTUAL_HEAP
/* Use virtual heap if it is available */
if (virtual_buffers_heap)
return virtual_heap_alloc(virtual_buffers_heap, flags, caps, bytes, align);
if (virtual_buffers_heap) {
ret = virtual_heap_alloc(virtual_buffers_heap, flags, caps, bytes, align);
if (!ret)
tr_err(&zephyr_tr, "!virtual_heap_alloc");
return ret;
}
#endif /* CONFIG_VIRTUAL_HEAP */

if (flags & SOF_MEM_FLAG_COHERENT)
return heap_alloc_aligned(heap, align, bytes);
if (flags & SOF_MEM_FLAG_COHERENT) {
ret = heap_alloc_aligned(heap, align, bytes);
if (!ret)
tr_err(&zephyr_tr, "!heap_alloc_aligned");
return ret;
}

return (__sparse_force void *)heap_alloc_aligned_cached(heap, align, bytes);
ret = heap_alloc_aligned_cached(heap, align, bytes);
if (!ret)
tr_err(&zephyr_tr, "!heap_alloc_aligned_cached");
return (__sparse_force void *)ret;
}
EXPORT_SYMBOL(rballoc_align);

Expand Down

0 comments on commit e200f37

Please sign in to comment.