memory_test.c

来自「此源码是sc3c2410的MEMORY读写测试程序」· C语言 代码 · 共 60 行

C
60
字号
/*********************************************************************************************
* File:	memory.c
* Author:	wuhan R&D  center, 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;
    UINT32T data;
    int memError=0;
    UINT32T *pt;
    
    //
    // memory test
    //
    uart_printf("\nMemory Test(%xh-%xh):WR\n",_RAM_STARTADDRESS+0x0e000000,(_ISR_STARTADDRESS&0xf0ff0000));

    //memory write
    pt=(UINT32T *)(_RAM_STARTADDRESS+0x0e000000);
    while((UINT32T)pt<(_ISR_STARTADDRESS&0xf0ff0000))
    {
	*pt=(UINT32T)pt;
	pt++;
    }

    //MEMORY READ
    uart_printf("\nMemory Test(%xh-%xh):RD\n",_RAM_STARTADDRESS+0x0e000000,(_ISR_STARTADDRESS&0xf0ff0000)); 
    //uart_printf("\b\bRD");
    pt=(UINT32T *)(_RAM_STARTADDRESS+0x0e000000);
	
    while((UINT32T)pt<(_ISR_STARTADDRESS&0xf0ff0000))
    {
	data=*pt;
	if(data!=(UINT32T)pt)
	{
	    memError=1;
	    uart_printf("\n\b\bFAIL:0x%x=0x%x\n",i,data);
	    break;
	}
	pt++;
    }

    if(memError==0)
    uart_printf("\n\b\bO.K.\n");
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?