zongqiang.zhang | 0c6a088 | 2019-08-07 14:48:21 +0800 | [diff] [blame^] | 1 | #ifndef _SP_FLASH_H_ |
| 2 | #define _SP_FLASH_H_ |
| 3 | |
| 4 | #include "../sys_hw/Prj_FlashCfg.H" |
| 5 | #include "sp_config.h" |
| 6 | |
| 7 | #ifdef __cplusplus |
| 8 | extern "C" { |
| 9 | #endif |
| 10 | |
| 11 | ///////////////////EEPROM ¿Õ¼ä///////////////////////////// |
| 12 | ///////////////////FLASH ¿Õ¼ä//////////////////////////////////////////////////// |
| 13 | |
| 14 | #if 0 |
| 15 | #define ADDR_FLASH_BEGIN 0x17000 // base addr |
| 16 | #define ADDR_CONFIG_PARA 0x17000 //ÅäÖòÎÊý |
| 17 | |
| 18 | #define ADDR_TRANSDTL_PTR 0x18000 //Á÷ˮָÕë |
| 19 | #define ADDR_TRANSDTL_BEGIN 0x200000 //Á÷Ë®Æðʼ |
| 20 | #define ADDR_TRANSDTL_END 0x350000 //Á÷Ë®½áÊø |
| 21 | #define ADDR_MAX 0x400000 |
| 22 | #endif |
| 23 | //############################################################### |
| 24 | /*********Ô¶³ÌÉý¼¶Îļþ´æ´¢100Ò³*********************/ |
| 25 | /*********×¢ÒâÉý¼¶µØÖ·ÓëBOOTÉý¼¶µØÖ·±£³ÖÒ»ÖÂ**/ |
| 26 | #define DEF_IAP_BASE_ADDR (DEF_FLASH_IAP_AppCodeStartAdd) |
| 27 | #define DEF_IapMarkAddr ( DEF_IAP_BASE_ADDR + 1 * DEF_FLASH_PageSize ) //IAPÉý¼¶±ê¼ÇµØÖ· |
| 28 | #define DEF_EraMarkAddr ( DEF_IAP_BASE_ADDR + 2 * DEF_FLASH_PageSize ) //²Á³ýFLASH±ê¼Ç |
| 29 | #define DEF_IapDataAddr ( DEF_IAP_BASE_ADDR + 3 * DEF_FLASH_PageSize ) //IAPÊý¾ÝÇøÆðʼµØÖ· |
| 30 | |
| 31 | #define DEF_FLASH_codeStartAdd (DEF_IapDataAddr) |
| 32 | |
| 33 | #define ADDR_UPGRADE_UPINFO (ADDR_FLASH_END + DEF_FLASH_PageSize *1) |
| 34 | #define ADDR_KEY_PARA (ADDR_UPGRADE_UPINFO + DEF_FLASH_PageSize *1) |
| 35 | |
| 36 | #define ADDR_UPGRADE_BEGIN (DEF_FLASH_codeStartAdd) |
| 37 | #define ADDR_UPGRADE_END (DEF_FLASH_IAP_AppCodeEndAdd -DEF_FLASH_PageSize) |
| 38 | |
| 39 | #define ADDR_APPLICATION_BASE 0x130000 //base addr |
| 40 | #define ADDR_APP_VERSION (ADDR_APPLICATION_BASE) //°æ±¾±êʶ |
| 41 | |
| 42 | #define ADDR_CONFIG_PARA (ADDR_APP_VERSION +DEF_FLASH_PageSize *1)//ÅäÖòÎÊý |
| 43 | |
| 44 | #define ADDR_LAST_TRANSNO (ADDR_CONFIG_PARA +DEF_FLASH_PageSize *10) |
| 45 | #define ADDR_UNCONFIRM_TRANSNO (ADDR_LAST_TRANSNO +DEF_FLASH_PageSize *1) |
| 46 | #define ADDR_TRANSDTL_BEGIN (ADDR_UNCONFIRM_TRANSNO +DEF_FLASH_PageSize *1) |
| 47 | #define ADDR_TRANSDTL_END (ADDR_TRANSDTL_BEGIN +DEF_FLASH_PageSize *100) |
| 48 | #define ADDR_FLASH_END (ADDR_TRANSDTL_END) |
| 49 | #define ADDR_MAX 0x400000 |
| 50 | |
| 51 | //######################################### |
| 52 | |
| 53 | uint16 sp_flash_read(uint32 addr,uint8 buf[],uint32 len); |
| 54 | uint16 sp_flash_write(uint32 addr,uint8 buf[],uint32 len); |
| 55 | uint16 sp_flash_erase(uint32 addr); |
| 56 | uint16 sp_flash_page_read(uint32 addr,uint8 buf[],uint32 len); |
| 57 | uint16 sp_flash_page_write(uint32 addr,uint8 buf[],uint32 len); |
| 58 | |
| 59 | #ifdef __cplusplus |
| 60 | } |
| 61 | #endif |
| 62 | |
| 63 | #endif |