| #ifndef _SP_FLASH_H_ |
| #define _SP_FLASH_H_ |
| |
| #include "../sys_hw/Prj_FlashCfg.H" |
| #include "sp_config.h" |
| |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
| |
| ///////////////////EEPROM ¿Õ¼ä///////////////////////////// |
| ///////////////////FLASH ¿Õ¼ä//////////////////////////////////////////////////// |
| |
| #if 0 |
| #define ADDR_FLASH_BEGIN 0x17000 // base addr |
| #define ADDR_CONFIG_PARA 0x17000 //ÅäÖòÎÊý |
| |
| #define ADDR_TRANSDTL_PTR 0x18000 //Á÷ˮָÕë |
| #define ADDR_TRANSDTL_BEGIN 0x200000 //Á÷Ë®Æðʼ |
| #define ADDR_TRANSDTL_END 0x350000 //Á÷Ë®½áÊø |
| #define ADDR_MAX 0x400000 |
| #endif |
| //############################################################### |
| /*********Ô¶³ÌÉý¼¶Îļþ´æ´¢100Ò³*********************/ |
| /*********×¢ÒâÉý¼¶µØÖ·ÓëBOOTÉý¼¶µØÖ·±£³ÖÒ»ÖÂ**/ |
| #define DEF_IAP_BASE_ADDR (DEF_FLASH_IAP_AppCodeStartAdd) |
| #define DEF_IapMarkAddr ( DEF_IAP_BASE_ADDR + 1 * DEF_FLASH_PageSize ) //IAPÉý¼¶±ê¼ÇµØÖ· |
| #define DEF_EraMarkAddr ( DEF_IAP_BASE_ADDR + 2 * DEF_FLASH_PageSize ) //²Á³ýFLASH±ê¼Ç |
| #define DEF_IapDataAddr ( DEF_IAP_BASE_ADDR + 3 * DEF_FLASH_PageSize ) //IAPÊý¾ÝÇøÆðʼµØÖ· |
| |
| #define DEF_FLASH_codeStartAdd (DEF_IapDataAddr) |
| |
| #define ADDR_UPGRADE_UPINFO (ADDR_FLASH_END + DEF_FLASH_PageSize *1) |
| #define ADDR_KEY_PARA (ADDR_UPGRADE_UPINFO + DEF_FLASH_PageSize *1) |
| |
| #define ADDR_UPGRADE_BEGIN (DEF_FLASH_codeStartAdd) |
| #define ADDR_UPGRADE_END (DEF_FLASH_IAP_AppCodeEndAdd -DEF_FLASH_PageSize) |
| |
| #define ADDR_APPLICATION_BASE 0x130000 //base addr |
| #define ADDR_APP_VERSION (ADDR_APPLICATION_BASE) //°æ±¾±êʶ |
| |
| #define ADDR_CONFIG_PARA (ADDR_APP_VERSION +DEF_FLASH_PageSize *1)//ÅäÖòÎÊý |
| |
| #define ADDR_LAST_TRANSNO (ADDR_CONFIG_PARA +DEF_FLASH_PageSize *10) |
| #define ADDR_UNCONFIRM_TRANSNO (ADDR_LAST_TRANSNO +DEF_FLASH_PageSize *1) |
| #define ADDR_TRANSDTL_BEGIN (ADDR_UNCONFIRM_TRANSNO +DEF_FLASH_PageSize *1) |
| #define ADDR_TRANSDTL_END (ADDR_TRANSDTL_BEGIN +DEF_FLASH_PageSize *100) |
| #define ADDR_FLASH_END (ADDR_TRANSDTL_END) |
| #define ADDR_MAX 0x400000 |
| |
| //######################################### |
| |
| uint16 sp_flash_read(uint32 addr,uint8 buf[],uint32 len); |
| uint16 sp_flash_write(uint32 addr,uint8 buf[],uint32 len); |
| uint16 sp_flash_erase(uint32 addr); |
| uint16 sp_flash_page_read(uint32 addr,uint8 buf[],uint32 len); |
| uint16 sp_flash_page_write(uint32 addr,uint8 buf[],uint32 len); |
| |
| #ifdef __cplusplus |
| } |
| #endif |
| |
| #endif |