/*
 * @Author       : ChenJie
 * @Date         : 2022-01-23 13:45:09
 * @Version      : V3.0
 * @LastEditors  : ChenJie
 * @LastEditTime : 2022-05-17 18:37:07
 * @Description  : file content
 * @FilePath     : \S32K146_4G\src\AppGlobalVar.h
 */
/*
 * AppGlobal.h
 *Ӧ�ò�ȫ�ֱ���
 *  Created on: 2022��1��19��
 *      Author: QiXiang_CHENJIE
 */
#ifndef APPGLOBALVAR_H_
#define APPGLOBALVAR_H_

//#define APP_UART0_ENABLE //ƽ����Ŀ
#define APP_CAN_ENABLE //�ؿ���Ŀ

#include "hal_adapter.h"
// test Var
#define defaultSn "GYTEST00000000001"
// #define defaultSn "PZLCLL128N2236001"
#define BATT_SN_LEN 17
#define HWVERSION 0x0001
#define BLSWVERSION 0x00000001
#define DRVSWVERSION 0x00000001
#define APPSWVERSION 0x00000104
#define BMS_MANUFACTURE 0xFF
#define BMS_INFO 0xFF
#define DATA_MODULE_TYPE 0x02

#define BMS_CELL_MAX_NUM 384
#define BMS_TEMP_MAX_NUM 64
//*ȫ�ֱ���*//

extern uint8 TcpbattSN[17];
extern uint8 VIN[17];
extern volatile uint32 TimerCounter;
extern uint32 BattTempR[4];
extern uint16 ErrorArray[10];
extern uint8 Fota_update_flag;
typedef struct
{
    uint8 RealLen;
    uint8 *DataPtr;
} QueueDataTrans_Type;
/*GPS*/
extern QueueHandle_t GpsDataQueueHandle;
extern sint16 xyzData[3];
/*Hal_Can*/
extern uint8 CanIf_u8TxConfirmCnt;
extern boolean CanIf_bTxFlag;
extern uint8 CanIf_u8RxIndicationCnt;
extern boolean CanIf_bRxFlag;
extern QueueHandle_t CanRecvQueueHandle;
/*Fota*/
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_DataPtr;
    uint32 Fota_Flash_Addres;
    uint8 Fota_CRC;
} Fota_Type;
/*���±�����ΪTCP��ر���*/
extern uint8 CSQValue;
extern sint8 SocketId;
extern sint8 RegChkRet;
extern char WebSiteIp[20];
extern const char WebSiteName[];
extern const uint16 WebSitePort;
extern char ImeiNum[15];
extern char IccidNum[20];
extern uint8 TcpWorkState;
typedef struct _AppConfigType
{
    bool appSaveFlg;
    bool eolFlg;
    uint8 deviceSn[17];
    uint8 re[20];
} AppConfigBody;
extern AppConfigBody AppConfigInfo;

