?? flashmem.h
字號(hào):
/*==============================================================================** FILENAME: PTFLASHMEM.H** DESCRIPTION: Header for Am29LV64xD Flash Memory Device Driver** CURRENT VERSION: 1.0** HISTORY:** Date CR No Person Description* ---------- ---------- ------ -------------* 2004-07-22 Li Lan Initial version.*==============================================================================*/#ifndef __PTFLASHMEM_H__#define __PTFLASHMEM_H__#ifdef __cplusplusextern "C" {#endif/*============================================================================== Includes and Public Data Declarations==============================================================================*//* 包含系統(tǒng)文件以及定義公用數(shù)據(jù)文件 *//*============================================================================== Include Files==============================================================================*//* 包含本地文件 *//*============================================================================== Constant / Define Declarations==============================================================================*//* 常量定義,并對(duì)所定義的常量進(jìn)行說(shuō)明 *//*============================================================================== Macro Definitions==============================================================================*//* 宏定義,并對(duì)其進(jìn)行簡(jiǎn)要說(shuō)明 */#ifdef _ASMLANGUAGE #define CAST(x)#else /* _ASMLANGUAGE */ #define CAST(x) (x)#endif /* _ASMLANGUAGE */#define AMD_FLASH_SECTOR_SIZE 0x10000 /* 64K Bytes */#define AMD_FLASH_MAX_SECTOR 128#define AMD_REG(offset) CAST((UINT16 *)(FLASH_ADRS + (offset) * 2))#define AMD_REG_2(offset) CAST((UINT16 *)(FLASH_ADRS + \ AMD_FLASH_SECTOR_SIZE * AMD_FLASH_MAX_SECTOR + (offset) * 2))/* commands for AMD flash */#define AMD_CMD_ERASE 0x8080#define AMD_CMD_PROGRAM 0xA0A0#define AMD_CMD_CFI_QUERY 0x9898#define AMD_CMD_ERASE_SUSPEND 0xB0B0#define AMD_CMD_ERASE_RESUME 0x3030#define AMD_CMD_SECTOR_ERASE 0x3030#define AMD_CMD_CHIP_ERASE 0x1010#define AMD_CMD_RESET 0xF0F0#define AMD_CMD_UNLOCK_BYPASS 0x2020#define AMD_CMD_AUTOSELECT 0x9090/* AMD unlock bypass reset circles */#define AMD_UNLOCK_BYPASS_RESET_CIRCLE_1 0x9090#define AMD_UNLOCK_BYPASS_RESET_CIRCLE_2 0x0000/* AMD unlock circles */#define AMD_UNLOCK_CIRCLE_1 0xAAAA#define AMD_UNLOCK_CIRCLE_2 0x5555/* AMD flash status bits */#define AMD_DQ2 0x04 /* Toggles when erase suspended */#define AMD_DQ5 0x20 /* Set when programming timeout */#define AMD_DQ6 0x40 /* Toggles when programming *//* Command codes for the flash_command routine */#define AMD_FLASH_SELECT 0 /* no command; just perform the mapping */#define AMD_FLASH_RESET 1 /* reset to read mode */#define AMD_FLASH_READ 1 /* reset to read mode, by any other name */#define AMD_FLASH_AUTOSEL 2 /* autoselect (fake Vid on pin 9) */#define AMD_FLASH_PROG 3 /* program a word */#define AMD_FLASH_CERASE 4 /* chip erase */#define AMD_FLASH_SERASE 5 /* sector erase */#define AMD_FLASH_ESUSPEND 6 /* suspend sector erase */#define AMD_FLASH_ERESUME 7 /* resume sector erase */#define AMD_FLASH_UB 8 /* go into unlock bypass mode */#define AMD_FLASH_UBPROG 9 /* program a word using unlock bypass */#define AMD_FLASH_UBRESET 10 /* reset to read mode from unlock bypass mode */#define AMD_FLASH_CFI 11 /* CFI query */#define AMD_FLASH_LASTCMD 11 /* used for parameter checking *//* Return codes from flash_status */#define AMD_STATUS_READY 0 /* ready for action */#define AMD_STATUS_BUSY 1 /* operation in progress */#define AMD_STATUS_ERSUSP 2 /* erase suspended */#define AMD_STATUS_TIMEOUT 3 /* operation timed out */#define AMD_STATUS_ERROR 4 /* unclassified but unhappy status */#define FLASH_29LV64xD 0x22D7 /* device code 29LV64xD */#define FLASH_29LV64xM 0x227E /* device code 29LV64xM *//* 告警日志相關(guān)宏定義 */#define ALARM_USER_FLAG 0x55aa#define ALARM_IDLE_FLAG 0xFFFF#define BOARD_HW_ITEM_NUM_OF_BLOCK (AMD_FLASH_SECTOR_SIZE/32)#define NODEB_HW_ITEM_NUM_OF_BLOCK (AMD_FLASH_SECTOR_SIZE/32)#define BOARD_SW_ITEM_NUM_OF_BLOCK 1365 /*(AMD_FLASH_SECTOR_SIZE/48)*//*============================================================================== Type Declarations==============================================================================*//* 類型定義,struct、enum等,對(duì)每種類型定義作簡(jiǎn)要說(shuō)明,如果是重要數(shù)據(jù)結(jié)構(gòu),要詳細(xì) 說(shuō)明 */typedef struct flash{ int Manufacturer; /* flash manufacturer */ int Type; /* flash type */ int Size; /* flash size */ int Width; /* flash width */ int nbSectors; /* number of sectors */ int sectorSize; /* sector size */} flash_t;STATUS sysFlashGet();STATUS sysFlashErase();STATUS sysFlashAllErase();STATUS sysFlashWrite();STATUS sysFlashSet();STATUS sysWriteAlarmLog();INT32 sysReadAlarmLog();STATUS sysClearAlarmLog();#ifdef __cplusplus}#endif#endif /* __PTFLASHMEM_H__ */
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -