This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

startware中的函数void *UTIL_allocMem(Uint32 size)

// Global memory allocation pointer
static VUint32 currMemPtr;


/************************************************************
* Explicit External Declarations *
************************************************************/

extern __FAR__ Uint32 EXTERNAL_RAM_START, EXTERNAL_RAM_END;

// Allocate memory from the ad-hoc heap
void *UTIL_allocMem(Uint32 size)

void *cPtr;
Uint32 size_temp;

// Ensure word boundaries
size_temp = ((size + 4) >> 2 ) << 2;

if((currMemPtr + size_temp) > ((Uint32) &EXTERNAL_RAM_END))
{
return NULL;
}

cPtr = (void *) (((Uint32) &EXTERNAL_RAM_START) + currMemPtr);
currMemPtr += size_temp;

return cPtr;
}

请教一下startware中的这个函数void *UTIL_allocMem(Uint32 size)的作用。 ad-hoc heap是什么意思啊,希望大神给予解答