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

📄 nandflash.h

📁 smp860运动控制器USB驱动,对从事数控技术开发人员非常有用
💻 H
字号:
#ifndef _FLASH_H_
#define _FLASH_H_

#define NandFlash_DEBUG		1

//#define MAX_BLOCKS_NUM      2048   // k9f5608 32MU8 2048 
#define MAX_BLOCKS_NUM      1024   // k9f2808 16MU8 1024 

#define K9F2808	(0xec73)
#define K9F3208	(0xece3)
#define KM29U128_ID     (0xec75)        //ID  28f08 0xec73    56f08  0xec75

//NandFlash.R/B		<----->		GPC10
//NandFlash.CE		<----->		GPC14
//NandFlash.CLE		<----->		ADDR2
//NandFlash.ALE		<----->		ADDR3

#define	NandFlash_DATA	0x02000000
#define	NandFlash_CLE	0x02000004
#define	NandFlash_ALE	0x02000008

#define	READCMD0	0
#define	READCMD1	1
#define	READCMD2	0x50
#define	ERASECMD0	0x60
#define	ERASECMD1	0xd0
#define	PROGCMD0	0x80
#define	PROGCMD1	0x10
#define	QUERYCMD	0x70
#define	READIDCMD	0x90

#define NandFlash_Chip_Enable	  ( rPDATC &= ~(1<<14) )
#define NandFlash_Chip_Disable	  ( rPDATC |= 1<<14 )

#define	READCMD0	0
#define	QUERYCMD	0x70

#define NandFlash_WR_CLE	  ( *(volatile U8 *)NandFlash_CLE )
#define NandFlash_WR_ALE	  ( *(volatile U8 *)NandFlash_ALE )
#define NandFlash_WR_DATA	  ( *(volatile U8 *)NandFlash_DATA )

#define ReadyBusy  (1<<10)
#define NandFlash_ReadyBusy  while( !(rPDATC & ReadyBusy) )  //wait tWB and check R/B pin.   				//step3:CE ->Low

#define NF_WRITE_PAGE_VERIFY     (0)             //Verifing is enable when writing flash

/*KM29U128函数声明*/
extern void           Flash_Reset(void);//flash reset
extern unsigned short   Check_Flash_Id(void);
extern unsigned char nfwritepage(unsigned short pageWord, unsigned char *buf);
extern void          nfreadpage(unsigned short pageWord, unsigned char *buf);
extern unsigned char nferaseblock(unsigned int cluster); 
extern unsigned char  NandFlash_Self_Test( void ) ;

#endif

⌨️ 快捷键说明

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