1.5wuling_zhuanjietou/UDS/uds_can_interface.h
2024-10-17 09:06:51 +08:00

106 lines
1.9 KiB
C

#ifndef _UDS_CAN_Interface_
#define _UDS_CAN_Interface_
#include "uds_config.h"
#define Version_Test 0
#define Encrypt_Switch 1
typedef void(*JumpToPtr)(void);
typedef struct{
bool Flg;
bool HappErrFlg;
//bool CanErrSendFlg;
//bool RecoverFlg;
INT8U GenFlg;
INT8U status;
INT8U BusOffRecCnt;
INT8U BusOffErrTimer;
INT8U NoBusOffCnt;
INT16U BusOffCrtCnt;
INT16U StartTime;
INT16U BusOffTime;
INT16U BusOffRecTime;
INT16U RxCntTime;
}_HSCANERROR;
//extern _HSCANERROR HsCanError;
#if BOOTLOADER_CODE_FLAG
//#define CAN0_MAX_BUFF 10//500
#define CAN0_MAX_RX 10//50
#else
//#define CAN0_MAX_BUFF 10
#define CAN0_MAX_RX 10//50
#endif
typedef struct {
INT32U id; /*11/29bit*/
INT8U dlc; /*0~8*/
INT8U data[8];
INT8U flag;
} can_msg_t;
typedef struct {
INT8U In;
INT8U Out;
can_msg_t CanMsg[CAN0_MAX_RX];
}_QueueCan0Rx;
typedef struct {
//status_t Flg;
INT8U In;
INT8U Out;
can_msg_t CanMsg[CAN0_MAX_RX];
}_QueueCan0Tx;
typedef struct
{
INT16U Time1;
INT16U Time2;
INT8U state;
} xchrTime;
extern INT8U g_ucWARN_LEVEL;
extern INT32U g_ulCanStatus;
extern INT8U gUdsBusOffCanOutBak;
extern INT32U TestCanRxCnt,TestCanRxCntBak;
extern INT32U ParseCanRxCnt;
extern _QueueCan0Tx QueueCan0Tx;
extern _QueueCan0Rx UdsQueueData;
extern can_msg_t TxCan0Bak;
extern void DealCanProc(void);
extern void DealCanProc_bussoff(void);
extern void DealCan2Proc(void);
extern INT8U checkPin(INT8U bcheck,xchrTime *pt,INT8U g);
extern void UdsQueueCanOut(void);
extern void UdsQueueCanIn(can_msg_t RxCanMsg);
extern void TxQueueCan0In(can_msg_t TxCanMsg);
extern void TxQueueCan0Out(void);
extern void ParseUdsCan(can_msg_t pCanMsg);
extern void UdsProcTask(void);
extern INT8U gAppCanTxErrFlg;
extern bool bCan0InitOkFlg;
extern void Uds_SetMsgMonitorTimer(uint16_t msgid);
#endif