![]() |
PDL for FM4
Version1.2
Peripheral Driverl Library for FM4
|
Data Structures | |
| struct | stc_can_ctrlr |
| Redefinition of CTRLR register bitfields. More... | |
| struct | stc_can_statr |
| Redefinition of STATR register bitfields. More... | |
| struct | stc_can_errcnt |
| Redefinition of ERRCNT register bitfields. More... | |
| struct | stc_can_intr |
| Redefinition of INTR register bitfields. More... | |
| struct | stc_can_testr |
| Redefinition of TESTR register bitfields. More... | |
| struct | stc_can_brper |
| Redefinition of BRPER register bitfields. More... | |
| struct | stc_can_ifncreq |
| Redefinition of IFnCREQ register bitfields. More... | |
| struct | stc_can_ifncmsk |
| Redefinition of IFnCMSK register bitfields. More... | |
| struct | stc_can_ifnmsk |
| Redefinition of IFnMSK register bitfields. More... | |
| struct | stc_can_ifnmsk2 |
| Redefinition of IFnMSK2 register bitfields. More... | |
| struct | stc_can_ifnarb |
| Redefinition of IFnARB register bitfields. More... | |
| struct | stc_can_ifnarb2 |
| Redefinition of IFnARB2 register bitfields. More... | |
| struct | stc_can_ifnmctr |
| Redefinition of IFnMCTR register bitfields. More... | |
| struct | stc_can_btr |
| Redefinition of BTR register bitfields. More... | |
| struct | stc_can_treqr |
| Redefinition of TREQR register bitfields. More... | |
| struct | stc_can_treqr1 |
| Redefinition of TREQR1 register bitfields. More... | |
| struct | stc_can_treqr2 |
| Redefinition of TREQR2 register bitfields. More... | |
| struct | stc_can_newdt |
| Redefinition of NEWDT register bitfields. More... | |
| struct | stc_can_newdt1 |
| Redefinition of NEWDT1 register bitfields. More... | |
| struct | stc_can_intpnd |
| Redefinition of INTPND register bitfields. More... | |
| struct | stc_can_intpnd1 |
| Redefinition of INTPND1 register bitfields. More... | |
| struct | stc_can_intpnd2 |
| Redefinition of INTPND2 register bitfields. More... | |
| struct | stc_can_msgval |
| Redefinition of MSGVAL register bitfields. More... | |
| struct | stc_can_msgval1 |
| Redefinition of MSGVAL1 register bitfields. More... | |
| struct | stc_can_msgval2 |
| Redefinition of MSGVAL2 register bitfields. More... | |
| struct | stc_cann |
| Redefinition of CAN registers. More... | |
| struct | stc_can_bitrate |
| CAN bitrate. More... | |
| struct | stc_can_msg_id |
| CAN message identifier. More... | |
| struct | stc_can_msg_data |
| CAN message data. More... | |
| struct | stc_can_msg |
| CAN message. More... | |
| struct | stc_can_interrupt_handling |
| CAN interrupt pointer structure. More... | |
| struct | stc_can_notification |
| CAN notification pointer structure. More... | |
| struct | stc_can_config |
| CAN configuration. More... | |
| struct | stc_can_intern_data |
| CAN instance internal data, storing internal information for each enabled CAN instance. More... | |
| struct | stc_can_instance_data |
| CAN instance data type. More... | |
Macros | |
| #define | CAN_INSTANCE_COUNT (uint32_t)(sizeof(m_astcCanInstanceDataLut) / sizeof(m_astcCanInstanceDataLut[0])) |
| Macro to return the number of enabled CAN instances. More... | |
| #define | CAN_STATUS_INTERRUPT (1 << 15) |
| Status interrupt detected. More... | |
| #define | CAN_NO_LEC_CHANGE 7 |
| #define | CAN_MSG_DIR_RX 0 |
| WRRD bit indicating read direction. More... | |
| #define | CAN_MSG_DIR_TX 1 |
| WRRD bit indicating write direction. More... | |
| #define | CAN_MSG_ID_EXTENDED 1 |
| Extended msg id is used. More... | |
| #define | CAN0 (*((volatile stc_cann_t *) FM4_CAN0_BASE)) |
| #define | CAN1 (*((volatile stc_cann_t *) FM4_CAN1_BASE)) |
| #define | CANPRE (*((volatile uint8_t *) FM4_CANPRES_BASE)) |
| #define | CAN_MESSAGE_DATA_BUFFER_SIZE 8 |
| Size of data bytes in a receive or transmit operation (usually 8) More... | |
| #define | CAN_MESSAGE_BUFFER_COUNT 32 |
| Number of possible message buffer for receive and transmit messages (usually 32) More... | |
| #define | CAN_BITRATE_TSEG1_MIN 2 |
| Lower limit for TSEG1 in structure stc_can_bitrate_t. More... | |
| #define | CAN_BITRATE_TSEG1_MAX 16 |
| Upper limit for TSEG1 in structure stc_can_bitrate_t. More... | |
| #define | CAN_BITRATE_TSEG2_MIN 1 |
| Lower limit for TSEG2 in structure stc_can_bitrate_t. More... | |
| #define | CAN_BITRATE_TSEG2_MAX 8 |
| Upper limit for TSEG2 in structure stc_can_bitrate_t. More... | |
| #define | CAN_BITRATE_SYNC_JUMP_WIDTH_MIN 1 |
| Lower limit for Sync Jump Width in structure stc_can_bitrate_t. More... | |
| #define | CAN_BITRATE_SYNC_JUMP_WIDTH_MAX 4 |
| Upper limit for Sync Jump Width in structure stc_can_bitrate_t. More... | |
| #define | CAN_BITRATE_PRESCALER_MIN 1 |
| Lower limit for Prescaler in structure stc_can_bitrate_t. More... | |
| #define | CAN_BITRATE_PRESCALER_MAX 64 |
| Upper limit for Prescaler in structure stc_can_bitrate_t. More... | |
| #define | CAN_MAX_CLK 16000000 |
| Maximum CAN clock frequency (after prescaler) More... | |
Typedefs | |
| typedef struct stc_can_ctrlr | stc_can_ctrlr_t |
| Redefinition of CTRLR register bitfields. More... | |
| typedef struct stc_can_statr | stc_can_statr_t |
| Redefinition of STATR register bitfields. More... | |
| typedef struct stc_can_errcnt | stc_can_errcnt_t |
| Redefinition of ERRCNT register bitfields. More... | |
| typedef struct stc_can_intr | stc_can_intr_t |
| Redefinition of INTR register bitfields. More... | |
| typedef struct stc_can_testr | stc_can_testr_t |
| Redefinition of TESTR register bitfields. More... | |
| typedef struct stc_can_brper | stc_can_brper_t |
| Redefinition of BRPER register bitfields. More... | |
| typedef struct stc_can_ifncreq | stc_can_ifncreq_t |
| Redefinition of IFnCREQ register bitfields. More... | |
| typedef struct stc_can_ifncmsk | stc_can_ifncmsk_t |
| Redefinition of IFnCMSK register bitfields. More... | |
| typedef struct stc_can_ifnmsk | stc_can_ifnmsk_t |
| Redefinition of IFnMSK register bitfields. More... | |
| typedef struct stc_can_ifnmsk2 | stc_can_ifnmsk2_t |
| Redefinition of IFnMSK2 register bitfields. More... | |
| typedef struct stc_can_ifnarb | stc_can_ifnarb_t |
| Redefinition of IFnARB register bitfields. More... | |
| typedef struct stc_can_ifnarb2 | stc_can_ifnarb2_t |
| Redefinition of IFnARB2 register bitfields. More... | |
| typedef struct stc_can_ifnmctr | stc_can_ifnmctr_t |
| Redefinition of IFnMCTR register bitfields. More... | |
| typedef struct stc_can_btr | stc_can_btr_t |
| Redefinition of BTR register bitfields. More... | |
| typedef struct stc_can_treqr | stc_can_treqr_t |
| Redefinition of TREQR register bitfields. More... | |
| typedef struct stc_can_treqr1 | stc_can_treqr1_t |
| Redefinition of TREQR1 register bitfields. More... | |
| typedef struct stc_can_treqr2 | stc_can_treqr2_t |
| Redefinition of TREQR2 register bitfields. More... | |
| typedef struct stc_can_newdt | stc_can_newdt_t |
| Redefinition of NEWDT register bitfields. More... | |
| typedef struct stc_can_newdt1 | stc_can_newdt1_t |
| Redefinition of NEWDT1 register bitfields. More... | |
| typedef struct stc_can_intpnd | stc_can_intpnd_t |
| Redefinition of INTPND register bitfields. More... | |
| typedef struct stc_can_intpnd1 | stc_can_intpnd1_t |
| Redefinition of INTPND1 register bitfields. More... | |
| typedef struct stc_can_intpnd2 | stc_can_intpnd2_t |
| Redefinition of INTPND2 register bitfields. More... | |
| typedef struct stc_can_msgval | stc_can_msgval_t |
| Redefinition of MSGVAL register bitfields. More... | |
| typedef struct stc_can_msgval1 | stc_can_msgval1_t |
| Redefinition of MSGVAL1 register bitfields. More... | |
| typedef struct stc_can_msgval2 | stc_can_msgval2_t |
| Redefinition of MSGVAL2 register bitfields. More... | |
| typedef struct stc_cann | stc_cann_t |
| Redefinition of CAN registers. More... | |
| typedef enum en_can_prescaler | en_can_prescaler_t |
| CAN Unit configuration structures. More... | |
| typedef struct stc_can_bitrate | stc_can_bitrate_t |
| CAN bitrate. More... | |
| typedef struct stc_can_msg_id | stc_can_msg_id_t |
| CAN message identifier. More... | |
| typedef struct stc_can_msg_data | stc_can_msg_data_t |
| CAN message data. More... | |
| typedef enum en_can_tx_mode | en_can_tx_mode_t |
| CAN transmit mode. More... | |
| typedef enum en_can_status | en_can_status_t |
| CAN status. More... | |
| typedef enum en_can_error | en_can_error_t |
| CAN error. More... | |
| typedef struct stc_can_msg | stc_can_msg_t |
| CAN message. More... | |
| typedef void(* | can_tx_msg_func_ptr_t )(uint8_t u8MsgBuf) |
| Message transmission complete callback function (can_tx_msg_func_ptr_t). More... | |
| typedef void(* | can_rx_msg_func_ptr_t )(uint8_t u8MsgBuf, stc_can_msg_t *pstcRxMsg) |
| Message reception callback function (can_rx_msg_func_ptr_t). More... | |
| typedef void(* | can_status_chg_func_ptr_t )(en_can_status_t enCanStatus) |
| Status changed callback function (can_status_chg_func_ptr_t). More... | |
| typedef void(* | can_error_func_ptr_t )(en_can_error_t enCanError) |
| Error callback function (can_error_func_ptr_t). More... | |
| typedef struct stc_can_interrupt_handling | stc_can_interrupt_handling_t |
| CAN interrupt pointer structure. More... | |
| typedef struct stc_can_notification | stc_can_notification_t |
| CAN notification pointer structure. More... | |
| typedef struct stc_can_config | stc_can_config_t |
| CAN configuration. More... | |
| typedef enum en_can_instance_index | en_can_instance_index_t |
| Enumeration to define an index for each enabled CAN instance. More... | |
| typedef struct stc_can_intern_data | stc_can_intern_data_t |
| CAN instance internal data, storing internal information for each enabled CAN instance. More... | |
| typedef struct stc_can_instance_data | stc_can_instance_data_t |
| CAN instance data type. More... | |
Enumerations | |
| enum | en_can_prescaler { CanPreDiv11 = 0, CanPreDiv12 = 1, CanPreDiv14 = 2, CanPreDiv18 = 3, CanPreDiv23 = 4, CanPreDiv13 = 5, CanPreDiv16 = 6, CanPreDiv112 = 7, CanPreDiv15 = 8, CanPreDiv110 = 9 } |
| CAN Unit configuration structures. More... | |
| enum | en_can_tx_mode { CanImmediateTransmit = 0, CanRemoteTransmit = 1 } |
| CAN transmit mode. More... | |
| enum | en_can_status { CanNoError = 0, CanStuffError = 1, CanFormError = 2, CanAckError = 3, CanBit1Error = 4, CanBit0Error = 5, CanCRCError = 6 } |
| CAN status. More... | |
| enum | en_can_error { CanBusOff = 0, CanWarning = 1 } |
| CAN error. More... | |
| enum | en_can_instance_index { CanInstanceIndexCan0, CanInstanceIndexCan1, CanInstanceIndexMax } |
| Enumeration to define an index for each enabled CAN instance. More... | |
Functions | |
| static stc_can_intern_data_t * | CanGetInternDataPtr (volatile stc_cann_t *pstcCan) |
| Return the internal data for a certain CAN instance. More... | |
| static void | Can_InitInterrupt (volatile stc_cann_t *pstcCan) |
| Set NVIC Interrupt depending on CAN instance. More... | |
| static void | Can_DeInitInterrupt (volatile stc_cann_t *pstcCan) |
| Clear NVIC Interrupt depending on CAN instance. More... | |
| void | CanIrqHandler (volatile stc_cann_t *pstcCan, stc_can_intern_data_t *pstcCanInternData) |
| CAN (Status/Error/Rx/Tx) interrupt ISR. More... | |
| en_result_t | Can_Init (volatile stc_cann_t *pstcCan, const stc_can_config_t *pstcConfig) |
| Initializes the CAN module. More... | |
| en_result_t | Can_DeInit (volatile stc_cann_t *pstcCan) |
| Deinitializes the CAN module. Any pending transmission or receiption will be aborted and all CAN related registers are reset to their default values. More... | |
| static en_result_t | CanIsMbUpdatePossible (volatile stc_cann_t *pstcCan, uint8_t u8MsgBuf) |
| Check if the given Message Buffer can be updated. More... | |
| en_result_t | Can_SetTransmitMsgBuffer (volatile stc_cann_t *pstcCan, uint8_t u8MsgBuf, const stc_can_msg_id_t *pstcMsgId, can_tx_msg_func_ptr_t pfnCallback) |
| Configures a message buffer for transmission. Setting of new values is not possible if a transmission is pending, except remote transmission mode. The callback function pfnCallback can be NULL, but there will be no notification of a successful transmission. This function has to be called at least once before function Can_UpdateAndTransmitMsgBuffer() can be used with the same message buffer index. More... | |
| en_result_t | Can_UpdateAndTransmitMsgBuffer (volatile stc_cann_t *pstcCan, uint8_t u8MsgBuf, const stc_can_msg_data_t *pstcMsgData, en_can_tx_mode_t enTxMode) |
| Updates the message data of a message buffer and/or start transmission. Transmits the message immediately (immediate transmission mode) or on reception of a matching remote frame (remote transmission mode). Function Can_SetTransmitMsgBuffer() must be called before setup the identifier and enable this message buffer. More... | |
| en_result_t | Can_UpdateAndTransmitFifoMsgBuffer (volatile stc_cann_t *pstcCan, uint8_t u8MsgBuf, const stc_can_msg_data_t *pstcMsgData, en_can_tx_mode_t enTxMode) |
| Updates the message data of a message buffer and/or start with EOB = 0 (Msg Buffer as FIFO) transmission. The function calls Can_UpdateAndTransmitMsgBuffer() More... | |
| en_result_t | Can_SetReceiveMsgBuffer (volatile stc_cann_t *pstcCan, uint8_t u8MsgBuf, stc_can_msg_t *pstcMsgBuffer, uint32_t u32MsgIdMask, can_rx_msg_func_ptr_t pfnCallback) |
| Configure a message buffer for reception. Configure and enable a message buffer for reception. The acceptance filter is set by pstcMsgBuffer->stcIdentifier and u32MsgIdMask. Each '0' bit in u32MsgIdMask masks the corresponding bit of the received message ID before comparing it to the configured identifier (set by pstcMsgBuffer->stcIdentifier). This allows receiving messages with different identifier. Setting all bits of u32MsgIdMask to '1' will only accept messages that match the configured identifier. If extended identifier is used, the u32MsgIdMask will also be interpreted as extended mask identifier. If 11 bit identifier is used, than u32MsgIdMask will be used as 11 bit mask identifier. The application must provide a message buffer object (pstcMsgBuffer) to be filled with received data. After reception of a message that passed the acceptance filter, the message's identifier, data and data length is copied into the provided message buffer and its bNew flag is set to TRUE. The message buffer has to be kept valid until this message buffer is reset (Can_ResetMsgBuffer()). More... | |
| en_result_t | Can_SetReceiveFifoMsgBuffer (volatile stc_cann_t *pstcCan, uint8_t u8MsgBuf, stc_can_msg_t *pstcMsgBuffer, uint32_t u32MsgIdMask, can_rx_msg_func_ptr_t pfnCallback) |
| Configure a message buffer for reception with EOB = 0 (FIFO mode). This function calls Can_SetReceiveMsgBuffer() More... | |
| en_result_t | Can_ResetMsgBuffer (volatile stc_cann_t *pstcCan, uint8_t u8MsgBuf) |
| Stop any message buffer operation i.e. disable it. More... | |
Variables | |
| stc_can_instance_data_t | m_astcCanInstanceDataLut [] |
| Look-up table for all enabled CAN instances and their internal data. More... | |
| stc_can_instance_data_t | m_astcCanInstanceDataLut [] |
| Look-up table for all enabled CAN instances and their internal data. More... | |
Provided functions of CAN module:
How to use the CAN module: First, to initialize a CAN module, Can_Init() must be called. The callback functions are optional, but recommended, otherwise there is no report to the API in case of any error. Can_DeInit() has to be used if any of the settings from Can_Init() have to be changed (use Can_DeInit() and afterwards Can_Init()). Can_DeInit() is used to completely disable the CAN module. With Can_DeInit() all CAN related register values are reset to their default values. Also any pending or ongoing transmission or reception will be aborted. Each CAN module has CAN_MESSAGE_BUFFER_COUNT number of message buffers which can be used either for reception or transmission of CAN messages. Each message buffer for transmission has to be set up first by calling Can_SetTransmitMsgBuffer(). For receiving CAN messages the function Can_SetReceiveMsgBuffer() has to be used. It is possible to set a callback function which will be notified whenever a message has been received.
| #define CAN0 (*((volatile stc_cann_t *) FM4_CAN0_BASE)) |
Definition at line 107 of file can.h.
Referenced by Can_DeInitInterrupt(), and Can_InitInterrupt().
| #define CAN1 (*((volatile stc_cann_t *) FM4_CAN1_BASE)) |
Definition at line 108 of file can.h.
Referenced by Can_DeInitInterrupt(), and Can_InitInterrupt().
| #define CAN_BITRATE_PRESCALER_MAX 64 |
Upper limit for Prescaler in structure stc_can_bitrate_t.
Definition at line 136 of file can.h.
Referenced by Can_Init().
| #define CAN_BITRATE_PRESCALER_MIN 1 |
Lower limit for Prescaler in structure stc_can_bitrate_t.
Definition at line 134 of file can.h.
Referenced by Can_Init().
| #define CAN_BITRATE_SYNC_JUMP_WIDTH_MAX 4 |
Upper limit for Sync Jump Width in structure stc_can_bitrate_t.
Definition at line 131 of file can.h.
Referenced by Can_Init().
| #define CAN_BITRATE_SYNC_JUMP_WIDTH_MIN 1 |
Lower limit for Sync Jump Width in structure stc_can_bitrate_t.
Definition at line 129 of file can.h.
Referenced by Can_Init().
| #define CAN_BITRATE_TSEG1_MAX 16 |
Upper limit for TSEG1 in structure stc_can_bitrate_t.
Definition at line 120 of file can.h.
Referenced by Can_Init().
| #define CAN_BITRATE_TSEG1_MIN 2 |
Lower limit for TSEG1 in structure stc_can_bitrate_t.
Definition at line 118 of file can.h.
Referenced by Can_Init().
| #define CAN_BITRATE_TSEG2_MAX 8 |
Upper limit for TSEG2 in structure stc_can_bitrate_t.
Definition at line 125 of file can.h.
Referenced by Can_Init().
| #define CAN_BITRATE_TSEG2_MIN 1 |
Lower limit for TSEG2 in structure stc_can_bitrate_t.
Definition at line 123 of file can.h.
Referenced by Can_Init().
| #define CAN_INSTANCE_COUNT (uint32_t)(sizeof(m_astcCanInstanceDataLut) / sizeof(m_astcCanInstanceDataLut[0])) |
Macro to return the number of enabled CAN instances.
Definition at line 70 of file can.c.
Referenced by CanGetInternDataPtr().
| #define CAN_MAX_CLK 16000000 |
Maximum CAN clock frequency (after prescaler)
Definition at line 139 of file can.h.
Referenced by Can_Init().
| #define CAN_MESSAGE_BUFFER_COUNT 32 |
Number of possible message buffer for receive and transmit messages (usually 32)
Definition at line 115 of file can.h.
Referenced by Can_DeInit(), Can_Init(), Can_ResetMsgBuffer(), Can_SetReceiveMsgBuffer(), Can_SetTransmitMsgBuffer(), and Can_UpdateAndTransmitMsgBuffer().
| #define CAN_MESSAGE_DATA_BUFFER_SIZE 8 |
| #define CAN_MSG_DIR_RX 0 |
WRRD bit indicating read direction.
Definition at line 79 of file can.c.
Referenced by Can_SetReceiveMsgBuffer(), Can_UpdateAndTransmitMsgBuffer(), and CanIrqHandler().
| #define CAN_MSG_DIR_TX 1 |
WRRD bit indicating write direction.
Definition at line 80 of file can.c.
Referenced by Can_Init(), Can_SetReceiveMsgBuffer(), Can_SetTransmitMsgBuffer(), and Can_UpdateAndTransmitMsgBuffer().
| #define CAN_MSG_ID_EXTENDED 1 |
Extended msg id is used.
Definition at line 81 of file can.c.
Referenced by Can_SetReceiveMsgBuffer(), Can_SetTransmitMsgBuffer(), and CanIrqHandler().
| #define CAN_NO_LEC_CHANGE 7 |
LEC (Last Error Code) special value indicating that no changes happened after the CPU has written this special value to LEC
Definition at line 77 of file can.c.
Referenced by CanIrqHandler().
| #define CAN_STATUS_INTERRUPT (1 << 15) |
| #define CANPRE (*((volatile uint8_t *) FM4_CANPRES_BASE)) |
Definition at line 109 of file can.h.
Referenced by Can_DeInit(), and Can_Init().
| typedef void(* can_error_func_ptr_t)(en_can_error_t enCanError) |
Error callback function (can_error_func_ptr_t).
Any error will be reported to the API (see en_can_error_t for possible error codes).
| typedef void(* can_rx_msg_func_ptr_t)(uint8_t u8MsgBuf, stc_can_msg_t *pstcRxMsg) |
| typedef void(* can_status_chg_func_ptr_t)(en_can_status_t enCanStatus) |
Status changed callback function (can_status_chg_func_ptr_t).
Any status change will be reported to the API (see en_can_status_t for possible status change codes).
| typedef void(* can_tx_msg_func_ptr_t)(uint8_t u8MsgBuf) |
| typedef enum en_can_error en_can_error_t |
CAN error.
These error values are used to report any CAN related error to the API via the CAN error callback function (can_error_func_ptr_t).
| typedef enum en_can_instance_index en_can_instance_index_t |
Enumeration to define an index for each enabled CAN instance.
| typedef enum en_can_prescaler en_can_prescaler_t |
CAN Unit configuration structures.
CAN Prescaler
| typedef enum en_can_status en_can_status_t |
CAN status.
These state values represent the current CAN state, and are used in the CAN status changed callback function (can_status_chg_func_ptr_t).
| typedef enum en_can_tx_mode en_can_tx_mode_t |
CAN transmit mode.
To select how transmit data should be processed.
| typedef struct stc_can_bitrate stc_can_bitrate_t |
CAN bitrate.
This structure is used to set the bitrate register. All values are decremented by 1 before writing to the CANn_BTR register (see HW manual for more details).
| typedef struct stc_can_brper stc_can_brper_t |
Redefinition of BRPER register bitfields.
| typedef struct stc_can_btr stc_can_btr_t |
Redefinition of BTR register bitfields.
| typedef struct stc_can_config stc_can_config_t |
CAN configuration.
Is used to set the CAN bitrate and allows deactivating of automatic retransmission in case of a transmission error. Optionally error and status changed notification can be set.
| typedef struct stc_can_ctrlr stc_can_ctrlr_t |
Redefinition of CTRLR register bitfields.
| typedef struct stc_can_errcnt stc_can_errcnt_t |
Redefinition of ERRCNT register bitfields.
| typedef struct stc_can_ifnarb2 stc_can_ifnarb2_t |
Redefinition of IFnARB2 register bitfields.
| typedef struct stc_can_ifnarb stc_can_ifnarb_t |
Redefinition of IFnARB register bitfields.
| typedef struct stc_can_ifncmsk stc_can_ifncmsk_t |
Redefinition of IFnCMSK register bitfields.
| typedef struct stc_can_ifncreq stc_can_ifncreq_t |
Redefinition of IFnCREQ register bitfields.
| typedef struct stc_can_ifnmctr stc_can_ifnmctr_t |
Redefinition of IFnMCTR register bitfields.
| typedef struct stc_can_ifnmsk2 stc_can_ifnmsk2_t |
Redefinition of IFnMSK2 register bitfields.
| typedef struct stc_can_ifnmsk stc_can_ifnmsk_t |
Redefinition of IFnMSK register bitfields.
| typedef struct stc_can_instance_data stc_can_instance_data_t |
CAN instance data type.
| typedef struct stc_can_intern_data stc_can_intern_data_t |
CAN instance internal data, storing internal information for each enabled CAN instance.
| typedef struct stc_can_interrupt_handling stc_can_interrupt_handling_t |
CAN interrupt pointer structure.
Holds some pointers to callback functions and buffer
| typedef struct stc_can_intpnd1 stc_can_intpnd1_t |
Redefinition of INTPND1 register bitfields.
| typedef struct stc_can_intpnd2 stc_can_intpnd2_t |
Redefinition of INTPND2 register bitfields.
| typedef struct stc_can_intpnd stc_can_intpnd_t |
Redefinition of INTPND register bitfields.
| typedef struct stc_can_intr stc_can_intr_t |
Redefinition of INTR register bitfields.
| typedef struct stc_can_msg_data stc_can_msg_data_t |
CAN message data.
Data structure for transmit and receive operations, maximum value for parameter u8DataLengthCode is CAN_MESSAGE_DATA_BUFFER_SIZE.
| typedef struct stc_can_msg_id stc_can_msg_id_t |
CAN message identifier.
This structure is used to set the CAN message identifier for transmit and receive operations. The identifiction is needed when setting the CAN arbitration register. On the one side this structure is used in the Can_SetTransmitMsgBuffer() function, on the other side same structure is used in the structure stc_can_msg_t which is used for receive data in Can_SetReceiveMsgBuffer(...) function.
| typedef struct stc_can_msg stc_can_msg_t |
CAN message.
This structure stores a CAN message, including the identifier, data and data length code (DLC). It also contains an overflow and new flag which indicates the message state for received messages.
| typedef struct stc_can_msgval1 stc_can_msgval1_t |
Redefinition of MSGVAL1 register bitfields.
| typedef struct stc_can_msgval2 stc_can_msgval2_t |
Redefinition of MSGVAL2 register bitfields.
| typedef struct stc_can_msgval stc_can_msgval_t |
Redefinition of MSGVAL register bitfields.
| typedef struct stc_can_newdt1 stc_can_newdt1_t |
Redefinition of NEWDT1 register bitfields.
| typedef struct stc_can_newdt stc_can_newdt_t |
Redefinition of NEWDT register bitfields.
| typedef struct stc_can_notification stc_can_notification_t |
CAN notification pointer structure.
Holds some pointers to callback functions for status and error notification
| typedef struct stc_can_statr stc_can_statr_t |
Redefinition of STATR register bitfields.
| typedef struct stc_can_testr stc_can_testr_t |
Redefinition of TESTR register bitfields.
| typedef struct stc_can_treqr1 stc_can_treqr1_t |
Redefinition of TREQR1 register bitfields.
| typedef struct stc_can_treqr2 stc_can_treqr2_t |
Redefinition of TREQR2 register bitfields.
| typedef struct stc_can_treqr stc_can_treqr_t |
Redefinition of TREQR register bitfields.
| typedef struct stc_cann stc_cann_t |
Redefinition of CAN registers.
| enum en_can_error |
| enum en_can_prescaler |
CAN Unit configuration structures.
CAN Prescaler
| enum en_can_status |
CAN status.
These state values represent the current CAN state, and are used in the CAN status changed callback function (can_status_chg_func_ptr_t).
| enum en_can_tx_mode |
| en_result_t Can_DeInit | ( | volatile stc_cann_t * | pstcCan | ) |
Deinitializes the CAN module. Any pending transmission or receiption will be aborted and all CAN related registers are reset to their default values.
| [in] | pstcCan | Pointer to register area of a CAN unit. |
| Ok | CAN module has been successfully deinitialized |
| ErrorInvalidParameter | If one of the following conditions are met:
|
Definition at line 634 of file can.c.
References stc_can_btr::BRP, stc_cann::BRPER, stc_cann::BTR_f, Can_DeInitInterrupt(), CAN_MESSAGE_BUFFER_COUNT, CanGetInternDataPtr(), CANPRE, stc_can_ctrlr::CCE, stc_cann::CTRLR, stc_cann::CTRLR_f, ErrorInvalidParameter, stc_cann::IF1ARB, stc_cann::IF1CMSK, stc_cann::IF1DTA1_L, stc_cann::IF1DTA2_L, stc_cann::IF1DTB1_L, stc_cann::IF1DTB2_L, stc_cann::IF1MCTR, stc_cann::IF1MSK, stc_cann::IF2ARB, stc_cann::IF2CMSK, stc_cann::IF2DTA1_L, stc_cann::IF2DTA2_L, stc_cann::IF2DTB1_L, stc_cann::IF2DTB2_L, stc_cann::IF2MCTR, stc_cann::IF2MSK, stc_can_ctrlr::INIT, Ok, stc_can_notification::pfnCanErrorInterruptFunction, stc_can_interrupt_handling::pfnCanRxInterruptFunction, stc_can_notification::pfnCanStatusInterruptFunction, stc_can_interrupt_handling::pfnCanTxInterruptFunction, stc_can_interrupt_handling::pstcMsgBuffer, stc_can_btr::SJW, stc_cann::STATR, stc_can_intern_data::stcCanInterruptHandling, stc_can_intern_data::stcCanNotificationCb, stc_cann::TESTR, stc_can_btr::TSEG1, and stc_can_btr::TSEG2.

