AppFunc.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /****************************************************************************
  2. *
  3. * Copy right: RL.Chen J and Zhen C
  4. * File name: AppFunc.h
  5. * Description: 应用层函数调用文件
  6. * History: 2021-07-15
  7. *
  8. ****************************************************************************/
  9. #include "flash_ec616_rt.h"
  10. #include "commontypedef.h"
  11. #include "flash_ec616_rt.h"
  12. #include "mem_map.h"
  13. #include "AppTaskTcp.h"
  14. #include "AppConfig.h"
  15. #include "ec_tcpip_api.h"
  16. #define FLASH_BMS_FOTA_START_ADDR 0x2E6000 //BMS升级文件存储起始地址
  17. #define FLASH_BMS_FOTA_LEN 0x32000 //BMS升级文件存储长度 = =200k
  18. #define FLASH_BMS_FOTA_END_ADDR 0x318000 //BMS升级文件存储结束地址
  19. typedef struct _Fota_Type
  20. {
  21. BOOL Fota_update_error ;
  22. UINT32 Fota_All_Data_Len ;
  23. UINT32 Fota_Current_Addres ;
  24. UINT8 Fota_Recv_Data_Len ;
  25. UINT8 Fota_Recv_Data[100] ;
  26. UINT32 Fota_Flash_Addres;
  27. UINT8 Fota_CRC ;
  28. }Fota_Type;
  29. UINT8 Fota_Func(UINT8 *DataPtr,INT32 connectId);
  30. void CANEncodeFunction(UINT32 ID,UINT8* rawData);
  31. void UDS_Service();
  32. UINT16 GetErrorNum(UINT16 *ErrorArray,UINT8 Errorlen);
  33. UINT8 PutErrorNum(UINT16 *ErrorArray,UINT8 Errorlen,UINT16 ErrorNum);
  34. UINT8 LookUpRTtable(UINT32 R_value);
  35. static BOOL UDSClearFotaDownloadRegion(void);
  36. static BOOL UDSAskforDownLoadData(void);
  37. static UINT8 UDSPositiveAnswer(UINT8 answerLen,UINT8 messageIndex,UINT32 posCode);
  38. static UINT8 UDSNegtiveAnswer(UINT8 answerLen,UINT8 messageIndex, UINT32 negCode);
  39. static UINT8 bcc_chk_fota(UINT8* data, UINT8 length);
  40. static UINT8 Fota_crc_chk(UINT8* data,UINT8 length);