MCUSW
Can.h File Reference

Introduction

This file contains interface header for CAN MCAL driver.

Go to the source code of this file.

Data Structures

struct  Can_MaskType
 Structure defining the filter mask to be used. More...
 
struct  Can_HwFilterType
 Structure defining the HW filter to be used. More...
 
struct  Can_FdBaudConfigType
 Structure defining the CAN FD data phase baud rate configuration. More...
 
struct  Can_BaudConfigType
 Structure defining the CAN baud rate configuration. More...
 
struct  Can_ControllerType
 Can Controller Configuration definition. More...
 
struct  Can_ControllerType_PC
 Can Controller Pre Compile Configuration definition. More...
 
struct  Can_MailboxType
 Can mailox configuration definition. More...
 
struct  Can_MailboxType_PC
 Can mailox Pre compile configuration definition. More...
 
struct  Can_DmaPrms
 Dummy structure will be used if DMA support is required. More...
 
struct  Can_ConfigType
 Can MCAL root configuration structure. More...
 
struct  Can_RegisterReadbackType
 Register Readback Structure. More...
 

Macros

#define CAN_SW_PATCH_VERSION   (2U)
 Driver Implementation Patch Version. More...
 
#define CAN_AR_RELEASE_REVISION_VERSION   (1U)
 AUTOSAR Patch version specification implemented by CanDriver. More...
 
Can Driver Module SW Version Info

Defines for CAN Driver version used for compatibility checks

#define CAN_SW_MAJOR_VERSION   (1U)
 Driver Implementation Major Version.Used for version compatibiltiy check. More...
 
#define CAN_SW_MINOR_VERSION   (3U)
 Driver Implementation Minor Version.Used for version compatibiltiy check. More...
 
Can Driver Module AUTOSAR Version Info

Defines for CAN Driver AUTOSAR version used for compatibility checks

#define CAN_AR_RELEASE_MAJOR_VERSION   (4U)
 AUTOSAR Major version specification implemented by CanDriver. More...
 
#define CAN_AR_RELEASE_MINOR_VERSION   (3U)
 AUTOSAR Minor version specification implemented by CanDriver. More...
 
Can Driver ID Info
#define CAN_VENDOR_ID   (44U)
 Texas Instruments Vendor ID. More...
 
#define CAN_MODULE_ID   (80U)
 Can Driver Module ID. More...
 
#define CAN_INSTANCE_ID   (0U)
 CAN Driver Instance ID. More...
 
CAN Driver states.
#define CAN_UNINIT   ((uint8)0U)
 CAN Driver is NOT initialized. More...
 
#define CAN_READY   ((uint8)1U)
 CAN Driver is initialized. More...
 
Can Driver Service Id

The Service Id is one of the argument to Det_ReportError function and is used to identify the source of the error

#define CAN_INIT_ID   (0x00U)
 Can_Init() More...
 
#define CAN_MAINFCT_WRITE_ID   (0x01U)
 Can_MainFunction_Write() More...
 
#define CAN_SETCTR_ID   (0x03U)
 Can_SetControllerMode() More...
 
#define CAN_DIINT_ID   (0x04U)
 Can_DisableControllerInterrupts() More...
 
#define CAN_ENINT_ID   (0x05U)
 Can_EnableControllerInterrupts() More...
 
#define CAN_WRITE_ID   (0x06U)
 Can_Write() More...
 
#define CAN_VERSION_ID   (0x07U)
 Can_GetVersionInfo() More...
 
#define CAN_MAINFCT_READ_ID   (0x08U)
 Can_MainFunction_Read() More...
 
#define CAN_MAINFCT_BO_ID   (0x09U)
 Can_MainFunction_BusOff() More...
 
#define CAN_MAINFCT_WU_ID   (0x0AU)
 Can_MainFunction_Wakeup() More...
 
#define CAN_CKWAKEUP_ID   (0x0BU)
 Can_CheckWakeup() More...
 
