![]() |
PDL for FM4
Version1.2
Peripheral Driverl Library for FM4
|
#include "pdl.h"

Go to the source code of this file.
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 | 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 | |
| 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... | |
| 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... | |