⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 isram.c

📁 Dignostic test program for SMDK441f board chip peripellel. ADS1.2 compiler
💻 C
字号:
#include "def.h"
#include "option.h"
#include <string.h>
#include "k44.h"
#include "k44lib.h"

void MarchCMinus32(int address,int unit,unsigned int pattern);
void _MarchSub1(unsigned int *pt,int unit,unsigned int pattern,int incdec);

int marchError;

void Test_Isram(void)
{
    Uart_Printf("[]The internal SRAM cell test by March C-\n");
	
    marchError=0;

    //internal SRAM 0x01ff0000 ~ 0x01ff1fff	      
    //set1=0x10000800~0x10000fff	      
    //set2=0x10001000~0x100017ff	      
    //set3=0x10001800~0x10001fff	      
    
    MarchCMinus32(0x01ff0000,2048,0x00000000); 
    MarchCMinus32(0x01ff0000,2048,0x0f0f0f0f);
    MarchCMinus32(0x01ff0000,2048,0x33333333);
    MarchCMinus32(0x01ff0000,2048,0x55555555);
    MarchCMinus32(0x01ff0000,2048,0xaaaaaaaa);

    if(marchError==0)
    	Uart_Printf("PASS: The internal sram march C- is passed.\n");
    else
	Uart_Printf("FAIL: The internal sram march C- is failed.\n");
}



void MarchCMinus32(int address,int unit,unsigned int pattern)
{
    int i;
    unsigned int *tempPt;
    
    tempPt=(unsigned int *)address;
    
    for(i=0;i<=unit;i++)
    {
	//Uart_Printf("P=%x",pattern);
	*tempPt++=pattern;
	//Uart_Printf("A=%x,P=%x\n",tempPt,*tempPt);
    }
    
    _MarchSub1((unsigned int *)address,unit,~pattern,1);
    _MarchSub1((unsigned int *)address,unit,pattern,1);
    _MarchSub1((unsigned int *)address+unit,unit,~pattern,-1);
    _MarchSub1((unsigned int *)address+unit,unit,pattern,-1); 
    
    tempPt=(unsigned int *)address;
    for(i=0;i<=unit;i++)
    {
	if(*tempPt!=pattern){marchError=1;Uart_Printf("ERROR0:%x\n",tempPt);}
	tempPt++;
    }
    //Uart_Printf("RP=%x,RA=%x\n",*tempPt,tempPt);
}



void _MarchSub1(unsigned int *pt,int unit,unsigned int pattern,int incdec)
{
    unsigned int i,rp;

    for(i=0;i<=unit;i++)
    {
	rp=*pt;
	//Uart_Printf("RP=%x",*pt);
	*pt=pattern;
	//Uart_Printf("j=%x,p=%x,pt=%x\n",rp,(~pattern),pt);
	
	if(rp!=(~pattern)){marchError=1;Uart_Printf("ERROR1:A=%x,RP=%x,WP=%x \n",pt,rp,(~pattern));}
	pt+=incdec;
    }
}

⌨️ 快捷键说明

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