summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libtremor/oggmalloc.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/codecs/libtremor/oggmalloc.c b/apps/codecs/libtremor/oggmalloc.c
index 3d60370641..3a5fecf910 100644
--- a/apps/codecs/libtremor/oggmalloc.c
+++ b/apps/codecs/libtremor/oggmalloc.c
@@ -61,7 +61,7 @@ void ogg_free(void* ptr)
61} 61}
62 62
63/* Allocate IRAM buffer */ 63/* Allocate IRAM buffer */
64static unsigned char iram_buff[IRAM_IBSS_SIZE] IBSS_ATTR __attribute__ ((aligned (16))); 64static unsigned char iram_buff[IRAM_IBSS_SIZE] IBSS_ATTR MEM_ALIGN_ATTR;
65static size_t iram_remain; 65static size_t iram_remain;
66 66
67void iram_malloc_init(void){ 67void iram_malloc_init(void){
@@ -70,14 +70,13 @@ void iram_malloc_init(void){
70 70
71void *iram_malloc(size_t size){ 71void *iram_malloc(size_t size){
72 void* x; 72 void* x;
73 73
74 /* always ensure 16-byte aligned */ 74 /* always ensure alignment to CACHEALIGN_SIZE byte */
75 if(size&0x0f) 75 size = (size + (CACHEALIGN_SIZE-1)) & ~(CACHEALIGN_SIZE-1);
76 size=(size-(size&0x0f))+16; 76
77
78 if(size>iram_remain) 77 if(size>iram_remain)
79 return NULL; 78 return NULL;
80 79
81 x = &iram_buff[IRAM_IBSS_SIZE-iram_remain]; 80 x = &iram_buff[IRAM_IBSS_SIZE-iram_remain];
82 iram_remain-=size; 81 iram_remain-=size;
83 82