2023-08-21 16:48:00 +08:00

58 lines
2.0 KiB
C

#if !defined(CANIF_H)
#define CANIF_H
/***°üº¬Í·Îļþ***/
//#include "global.h"
#include "ComTypes.h"
#include "CanTrcv.h"
#include "CanIf_Cfg.h"
//#include "canhl.h"
typedef struct
{
uint32_t Arb; //!<Arb data
uint8_t Data[8]; //!<data
uint8_t Dlc; //!<data length
uint8_t eob; //!<end of buffer
uint8_t newdt; //!<new data
}CAN_DataT;
typedef enum
{
CAN_OK = 0,
CAN_NOT_OK = 1
} Can_ReturnType;
typedef enum
{
CAN_NORMAL = 0,
CAN_STOP = 1
} ControllerModeType;
typedef enum
{
busoff = 0,
error_passive = 1,
error_active=2
} ErrorStatusType;
/***API½Ó¿Ú***/
extern void ReInitCanIf_Parameter(void);
extern void CanIf_MainFunction(void);
extern void InitCanIf_Parameter(void);
extern void DeInitCanIf_Parameter(void);
extern ComStd_ReturnType SetCanIf_BusoffEvent(CanIf_ControllerErrorType LeCanIf_u_BusoffEvent);
extern ComStd_ReturnType SetCanIf_WakeUpEvent(CanIf_WakeUpSourceType LeCanIf_e_WakeUpSource);
extern ComStd_ReturnType ClrCanIf_WakeUpEvent(CanIf_WakeUpSourceType LeCanIf_e_WakeUpSource);
extern ComStd_ReturnType GetCanIf_WakeUpEvent(CanIf_WakeUpSourceType *LeCanIf_e_WakeUpSource);
extern ComStd_ReturnType SetCanIf_ControllerMode(CanIf_ControllerModeType LeCanIf_e_ControllerMode);
extern ComStd_ReturnType GetCanIf_ControllerMode(CanIf_ControllerModeType *LeCanIf_e_ControllerModePtr);
extern ComStd_ReturnType GetCanIf_TransceiverMode(CanTrcv_WorkModeType *LeCanIf_e_WorkModePtr);
extern ComStd_ReturnType SetCanIf_TransceiverMode(CanTrcv_WorkModeType LeCanIf_e_WorkMode);
extern void RxIndicationCanIf_Messages(CanIf_HwHandleType Hrh, CanIf_CanIdType LeCanIf_e_CanId, CanIf_CanDlcType LeCanIf_e_CanDlc, CanIf_CanDataType* LeCanIf_e_CanSduPtr);
extern ComStd_ReturnType TransmitCanIf_Buffer(CanIf_CanIdType LeCanIf_t_TxCanID,CanIf_CanDlcType LeCanIf_t_TxCanDlc,CanIf_CanDataType *LeCanIf_t_TxCanDataPtr);
extern void ConfirmCanIf_TxOK(ComUint8 LeCanIf_e_Hrh,CanIf_CanIdType LeCanIf_t_TxCanID);
extern ComStd_ReturnType ResetCanIf_Controller(ComUint8 LeCanIf_u_Channel);
#endif