📄 flash_api.h
字号:
/******************************************************************************
* Filename : Flash_api.h
* Start : 2004. 4. 28
* By : Taejin Kwon
* Contact : eric.kwon@samsung.com
* Description :
******************************************************************************
*/
#ifndef _FLASH_API_H_
#define _FLASH_API_H_
#ifdef __cplusplus
extern "C" {
#endif
#define _SUPPORT_16BIT_BFLASH 0 /* support 16bit flash memory or not... */
#define _FLASH_DEBUG 0
#define _NEW_FLASH_IMAGE_ 0 /* for Lab Tool interface */
#define FLASH_BASE_ADDR 0x20000000
#define FLASH_ERASE_CHECK_COUNT 2000
#define _4MBIT 524288
#define _8MBIT 1048576
#define _16MBIT 2097152
typedef enum {
#if _SUPPORT_16BIT_BFLASH
SST_39VF160,
SST_39VF800,
SST_39VF400,
#endif
SST_39VF040,
SST_39VF080,
FUJ_29LV800T,
FUJ_29LV800B,
ES_29LV800T,
ES_29LV800B,
EN_29LV800T,
EN_29LV800B,
A_29L400T,
A_29L400B,
A_29L800T,
A_29L800B,
S_29AL016MT,
S_29AL016MB,
S_29AL008DT,
S_29AL008DB,
M29W160ET,
M29W160EB,
M29W800ET,
M29W800EB,
SST_39VF088,
S_FUNAI,
NUM_OF_FLASH_SUPPORTED
} Flash_type_et;
typedef enum {
FLASH_8BIT,
FLASH_16BIT
} Flash_bit_et;
typedef enum {
FLASH_CMD_SST,
FLASH_CMD_SST_8,
FLASH_CMD_FUJ,
FLASH_CMD_FUJ_8
} Flash_cmd_et;
/*
add eeprom_block for increase num of eeprom block.
2006.04.25. by CKLee.
*/
typedef struct {
#if _FLASH_DEBUG
NCHAR* string;
#endif
UINT max_size;
UCHAR id1;
USHORT id2;
Flash_bit_et bit;
UINT id2_adr;
Flash_cmd_et cmd_type;
UINT last_adr[2];
UINT eeprom_block;
} Flash_type_st;
typedef unsigned short FLASH16;
typedef unsigned char FLASH8;
extern Flash_type_et gFlashType;
extern CONST Flash_type_st gFlash[];
#define FLASH_DEVICE_SIZE gFlash[gFlashType].max_size
#define FLASH_ID gFlash[gFlashType].id1
#define FLASH_ID2 gFlash[gFlashType].id2
#define FLASH_BIT gFlash[gFlashType].bit
#define FLASH_ID2_ADR gFlash[gFlashType].id2_adr
#define FLASH_CMDTYPE gFlash[gFlashType].cmd_type
/*
* To support flash device emulate EEPROM
* Flash read routine changed in two block.
* Because there are some FLASH device's last sector size is not same with
* SST type. To cover this problem, flash addressing is based on each
* flash device type defined in gFlash array.
*
* 2005.11.10 TJ
*/
#define FLASH_ADDR_EEPROM_0 gFlash[gFlashType].last_adr[0]
#define FLASH_ADDR_EEPROM_1 gFlash[gFlashType].last_adr[1]
/*
index change to 32bit for increase num of eeprom block.
2006.04.25. by CKLee.
*/
#define FLASH_EEPROM_MAX_BLOCKS gFlash[gFlashType].eeprom_block
#define FLASH_EEPROM_MAX_SECTORS 2
#define FLASH_EEPROM_SIZE 128
#define FLASH_EEPROM_VALID_ID 0x5A
#define FIRM_PADDING_SIZE 16
#define FLASH_BLOCK_SIZE 32768
#define FLASH_SECTOR_SIZE 8192
Flash_type_et FLASH_detectDevice(VOID);
BOOL FLASH_eraseEntireFlash( VOID );
BOOL FLASH_writeFirmImage( UINT *addr );
BOOL FLASH_readFromFlash( UINT *dst, UINT *recover_size );
BOOL FLASH_verifyFlashImage( UINT *src, UINT *dst, UINT size );
BOOL FLASH_readEepromImage( UCHAR *dst, UINT size );
BOOL FLASH_writeEepromImage( UINT *addr, UINT size );
BOOL FLASH_eraseOneSector( USHORT *Dst );
VOID FLASH_updateFirmware( UINT *src );
#ifdef __cplusplus
}
#endif
#endif // _FLASH_API_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -