| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- #ifndef _CFG_H_
- #define _CFG_H_
- #include "stdint.h"
- #define TRIPHASIC 0
- #define SINGLE 0
- #define MD_BASE_Addr (1500)
- #define MD_STATUS_Addr 1
- #define MD_WRITE_Addr 50
- #define MD_READ_STATUS (MD_BASE_Addr + MD_STATUS_Addr)
- #define MD_WRIE_DATA (MD_BASE_Addr+MD_WRITE_Addr)
- #define BOOT_LOADER ((uint32_t)(0x08000000)) //boot loadr addr
- #define BOOT_LOADER_SIZE (20*1024) //boot loade size
- #define META_DATA ((uint32_t)(0x08005000)) //meta data addr
- #define META_DATA_SIZE (1*1024) //meta data size
- #define PROGRAME_APP1 ((uint32_t)(0x08005400)) //App1 Rom Start addr
- #define PROGRAME_APP1_SIZE (20*1024) //App1 programe Max size
- #define PROGRAME_APP2 ((uint32_t)(0x0800A400)) //App2 Rom Start addr
- #define PROGRAME_APP2_SIZE (20*1024) //App2 programe Max size
- #define PARTITION 1
- #define VERSION "V1.0.0.0"
- #define MODBUS_HEAD "GOWONE_UPGRADE"
- #define MB_Boot_Loader_Version_Addr 1
- #define MB_Boot_APP1_Version 2
- #define MB_Boot_APP2_Version 3
- #define MB_default_Start_Area 4 //defalut start and defalut app1
- #define MB_Last_Running_Area 5
- #define MB_Last_Running_Error 6 //running error number
- #define MB_Upload_Status 7
- #define MB_APP1_CRC 8
- #define MB_APP2_CRC 9
- #define MB_Upload_Area 30
- #define MB_META_DATA_Addr 31
- #define MB_META_DATA_Addr_BytN 20
- #define MB_Recive_Data 32
- #define MB_Recive_Over 33
- #define MB_Start_Area 34
- #define BOOT_Version (MD_BASE_Addr + MB_Boot_Loader_Version_Addr)
- #define BOOT_APP1_Version (MD_BASE_Addr + MB_Boot_APP1_Version)
- #define BOOT_APP2_Version (MD_BASE_Addr + MB_Boot_APP2_Version)
- #define BOOT_Last_Running_Area (MD_BASE_Addr + MB_Last_Running_Area)
- #define BOOT_Last_Running_Error (MD_BASE_Addr + MB_Last_Running_Error)
- #define BOOT_Upload_Status (MD_BASE_Addr + MB_Upload_Status)
- #define BOOT_APP1_CRC (MD_BASE_Addr + MB_APP1_CRC)
- #define BOOT_APP2_CRC (MD_BASE_Addr + MB_APP2_CRC)
- #define BOOT_Upload_Area (MD_BASE_Addr + MB_Upload_Area)
- #define BOOT_META_DATA (MD_BASE_Addr + MB_META_DATA_Addr)
- #define BOOT_Recive_Data (MD_BASE_Addr + MB_Recive_Data)
- #define BOOT_Recive_Over (MD_BASE_Addr + MB_Recive_Over)
- #define BOOT_Start_Area (MD_BASE_Addr + MB_Start_Area)
- #define MAX_LENTH (128)
- #define Mb_Wcmd_Width 16
- #define NOERROR 0
- #define MAX_ERROR_COUNT 2
- #define ERROR_VERSION 0xFFFFFFFF
- typedef struct {
- int index;
- uint16_t lenth;
- uint8_t recive[MAX_LENTH];
- }Flash_Data;
- typedef struct
- {
- uint8_t flag;
- uint16_t base_addr;
- Flash_Data flash_Data;
- }MD_DATA;
- typedef struct {
- uint32_t operation_flag; // 0
- uint32_t partition; // 1
- uint32_t errno; // 0
- uint32_t error_count; // 0
- uint32_t rom_addr; // PROGRAME_APP1 0x08005400
- uint32_t recent_running_time; // 0
- uint32_t running_app_version; // V1.0.0.0 (1<<24 | 0 << 16 | 0 << 8 | 0)
- uint32_t app1_version; // V1.0.0.0 (1<<24 | 0 << 16 | 0 << 8 | 0)
- uint32_t app1_rom_addr; // PROGRAME_APP1 0x08005400
- uint32_t app1_partition; // 1
- uint32_t app2_version; // V1.0.0.0 (1<<24 | 0 << 16 | 0 << 8 | 0)
- uint32_t app2_rom_addr; // PROGRAME_APP2 0x0800A400
- uint32_t app2_partition; // 2
- }META_DATA_S;
- typedef struct g_MD_Data{
- uint8_t count;
- MD_DATA data[Mb_Wcmd_Width];
- }g_MD_Data;
- g_MD_Data* get_md_data();
- #endif
|