|
static |
Clear NVIC Interrupt depending on CAN instance.
| pstcCan | Pointer to CAN instance |
Definition at line 181 of file can.c.
References CAN0, CAN1, and PDL_DEFAULT_INTERRUPT_LEVEL.
Referenced by Can_DeInit().

| en_result_t Can_Init | ( | volatile stc_cann_t * | pstcCan, |
| const stc_can_config_t * | pstcConfig | ||
| ) |
Initializes the CAN module.
This function initializes one specific CAN module with the parameters provided in the given config structure. After initialization the CAN module has Error, Status and Module-Interrupt enabled and is ready to use.
Can_Init() has to be called with the parameter pstcConfig of type stc_can_config_t the basic CAN settings automatic retransmission, the CAN baudrate, and the error and status change callback function can be set.
All values in pstcConfig have to be in valid range (see can.h for allowed ranges of dedicated parameters). The error and status change callback functions can be NULL. In this case no information of error or status changes will be reported to the API.
To reset and disable the CAN module the function Can_DeInit() has to be used.
The resulting CAN presecaler value is checked, if it is within CAN_MAX_CLK (normally 16 MHz).
| [in] | pstcCan | Pointer to register area of a CAN unit. |
| [in] | pstcConfig | CAN configuration parameters. |
| Ok | CAN module has been successfully initialized. |
| ErrorInvalidParameter | If one of the following conditions are met:
|
Definition at line 427 of file can.c.
References stc_can_ifncmsk::ARB, stc_can_config::bDisableAutomaticRetransmission, stc_can_btr::BRP, stc_cann::BRPER, stc_can_config::bTouchPrescaler, stc_cann::BTR_f, CAN_BITRATE_PRESCALER_MAX, CAN_BITRATE_PRESCALER_MIN, CAN_BITRATE_SYNC_JUMP_WIDTH_MAX, CAN_BITRATE_SYNC_JUMP_WIDTH_MIN, CAN_BITRATE_TSEG1_MAX, CAN_BITRATE_TSEG1_MIN, CAN_BITRATE_TSEG2_MAX, CAN_BITRATE_TSEG2_MIN, Can_InitInterrupt(), CAN_MAX_CLK, CAN_MESSAGE_BUFFER_COUNT, CAN_MSG_DIR_TX, CanGetInternDataPtr(), CANPRE, CanPreDiv11, CanPreDiv110, CanPreDiv112, CanPreDiv12, CanPreDiv13, CanPreDiv14, CanPreDiv15, CanPreDiv16, CanPreDiv18, CanPreDiv23, stc_can_ctrlr::CCE, stc_can_ifncmsk::CONTROL, stc_cann::CTRLR_f, stc_can_ctrlr::DAR, stc_can_ctrlr::EIE, stc_can_bitrate::enCanPrescaler, ErrorInvalidParameter, stc_can_ctrlr::IE, stc_cann::IF1ARB, stc_cann::IF1CMSK_f, stc_cann::IF1CREQ, stc_cann::IF1MCTR, stc_can_ctrlr::INIT, Ok, PDL_ZERO_STRUCT, stc_can_notification::pfnCanErrorInterruptFunction, stc_can_notification::pfnCanStatusInterruptFunction, stc_can_config::pfnErrorCallback, stc_can_config::pfnStatusCallback, stc_can_ctrlr::SIE, stc_can_btr::SJW, stc_cann::STATR, stc_can_config::stcBitrate, stc_can_intern_data::stcCanNotificationCb, TRUE, stc_can_btr::TSEG1, stc_can_btr::TSEG2, stc_can_bitrate::u16Prescaler, stc_can_bitrate::u8SyncJumpWidth, stc_can_bitrate::u8TimeSegment1, stc_can_bitrate::u8TimeSegment2, and stc_can_ifncmsk::WRRD.

