I have gone through owl source and found external SRAM is initialize if EXTERNAL_SRAM is defined as follows.
#ifdef EXTERNAL_SRAM
SRAM_Init();
#endif /* EXTERNAL_SRAM */
#ifdef EXTERNAL_SRAM
#define EXT __attribute__ ((section (".extdata")))
#endif
but in code I could not find any entry of #defined EXTERNAL_SRAM
So I doubt how SRAM_Init(); is complied.
Also I found that in patch file buffer is created using “createMemoryBuffer” and it finally call “malloc” function. My questian is how malloc manages the location of SRAM (embedded or external) to create buffer.
SimpleDelayPatch.hpp
-----------------------------
#define REQUEST_BUFFER_SIZE 32768
AudioBuffer* buffer = createMemoryBuffer(1, REQUEST_BUFFER_SIZE);
StompBox.cpp
AudioBuffer* Patch::createMemoryBuffer(int channels, int samples){
return processor->createMemoryBuffer(channels, samples);
}
MemoryBuffer.hpp
-------------------------
class ManagedMemoryBuffer : public MemoryBuffer {
public:
ManagedMemoryBuffer(int ch, int sz) :
MemoryBuffer((float*)malloc(ch*sz*sizeof(float)), ch, sz) {
if(buffer == NULL){
channels = 0;
size = 0;
}
}
~ManagedMemoryBuffer(){
free(buffer);
}
};
PatchProcessor.cpp
===============
AudioBuffer* PatchProcessor::createMemoryBuffer(int channels, int size){
MemoryBuffer* buf = new ManagedMemoryBuffer(channels, size);
if(buf == NULL)
return NULL;
buffers[bufferCount++] = buf;
buf->clear();
return buf;
}
I have found “myalloc” function to create buffer on EXT SRAM but could not any entry which call this “myalloc”.
SRAMALLOC.H
-----------------------
void InitMem(char *ptr, int size_in_bytes);
void * myalloc(int elem_size);
void myfree(void *p);
Can anybody clear my doubt/confusion???