#define CAN_MAINFCT_MODE_ID   (0x0CU)
 Can_MainFunction_Mode() More...
 
#define CAN_SETBAUDRATE_ID   (0x0FU)
 Can_SetBaudrate() More...
 
#define CAN_DEINIT_ID   (0x10U)
 Can_DeInit() More...
 
#define CAN_GETCTRERRST_ID   (0x11U)
 Can_GetControllerErrorState() More...
 
#define CAN_GETCTRMODE_ID   (0x12U)
 Can_GetControllerMode() More...
 
#define CAN_LOOPBACK_ID   (0x20U)
 Can_TestLoopBackModeEnable() More...
 
#define CAN_RXPROCESS_ID   (0x21U)
 Can_RxProcess() More...
 
Can Error Codes

Error codes returned by Can functions

#define CAN_E_PARAM_POINTER   (0x01U)
 
#define CAN_E_PARAM_HANDLE   (0x02U)
 ERROR:NULL_PTR passed as parameter. More...
 
#define CAN_E_PARAM_DLC   (0x03U)
 ERROR:Invalid Controller Handle. More...
 
#define CAN_E_PARAM_CONTROLLER   (0x04U)
 ERROR:Invalid length of msg. More...
 
#define CAN_E_UNINIT   (0x05U)
 ERROR:Invalid controller id. More...
 
#define CAN_E_TRANSITION   (0x06U)
 ERROR:Eror due to API invoked without performing Can_Init() More...
 
#define CAN_E_DATALOST   (0x07U)
 ERROR:Eror during Controller state transition. More...
 
#define CAN_E_PARAM_BAUDRATE   (0x08U)
 ERROR:Data lost/dropped. More...
 
#define CAN_E_ICOM_CONFIG_INVALID   (0x09U)
 ERROR:Timeout occured. More...
 
#define CAN_E_INIT_FAILED   (0x0AU)
 ERROR:Invalid Baudrate configuration. More...
 
CAN Config Ids

ERROR:Invalid configuration set selection

The Config Ids used for different CAN Configuration builds

#define CAN_CFG_ID_0   (0x01U)
 Config 0 (All configurations ON) More...
 
#define CAN_CFG_ID_1   (0x02U)
 Config 1 (All configurations OFF). CAN_CFG_ID_1 is used only for compile check. More...
 
#define CAN_CFG_ID_2   (0x04U)
 Config 2 (All configurations ON except DET OFF) More...
 
#define CAN_CFG_ID_3   (0x08U)
 Config 3 (Configurator auto generated file) More...
 
#define CAN_CFG_ID_4   (0x10U)
 Config 4 (Configurator auto generated file MCAN instead of DCAN2 with pre-compile variant ON) More...
 
#define CAN_CFG_ID_5   (0x20U)
 Config 5 (All configurations ON but used only for testing WakeUp by external HW event and Performance tests) More...
 
#define CAN_CFG_ID_6   (0x40U)
 Config 6 (Used for MCAN Testing) More...
 

Typedefs

typedef uint8 CanControllerState_Type
 Can Controller State enum type. More...
 
typedef uint32 Can_InterruptMask_Type
 Can Interrupt Mask type. More...
 

Enumerations

enum  Can_MailBoxDirectionType { CAN_MAILBOX_DIRECTION_RX = 0x0U, CAN_MAILBOX_DIRECTION_TX = 0x1U }
 Can Mailbox direction enum. More...
 
enum  Can_HandleType { CAN_FULL = 0x0U, CAN_BASIC = 0x1U }
 Can Handle Type enum. More...
 
enum  Can_TxRxProcessingType { CAN_TX_RX_PROCESSING_INTERRUPT = 0x0U, CAN_TX_RX_PROCESSING_MIXED = 0x1U, CAN_TX_RX_PROCESSING_POLLING = 0x2U }
 Can Tx/Rx processing enum. More...
 