/*���±�����ΪApp_CAN��ر���*/
#ifdef APP_CAN_ENABLE
extern uint8 vehicleStatus;
extern uint8 bmsHVOn;
extern uint8 currentGearPosition;
extern uint8 parkingBreakStatus;
extern uint8 breakingStatus;
extern uint32 ODO;
extern uint8 dcdcWorkStatus;
extern uint8 numOfChrgableSubsys;
extern uint8 chrgableSubsysCode;
extern uint16 vcuDCVol;
// EBC
extern uint8 ebcStatus;
extern uint8 ebcAskHVOn;
extern uint8 ebcAskHVOff;
extern uint8 retainLockSignal;
extern uint8 dischargeLockSignal;
extern uint8 chargeLockSignal;
extern uint8 chargeFlag;
// BCU�������
extern UINT32 BcuInTable[28];
extern BOOL BcuRxShortError[28];
extern BOOL BcuRxLongError[28];
extern UINT8 BcuRxErrorCounter[28];
extern UINT8 BcuRxFlag[28];
extern UINT8 BMS_ReqVIN;
extern UINT8 BMS_ReqHVOff;
extern UINT8 BMS_ProtocolEditionH;
extern UINT8 BMS_ProtocolEditionL;
extern UINT8 BMS_CharDevNum;
extern UINT8 BMS_FtPosRly;
extern UINT8 BMS_FtNegRly;
extern UINT8 BMS_FtPosCharRly1;
extern UINT8 BMS_FtNegCharRly1;
extern UINT8 BMS_FtPosCharRly2;
extern UINT8 BMS_FtNegCharRly2;
extern UINT8 BMS_FtHeatRly1;
extern UINT8 BMS_FtHeatRly2;
extern UINT8 BMS_StPosRly;
extern UINT8 BMS_StNegRly;
extern UINT8 BMS_StPreCharRly;
extern UINT8 BMS_StPosCharRly1;
extern UINT8 BMS_StNegCharRly1;
extern UINT8 BMS_StPosCharRly2;
extern UINT8 BMS_StNegCharRly2;
extern UINT8 BMS_FtAuxRelayWeld;
extern UINT8 BMS_BraOpenCirc;
extern UINT8 BMS_FtBackCharCurrOutLim;
extern UINT8 BMS_FtPosRlyOpen;
extern UINT8 BMS_FtNegRlyOpen;
extern UINT8 BMS_FtPosCharRly1Open;
extern UINT8 BMS_FtPosCharRly2Open;
extern UINT8 BMS_FtNegCharRly1Open;
extern UINT8 BMS_FtNegCharRly2Open;
extern UINT8 BMS_FtTMSContClose;
extern UINT8 BMS_FtTMSContOpen;
extern UINT8 BMS_FtTMS;
extern UINT8 BMS_Ft24VSpy;
extern UINT8 BMS_FtPACKSelfProt;
extern UINT8 BMS_FtCharSockTempOver;
extern UINT8 BMS_FtTempOutCtrl;
extern UINT8 BMS_StPosHeatRly;
extern UINT8 BMS_StNegHeatRly;
extern UINT8 BMS_CharSysNum;
extern UINT8 BMS_FtCode;
extern UINT8 BMS_ST1CheckSum;
extern UINT8 BMS_ST1Counter;
extern UINT8 BMS_Mode;
extern UINT8 BMS_AuxRlySt;
extern UINT8 BMS_BattBalaSt;
extern UINT8 BMS_CharGunSt;
extern UINT8 BMS_CharMode;
extern UINT8 BMS_CharSt;
extern UINT8 BMS_FtLvl;
extern UINT8 BMS_FtCellTempDiff;
extern UINT8 BMS_FtCellTempHigh;
extern UINT8 BMS_FtPACKOverVolt;
extern UINT8 BMS_FtPACKUndeVolt;
extern UINT8 BMS_FtSOCLow;
extern UINT8 BMS_FtCellOverVolt;
extern UINT8 BMS_FtCellUndeVolt;
extern UINT8 BMS_FtIns;
extern UINT8 BMS_FtCellOverVoltDiff;
extern UINT8 BMS_FtCharCurrOver;
extern UINT8 BMS_FtDisCharCurrOver;
extern UINT8 BMS_FtCellTempLow;
extern UINT8 BMS_FtBranVoltDifOver;
extern UINT8 BMS_FtBMSHardWare;
extern UINT8 BMS_FtSOCHigh;
extern UINT8 BMS_FtSOCJump;
extern UINT8 BMS_FtInCom;
extern UINT8 BMS_FtSysMism;
extern UINT8 BMS_FtHvIntLock;
extern UINT8 BMS_FtSmoke;
extern UINT8 BMS_FtFire;
extern UINT8 BMS_FtNum;
extern UINT8 BMS_PackSOC;
extern UINT8 BMS_PackSOH;
extern UINT8 BMS_MaxCellTemp;
extern UINT8 BMS_MinCellTemp;
extern UINT8 BMS_AverCellTemp;
extern UINT8 BMS_MaxCellTempCSC;
extern UINT8 BMS_MaxCellTempNum;
extern UINT8 BMS_MinCellTempCSC;
extern UINT8 BMS_MinCellTempNum;
extern UINT8 BMS_MaxCellVoltCSC;
extern UINT8 BMS_MaxCellVoltNum;
extern UINT8 BMS_MinCellVoltCSC;
extern UINT8 BMS_MinCellVoltNum;
extern UINT8 BMS_InsDeteSt;
extern UINT8 BMS_FtCharInsLow;
extern UINT8 BMS_FtCurrSenr;
extern UINT8 BMS_FtHeatingFilm;
extern UINT8 BMS_FtMainLoopPreChar;
extern UINT8 BMS_FtAuxLoopPreChar;
extern UINT8 BMS_FtACANLost;
extern UINT8 BMS_FtDCDC;
extern UINT8 BMS_FtSOCDif;
extern UINT8 BMS_FtCellOverDisChar;
extern UINT8 BMS_FtCharOver;
extern UINT8 BMS_FtContDisCharCurrOverLoad;
extern UINT8 BMS_FtContCharCurrOverLoad;
extern UINT8 BMS_Gun1DCNegTemp;
extern UINT8 BMS_Gun1DCPosTemp;
extern UINT8 BMS_Gun2DCNegTemp;
extern UINT8 BMS_Gun2DCPosTemp;
extern UINT8 BMS_CurrHeatSt;
extern UINT8 BMS_CurrCoolSt;
extern UINT8 BMS_FtCharCnct;
extern UINT8 BMS_FtOverDisCharCurrDuringChar;
extern UINT8 BMS_FtCharNTC;
extern UINT8 BMS_FtELock;
extern UINT8 BMS_CellVoltFramNum;
extern UINT8 BMS_CellTempFramNum;
extern UINT8 BMS_CSC_Code;
extern UINT8 BMS_CellTemp[BMS_TEMP_MAX_NUM];
extern UINT8 BMS_Checksum;
extern UINT8 BMS_PackComp;
extern UINT8 BMS_BattCodeLeng;
extern UINT8 BMS_SN[27];
extern UINT8 BMS_BattType;
extern UINT8 BMS_CoolType;
extern UINT8 BMS_CSC_Total;
extern UINT8 BMS_CellVoltLevel;
extern UINT8 BMS_CellMinVolt;
extern UINT8 BMS_CellMaxVolt;
extern UINT8 BMS_HVBranNum;
extern UINT8 BMS_SingleHVBranchCellNum;
extern UINT8 BMS_ReqMode;
extern UINT8 BMS_HVCmd;
extern UINT8 BMS_ChgSts;
extern UINT8 BMS_HVRelaySts;
extern UINT8 BMS_SetTemp;
extern UINT8 BMS_Life;
extern UINT8 BMS_CRC;
extern UINT8 TMS_WorkStatus;
extern UINT8 TMS_HVRelayST;
extern UINT8 TMS_OutletTemp;
extern UINT8 TMS_InletTemp;
extern UINT8 TMS_ErrCode;
extern UINT8 TMS_FaultLevel;
extern UINT16 BMS_SoftwareVersion;
extern UINT16 BMS_HardwareVersion;
extern UINT16 BMS_PackCurr;
extern UINT16 BMS_MaxCharCurr;
extern UINT16 BMS_MaxDisCharCurr;
extern UINT16 BMS_PosIns;
extern UINT16 BMS_NegIns;
extern UINT16 BMS_BattVolt;
extern UINT16 BMS_LinkVolt;
extern UINT16 BMS_MaxCellVolt;
extern UINT16 BMS_AverCellVolt;
extern UINT16 BMS_MinCellVolt;
extern UINT16 BMS_ContChrgCurr;
extern UINT16 BMS_ContDisCharCurr;
extern UINT16 BMS_CharReqVolt;
extern UINT16 BMS_CharReqCurr;
extern UINT16 BMS_SysInsRes;
extern UINT16 BMS_MaxDisCharPwr;
extern UINT16 BMS_MaxCharPwr;
extern UINT16 BMS_ContDisCharPwr;
extern UINT16 BMS_ContCharPwr;
extern UINT16 BMS_InstEngyCons;
extern UINT16 BMS_TotalEngyCons;
extern UINT16 BMS_SOE;
extern UINT16 BMS_RmanCharTime;
extern UINT16 BMS_CharNum;
extern UINT16 BMS_CellVolt[BMS_CELL_MAX_NUM];
extern UINT16 BMS_BattRateCap;
extern UINT16 BMS_BattRateVolt;
extern UINT16 BMS_BattRateEngy;
extern UINT16 BMS_CellTotal;
extern UINT16 BMS_TempTotal;
extern UINT16 BMS_SingleCharEngy;
extern UINT16 BMS_SingleCharCapy;
extern UINT16 BMS_HVVolt;
extern UINT16 TMS_ReqPow;
extern UINT32 BMS_TotalCharEngy;
extern UINT32 BMS_TotalDisCharEngy;
extern UINT32 BMS_TotalBackCharEngy;
extern UINT32 BMS_TotalStaCharEngy;
extern UINT32 BMS_TotalGunCharEngy;
extern UINT32 BMS_TotalGunCharCapy;
extern UINT32 BMS_TotalCharCapy;
extern UINT32 BMS_TotalDisCharCapy;
extern UINT32 BMS_TotalBackCharCapy;
extern UINT32 BMS_TotalStaCharCapy;
#endif
#endif /* APPGLOBALVAR_H_ */
