nandflash.c

来自「这个是在windows下用ADS开发的s3c44b0的硬件测试程序」· C语言 代码 · 共 55 行

C
55
字号
/****************************************************************
 *		  ARMSYS S3C44B0X  NandFLASH TEST							*  
 ****************************************************************
 
  1.2005.5.16::  NandFLASH TEST
 
 ***************************************************************/
 
#include "..\Target\44blib.h"
#include "..\nandflash\nandFlib.h"
#include "..\nandflash\nandflash.h"

void Read_ID(void)
{
	unsigned short id;
	id = Check_Flash_Id();
	Uart_Printf("\nNandFLASH Chip's ID is 0x%4x\n",id);
}
void Erase_test(void)
{
	Uart_Printf("\nBegin to erase the last block...");
	if(Erase_Cluster(LASTBLOCK))
		Uart_Printf("\nOK! Compeleted.");
	else 
	    Uart_Printf("\nErase error!");
}

void Write_test(void)
{
	int i;
	unsigned char buffer[528];
	for(i=0;i<528;i++)
		buffer[i]=0xaa;
	Uart_Printf("\nBegin to Write the first Page of the last block...");
	if(WritePage(LASTBLOCK,0,buffer))
	    Uart_Printf("\nOK! Compeleted.");
	else 
	    Uart_Printf("\nWrite error!");
}

void Read_test(void)
{
	int i,j=0;
	unsigned char buffer[528];
	
	Uart_Printf("\nBegin to Read the first Page of the last block...");
	ReadPage(LASTBLOCK,0,buffer);
	for(i=0;i<528;i++)
	{
		if(buffer[i]==0xaa)
			j++;
	}
    Uart_Printf("\n%4d Bytes verify match!",j);

}	    

⌨️ 快捷键说明

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