📄 memory_test.c
字号:
/*********************************************************************************************
* File: memory.c
* Author: embest
* Desc: memory test file
* History:
*********************************************************************************************/
/*------------------------------------------------------------------------------------------*/
/* include files */
/*------------------------------------------------------------------------------------------*/
#include "2410lib.h"
/*********************************************************************************************
* name: memory_test
* func: memory test
* para: none
* ret: none
* modify:
* comment:
*********************************************************************************************/
void memory_test(void)
{
int i;
int nMemError=0;
UINT32T nData,nTestStart,nTestEnd;
UINT32T *pPt;
UINT32T *pSrcPt=0;
UINT8T szBuf[40];
uart_printf("\n Memory Access Test Example\n");
// memory test
uart_printf(" Enter a start address of ram to test(0x3...):");
#ifdef BOARDTEST
nTestStart = 0x30200000;
#else
nTestStart = uart_getintnum();
#endif
uart_printf(" Enter a end address of ram to test(0x3...):");
#ifdef BOARDTEST
nTestEnd = 0x30400000;
print_lcd(195,170,0x1c,"Memory writing...");
#else
nTestEnd = uart_getintnum();
#endif
uart_printf(" Memory Test(%xh-%xh):WR",nTestStart,nTestEnd);
pPt=(UINT32T *)(nTestStart);
while((UINT32T)pPt<(nTestEnd))
{
nData = *pSrcPt++;
*pPt = nData; // write something to test
pPt++;
}
uart_printf("\b\bRD");
#ifdef BOARDTEST
print_lcd(195,180,0x1c,"Memory Reading...");
#endif
pPt=(UINT32T *)(nTestStart);
while((UINT32T)pPt<(nTestEnd))
{
nData = *pSrcPt++;
if(nData - (*pPt))
{
nMemError=1;
sprintf(&szBuf, "MemTest FAIL:0x%x=0x%x\n",i,nData);
break;
}
pPt++;
}
if(nMemError==0)
sprintf(&szBuf, "MemTest O.K.\n");
uart_printf(szBuf);
#ifdef BOARDTEST
print_lcd(195,190,0x1c,&szBuf);
#endif
uart_printf(" end.\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -