Skip to content

Commit f9438a7

Browse files
committed
subsys/audio: sof: use mem_slab for buffers
Zephyr's k_mem_pool does not allocate buffers that are cache line and/or DMA transfers aligned. The manual cache line manipulations has the potential to disrupt the k_mem_pool's own tracking information, and thus causing exceptions in freeing the memory. So the memory allocator is modified to use memory slab for buffers, and it needs to be initialized. Shrink the size of k_mem_pool as buffers are not being allocated from there. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
1 parent ea4225d commit f9438a7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

samples/audio/sof/prj.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ CONFIG_LOG_PRINTK=y
44
CONFIG_LOG_IMMEDIATE=y
55
CONFIG_SOF_LOG_LEVEL=4
66
# SOF requires malloc/calloc
7-
CONFIG_HEAP_MEM_POOL_SIZE=196608
7+
CONFIG_HEAP_MEM_POOL_SIZE=65536

subsys/audio/sof.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ LOG_MODULE_REGISTER(sof, CONFIG_SOF_LOG_LEVEL);
1717
#include <platform/dma.h>
1818
#include <platform/shim.h>
1919
#include <platform/timer.h>
20+
#include <sof/alloc.h>
2021
#include <sof/clk.h>
2122
#include <sof/interrupt.h>
2223
#include <sof/mailbox.h>
@@ -290,6 +291,8 @@ static int sof_init(struct device *unused)
290291
{
291292
int ret;
292293

294+
malloc_init();
295+
293296
platform_interrupt_init();
294297

295298
/* prepare host windows */

0 commit comments

Comments
 (0)