main.c

来自「基于三星44b0的flash程序」· C语言 代码 · 共 72 行

C
72
字号
#include "..\Target\44blib.h"
#include "..\target\44b.h"
#include "..\flashtest\flashrom.h"


void Main(void)
{
	int  i;
	char aa;
	INT16U  temp;
	//rSYSCFG=CACHECFG;	// Using 8KB Cache//

	Uart_Init(0,115200);
	Led_Display(0xf);
	Delay(0);
	
	Uart_Select(0); //Select UART0//
	Beep(0x1);
	Uart_Printf("\n---------------------------------------------------------------");
	Beep(0x00);
	Uart_Printf("\nOEM name   :     LiYuTai Elec.Co.,Ltd.			               ");
	Uart_Printf("\nWebsite    :     www.hzlitai.com.cn                             ");
	Uart_Printf("\nEmail      :     lyt_tech@yahoo.com.cn                          ");
	Uart_Printf("\nFunction   :     ARMSYS44b0's Helloworld Program                ");
	Uart_Printf("\nUART config:     115.2kbps,8Bit,NP,UART0                        ");
	Uart_Printf("\n---------------------------------------------------------------");
	Uart_Printf("\nS3C44B0X Test Program Ver 2.0 rSYSCFG=0x%x MCLK=%dHz\n",rSYSCFG,MCLK);
	Uart_Printf("\n--------------------Run test flash? (Y/N)-----------------------");
    
	Led_Display(0x0);
    
	aa= Uart_Getch();
	
	if((aa=='Y')||(aa=='y'))
	{
    	SST39VF160_SectorErase(0xff800);
		   Uart_Printf("\nSector erase successfully!");
    	if(SST39VF160_CheckBlank(0xff800,2048))//是否为空
	    {
		   Uart_Printf("\nBlank check OK! Begin to Write the sector...");
		   for(i=0;i<2048;i++)
		   {
		      if(SST39VF160_WordProg(0xff800+i,0xaa55))
		      {
		      	Delay(2);
		      	}
		      else
		      	  Uart_Printf("adr=%d,Write Error",i);
		   }
		   Uart_Printf("\nWrite OK! Begin to Verify... ");   
           for(i=0;i<2048;i++)
           {
              temp = Readflash(0xff800+i);
              if(temp!= 0xaa55)
              {
              	 Uart_Printf("\nadr=%4d,temp = %4x Verify Error!",i,temp);	      
		         //break;
		      }
		   }
		   Uart_Printf("\nVerify OK! Begin to erase the sector...");
		   SST39VF160_SectorErase(0xff800);
		   Uart_Printf("\nSector erase successfully!");
		}
		else
		Uart_Printf("\nThe Sector is not empty! Abort the test!");
	}  
	else
		Uart_Printf("\nNot running! Abort the test!");
	while(1);
}

⌨️ 快捷键说明

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