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

📄 flash.h

📁 k9f5608 bsp 源程序
💻 H
字号:

#ifndef _FLASH_H_
#define _FLASH_H_

#define	BYTE	unsigned char


#define FALSE 0
#define TRUE 1

/*KM29U128 IO 定义*/
#if 0
#define RB	(0x01)
#define CLE	(0x02)
#define ALE	(0x04)
#define CE	(0x08)
#define rPDATA P5	/*Port5*/
#endif

#define ALE	(0x02)
#define CE	(0x08)
#define rPDATA P4	/*Port4*/






//xdata BYTE rKM29UXDATA  	_at_	0x4000;

#define SectorLength (512)

/*KM29U128操作宏定义*/
#if 0
#define FC_CMD		{rPDATA |= CLE;	rPDATA &= ~(ALE|CE);}
#define FC_ADDR		{rPDATA |= ALE;	rPDATA&=~(CLE|CE);}
#define FC_DATA        {rPDATA &= ~(ALE|CLE|CE);               }
#define FC_INACTIVE	{rPDATA |= CE;	rPDATA&=~(ALE|CLE);}       
#define WAITRB		while(!(rPDATA & RB))  //wait tWB and check R/B pin.   
#endif

#define  FC_CMD       	{NAND_MD=1;rPDATA &= ~(ALE|CE);}
#define  FC_ADDR	  	{rPDATA |= ALE;NAND_MD=0;rPDATA&=~CE;}
#define  FC_DATA       	{rPDATA &= ~(ALE|CE);NAND_MD=0;}
#define  FC_INACTIVE	{rPDATA |= CE;rPDATA &= ~ALE;NAND_MD=0;}
#define  WAITRB			while(!(NAND_RB))  //wait tWB and check R/B pin.   
#define KM29U128_ID (0xec75)               // k9f5608
#define WRITEVERIFY  (1)  //Verifing is enable when writing flash
/*KM29U128函数声明*/
void Flash_Reset(void);//flash reset
unsigned int Check_Flash_Id(void);
unsigned char Erase_Cluster(unsigned int cluster);
void ReadPage(unsigned int block,unsigned int page,unsigned char *pPage);
int WritePage(unsigned int block,unsigned int page,unsigned char *pPage);
//

int ReadSector(unsigned char *Name,unsigned char *databuff);
//void Flash_Tools(unsigned int sector,unsigned int cluster);

#endif  /* _FLASH_H_ */

⌨️ 快捷键说明

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