|
static |
Set NVIC Interrupt depending on CAN instance.
| pstcCan | Pointer to CAN instance |
Definition at line 155 of file can.c.
References CAN0, CAN1, PDL_IRQ_LEVEL_CAN0, and PDL_IRQ_LEVEL_CAN1.
Referenced by Can_Init().

| en_result_t Can_ResetMsgBuffer | ( | volatile stc_cann_t * | pstcCan, |
| uint8_t | u8MsgBuf | ||
| ) |
Stop any message buffer operation i.e. disable it.
| [in] | pstcCan | Pointer to register area of a CAN unit. |
| [in] | u8MsgBuf | Message buffer index (0 .. CAN_MESSAGE_BUFFER_COUNT - 1) |
| Ok | Message buffer operations have been stoped |
| ErrorInvalidParameter | If one of the following conditions are met:
|
Definition at line 1348 of file can.c.
References CAN_MESSAGE_BUFFER_COUNT, CanGetInternDataPtr(), ErrorInvalidParameter, stc_cann::IF1MCTR, stc_can_ifnarb::MSGVAL, Ok, stc_can_interrupt_handling::pfnCanRxInterruptFunction, stc_can_interrupt_handling::pfnCanTxInterruptFunction, stc_can_interrupt_handling::pstcMsgBuffer, stc_can_intern_data::stcCanInterruptHandling, and stc_cann::u32IF1ARB.

