芯唐n3292 一个比较BC的问题,关于内存映射
看了缥缈九哥的笔记里边N32905的物理寻址空间:
IBR: 0xFFFF_0000 - 0xFFFF_FFFF
保留: 0xFF00_2000 - 0xFFFE_FFFF
SRAM: 0xFF00_0000 - 0xFF00_1FFF
保留: 0xC000_0000 - 0xFEFF_FFFF
APB: 0xB800_0000 - 0xBFFF_FFFF
AHB: 0xB000_0000 - 0xB7FF_FFFF
SSDRAM: 0x8000_0000 - 0xAFFF_FFFF (SDRAM的影射空间)
保留: 0x4000_0000 - 0x7FFF_FFFF
SDRAM: 0x0000_0000 - 0x3FFF_FFFF
我现在刚在熟悉N3292,里边例程有有一个变量WriteBuffer,定义完是放在SDRAM?之后pSrc = (UINT8 *)((UINT32)WriteBuffer | 0x80000000);是放到(SDRAM的影射空间)?非常不解,希望有知道的大侠解释一下。
程序如下
//#define DBG_PRINTF printf
__align(4096)UINT8 WriteBuffer;
__align(4096) UINT8 ReadBuffer;
int main()
{
WB_UART_T uart;
UINT32 u32ExtFreq;
unsigned char *pSrc, *pDst;
int volatile i;
BOOL bLoop = TRUE;
UINT8 u8Item;
/*
sysSetSystemClock(eSYS_UPLL, //E_SYS_SRC_CLK eSrcClk,
240000000, //UINT32 u32PllKHz,
240000000); //UINT32 u32SysKHz,
sysSetCPUClock(240000000);
sysSetAPBClock(48000000);
*/
u32ExtFreq = sysGetExternalClock(); /* Hz unit */
uart.uart_no = WB_UART_1;
uart.uiFreq = u32ExtFreq;
uart.uiBaudrate = 115200;
uart.uiDataBits = WB_DATA_BITS_8;
uart.uiStopBits = WB_STOP_BITS_1;
uart.uiParity = WB_PARITY_NONE;
uart.uiRxTriggerLevel = LEVEL_1_BYTE;
sysInitializeUART(&uart);
DBG_PRINTF("SpiFlash Test...\n");
pSrc = (UINT8 *)((UINT32)WriteBuffer | 0x80000000);
pDst = (UINT8 *)((UINT32)ReadBuffer | 0x80000000);
for (i=0; i<TEST_SIZE; i++)
*(pSrc+i) = i & 0xff;
spiFlashInit();
spiFlashEraseAll();
while(bLoop)
{
sysprintf("\nPlease Select Test Item\n");
sysprintf(" 1 : Read/Write Test\n");
sysprintf(" 2 : Qude Read/Write Test with Winbond W25Q256FV\n");
sysprintf(" 3 : Exit\n>");
u8Item = sysGetChar();
switch(u8Item)
{
case '1':
DBG_PRINTF("\tErase SpiFlash Block 0\n");
spiFlashEraseBlock(0, 1);
DBG_PRINTF("\tWrite SpiFlash\n");
spiFlashWrite(0, TEST_SIZE, pSrc);
memset(pDst, 0, TEST_SIZE);
DBG_PRINTF("\tRead and Compare SpiFlash\n");
spiFlashRead(0, TEST_SIZE, pDst);
for (i=0; i<TEST_SIZE; i++)
{
if (*(pSrc+i) != *(pDst+i))
{
DBG_PRINTF("error!! Src[%d] = 0x%X, Dst[%d] = 0x%X\n", i, *(pSrc+i), i, *(pDst+i));
break;
}
}
break;
case '2':
DBG_PRINTF("\tErase SpiFlash Block 0\n");
spiFlashEraseBlock(0, 1);
DBG_PRINTF("\tWrite SpiFlash\n");
spiFlashQuadWrite(0, TEST_SIZE, pSrc);
memset(pDst, 0, TEST_SIZE);
DBG_PRINTF("\tRead and Compare SpiFlash\n");
spiFlashFastReadQuad(0, TEST_SIZE, pDst);
for (i=0; i<TEST_SIZE; i++)
{
if (*(pSrc+i) != *(pDst+i))
{
DBG_PRINTF("error!! Src[%d] = 0x%X, Dst[%d] = 0x%X\n", i, *(pSrc+i), i, *(pDst+i));
break;
}
}
break;
case '3':
bLoop = FALSE;
break;
default:
sysprintf("Write Item\n");
break;
}
}
DBG_PRINTF("finish SPI test\n");
return 0;
}
真是妹子么? 看起来好厉害啊 女人搞技术挺奇怪?
页:
[1]