stm32_ota/USER/USERCMD/usercmd.h

82 lines
3.9 KiB
C
Raw Permalink Normal View History

2023-12-15 06:28:06 +00:00
#ifndef __USERCMD_H
#define __USERCMD_H
#include <string.h>
#include <stdint.h>
#include "stm32f10x.h"
#include "user_flash.h"
#include "userapp.h"
#include "ec20module.h"
/******************************************************************************
*<EFBFBD>ڲ<EFBFBD>ʹ<EFBFBD>õij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*******************************************************************************/
/*<2A><><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С*/
#define IAPFLASHCONFIGLEN sizeof(IAPConfig_s) //<2F><EFBFBD><EAB6A8>IAPConfig_s<5F><EFBFBD><EFBFBD><E5B3A4>
#define FOLDER_MAXLEN 64 //<2F>ļ<EFBFBD><C4BC><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define USERNAME_MAXLEN 64 //<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define PASSWORD_MAXLEN 64 //<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/*<2A><><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
#define IS_IapFlag_ALL_PERIPH(PERIPH) (((PERIPH) == 0x30) || \
((PERIPH) == 0x31) ) //IAPConfig_s<5F><EFBFBD><E1B9B9><EFBFBD><EFBFBD>IapFlag<61><67><EFBFBD><EFBFBD>У<EFBFBD><D0A3>
2023-12-20 10:22:52 +00:00
2023-12-15 06:28:06 +00:00
#define IS_RunAppNum_ALL_PERIPH(PERIPH) (((PERIPH) == 0x30) || \
((PERIPH) == 0x31) || \
((PERIPH) == 0x32) || \
((PERIPH) == 0x33)) //IAPConfig_s<5F><EFBFBD><E1B9B9><EFBFBD><EFBFBD>RunAppNum<75><6D><EFBFBD><EFBFBD>У<EFBFBD><D0A3>
#define IS_JumpResult_ALL_PERIPH(JumpResult)(((PERIPH) == 0x30) || \
((PERIPH) == 0x31) ) //IAPConfig_s<5F><EFBFBD><E1B9B9><EFBFBD><EFBFBD>JumpResult<6C><74><EFBFBD><EFBFBD>У<EFBFBD><D0A3>
#define IS_VolumeRank_ALL_PERIPH(PERIPH) (((PERIPH) >= 0x31) && \
((PERIPH) <= 0x39) )
/******************************************************************************
*<EFBFBD>û<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*******************************************************************************/
/*IAP<41><50><EFBFBD><EFBFBD>FLASH<53><EFBFBD><E6B4A2>ʽ*/
typedef struct
{
char Head ; //<2F>̶<EFBFBD><CCB6>ַ<EFBFBD><D6B7><EFBFBD>'['
char IapFlag ; //'0'\'1' //BootLoader<65><72>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>APP<50><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint8_t RunAppNum ; //'1'\'2'\'3' //BootLoader<65><72>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD>ת<EFBFBD><D7AA> APP<50><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ҫ<EFBFBD>Ĵ<EFBFBD>λ<EFBFBD><CEBB>
uint8_t JumpResult ; //'0'\'1' //APP<50><50>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>app.limitRank
char BootVers[VERSION_LEN+1] ; //<2F><>¼BootLoader<65><EFBFBD><E6B1BE>
char FtpFolder[FOLDER_MAXLEN] ; //app<70><70>bin<69>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ftp<74><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>У<EFBFBD>boot<6F><74><EFBFBD>Ӵ<EFBFBD><D3B4>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>³<EFBFBD><C2B3><EFBFBD>
char FtpUsername[USERNAME_MAXLEN] ; //FTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>
char FtpPassword[PASSWORD_MAXLEN] ; //FTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>
char FtpIP[MAX_IP_LEN] ; //FTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP
char TcpIP[MAX_IP_LEN] ; //TCP<43><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP
char TcpPort[PORT_MAXLEN] ; //TCP<43><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PORT
char Reserve ; //Ԥ<><D4A4>,<2C><><EFBFBD><EFBFBD>һҳFLASH<53>洢IAP<41><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ɸ<EFBFBD><C9B8><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>IAPConfig_s<5F><EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
char Tail ; //<2F>̶<EFBFBD><CCB6>ַ<EFBFBD><D6B7><EFBFBD>']'
}IAPConfig_s ; //IAP<41><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/*IAP<41><50><EFBFBD><EFBFBD>FLASH<53><EFBFBD><E6B4A2>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
typedef union
{
IAPConfig_s sIapFlash ; //IAPConfig_s<5F><EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD>
uint8_t iapFlashBuffer[IAPFLASHCONFIGLEN] ;
}IAPFlash_u ; //IAP<41><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/******************************************************************************
*<EFBFBD><EFBFBD><EFBFBD>ⲿʹ<EFBFBD>õij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*******************************************************************************/
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FLASH<53>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ*/
extern IAPFlash_u uIapFlash ; //<2F><><EFBFBD><EFBFBD>IAPFlash_u<5F><75><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/*****************************************
*<EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD>ʹ<EFBFBD>õĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
****************************************/
/*****************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿں<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
****************************************/
extern void InitIapFlashConfig( IAPFlash_u *config ) ; //<2F>ȴ<EFBFBD>FLASH<53><48><EFBFBD><EFBFBD>IAPFlash<73><68>Ϣ<EFBFBD><CFA2>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD>IAPFlash_u<5F><75><EFBFBD>͵<EFBFBD>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>FLASH<53><48>
extern void Get_uIapFlash(IAPFlash_u *config) ; //<2F><><EFBFBD>ڲ<EFBFBD>flash<73><68>IAPCONFIG_AREA_ADDR<44><52>ַ<EFBFBD><D6B7>ȡһҳ<D2BB><D2B3><EFBFBD><EFBFBD>ȡFLASH<53>е<EFBFBD>IAP<41><50>Ϣ
extern void Set_uIapFlash(IAPFlash_u *config); //<2F><><EFBFBD>µ<EFBFBD>IAP<41><50>Ϣд<CFA2><D0B4>FLASH
#endif