| en_result_t Can_SetReceiveFifoMsgBuffer | ( | volatile stc_cann_t * | pstcCan, |
| uint8_t | u8MsgBuf, | ||
| stc_can_msg_t * | pstcMsgBuffer, | ||
| uint32_t | u32MsgIdMask, | ||
| can_rx_msg_func_ptr_t | pfnCallback | ||
| ) |
Configure a message buffer for reception with EOB = 0 (FIFO mode). This function calls Can_SetReceiveMsgBuffer()
| [in] | pstcCan | Pointer to register area of a CAN unit. |
| [in] | u8MsgBuf | Message buffer index (0 .. CAN_MESSAGE_BUFFER_COUNT - 1) |
| [in,out] | pstcMsgBuffer | CAN message object which defines identifier for acceptance filter. |
| [in] | u32MsgIdMask | Mask for identifier acceptance filter and later receives the received message (all '1' disables masking). |
| [in] | pfnCallback | Callback function which is called when new CAN message was received and accepted by this message buffer. |
| Ok | Message buffer for reception has been succesfully set. |
| ErrorInvalidParameter | If one of the following conditions are met:
|
Definition at line 1291 of file can.c.
References stc_can_intern_data::bEobZero, Can_SetReceiveMsgBuffer(), CanGetInternDataPtr(), ErrorInvalidParameter, FALSE, and TRUE.

