flash1.h
来自「WinCE 3.0 BSP, 包含Inter SA1110, Intel_815」· C头文件 代码 · 共 116 行
H
116 行
#ifndef __FLASH_H__
#define __FLASH_H__
//
// Define flash memory command set
//
#define ERASE_SETUP 0x20
#define PROGRAM_SETUP 0x40
#define CLEAR_STATUS_REGISTER 0x50
#define READ_STATUS_REGISTER 0x70
#define INTELLIGENT_IDENTIFIER 0x90
#define ERASE_SUSPEND 0xb0
#define ERASE_RESUME 0xd0
#define READ_ARRAY 0xff
#define ExtendCmd32(x) (((x)<<24)|((x)<<16)|((x)<<8)|(x))
#define ERASE_SETUP32 ExtendCmd32(ERASE_SETUP)
#define PROGRAM_SETUP32 ExtendCmd32(PROGRAM_SETUP)
#define CLEAR_STATUS_REGISTER32 ExtendCmd32(CLEAR_STATUS_REGISTER)
#define READ_STATUS_REGISTER32 ExtendCmd32(READ_STATUS_REGISTER)
#define INTELLIGENT_IDENTIFIER32 ExtendCmd32(INTELLIGENT_IDENTIFIER)
#define ERASE_SUSPEND32 ExtendCmd32(ERASE_SUSPEND)
#define ERASE_RESUME32 ExtendCmd32(ERASE_RESUME)
#define READ_ARRAY32 ExtendCmd32(READ_ARRAY)
#define FLASH_WRITE_CMD WRITE_REGISTER_ULONG
#define FLASH_READ_CMD READ_REGISTER_ULONG
#define FLASH_STATUS(reg,mask) (FLASH_READ_CMD((reg)) & (mask))
// Define status register
typedef struct _FM_STATUS {
UCHAR Reserved : 3;
UCHAR VPPS : 1;
UCHAR PS : 1;
UCHAR ES : 1;
UCHAR ESS : 1;
UCHAR WSMS : 1;
} FM_STATUS, *PFM_STATUS;
#define FM_WSMS 0x80
#define FM_ESS 0x40
#define FM_ES 0x20
#define FM_PS 0x10
#define FM_VPPS 0x08 // jshih ??? 0x04
#define FM_ERROR_MASK FM_VPPS|FM_PS|FM_ES|FM_ESS
#define ExtendStatus32(x) (((x)<<16)|(x))
#define FM_WSMS32 ExtendStatus32(FM_WSMS)
#define FM_ESS32 ExtendStatus32(FM_ESS)
#define FM_ES32 ExtendStatus32(FM_ES)
#define FM_PS32 ExtendStatus32(FM_PS)
#define FM_VPPS32 ExtendStatus32(FM_VPPS)
#define FM_ERROR_MASK32 ExtendStatus32(FM_ERROR_MASK)
//
// Time constants (unit in second)
//
#define PROGRAM_TIMEOUT 20 // Timeout value of write operation
#define ERASE_TIMEOUT 400 // Timeout value of block erase operation
//
// Flash memory error condition
//
typedef enum _FM_ERROR {
Fm_No_Error,
Vpp_Low,
Program_Error,
Program_Timeout,
Command_Sequence_Error,
Block_Erase_Error,
Block_Erase_Timeout,
Address_Overflow
} FM_ERROR;
//
// Flash memory chip despcriptor
//
typedef struct _FLASH_DESCRIPTOR {
BYTE ManufactureCode;
BYTE DeviceCode;
UINT NumberOfBlocks;
UINT InterfaceWidth;
UINT TotalSize;
ADDRESS* BlockEnd;
} FLASH_DESCRIPTOR, *PFLASH_DESCRIPTOR;
//
// Chip description table
//
#define NUMBER_OF_SUPPORTED_DEVICE 3
#define INTEL_28F008SA 0
#define INTEL_28F016SV 1
#define INTEL_28F0640J5 2
extern ADDRESS BlockEnd_28F008SA1[];
extern ADDRESS BlockEnd_28F016SV1[];
extern ADDRESS BlockEnd_28F0640J51[];
extern FLASH_DESCRIPTOR _fd1[];
#endif // __FLASH_H__
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?