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

49 lines
1.6 KiB
C

#ifndef CORE_INCLUDE_IVEc_MCAL_MCAN_H_
#define CORE_INCLUDE_IVEc_MCAL_MCAN_H_
#include <../Core/Include/ivec_mcal_common.h>
#include "..\utils\utils.h"
#include "ti_msp_dl_config.h"
#include <../Core/Include/ivec_mcal_mcan.h>
#define mcalMAX_FILTERS_u8 10
typedef enum{
IVEC_MCAL_CAN_BR_125 = 125,
IVEC_MCAL_CAN_BR_250 = 250,
IVEC_MCAL_CAN_BR_500 = 500,
IVEC_MCAL_CAN_BR_1000 = 1000
}IVEC_McalCanBr_e;
typedef struct
{
MCAN_Regs *pMCAN;
uint8_t __u8Init;
IVEC_McalCanBr_e u16Speed;
int32_t i32MaskCount;
int32_t i32FilterCount;
uint32_t u32MaskValues[mcalMAX_FILTERS_u8];
uint32_t u32FilterValues[mcalMAX_FILTERS_u8];
} IVEC_McalCanHandle_s;
/* Function Prototypes for MCAN MCAL Layer */
/* Initialize the MCAN module */
IVEC_McalCommonErr_e xMCAL_MCANInit(IVEC_McalCanHandle_s* pxCanHandle);
/* Deinitialize the MCAN module */
IVEC_McalCommonErr_e xMCAL_MCANDeInit(IVEC_McalCanHandle_s* pxCanHandle);
/* Transmit data via MCAN */
IVEC_McalCommonErr_e xMCAL_MCANTx(IVEC_McalCanHandle_s* pxCanHandle, uint32_t u32Id, uint16_t* pu16TxData, uint32_t u32BufNum, uint32_t u32Bytes);
/* Receive data via MCAN */
IVEC_McalCommonErr_e xMCAL_MCANRx(IVEC_McalCanHandle_s* pxCanHandle, uint32_t* pu32Id, uint8_t* pu8RxData, int iDLC);
/* Get the error status of the MCAN module */
IVEC_McalCommonErr_e xMCAL_MCANGetErrorStatus(IVEC_McalCanHandle_s* pxCanHandle, char* pcErrorStatus);
/* Get interrupt status of MCAN Interrupt Line 1 */
IVEC_McalCommonErr_e xMCAL_MCANGetInterruptLine1Status(IVEC_McalCanHandle_s* pxCanHandle, uint32_t* pu32InterruptStatus);
#endif /* CORE_INCLUDE_IVEc_MCAL_MCAN_H_ */