| en_result_t Can_SetReceiveMsgBuffer | ( | volatile stc_cann_t * | pstcCan, |
| uint8_t | u8MsgBuf, | ||
| stc_can_msg_t * | pstcMsgBuffer, | ||
| uint32_t | u32MsgIdMask, | ||
| can_rx_msg_func_ptr_t | pfnCallback | ||
| ) |
Configure a message buffer for reception. Configure and enable a message buffer for reception. The acceptance filter is set by pstcMsgBuffer->stcIdentifier and u32MsgIdMask. Each '0' bit in u32MsgIdMask masks the corresponding bit of the received message ID before comparing it to the configured identifier (set by pstcMsgBuffer->stcIdentifier). This allows receiving messages with different identifier. Setting all bits of u32MsgIdMask to '1' will only accept messages that match the configured identifier. If extended identifier is used, the u32MsgIdMask will also be interpreted as extended mask identifier. If 11 bit identifier is used, than u32MsgIdMask will be used as 11 bit mask identifier. The application must provide a message buffer object (pstcMsgBuffer) to be filled with received data. After reception of a message that passed the acceptance filter, the message's identifier, data and data length is copied into the provided message buffer and its bNew flag is set to TRUE. The message buffer has to be kept valid until this message buffer is reset (Can_ResetMsgBuffer()).
A mask identifier has to be set when calling Can_SetReceiveMsgBuffer(), the length for the mask identifier will be the same like the one used in pstcMsgBuffer (11-bit or 29-bit identifier mask). The extended identification mask bit and the direction mask bit are always set to 1.
The API has to check the bNew flag of parameter pstcMsgBuffer to get information about if a message has already been received or not. If a new message has been received while bNew flag is set (the last received message was not read out by API so far) than the bOverflow flag will be set. So, if callback function is not used, the API has to reset the bNew flag when the received message is read out (also the bOverflow flag has to be reset) and furthermore.
| [in] | pstcCan | Pointer to register area of a CAN unit. |
| [in] | u8MsgBuf | Message buffer index (0 .. CAN_MESSAGE_BUFFER_COUNT - 1) |
| [in,out] | pstcMsgBuffer | CAN message object which defines identifier for acceptance filter. |
| [in] | u32MsgIdMask | Mask for identifier acceptance filter and later receives the received message (all '1' disables masking). |
| [in] | pfnCallback | Callback function which is called when new CAN message was received and accepted by this message buffer. |
| Ok | Message buffer for reception has been succesfully set. |
| ErrorInvalidParameter | If one of the following conditions are met:
|
Definition at line 1171 of file can.c.
References stc_can_ifncmsk::ARB, stc_can_intern_data::bEobZero, stc_can_msg_id::bExtended, stc_can_msg::bNew, stc_can_msg::bOverflow, CAN_MESSAGE_BUFFER_COUNT, CAN_MSG_DIR_RX, CAN_MSG_DIR_TX, CAN_MSG_ID_EXTENDED, CanGetInternDataPtr(), stc_can_ifncmsk::CONTROL, stc_can_ifnarb::DIR, stc_can_ifnmctr::EOB, ErrorInvalidParameter, FALSE, stc_can_ifnarb::ID, stc_cann::IF1CMSK_f, stc_cann::IF1CREQ, stc_cann::IF1MCTR, stc_cann::IF1MCTR_f, stc_cann::IF1MSK, stc_cann::IF1MSK_f, stc_can_ifncmsk::MASK, stc_can_ifnarb::MSGVAL, stc_can_ifnmsk::MSK, stc_can_ifnmsk::MXTD, Ok, PDL_ZERO_STRUCT, stc_can_interrupt_handling::pfnCanRxInterruptFunction, stc_can_interrupt_handling::pstcMsgBuffer, stc_can_ifnmctr::RXIE, stc_can_intern_data::stcCanInterruptHandling, stc_can_msg::stcIdentifier, TRUE, stc_can_msg_id::u32Identifier, stc_cann::u32IF1ARB, stc_can_ifnmctr::UMASK, stc_can_ifncmsk::WRRD, and stc_can_ifnarb::XTD.
Referenced by Can_SetReceiveFifoMsgBuffer().


