Forums

MEM_Alloc TI

Started by gie78 January 19, 2006
Hi

I posted a similar question a few days ago and got a good answer. But
there is still one thing I don`t understand, maybe anybody could help
me again.

My problem is still the segID. In some manuals TI writes the segID
could be an integer or the memory segment name which you have defined
in the DSP/BIOS Configuration Tool.

Before you can use the segID identifier which is defined in the
DSP/BIOS you have to declare the Heap lable for example like this:
//////////////////////////////////////////////////////////////////////////
extern int IRAM_HEAP

void myfilter(void)
{
   int *coeff;

   coeff = MEM_alloc(IRAM_HEAP,128,0);

   ..
   ..
   ..

   MEM_free(IRAM_HEAP,coeff,128);
}
////////////////////////////////////////////////////////////////////////

But TI says instate of the section lable you could also use an integer.
These would be better for my application but how can I specify which
memory section is linked to which integer.

SDRAM_HEAB
IPRAM_HEAB  // for example these are the 3 available section in the
DSP/BIOS
IDRAM_HEAB

////////////////////seperate
file/////////////////////////////////////////////////
void* newMEM(int sec, int size, int align)
{
  void* ret;

  ret = MEM_calloc(sec,size,align);

  if( MEM_ILLEGAL == ret )
  {
     while(1)
        ;
  }

  return ret;
}

/////////////////////////////seperate file/////////////////////////
#include "sections.h"

void filter1(void)
{
  int *coeff;
  int nsize;

  size=128;

  coeff = newMEM(DATAMEM_INTERNAL, nsize, 0);

  ..
  ..
  ..
}

//////////////////////////////////sections.h Header
/////////////////////////
enum MemSection
{
  MEM_EXTERNAL
  PROGMEM_INTERNAL
  DATAMEM_INTERNAL
};


I know normaly I could declare the section lables in the sections.h
file but in my case its impossible.

And now my question: how can I tell the BIOS that SDRAM_HEAB = 0,
IPRAM_HEAB  = 1 and IDRAM_HEAB = 2.