enum  Can_ControllerInstance {
  CAN_CONTROLLER_INSTANCE_MCU_MCAN0 = 0U, CAN_CONTROLLER_INSTANCE_MCU_MCAN1 = 1U, CAN_CONTROLLER_INSTANCE_MCAN0 = 2U, CAN_CONTROLLER_INSTANCE_MCAN1 = 3U,
  CAN_CONTROLLER_INSTANCE_MCAN2 = 4U, CAN_CONTROLLER_INSTANCE_MCAN3 = 5U, CAN_CONTROLLER_INSTANCE_MCAN4 = 6U, CAN_CONTROLLER_INSTANCE_MCAN5 = 7U,
  CAN_CONTROLLER_INSTANCE_MCAN6 = 8U, CAN_CONTROLLER_INSTANCE_MCAN7 = 9U, CAN_CONTROLLER_INSTANCE_MCAN8 = 10U, CAN_CONTROLLER_INSTANCE_MCAN9 = 11U,
  CAN_CONTROLLER_INSTANCE_MCAN10 = 12U, CAN_CONTROLLER_INSTANCE_MCAN11 = 13U, CAN_CONTROLLER_INSTANCE_MCAN12 = 14U, CAN_CONTROLLER_INSTANCE_MCAN13 = 15U
}
 Can Controller Instances enum. More...
 

Functions

void Can_GetVersionInfo (Std_VersionInfoType *VersionInfo)
 Function returns the version information of this module. More...
 
void Can_Init (const Can_ConfigType *CfgPtr)
 This function initializes the module. More...
 
Std_ReturnType Can_SetControllerMode (uint8 Controller, Can_ControllerStateType Transition)
 This function performs software triggered state transitions of the CAN controller State machine. More...
 
Std_ReturnType Can_Write (Can_HwHandleType Hth, const Can_PduType *PduInfo)
 This function is called by CanIf to pass a CAN message to CanDrv for transmission. More...
 
void Can_DisableControllerInterrupts (uint8 Controller)
 This function disables all interrupts for this CAN controller. More...
 
void Can_EnableControllerInterrupts (uint8 Controller)
 This function enables all allowed interrupts. More...
 
void Can_MainFunction_Write (void)
 This function performs the polling of TX confirmation when CAN_TX_PROCESSING is set to POLLING. More...
 
void Can_MainFunction_BusOff (void)
 This function performs the polling of bus-off events that are configured statically as 'to be polled'. More...
 
void Can_MainFunction_Read (void)
 This function performs the polling of RX indications when CAN_RX_PROCESSING is set to POLLING. More...
 
void Can_MainFunction_Wakeup (void)
 This function performs the polling of wake-up events that are configured statically as 'to be polled'. More...
 
void Can_MainFunction_Mode (void)
 This function performs the polling of CAN controller mode transitions. More...
 
Std_ReturnType Can_SetBaudrate (uint8 Controller, uint16 BaudRateConfigID)
 This service shall set the baud rate configuration of the CAN controller. Depending on necessary baud rate modifications the controller might have to reset. More...
 
Std_ReturnType Can_TestLoopBackModeEnable (uint8 Controller, uint8 Mode)
 This service will enable CAN loopback mode. More...
 
Std_ReturnType Can_TestLoopBackModeDisable (uint8 Controller, uint8 Mode)
 This service will disable CAN loopback mode. More...
 
Std_ReturnType Can_RegisterReadback (VAR(uint8,) Controller, Can_RegisterReadbackType *RegRbPtr)
 This service will readback CAN registers. More...
 
void Can_DeInit (void)
 This function de-initializes the module. More...
 
Std_ReturnType Can_GetControllerMode (uint8 Controller, Can_ControllerStateType *ControllerModePtr)
 This service reports about the current status of the requested CAN controller. More...
 
Std_ReturnType Can_GetControllerErrorState (uint8 ControllerId, Can_ErrorStateType *ErrorStatePtr)
 This service obtains the error state of the CAN controller. More...