| en_result_t Can_SetTransmitMsgBuffer | ( | volatile stc_cann_t * | pstcCan, |
| uint8_t | u8MsgBuf, | ||
| const stc_can_msg_id_t * | pstcMsgId, | ||
| can_tx_msg_func_ptr_t | pfnCallback | ||
| ) |
Configures a message buffer for transmission. Setting of new values is not possible if a transmission is pending, except remote transmission mode. The callback function pfnCallback can be NULL, but there will be no notification of a successful transmission. This function has to be called at least once before function Can_UpdateAndTransmitMsgBuffer() can be used with the same message buffer index.
With the parameter stc_can_msg_id_t::pstcMsgId of type stc_can_msg_id_t the API can set the identifier (11 bit or 29 bit length) of the CAN transmit message. It is possible to set a callback function to get notified when a transmission is successfully finished. Can_SetTransmitMsgBuffer() must be called before calling Can_UpdateAndTransmitMsgBuffer(). Update or setting of new values of function Can_SetTransmitMsgBuffer() or Can_UpdateAndTransmitMsgBuffer() is not possible if a transmission is pending or ongoing, except remote transmission mode is used.
| [in] | pstcCan | Pointer to register area of a CAN unit. |
| [in] | u8MsgBuf | Message buffer index (0 .. CAN_MESSAGE_BUFFER_COUNT - 1) |
| [in] | pstcMsgId | CAN message identifier. |
| [in] | pfnCallback | Callback function to be called after successful transmission, can be NULL. |
| Ok | Message buffer has been successfully initialized. |
| ErrorInvalidParameter | If one of the following conditions are met:
|
| ErrorOperationInProgress | If following condition is met:
|
Definition at line 816 of file can.c.
References stc_can_ifncmsk::ARB, stc_can_msg_id::bExtended, CAN_MESSAGE_BUFFER_COUNT, CAN_MSG_DIR_TX, CAN_MSG_ID_EXTENDED, CanGetInternDataPtr(), CanIsMbUpdatePossible(), stc_can_ifnarb::DIR, ErrorInvalidParameter, ErrorOperationInProgress, stc_can_ifnarb::ID, stc_cann::IF1CMSK_f, stc_cann::IF1CREQ, stc_can_ifnarb::MSGVAL, Ok, stc_can_interrupt_handling::pfnCanTxInterruptFunction, stc_can_intern_data::stcCanInterruptHandling, stc_can_msg_id::u32Identifier, stc_cann::u32IF1ARB, stc_can_ifncmsk::WRRD, and stc_can_ifnarb::XTD.

