示例#1
0
文件: nand.c 项目: ZhaGoo/gp720
INT32S NAND_Initial(void)
{
	INT16S ret;
    
	if(bNandInit == -1)
	{		
	   DrvNand_bchtable_alloc();
		ret = DrvNand_initial();	                         //L2 API 
		bNandInit = 0;
		if(ret!=0)
		{
			if (ret == 0xfff0) //ID not suppot
			{
				bNandInit = -1;
				//return ret;
			}
			else
			{
				DrvNand_lowlevelformat();
				ret = DrvNand_initial();
				if(ret!=0)
				{
					bNandInit = -1;
					//return ret;
				}		   
			}
		}	
		if ( bNandInit != 0)			
		{		
			DrvNand_bchtable_free();
		}
	}
	
	return 0;
}
void gp_nand_test(void)
{
//		UINT16 main_id;
//		UINT32 vendor_id;
//		UINT32 i,j,m;
		UINT32 ret;
		
		//DrvNand_lowlevelformat();
		
		ret = DrvNand_initial();	
		if(ret !=0)
		{
			//while(1)
			for(ret = 0;ret<50;ret++)
			{
				printk("==Nand initial Fail!!==\n");
			}			
#ifdef PART0_WRITE_MONITOR_DEBUG			
			printk("==Hangup to debug!!==\n");
			while(1);
#endif			
		} 
		else 
		{
			NF_TEST_DIAG("==Nand initial success!!==\n");	
		}
		
		//read_write_code();
}