/**************************************************************************** * * Copy right: RL.Chen J and Zhen C * File name: AppFunc.h * Description: 应用层函数调用文件 * History: 2021-07-15 * ****************************************************************************/ #include "flash_ec616_rt.h" #include "commontypedef.h" #include "flash_ec616_rt.h" #include "mem_map.h" #include "AppTaskTcp.h" #include "AppConfig.h" #include "ec_tcpip_api.h" #define FLASH_BMS_FOTA_START_ADDR 0x2E6000 //BMS升级文件存储起始地址 #define FLASH_BMS_FOTA_LEN 0x32000 //BMS升级文件存储长度 = =200k #define FLASH_BMS_FOTA_END_ADDR 0x318000 //BMS升级文件存储结束地址 typedef struct _Fota_Type { BOOL Fota_update_error ; UINT32 Fota_All_Data_Len ; UINT32 Fota_Current_Addres ; UINT8 Fota_Recv_Data_Len ; UINT8 Fota_Recv_Data[100] ; UINT32 Fota_Flash_Addres; UINT8 Fota_CRC ; }Fota_Type; UINT8 Fota_Func(UINT8 *DataPtr,INT32 connectId); void CANEncodeFunction(UINT32 ID,UINT8* rawData); void UDS_Service(); UINT16 GetErrorNum(UINT16 *ErrorArray,UINT8 Errorlen); UINT8 PutErrorNum(UINT16 *ErrorArray,UINT8 Errorlen,UINT16 ErrorNum); UINT8 LookUpRTtable(UINT32 R_value); static BOOL UDSClearFotaDownloadRegion(void); static BOOL UDSAskforDownLoadData(void); static UINT8 UDSPositiveAnswer(UINT8 answerLen,UINT8 messageIndex,UINT32 posCode); static UINT8 UDSNegtiveAnswer(UINT8 answerLen,UINT8 messageIndex, UINT32 negCode); static UINT8 bcc_chk_fota(UINT8* data, UINT8 length); static UINT8 Fota_crc_chk(UINT8* data,UINT8 length);