#define EXT_SRAM_BASE 0x68000000
//*****************************************************************************
//
//! Initializes any daughter-board SRAM as the external RAM heap.
//!
//! When an SRAM/Flash daughter board is installed, this function may be used
//! to configure the memory manager to use the SRAM on this board rather than
//! the SDRAM as its heap. This allows software to call the ExtRAMAlloc() and
//! ExtRAMFree() functions to manage the SRAM on the daughter board.
//!
//! Function PinoutSet() must be called before this function.
//!
//! \return Returns \b true on success of \b false if no SRAM is found or
//! any other error occurs.
//
//*****************************************************************************
tBoolean
ExtRAMHeapInit(void)
{
volatile unsigned char *pucTest;
//
// Is the correct daughter board installed?
//
if(g_eDaughterType == DAUGHTER_SRAM_FLASH)
{
//
// Test that we can access the SRAM on the daughter board.
//
pucTest = (volatile unsigned char *)EXT_SRAM_BASE;
pucTest[0] = 0xAA;
pucTest[1] = 0x55;
if((pucTest[0] == 0xAA) && (pucTest[1] == 0x55))
{
//
// The memory appears to be there so remember that we found it.
//
g_bExtRAMPresent = true;
//
// Now set up the heap that ExtRAMAlloc() and ExtRAMFree() will use.
//
bpool((void *)pucTest, SRAM_MEM_SIZE);
}
}
else
{
//
// The SRAM/Flash daughter board is not currently installed.
//
return(false);
}
//
// If we get here, all is well so pass this good news back to the caller.
//
return(true);
}
具体用法,你参考dk-lm3s9b96中的qs-checkout项目里的如上hans
详情回复
发表于 2011-1-27 14:55
//*****************************************************************************
//
//! Initializes any daughter-board SRAM as the external RAM heap.
//!
//! When an SRAM/Flash daughter board is installed, this function may be used
//! to configure the memory manager to use the SRAM on this board rather than
//! the SDRAM as its heap. This allows software to call the ExtRAMAlloc() and
//! ExtRAMFree() functions to manage the SRAM on the daughter board.
//!
//! Function PinoutSet() must be called before this function.
//!
//! \return Returns \b true on success of \b false if no SRAM is found or
//! any other error occurs.
//
//*****************************************************************************
tBoolean
ExtRAMHeapInit(void)
{
volatile unsigned char *pucTest;
//
// Is the correct daughter board installed?
//
if(g_eDaughterType == DAUGHTER_SRAM_FLASH)
{
//
// Test that we can access the SRAM on the daughter board.
//
pucTest = (volatile unsigned char *)EXT_SRAM_BASE;
pucTest[0] = 0xAA;
pucTest[1] = 0x55;
if((pucTest[0] == 0xAA) && (pucTest[1] == 0x55))
{
//
// The memory appears to be there so remember that we found it.
//
g_bExtRAMPresent = true;
//
// Now set up the heap that ExtRAMAlloc() and ExtRAMFree() will use.
//
bpool((void *)pucTest, SRAM_MEM_SIZE);
}
}
else
{
//
// The SRAM/Flash daughter board is not currently installed.
//
return(false);
}
//
// If we get here, all is well so pass this good news back to the caller.
//
return(true);
}