STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
|
Can Specific Arquitecture Driver More...
#include "Std_Types.h"
#include "Registers.h"
#include "Can_Cfg.h"
#include "Can_Arch.h"
#include "Bfx.h"
#include "CanIf_Can.h"
Data Structures | |
struct | _HwObjectHandler |
Tx Hardware objecj descriptor. More... | |
struct | _HwExtFilter |
Extended Filter descriptor. More... | |
Typedefs | |
typedef struct _HwObjectHandler | HwObjectHandler |
Tx Hardware objecj descriptor. | |
typedef struct _HwExtFilter | HwExtFilter |
Extended Filter descriptor. | |
Functions | |
static void | Can_SetupConfiguredInterrupts (const Can_Controller *Controller, Can_RegisterType *Can) |
setup Can controller interrupts | |
static void | Can_SetupConfiguredFilters (const Can_ConfigType *Config, uint8 Controller) |
Setup reception Filters | |
static void | Can_SetupBaudrateConfig (const Can_ControllerBaudrateConfig *Baudrate, Can_RegisterType *Can) |
setup Can controller baudrate | |
static uint8 | Can_GetClosestDlcWithPadding (uint8 Dlc, uint32 *RamBuffer, uint8 PaddingValue) |
Determine data lenth to send | |
static uint8 | Can_GetTxPduId (const Can_Controller *Controller, PduIdType *CanPduId) |
Get an CAN PduId from the Tx Event FIFO zone | |
static void | Can_GetMessage (volatile uint32 *Fifo, PduInfoType *PduInfo, uint32 *CanId) |
Get a Message from one of the the Rx FIFOs | |
static void | Can_Isr_RxFifo0NewMessage (Can_HwUnit *HwUnit, uint8 Controller) |
Can Rx Fifo 0 New Message Callback | |
static void | Can_Isr_RxFifo0Full (Can_HwUnit *HwUnit, uint8 Controller) |
Can Rx Fifo 0 Full Callback | |
static void | Can_Isr_RxFifo0MessageLost (Can_HwUnit *HwUnit, uint8 Controller) |
Can Rx Fifo 0 Message Lost Callback | |
static void | Can_Isr_RxFifo1NewMessage (Can_HwUnit *HwUnit, uint8 Controller) |
Can Rx Fifo 1 New Message Callback | |
static void | Can_Isr_RxFifo1Full (Can_HwUnit *HwUnit, uint8 Controller) |
Can Rx Fifo 1 Full Callback | |
static void | Can_Isr_RxFifo1MessageLost (Can_HwUnit *HwUnit, uint8 Controller) |
Can Rx Fifo 1 Message Lost Callback | |
static void | Can_Isr_HighPriorityMessageRx (Can_HwUnit *HwUnit, uint8 Controller) |
Can Tx Fifo/Queue Error Callback | |
static void | Can_Isr_TransmissionCompleted (Can_HwUnit *HwUnit, uint8 Controller) |
Can Transmission completed Callback | |
static void | Can_Isr_TransmissionCancellationFinished (Can_HwUnit *HwUnit, uint8 Controller) |
Can Transmission cancellation finished Callback | |
static void | Can_Isr_TxEventFifoElementLost (Can_HwUnit *HwUnit, uint8 Controller) |
Can Tx Event Fifo Element Lost Callback | |
static void | Can_Isr_TxEventFifoFull (Can_HwUnit *HwUnit, uint8 Controller) |
Can Tx Event Fifo Full Callback | |
static void | Can_Isr_TxEventFifoNewEntry (Can_HwUnit *HwUnit, uint8 Controller) |
Can Tx Event Fifo New Entry Callback | |
static void | Can_Isr_TxFifoEmpty (Can_HwUnit *HwUnit, uint8 Controller) |
Can Tx Event Fifo Empty Callback | |
static void | Can_Isr_TimestampWraparound (Can_HwUnit *HwUnit, uint8 Controller) |
Timestamp wraparound | |
static void | Can_Isr_MessageRamAccessFailure (Can_HwUnit *HwUnit, uint8 Controller) |
Message RAM access failure | |
static void | Can_Isr_TimeoutOccurred (Can_HwUnit *HwUnit, uint8 Controller) |
Timeout occurred | |
static void | Can_Isr_ErrorLoggingOverflow (Can_HwUnit *HwUnit, uint8 Controller) |
Error logging overflow | |
static void | Can_Isr_ErrorPassive (Can_HwUnit *HwUnit, uint8 Controller) |
Error passive | |
static void | Can_Isr_WarningStatus (Can_HwUnit *HwUnit, uint8 Controller) |
Warning status | |
static void | Can_Isr_BusOffStatus (Can_HwUnit *HwUnit, uint8 Controller) |
Can Bus Off Callback | |
static void | Can_Isr_WatchdogInterrupt (Can_HwUnit *HwUnit, uint8 Controller) |
Watchdog error | |
static void | Can_Isr_ProtocolErrorInArbitrationPhase (Can_HwUnit *HwUnit, uint8 Controller) |
Protocol error in arbitration phase (nominal bit time is used) | |
static void | Can_Isr_ProtocolErrorInDataPhase (Can_HwUnit *HwUnit, uint8 Controller) |
Protocol error in data phase (data bit time is used) | |
void | Can_Arch_Init (Can_HwUnit *HwUnit, const Can_ConfigType *Config, uint8 Controller) |
Can low level Initialization | |
void | Can_Arch_DeInit (Can_HwUnit *HwUnit, uint8 Controller) |
Can low level Deinitialization | |
Std_ReturnType | Can_Arch_SetBaudrate (Can_HwUnit *HwUnit, uint8 Controller, uint16 BaudRateConfigID) |
Can low level Set Baudrate | |
Std_ReturnType | Can_Arch_SetControllerMode (Can_HwUnit *HwUnit, uint8 Controller, Can_ControllerStateType Transition) |
Can low level Set Controller Mode | |
void | Can_Arch_EnableControllerInterrupts (Can_HwUnit *HwUnit, uint8 Controller) |
Can low level Enable Controller Interrupts | |
void | Can_Arch_DisableControllerInterrupts (Can_HwUnit *HwUnit, uint8 Controller) |
Can low level Disable Controller Interrupts | |
Std_ReturnType | Can_Arch_CheckWakeup (Can_HwUnit *HwUnit, uint8 Controller) |
Can low level wakeup check | |
Std_ReturnType | Can_Arch_GetControllerErrorState (Can_HwUnit *HwUnit, uint8 ControllerId, Can_ErrorStateType *ErrorStatePtr) |
Can low level Get Controller Error State | |
Std_ReturnType | Can_Arch_GetControllerMode (Can_HwUnit *HwUnit, uint8 Controller, Can_ControllerStateType *ControllerModePtr) |
Can low level Get Controller Mode | |
Std_ReturnType | Can_Arch_GetControllerRxErrorCounter (Can_HwUnit *HwUnit, uint8 ControllerId, uint8 *RxErrorCounterPtr) |
Can low level Get Controller Rx Error Counter | |
Std_ReturnType | Can_Arch_GetControllerTxErrorCounter (Can_HwUnit *HwUnit, uint8 ControllerId, uint8 *TxErrorCounterPtr) |
Can low level Get Controller Tx Error Counter | |
Std_ReturnType | Can_Arch_GetCurrentTime (Can_HwUnit *HwUnit, uint8 ControllerId, Can_TimeStampType *timeStampPtr) |
Can low level Get Current Time | |
void | Can_Arch_EnableEgressTimeStamp (Can_HwUnit *HwUnit, Can_HwHandleType Hth) |
Can low level Enable Egress TimeStamp | |
Std_ReturnType | Can_Arch_GetEgressTimeStamp (Can_HwUnit *HwUnit, PduIdType TxPduId, Can_HwHandleType Hth, Can_TimeStampType *timeStampPtr) |
Can low level Get Egress TimeStamp | |
Std_ReturnType | Can_Arch_GetIngressTimeStamp (Can_HwUnit *HwUnit, Can_HwHandleType Hrh, Can_TimeStampType *timeStampPtr) |
Can low level Get Ingress TimeStamp | |
Std_ReturnType | Can_Arch_Write (Can_HwUnit *HwUnit, Can_HwHandleType Hth, const Can_PduType *PduInfo) |
Can low level Write | |
void | Can_Arch_IsrMainHandler (Can_HwUnit *HwUnit, uint8 Controller) |
Can Interrupt Handler | |
Variables | |
static const Can_ErrorType | AutosarError [] |
Autosar errors to report. | |
static Can_RegisterType * | CanPeripherals [] = { CAN1, CAN2 } |
Can controller register structure. | |
static SramCan_RegisterType * | SramCanPeripherals [] = { SRAMCAN1, SRAMCAN2 } |
Can controller SRAM register structure. | |
static const uint8 | DlcToBytes [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 20, 24, 32, 48, 64 } |
Dlc defines to actual bytes. | |
static const uint8 | Fifo0ToCtrlIds [] = { 1u , 4u } |
Fifo 0 to controller id decoder. | |
static const uint8 | Fifo1ToCtrlIds [] = { 2u , 5u } |
Fifo 1 to controller id decoder. | |
Can Specific Arquitecture Driver
Can driver implementation for the STM32G0xx family of microcontrollers. This file contains the hardware specific implementation of the Can driver. The file is implemented as a means of abstraction from the hardware, this way we can avoid to include Arch headers in the actual driver header, making the low level interfaces available only for the inmediate upper layer.
#define Det_ReportRuntimeError | ( | ModuleId, | |
InstanceId, | |||
ApiId, | |||
ErrorId ) |
ModuleId | module id number |
InstanceId | Instance Id |
ApiId | Pai id |
ErrorId | Error code |
#define TXBC_TFQM_BIT 24u |
Tx FIFO/Queue Mode bit
Std_ReturnType Can_Arch_CheckWakeup | ( | Can_HwUnit * | HwUnit, |
uint8 | Controller ) |
Can low level wakeup check
This function checks if a wakeup has occurred for the given controller.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the wakeup shall be checked. |
E_OK | wakeup detected E_NOT_OK: no wakeup detected |
void Can_Arch_DeInit | ( | Can_HwUnit * | HwUnit, |
uint8 | Controller ) |
Can low level Deinitialization
This function deinitializes the CAN controller. It sets the complete CAN controller into a state comparable to power on reset. All CAN controller registers will be reset to their reset values.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller to be de-initialized |
< Initialization bit
< Initialization bit
< Clock stop request bit
< Clock stop acknowledge bit
< Configuration change enable bit
< Interrupt Line 0
< Interrupt Line 1
void Can_Arch_DisableControllerInterrupts | ( | Can_HwUnit * | HwUnit, |
uint8 | Controller ) |
Can low level Disable Controller Interrupts
This function disables all interrupts for this CAN controller. The function will only disable the internals interrupt lines zero and one, the external interrupt line must be disabled by the application using the Nvic Driver.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which interrupts shall be disabled. |
< Interrupt Line 0
< Interrupt Line 1
void Can_Arch_EnableControllerInterrupts | ( | Can_HwUnit * | HwUnit, |
uint8 | Controller ) |
Can low level Enable Controller Interrupts
This function enables all interrupts for this CAN controller. The function will only enable the internals interrupt lines zero and one, the external interrupt line must be enabled by the application using the Nvic Driver.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which interrupts shall be enabled. |
< Interrupt Line 0
< Interrupt Line 1
void Can_Arch_EnableEgressTimeStamp | ( | Can_HwUnit * | HwUnit, |
Can_HwHandleType | Hth ) |
Can low level Enable Egress TimeStamp
Activates egress time stamping on the messages to be transmitted.
HwUnit | Pointer to the hardware unit configuration |
Hth | information which HW-transmit handle shall be used for enabling the time stamp. |
Std_ReturnType Can_Arch_GetControllerErrorState | ( | Can_HwUnit * | HwUnit, |
uint8 | ControllerId, | ||
Can_ErrorStateType * | ErrorStatePtr ) |
Can low level Get Controller Error State
This function returns the error state of the CAN controller reading the internal registers.
HwUnit | Pointer to the hardware unit configuration |
ControllerId | CanIf ControllerId which is assigned to a CAN controller, which is requested for ErrorState. |
ErrorStatePtr | Pointer to a memory location, where the error state of the CAN controller will be stored. |
E_OK | request accepted E_NOT_OK: request not accepted |
< Bus_Off bit
< Protocol_Error bit
Std_ReturnType Can_Arch_GetControllerMode | ( | Can_HwUnit * | HwUnit, |
uint8 | Controller, | ||
Can_ControllerStateType * | ControllerModePtr ) |
Can low level Get Controller Mode
The fucntion only returns the current software flag which stores the mode of the CAN controller set by the Can_Arch_SetControllerMode() function. It does not read any hardware registers
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be read. |
ControllerModePtr | Pointer to a memory location, where the current mode of the CAN |
E_OK | request accepted E_NOT_OK: request not accepted |
Std_ReturnType Can_Arch_GetControllerRxErrorCounter | ( | Can_HwUnit * | HwUnit, |
uint8 | ControllerId, | ||
uint8 * | RxErrorCounterPtr ) |
Can low level Get Controller Rx Error Counter
Reads and return the Rx internal error counter of the can peripheral
HwUnit | Pointer to the hardware unit configuration |
ControllerId | CAN controller, whose current Rx error counter shall be acquired. |
RxErrorCounterPtr | Pointer to a memory location, where the current Rx error counter of the CAN controller will be stored. |
E_OK | Rx error counter available. E_NOT_OK: Wrong ControllerId, or Rx error counter not available. |
< Receive Error Counter
< Receive Error Counter bitfiled size
< Receive Error Passive
Std_ReturnType Can_Arch_GetControllerTxErrorCounter | ( | Can_HwUnit * | HwUnit, |
uint8 | ControllerId, | ||
uint8 * | TxErrorCounterPtr ) |
Can low level Get Controller Tx Error Counter
Reads and return the Tx internal error counter of the can peripheral
HwUnit | Pointer to the hardware unit configuration |
ControllerId | CAN controller, whose current Tx error counter shall be acquired. |
TxErrorCounterPtr | Pointer to a memory location, where the current Tx error counter |
E_OK | Tx error counter available. E_NOT_OK: Wrong ControllerId, or Tx error counter not |
< Transmit Error Counter
< Transmit Error Counter bitfiled size
Std_ReturnType Can_Arch_GetCurrentTime | ( | Can_HwUnit * | HwUnit, |
uint8 | ControllerId, | ||
Can_TimeStampType * | timeStampPtr ) |
Can low level Get Current Time
Returns a time value out of the HW registers.
HwUnit | Pointer to the hardware unit configuration |
ControllerId | CAN controller, whose current time shall be acquired. |
timeStampPtr | Pointer to a memory location, where the current time of the CAN |
E_OK | successful E_NOT_OK: failed |
Std_ReturnType Can_Arch_GetEgressTimeStamp | ( | Can_HwUnit * | HwUnit, |
PduIdType | TxPduId, | ||
Can_HwHandleType | Hth, | ||
Can_TimeStampType * | timeStampPtr ) |
Can low level Get Egress TimeStamp
Reads back the egress time stamp on a dedicated message object. It needs to be called within the TxConfirmation() function.
HwUnit | Pointer to the hardware unit configuration |
TxPduId | Tx-PDU handle of CAN L-PDU that has been transmitted. |
Hth | information which HW-transmit handle shall be used for reading the time stamp. |
timeStampPtr | Pointer to a memory location where the time stamp value shall be stored. |
E_OK | success E_NOT_OK: failed to read time stamp. |
Std_ReturnType Can_Arch_GetIngressTimeStamp | ( | Can_HwUnit * | HwUnit, |
Can_HwHandleType | Hrh, | ||
Can_TimeStampType * | timeStampPtr ) |
Can low level Get Ingress TimeStamp
Reads back the ingress time stamp on a dedicated message object. It needs to be called within the RxIndication() function.
HwUnit | Pointer to the hardware unit configuration |
Hrh | information which HW-receive handle shall be used for reading the time stamp. |
timeStampPtr | Pointer to a memory location where the time stamp value shall be stored. |
E_OK | success E_NOT_OK: failed to read time stamp. |
void Can_Arch_Init | ( | Can_HwUnit * | HwUnit, |
const Can_ConfigType * | Config, | ||
uint8 | Controller ) |
Can low level Initialization
Set up the internal register for the CAN controller inside the microcontroller. This function shall take out the controller from the reset mode, set operation mode and initialize the baudrate according to the parameters in config structure, enable the interrupts for the controller and initialize all message objects as free.
HwUnit | Pointer to the hardware unit configuration |
Config | Pointer to driver configuration |
Controller | Index of the controller to be initialized |
< Clock stop request bit
< Clock stop acknowledge bit
< Initialization bit
< Initialization bit
< Configuration change enable bit
< Disable automatic retransmission bit
< Transmit pause bit
< Protocol exception handling disable bit
< FD operation enable bit
< Test mode enable bit
< Bus monitoring mode bit
< Restricted operation mode bit
< Loop back mode bit
< Restricted Operation mode
< Restricted operation mode bit
< Normal mode
< Bus Monitoring mode
< Test mode enable bit
< Loop back mode bit
< Internal LoopBack mode
< Bus monitoring mode bit
< Bus monitoring mode bit
< Tx FIFO/Queue Mode bit
< Reject Remote Frames Standard
< Reject Remote Frames Extended
< Reject Remote Frames Standard
< Reject Remote Frames Extended
void Can_Arch_IsrMainHandler | ( | Can_HwUnit * | HwUnit, |
uint8 | Controller ) |
Can Interrupt Handler
This function is the interrupt handler for the Can controller, it will check the interrupt flags and call the corresponding callback functions.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
Std_ReturnType Can_Arch_SetBaudrate | ( | Can_HwUnit * | HwUnit, |
uint8 | Controller, | ||
uint16 | BaudRateConfigID ) |
Can low level Set Baudrate
This function sets the baudrate configuration of the CAN controller. The fucntion will determine if FD baud rate configuration is required and will set the baud rate accordingly. Function does not check if the baud rate configuration is valid.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the baud rate shall be set. |
BaudRateConfigID | references a baud rate configuration by ID |
E_OK | Service request accepted, setting of (new) baud rate started E_NOT_OK: Service request not accepted |
Std_ReturnType Can_Arch_SetControllerMode | ( | Can_HwUnit * | HwUnit, |
uint8 | Controller, | ||
Can_ControllerStateType | Transition ) |
Can low level Set Controller Mode
This function performs software triggered state transitions of the CAN controller State machine. Trnasitions are: Start, Stop, Wakeup, Reset. It is required a previous state in order to proceed with the requested transition, otherwise the function will return E_NOT_OK.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
Transition | Transition value to request new state. |
E_OK | request accepted E_NOT_OK: request not accepted |
< Initialization bit
< Initialization bit
< Initialization bit
< Clock stop request bit
< Clock stop acknowledge bit
< Configuration change enable bit
< Clock stop request bit
< Clock stop acknowledge bit
Std_ReturnType Can_Arch_Write | ( | Can_HwUnit * | HwUnit, |
Can_HwHandleType | Hth, | ||
const Can_PduType * | PduInfo ) |
Can low level Write
The function stores the message pointed to by PduInfo into the internal Tx message buffer of the CAN Sram area and activates the corresponding hardware transmit bits. It reades the hardware fifo index to know which of the three buffers is available for transmission. The function will return CAN_BUSY if no buffer is available.
HwUnit | Pointer to the hardware unit configuration |
Hth | information which HW-transmit handle shall be used for transmit. Implicitly this is also the information about the controller to use because the Hth numbers are unique inside one hardware unit. |
PduInfo | Pointer to SDU user memory, Data Length and Identifier |
E_OK | Write command has been accepted E_NOT_OK: development error occurred CAN_BUSY: No TX hardware buffer available or pre-emptive call of Can_Write that can't be implemented re-entrant (see Can_ReturnType) |
< Tx FIFO/Queue Full
< Tx FIFO/Queue Put Index
< Tx FIFO/Queue Put Index bitfiled size
< ID bit
< Standard ID
< Tx standard ID bit
< Tx standard ID bitfield size
< Extended identifier bit
< Tx extended ID bit
< Tx extended ID bitfield size
< Extended identifier bit
< Message Marker bit
< Message Marker bitfield size
< Fromat ID bit
< Classic mode
< FD format bit
< FD format bit
< Bit rate switch enable bit
< Bit rate switch bit
< Event FIFO Control bit
< Data length code bit
< Data length code bitfield size
|
static |
Determine data lenth to send
< Add static when no testing
This function determines the data lenght to send according to the CAN FD specification, in case the actual data lenght do not match with any of the available data lenghts, the function will return the closest data lenght with padding.
Dlc | Data lenght to send |
RamBuffer | Pointer to the buffer where the data will be stored |
PaddingValue | Value to use for padding |
DataLenght | Define with for data lenght to send |
< Add static when no testing
< 12 bytes payload length
< 16 bytes payload length
< 20 bytes payload length
< 24 bytes payload length
< 32 bytes payload length
< 48 bytes payload length
< 64 bytes payload length
< 8 bytes payload length
|
static |
Get a Message from one of the the Rx FIFOs
< Add static when no testing
This function gets the oldest message from one of the the Rx FIFOs, it also returns the message ID and the data lenght, the message is actually store into the ObjHeader1, ObjHeader2 and ObjPayload fields of the Rx FIFO element.
Fifo | Pointer to the Rx FIFO element. |
PduInfo | Pointer to the variable where the message will be stored. |
CanId | Pointer to the variable where the message ID will be stored. |
< Add static when no testing
< Data length code bit
< Data length code bitfield size
< Extended identifier bit
< Standard ID
< Rx standard ID bit
< Rx standard ID bitfield size
< Rx extended ID bit
< Rx extended ID bitfield size
< ID bit
< FD format bit
< Fromat ID bit
|
static |
Get an CAN PduId from the Tx Event FIFO zone
< Add static when no testing
This function gets the oldest CAN PduId from the Tx Event FIFO zone, it also returns the number of elements in the Tx Event FIFO zone., the CAN Pdu id is actually store into the MM field of the Tx Event FIFO element.
Controller | CAN controller for which the status shall be changed. |
CanPduId | Pointer to the variable where the CAN PduId will be stored. |
Number | of elements left in the Tx Event FIFO zone. |
< Add static when no testing
< Tx FIFO/Queue Get Index
< Tx FIFO/Queue Get Index bitfiled size
< Message Marker bit
< Message Marker bitfield size
< Tx FIFO/Queue Fill Level
< Tx FIFO/Queue Fill Level bitfiled size
|
static |
Can Bus Off Callback
< Add static when no testing
This function is the callback for the Bus Off interrupt, it will set the controller mode to stopped and notify the upper layer that the controller is in bus off mode.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
< Bus_Off bit
< Initialization bit
< Configuration change enable bit
|
static |
Error logging overflow
< Add static when no testing
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Error passive
< Add static when no testing
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Can Tx Fifo/Queue Error Callback
< Add static when no testing
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Message RAM access failure
< Add static when no testing
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Protocol error in arbitration phase (nominal bit time is used)
< Add static when no testing
The function report the Error code to upper layer CanIf in error happens in arbitration phase, errors reported are only tose the Mcu supports, if the Mcu doesn't support the error it will be ignored
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Protocol error in data phase (data bit time is used)
< Add static when no testing
The function report the Error code to upper layer CanIf in error happens in data phase, errors reported are only tose the Mcu supports, if the Mcu doesn't support the error it will be ignored
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Can Rx Fifo 0 Full Callback
< Add static when no testing
This function is the callback for the Rx Fifo 0 Full interrupt, it will read all the messages arrived and pass them to the upper layer.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
< Rx FIFO 0 Fill Level
< Rx FIFO 0 Fill Level
< Rx FIFO 0 Get Index
< Rx FIFO 0 Get Index bitfiled size
|
static |
Can Rx Fifo 0 Message Lost Callback
< Add static when no testing
A messages haven't read on time and it was overwritten or not by a new message. if FIfo is in blocking mode the message will never overwrite but this ISR will be called
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Can Rx Fifo 0 New Message Callback
< Add static when no testing
This function is the callback for the Rx Fifo 0 New Message interrupt, it will read the oldest message arrived and pass it to the upper layer.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
< Rx FIFO 0 Get Index
< Rx FIFO 0 Get Index bitfiled size
|
static |
Can Rx Fifo 1 Full Callback
< Add static when no testing
This function is the callback for the Rx Fifo 1 Full interrupt, it will read all the messages arrived and pass them to the upper layer.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
< Rx FIFO 0 Fill Level
< Rx FIFO 0 Fill Level
< Rx FIFO 0 Get Index
< Rx FIFO 0 Get Index bitfiled size
|
static |
Can Rx Fifo 1 Message Lost Callback
< Add static when no testing
A messages haven't read on time and it was overwritten or not by a new message. if FIfo is in blocking mode the message will never overwrite but this ISR will be called
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Can Rx Fifo 1 New Message Callback
< Add static when no testing
This function is the callback for the Rx Fifo 1 New Message interrupt, it will read the oldest message arrived and pass it to the upper layer.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
< Rx FIFO 0 Get Index
< Rx FIFO 0 Get Index bitfiled size
|
static |
Timeout occurred
< Add static when no testing
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Timestamp wraparound
< Add static when no testing
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Can Transmission cancellation finished Callback
< Add static when no testing
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Can Transmission completed Callback
< Add static when no testing
This function is the callback for the Transmission completed interrupt, it will read the PduId of the recent message transmitted and pass it to the upper layer.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Can Tx Event Fifo Element Lost Callback
< Add static when no testing
A messages event haven't read on time and it was overwritten or not by a new message. if FIfo is in blocking mode the message will never overwrite but this ISR will be called
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Can Tx Event Fifo Full Callback
< Add static when no testing
This function is the callback for the Tx Event Fifo Full interrupt, it will read the PduId of the all recent message transmitted and pass it to the upper layer.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Can Tx Event Fifo New Entry Callback
< Add static when no testing
This function is the callback for the Tx Event Fifo New Entry interrupt, it will read the PduId of the recent message transmitted and pass it to the upper layer.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Can Tx Event Fifo Empty Callback
< Add static when no testing
This function is the callback for the Tx Event Fifo Empty interrupt, it will read the PduId of the all recent message transmitted and pass it to the upper layer.
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Warning status
< Add static when no testing
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
Watchdog error
< Add static when no testing
HwUnit | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
|
static |
setup Can controller baudrate
< Add static when no testing
This function sets up the baudrate for the given controller. It will set the baudrate for the nominal and data bit timing registers. The function will only set the baudrate if the Baudrate pointer is not NULL.
Baudrate | Baudrate configuration |
Can | Register structure of the CAN controller |
< Add static when no testing
< Nominal (Re)Synchronization Jump Width
< Nominal Jump Width bitfiled size
< Nominal Time Segment 1
< Nominal Time Segment 1 bitfiled size
< Nominal Time Segment 2
< Nominal Time Segment 2 bitfiled size
< Nominal Baud Rate Prescaler
< Nominal Baud Rate Prescaler bitfiled size
< Data (Re)Synchronization Jump Width
< Data Jump Width bitfiled size
< Data Time Segment 1
< Data Time Segment 1 bitfiled size
< Data Time Segment 2
< Data Time Segment 2 bitfiled size
< Data Baud Rate Prescaler
< Nominal Baud Rate Preescaler bitfiled size
< Bit rate switch enable bit
|
static |
Setup reception Filters
< Add static when no testing
This function sets up the reception filters for the given controller. It will set the filters for the standard and extended ID's. The function will only set the filters if the HwFilter pointer is not NULL.
Config | Pointer to the hardware unit configuration |
Controller | CAN controller for which the status shall be changed. |
< Add static when no testing
< Receive object
< Standard ID
< Mixed ID
< Standard ID
< Standard ID Filter 1
< Rx standard ID bitfield size
< Standard ID Filter 2
< Rx standard ID bitfield size
< Standard ID Filter Element Configuration
< Standard ID Filter 1 bitfield size
< Standard ID Filter Type
< Standard ID Filter Type bitfield size
< Extended ID
< Mixed ID
< Extended ID
< Extended ID Filter 1
< Rx extended ID bitfield size
< Extended ID Filter 1
< Rx extended ID bitfield size
< Extended ID Filter Type
< Extended ID Filter Type bitfield size
< Extended ID Filter Element Configuration
< Extended ID Filter 1 bitfield size
< List Size Standard
< List Size Standard
< Accept Non-matching Frames Standard
< Accept Non-matching Frames Standard
< List Size Extended
< List Size Extended
< Accept Non-matching Frames Extended
< Accept Non-matching Frames Extended
|
static |
setup Can controller interrupts
< Add static when no testing
This function setup the interrupts for the Can controller, tkaes the values in Line0ActiveITs and Line1ActiveITs and assign to interrupt lines plus enable the Tx complete and abort interrupts
Controller | CAN controller for which the status shall be changed. |
Can | Pointer to the Can controller register structure |
< Add static when no testing
< Rx FIFO 1 message lost
< Rx FIFO 1 message lost
< Tx Event FIFO element lost
< Error_Passive status changed
< Protocol error in arbitration phase detected
< Protocol error in data phase detected
< Misc. Interrupts Group: TOOL: Timeout Occurred, MRAFL: Message RAM Access Failure and TSWL: Timestamp Wraparound
< Misc. Interrupts List
< Bit and Line Error Interrupts Group: EPL: Error Passive and ELOL: Error Logging Overflow
< Bit and Line Error Interrupts List
< Protocol Error Group: ARAL: Access to Reserved Address Line, PEDL: Protocol Error in Data Phase Line, PEAL: Protocol Error in Arbitration Phase Line WDIL: Watchdog Interrupt Line, BOL: Bus_Off Status and EWL: Warning Status
< Protocol Error Interrupts List
< Transmission Completed
< Add message to Tx Buffer 0
< Add message to Tx Buffer 1
< Add message to Tx Buffer 2
< Transmission Cancellation Finished
< Add message to Tx Buffer 0
< Add message to Tx Buffer 1
< Add message to Tx Buffer 2
|
static |
Autosar errors to report.