| en_result_t Can_UpdateAndTransmitFifoMsgBuffer | ( | volatile stc_cann_t * | pstcCan, |
| uint8_t | u8MsgBuf, | ||
| const stc_can_msg_data_t * | pstcMsgData, | ||
| en_can_tx_mode_t | enTxMode | ||
| ) |
Updates the message data of a message buffer and/or start with EOB = 0 (Msg Buffer as FIFO) transmission. The function calls Can_UpdateAndTransmitMsgBuffer()
| [in] | pstcCan | Pointer to register area of a CAN unit. |
| [in] | u8MsgBuf | Message buffer index (0 .. CAN_MESSAGE_BUFFER_COUNT - 1) |
| [in] | pstcMsgData | CAN message data |
| [in] | enTxMode | Transmission mode (immediately or remote) |
| Ok | Message buffer has been successfully updated. |
| ErrorInvalidParameter | If one of the following conditions are met:
|
| ErrorUninitialized | If Can_SetTransmitMsgBuffer() was not called before. |
| ErrorOperationInProgress | If a transmission is pending (either wait or call Can_ResetMsgBuffer() ). |
Definition at line 1088 of file can.c.
References stc_can_intern_data::bEobZero, Can_UpdateAndTransmitMsgBuffer(), CanGetInternDataPtr(), ErrorInvalidParameter, FALSE, and TRUE.

