|
|
#ifndef __FLASH_H
|
|
|
#define __FLASH_H
|
|
|
#include "system.h"
|
|
|
#define W25Q128 0XEF17 //本开发版采用的芯片是W25Q128,对应制造商设备ID号0xEF17//
|
|
|
extern u16 W25QXX_TYPE; //定义W25QXX芯片型号//
|
|
|
#define W25QXX_CS PAout(4) //W25QXX的片选信号//
|
|
|
//W25Q128 指令表//
|
|
|
#define W25X_WriteEnable 0x06 //写入使能//
|
|
|
#define W25X_WriteDisable 0x04 //写入禁止//
|
|
|
#define W25X_ReadStatusReg 0x05 //读取状态寄存器//
|
|
|
#define W25X_WriteStatusReg 0x01 //写入状态寄存器//
|
|
|
#define W25X_ReadData 0x03 //读取数据//
|
|
|
#define W25X_FastReadData 0x0B //快速读取数据//
|
|
|
#define W25X_FastReadDual 0x3B //快速双端口输出方式读取存储器数据//
|
|
|
#define W25X_PageProgram 0x02 //页编程//
|
|
|
#define W25X_BlockErase 0xD8 //块擦除//
|
|
|
#define W25X_SectorErase 0x20 //扇擦除//
|
|
|
#define W25X_ChipErase 0xC7 //芯片擦除//
|
|
|
#define W25X_PowerDown 0xB9 //掉电//
|
|
|
#define W25X_ReleasePowerDown 0xAB //释放掉电//
|
|
|
#define W25X_DeviceID 0xAB //设备ID号//
|
|
|
#define W25X_ManufactDeviceID 0x90 //制造商设备ID号//
|
|
|
#define W25X_JedecDeviceID 0x9F //JEDEC(Joint Electron Device Engineering Council)电子元件工业联合会//
|
|
|
//申明14个函数//
|
|
|
void W25QXX_Init(void); //W25Qxx初始化函数*//
|
|
|
u16 W25QXX_ReadID(void); //读取FLASH ID函数*//
|
|
|
u8 W25QXX_ReadSR(void); //读取状态寄存器函数*//
|
|
|
void W25QXX_Write_SR(u8 sr); //写入状态寄存器函数*//
|
|
|
void W25QXX_Write_Enable(void); //写入使能函数*//
|
|
|
void W25QXX_Write_Disable(void); //写入失能函数*//
|
|
|
void W25QXX_Write_Page(u8* pBuffer,u32 WriteAddr,u16 NumByteToWrite);//Y
|
|
|
void W25QXX_Write_NoCheck(u8* pBuffer,u32 WriteAddr,u16 NumByteToWrite);//无检查写入flash函数*//
|
|
|
void W25QXX_Read(u8* pBuffer,u32 ReadAddr,u16 NumByteToRead); //读取flash函数*//
|
|
|
void W25QXX_Write(u8* pBuffer,u32 WriteAddr,u16 NumByteToWrite); //写入flash函数//
|
|
|
void W25QXX_Erase_Chip(void); //整片芯片擦除函数*//
|
|
|
void W25QXX_Erase_Sector(u32 Dst_Addr); //扇区擦除函数*//
|
|
|
void W25QXX_Wait_Busy(void); //等待空闲函数*//
|
|
|
void W25QXX_PowerDown(void); //进入掉电模式函数*//
|
|
|
void W25QXX_WAKEUP(void); //唤醒函数*//
|
|
|
#endif
|
|
|
|