chg-stn-motherboard-ti-mcu/Core/Include/ivec_mcal_mcan.h

59 lines
1.8 KiB
C

#ifndef CORE_INCLUDE_IVEc_MCAL_MCAN_H_
#define CORE_INCLUDE_IVEc_MCAL_MCAN_H_
#include "..\utils\utils.h"
#include "ti_msp_dl_config.h"
#define ivMCAL_MAX_FILTERS 10
/* Enum for CAN ID Types */
typedef enum {
IVEC_MCAL_CAN_ID_STD = 0x00, /* Standard ID */
IVEC_MCAL_CAN_ID_EXT = 0x01, /* Extended ID */
IVEC_MCAL_CAN_ID_ERROR = 0x02 /* Error ID */
} xMCAL_CanIdType_e;
/* CAN Baud Rate Options */
typedef enum
{
IVEC_CAN_BAUD_500 = 500,
IVEC_CAN_BAUD_250 = 250,
IVEC_CAN_BAUD_150 = 150,
IVEC_CAN_BAUD_1000 = 1000,
IVEC_CAN_BAUD_125 = 125,
}xMCAL_CanBaud_e;
typedef struct
{
MCAN_Regs *pMCAN;
uint8_t __u8Init;
xMCAL_CanBaud_e u16Speed;
int32_t i32MaskCount;
int32_t i32FilterCount;
uint32_t u32MaskValues[ivMCAL_MAX_FILTERS];
uint32_t u32FilterValues[ivMCAL_MAX_FILTERS];
} xMcalCanHandle;
/* Function Prototypes for MCAN MCAL Layer */
/* Initialize the MCAN module */
IVEC_McalStatus_e xMCAL_MCANInit(xMcalCanHandle* pxCanHandle);
/* Deinitialize the MCAN module */
IVEC_McalStatus_e xMCAL_MCANDeInit(xMcalCanHandle* pxCanHandle);
/* Transmit data via MCAN */
IVEC_McalStatus_e xMCAL_MCANTx(xMcalCanHandle* pxCanHandle, uint32_t u32Id, uint16_t* pu16TxData, uint32_t u32BufNum, uint32_t u32Bytes);
/* Receive data via MCAN */
IVEC_McalStatus_e xMCAL_MCANRx(xMcalCanHandle* pxCanHandle, uint32_t* pu32Id, uint8_t* pu8RxData, int iDLC);
/* Get the error status of the MCAN module */
IVEC_McalStatus_e xMCAL_MCANGetErrorStatus(xMcalCanHandle* pxCanHandle, char* pcErrorStatus);
/* Get interrupt status of MCAN Interrupt Line 1 */
IVEC_McalStatus_e xMCAL_MCANGetInterruptLine1Status(xMcalCanHandle* pxCanHandle, uint32_t* pu32InterruptStatus);
#endif /* CORE_INCLUDE_IVEc_MCAL_MCAN_H_ */