| en_result_t Can_UpdateAndTransmitMsgBuffer | ( | volatile stc_cann_t * | pstcCan, |
| uint8_t | u8MsgBuf, | ||
| const stc_can_msg_data_t * | pstcMsgData, | ||
| en_can_tx_mode_t | enTxMode | ||
| ) |
Updates the message data of a message buffer and/or start transmission. Transmits the message immediately (immediate transmission mode) or on reception of a matching remote frame (remote transmission mode). Function Can_SetTransmitMsgBuffer() must be called before setup the identifier and enable this message buffer.
| [in] | pstcCan | Pointer to register area of a CAN unit. |
| [in] | u8MsgBuf | Message buffer index (0 .. CAN_MESSAGE_BUFFER_COUNT - 1) |
| [in] | pstcMsgData | CAN message data |
| [in] | enTxMode | Transmission mode (immediately or remote) |
| Ok | Message buffer has been successfully updated. |
| ErrorInvalidParameter | If one of the following conditions are met:
|
| ErrorUninitialized | If Can_SetTransmitMsgBuffer() was not called before. |
| ErrorOperationInProgress | If a transmission is pending (either wait or call Can_ResetMsgBuffer() ). |
Definition at line 919 of file can.c.
References stc_can_ifncmsk::ARB, stc_can_msg_data::au8Data, stc_can_intern_data::bEobZero, CAN_MESSAGE_BUFFER_COUNT, CAN_MSG_DIR_RX, CAN_MSG_DIR_TX, CanGetInternDataPtr(), CanImmediateTransmit, CanIsMbUpdatePossible(), stc_can_ifncmsk::CONTROL, stc_can_ifncmsk::DATAA, stc_can_ifncmsk::DATAB, stc_can_ifnmctr::DLC, stc_can_ifnmctr::EOB, ErrorInvalidParameter, ErrorOperationInProgress, ErrorUninitialized, stc_cann::IF1CMSK_f, stc_cann::IF1CREQ, stc_cann::IF1DTA1_L, stc_cann::IF1DTA2_L, stc_cann::IF1DTB1_L, stc_cann::IF1DTB2_L, stc_cann::IF1MCTR_f, stc_can_ifnarb::MSGVAL, stc_can_ifncmsk::NEWDAT, stc_can_ifnmctr::NEWDAT, Ok, stc_can_ifnmctr::RMTEN, TRUE, stc_can_ifnmctr::TXIE, stc_cann::u32IF1ARB, stc_can_msg_data::u8DataLengthCode, and stc_can_ifncmsk::WRRD.
Referenced by Can_UpdateAndTransmitFifoMsgBuffer().


|
static |
Return the internal data for a certain CAN instance.
| pstcCan | Pointer to CAN instance |
Definition at line 133 of file can.c.
References CAN_INSTANCE_COUNT, and stc_can_instance_data::stcInternData.
Referenced by Can_DeInit(), Can_Init(), Can_ResetMsgBuffer(), Can_SetReceiveFifoMsgBuffer(), Can_SetReceiveMsgBuffer(), Can_SetTransmitMsgBuffer(), Can_UpdateAndTransmitFifoMsgBuffer(), and Can_UpdateAndTransmitMsgBuffer().

| void CanIrqHandler | ( | volatile stc_cann_t * | pstcCan, |
| stc_can_intern_data_t * | pstcCanInternData | ||
| ) |
CAN (Status/Error/Rx/Tx) interrupt ISR.
Check for any pending interrupt source and process until no more INTs are active.
| [in] | pstcCan | Pointer to register area of a CAN unit. |
| [in] | pstcCanInternData | Pointer to internal data. |
Description of flow:
Definition at line 224 of file can.c.
References stc_can_ifncmsk::ARB, stc_can_msg_data::au8Data, stc_can_msg_id::bExtended, stc_can_msg::bNew, stc_can_statr::BOFF, stc_can_msg::bOverflow, CAN_MSG_DIR_RX, CAN_MSG_ID_EXTENDED, CAN_NO_LEC_CHANGE, CAN_STATUS_INTERRUPT, CanBusOff, CanWarning, stc_can_ifncmsk::CIP, stc_can_ifncmsk::CONTROL, stc_can_ifncmsk::DATAA, stc_can_ifncmsk::DATAB, stc_can_ifnarb::DIR, stc_can_ifnmctr::DLC, stc_can_statr::EWARN, FALSE, stc_can_ifnarb::ID, stc_cann::IF2ARB2_f, stc_cann::IF2CMSK_f, stc_cann::IF2CREQ, stc_cann::IF2DTA1_L, stc_cann::IF2DTA2_L, stc_cann::IF2DTB1_L, stc_cann::IF2DTB2_L, stc_cann::IF2MCTR_f, stc_cann::INTR, stc_can_statr::LEC, stc_can_ifncmsk::MASK, stc_can_ifnmctr::MSGLST, stc_can_ifncmsk::NEWDAT, stc_can_notification::pfnCanErrorInterruptFunction, stc_can_interrupt_handling::pfnCanRxInterruptFunction, stc_can_notification::pfnCanStatusInterruptFunction, stc_can_interrupt_handling::pfnCanTxInterruptFunction, stc_can_interrupt_handling::pstcMsgBuffer, stc_cann::STATR_f, stc_can_intern_data::stcCanInterruptHandling, stc_can_intern_data::stcCanNotificationCb, stc_can_msg::stcData, stc_can_msg::stcIdentifier, TRUE, stc_can_msg_id::u32Identifier, stc_cann::u32IF2ARB, stc_can_msg_data::u8DataLengthCode, stc_can_ifncmsk::WRRD, and stc_can_ifnarb2::XTD.
|
static |
Check if the given Message Buffer can be updated.
Updating is not possible if a transmission is pending, except we are in remote transmission mode.
| [in] | pstcCan | Pointer to register area of a CAN unit. |
| [in] | u8MsgBuf | Message buffer index (0 .. CAN_MESSAGE_BUFFER_COUNT - 1) |
| Ok | Message buffer can be updated |
| ErrorOperationInProgress | A transmission is pending |
Definition at line 738 of file can.c.
References ErrorInvalidParameter, ErrorOperationInProgress, stc_cann::IF1MCTR_f, Ok, stc_can_ifnmctr::RMTEN, stc_cann::TREQR1, and stc_cann::TREQR2.
Referenced by Can_SetTransmitMsgBuffer(), and Can_UpdateAndTransmitMsgBuffer().

| stc_can_instance_data_t m_astcCanInstanceDataLut[] |
Look-up table for all enabled CAN instances and their internal data.
| stc_can_instance_data_t m_astcCanInstanceDataLut[] |