| 
					
				 | 
			
			
				@@ -1,9 +1,14 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifndef __DEV_IAP_H 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #define __DEV_IAP_H 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/************************************************************************************************ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *                                          Includes                                             * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ ************************************************************************************************/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include "dev_can.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <stdint.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef __cplusplus 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-extern 'C' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+extern "C" { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #ifdef __DEV_IAP_H_GLOBAL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #define __DEV_IAP_H_EXTERN 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -24,13 +29,8 @@ extern 'C' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  ************************************************************************************************/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /************************************************************************************************ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- *                                          Includes                                             * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *                                          Defines                                              * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  ************************************************************************************************/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#include "dev_can.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#include <stdint.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    /************************************************************************************************ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     *                                          Defines                                              * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     ************************************************************************************************/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #define UPGRADE_FLAG_DATA_SIZE  4                                                // 升级参数数组元素个数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #define UPGRADE_APP_DATA_SIZE   4                                                // 升级参数数组元素个数 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -59,53 +59,53 @@ extern 'C' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #define UPGRADE_SIGN       0x5AA5 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #define DEVICE_ID          0x5AA5 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    typedef union 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        uint16_t u8_buf[8]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        uint16_t u16_buf[4]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } u16_u8; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+typedef union 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uint16_t u8_buf[8]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uint16_t u16_buf[4]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} u16_u8; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    typedef union 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        uint16_t u8_save[200]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        uint16_t u16_save[100]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } u16save_u8save; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+typedef union 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uint16_t u8_save[200]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uint16_t u16_save[100]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} u16save_u8save; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    typedef struct 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        uint16_t       total_packages; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        uint16_t       current_packages; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        uint16_t       count_packages; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        uint16_t       recv_len; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        uint16_t       crc16; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        uint16_t       firmware_crc16; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        uint16_t       firmware_ver; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        uint16_t       total_bytes; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        uint16_t       count_bytes; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        u16_u8         flash_data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        u16_u8         recheck_data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        u16save_u8save save_data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } iap_type; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    typedef union 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+typedef struct 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uint16_t       total_packages; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uint16_t       current_packages; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uint16_t       count_packages; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uint16_t       recv_len; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uint16_t       crc16; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uint16_t       firmware_crc16; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uint16_t       firmware_ver; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uint16_t       total_bytes; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uint16_t       count_bytes; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    u16_u8         flash_data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    u16_u8         recheck_data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    u16save_u8save save_data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} iap_type; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+typedef union 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    struct 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        struct 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            uint16_t sign;        // 首地址 buf[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            uint16_t crc16;       // 中地址 buf[1] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            uint32_t moving_size; // 高地址 buf[2] buf[3] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } param; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        uint16_t infor_buf[UPGRADE_FLAG_DATA_SIZE]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } upgrade_param; // 升级参数使用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    extern upgrade_param upgrade; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    void    iap_param_init (void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    void    iap_flag_release (void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    uint8_t erase_app_flash (uint32_t start_address, uint32_t end_addr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    void    jump_boot_time_ctrl (void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    void    iap_rec_handler (pdu_tag rec_msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        uint16_t sign;        // 首地址 buf[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        uint16_t crc16;       // 中地址 buf[1] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        uint32_t moving_size; // 高地址 buf[2] buf[3] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } param; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uint16_t infor_buf[UPGRADE_FLAG_DATA_SIZE]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} upgrade_param; // 升级参数使用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+extern upgrade_param upgrade; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+void    iap_param_init (void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+void    iap_flag_release (void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+uint8_t erase_app_flash (uint32_t start_address, uint32_t end_addr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+void    jump_boot_time_ctrl (void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+void    iap_rec_handler (pdu_tag rec_msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /************************************************************************************************ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  *                                          Defines                                              * 
			 |