20 #define AUDIO_MEM_UNUSED_VAR(x) ((void)(x))
22 #if defined(AUDIO_CONF_TRACK_MALLOC)
23 #define AUDIO_MAX_MEMBLOCKS_NB 3000
34 AudioMemBlock_t memBlocks[AUDIO_MAX_MEMBLOCKS_NB];
35 } AudioMemoryCurrent_t;
37 int32_t AFE_currentBlock = 0;
38 AudioMemoryCurrent_t AudioMem;
42 #define _CCSIDR_LSSHIFT(x) (((x) & SCB_CCSIDR_LINESIZE_Msk) >> SCB_CCSIDR_LINESIZE_Pos)
46 #ifdef __DCACHE_PRESENT
58 start = (uint32_t)buffer;
59 end =
start + (length_in_bytes * 4);
78 wshift =
__CLZ(ways) & 0x1f;
82 ssize = (1 << sshift);
83 start &= ~(ssize - 1);
88 int32_t tmpways = ways;
97 sets = ((uint32_t)
start >> sshift) & smask;
103 sw = ((tmpways << wshift) | (sets << sshift));
125 #if defined(AUDIO_CONF_TRACK_MALLOC)
126 if (AFE_currentBlock < AUDIO_MAX_MEMBLOCKS_NB)
128 AudioMem.totalSize += size;
129 AudioMem.memBlocks[AFE_currentBlock].size = size;
130 AudioMem.memBlocks[AFE_currentBlock].ptr = malloc(size);
131 ptr = AudioMem.memBlocks[AFE_currentBlock++].ptr;
146 __weak
void AudioFree(
void *
const pMemToFree, int32_t
const type)
148 if (pMemToFree !=
NULL)
150 #if defined(AUDIO_CONF_TRACK_MALLOC)
153 for (i = 0; i < AFE_currentBlock; i++)
155 if (AudioMem.memBlocks[i].ptr == pMemToFree)
157 AudioMem.totalSize -= AudioMem.memBlocks[i].size;