![]() |
MCUXpresso SDK API Reference Manual
Rev 2.16.000
NXP Semiconductors
|
This document consists of sections titled with Driver Overview, Data Structures, Enumerations, Functions, etc., each with an overview list and detailed documentation. It is recommended to read the Driver Overview first for it includes a comprehensive description of the peripheral, driver and driver changes. Other sections give detailed information for APIs, enums, macros, etc., for your further reference.
Modules | |
The Driver Change Log | |
The current MSCAN driver version is 2.1.0. | |
Data Structures | |
struct | MSCAN_IDR1Type |
MSCAN IDR1 struct. More... | |
struct | MSCAN_IDR3Type |
MSCAN IDR3 struct. More... | |
union | IDR1_3_UNION |
MSCAN idr1 and idr3 union. More... | |
struct | MSCAN_ExtendIDType |
MSCAN extend ID struct. More... | |
struct | MSCAN_StandardIDType |
MSCAN standard ID struct. More... | |
struct | mscan_mb_t |
MsCAN message buffer structure. More... | |
struct | mscan_frame_t |
MsCAN frame structure. More... | |
struct | mscan_idfilter_config_t |
MsCAN module acceptance filter configuration structure. More... | |
struct | mscan_timing_config_t |
MsCAN protocol timing characteristic configuration structure. More... | |
struct | mscan_config_t |
MsCAN module configuration structure. More... | |
struct | mscan_mb_transfer_t |
MSCAN Message Buffer transfer. More... | |
struct | mscan_handle_t |
MsCAN handle structure. More... | |
Macros | |
#define | MSCAN_RX_MB_STD_MASK(id) |
MsCAN Rx Message Buffer Mask helper macro. More... | |
#define | MSCAN_R_TSRR (1U) |
MsCAN SRR bit. More... | |
#define | MSCAN_R_TEIDE (1U) |
MsCAN IDE bit. More... | |
Typedefs | |
typedef void(* | mscan_transfer_callback_t )(CAN_Type *base, mscan_handle_t *handle, status_t status, void *userData) |
MsCAN transfer callback function. More... | |
Enumerations | |
enum | { kStatus_MSCAN_TxBusy = MAKE_STATUS(kStatusGroup_MSCAN, 0), kStatus_MSCAN_TxIdle = MAKE_STATUS(kStatusGroup_MSCAN, 1), kStatus_MSCAN_TxSwitchToRx, kStatus_MSCAN_RxBusy = MAKE_STATUS(kStatusGroup_MSCAN, 3), kStatus_MSCAN_RxIdle = MAKE_STATUS(kStatusGroup_MSCAN, 4), kStatus_MSCAN_RxOverflow = MAKE_STATUS(kStatusGroup_MSCAN, 5), kStatus_MSCAN_RxFifoBusy = MAKE_STATUS(kStatusGroup_MSCAN, 6), kStatus_MSCAN_RxFifoIdle = MAKE_STATUS(kStatusGroup_MSCAN, 7), kStatus_MSCAN_RxFifoOverflow = MAKE_STATUS(kStatusGroup_MSCAN, 8), kStatus_MSCAN_RxFifoWarning = MAKE_STATUS(kStatusGroup_MSCAN, 9), kStatus_MSCAN_ErrorStatus = MAKE_STATUS(kStatusGroup_MSCAN, 10), kStatus_MSCAN_UnHandled = MAKE_STATUS(kStatusGroup_MSCAN, 11), kStatus_MSCAN_DataLengthError = MAKE_STATUS(kStatusGroup_MSCAN, 12) } |
FlexCAN transfer status. More... | |
enum | mscan_frame_format_t { kMSCAN_FrameFormatStandard = 0x0U, kMSCAN_FrameFormatExtend = 0x1U } |
MsCAN frame format. More... | |
enum | mscan_frame_type_t { kMSCAN_FrameTypeData = 0x0U, kMSCAN_FrameTypeRemote = 0x1U } |
MsCAN frame type. More... | |
enum | mscan_clock_source_t { kMSCAN_ClkSrcOsc = 0x0U, kMSCAN_ClkSrcBus = 0x1U } |
MsCAN clock source. More... | |
enum | mscan_busoffrec_mode_t { kMSCAN_BusoffrecAuto = 0x0U, kMSCAN_BusoffrecUsr = 0x1U } |
MsCAN bus-off recovery mode. More... | |
enum | _mscan_tx_buffer_empty_flag { kMSCAN_TxBuf0Empty = 0x1U, kMSCAN_TxBuf1Empty = 0x2U, kMSCAN_TxBuf2Empty = 0x4U, kMSCAN_TxBufFull = 0x0U } |
MsCAN Tx buffer empty flag. More... | |
enum | mscan_id_filter_mode_t { kMSCAN_Filter32Bit = 0x0U, kMSCAN_Filter16Bit = 0x1U, kMSCAN_Filter8Bit = 0x2U, kMSCAN_FilterClose = 0x3U } |
MsCAN id filter mode. More... | |
enum | _mscan_interrupt_enable { kMSCAN_WakeUpInterruptEnable = CAN_RIER_WUPIE_MASK, kMSCAN_StatusChangeInterruptEnable = CAN_RIER_CSCIE_MASK, kMSCAN_RxStatusChangeInterruptEnable = CAN_RIER_RSTATE_MASK, kMSCAN_TxStatusChangeInterruptEnable = CAN_RIER_TSTATE_MASK, kMSCAN_OverrunInterruptEnable = CAN_RIER_OVRIE_MASK, kMSCAN_RxFullInterruptEnable = CAN_RIER_RXFIE_MASK, kMSCAN_TxEmptyInterruptEnable = CAN_TIER_TXEIE_MASK } |
MsCAN interrupt configuration structure, default settings all disabled. More... | |
Driver version | |
#define | FSL_MSCAN_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) |
MsCAN driver version. More... | |
Initialization and deinitialization | |
void | MSCAN_Init (CAN_Type *base, const mscan_config_t *config) |
Initializes a MsCAN instance. More... | |
void | MSCAN_Deinit (CAN_Type *base) |
De-initializes a MsCAN instance. More... | |
void | MSCAN_GetDefaultConfig (mscan_config_t *config, uint32_t sourceClock_Hz) |
Gets the default configuration structure. More... | |
Configuration. | |
static uint8_t | MSCAN_GetTxBufferEmptyFlag (CAN_Type *base) |
Get the transmit buffer empty status. More... | |
static void | MSCAN_TxBufferSelect (CAN_Type *base, uint8_t txBuf) |
The selection of the actual transmit message buffer. More... | |
static uint8_t | MSCAN_GetTxBufferSelect (CAN_Type *base) |
Get the actual transmit message buffer. More... | |
static void | MSCAN_TxBufferLaunch (CAN_Type *base, uint8_t txBuf) |
Clear TFLG to schedule for transmission. More... | |
static uint8_t | MSCAN_GetTxBufferStatusFlags (CAN_Type *base, uint8_t mask) |
Get Tx buffer status flag. More... | |
static uint8_t | MSCAN_GetRxBufferFullFlag (CAN_Type *base) |
Check Receive Buffer Full Flag. More... | |
static void | MSCAN_ClearRxBufferFullFlag (CAN_Type *base) |
Clear Receive buffer Full flag. More... | |
static uint8_t | MSCAN_ReadRIDR0 (CAN_Type *base) |
static uint8_t | MSCAN_ReadRIDR1 (CAN_Type *base) |
static uint8_t | MSCAN_ReadRIDR2 (CAN_Type *base) |
static uint8_t | MSCAN_ReadRIDR3 (CAN_Type *base) |
static void | MSCAN_WriteTIDR0 (CAN_Type *base, uint8_t id) |
static void | MSCAN_WriteTIDR1 (CAN_Type *base, uint8_t id) |
static void | MSCAN_WriteTIDR2 (CAN_Type *base, uint8_t id) |
static void | MSCAN_WriteTIDR3 (CAN_Type *base, uint8_t id) |
static void | MSCAN_SetIDFilterMode (CAN_Type *base, mscan_id_filter_mode_t mode) |
static void | MSCAN_WriteIDAR0 (CAN_Type *base, uint8_t *pID) |
static void | MSCAN_WriteIDAR1 (CAN_Type *base, uint8_t *pID) |
static void | MSCAN_WriteIDMR0 (CAN_Type *base, uint8_t *pID) |
static void | MSCAN_WriteIDMR1 (CAN_Type *base, uint8_t *pID) |
bool | MSCAN_CalculateImprovedTimingValues (uint32_t baudRate, uint32_t sourceClock_Hz, mscan_timing_config_t *pconfig) |
Calculates the improved timing values by specific baudrates for classical MSCAN. More... | |
void | MSCAN_SetTimingConfig (CAN_Type *base, const mscan_timing_config_t *config) |
Sets the MsCAN protocol timing characteristic. More... | |
status_t | MSCAN_SetBaudRate (CAN_Type *base, uint32_t sourceClock_Hz, uint32_t baudRate_Bps) |
Set Baud Rate of MsCAN. More... | |
Status | |
static uint8_t | MSCAN_GetTxBufEmptyFlags (CAN_Type *base) |
Gets the MsCAN Tx buffer empty flags. More... | |
Interrupts | |
static void | MSCAN_EnableTxInterrupts (CAN_Type *base, uint8_t mask) |
Enables MsCAN Transmitter interrupts according to the provided mask. More... | |
static void | MSCAN_DisableTxInterrupts (CAN_Type *base, uint8_t mask) |
Disables MsCAN Transmitter interrupts according to the provided mask. More... | |
static void | MSCAN_EnableRxInterrupts (CAN_Type *base, uint8_t mask) |
Enables MsCAN Receiver interrupts according to the provided mask. More... | |
static void | MSCAN_DisableRxInterrupts (CAN_Type *base, uint8_t mask) |
Disables MsCAN Receiver interrupts according to the provided mask. More... | |
static void | MSCAN_AbortTxRequest (CAN_Type *base, uint8_t mask) |
Abort MsCAN Tx request. More... | |
Bus Operations | |
static void | MSCAN_Enable (CAN_Type *base, bool enable) |
Enables or disables the MsCAN module operation. More... | |
status_t | MSCAN_WriteTxMb (CAN_Type *base, mscan_frame_t *pTxFrame) |
Writes a MsCAN Message to the Transmit Message Buffer. More... | |
status_t | MSCAN_ReadRxMb (CAN_Type *base, mscan_frame_t *pRxFrame) |
Reads a MsCAN Message from Receive Message Buffer. More... | |
Transactional | |
void | MSCAN_TransferCreateHandle (CAN_Type *base, mscan_handle_t *handle, mscan_transfer_callback_t callback, void *userData) |
Initializes the MsCAN handle. More... | |
status_t | MSCAN_TransferSendBlocking (CAN_Type *base, mscan_frame_t *pTxFrame) |
Performs a polling send transaction on the CAN bus. More... | |
status_t | MSCAN_TransferReceiveBlocking (CAN_Type *base, mscan_frame_t *pRxFrame) |
Performs a polling receive transaction on the CAN bus. More... | |
status_t | MSCAN_TransferSendNonBlocking (CAN_Type *base, mscan_handle_t *handle, mscan_mb_transfer_t *xfer) |
Sends a message using IRQ. More... | |
status_t | MSCAN_TransferReceiveNonBlocking (CAN_Type *base, mscan_handle_t *handle, mscan_mb_transfer_t *xfer) |
Receives a message using IRQ. More... | |
void | MSCAN_TransferAbortSend (CAN_Type *base, mscan_handle_t *handle, uint8_t mask) |
Aborts the interrupt driven message send process. More... | |
void | MSCAN_TransferAbortReceive (CAN_Type *base, mscan_handle_t *handle, uint8_t mask) |
Aborts the interrupt driven message receive process. More... | |
void | MSCAN_TransferHandleIRQ (CAN_Type *base, mscan_handle_t *handle) |
MSCAN IRQ handle function. More... | |
struct MSCAN_IDR1Type |
Data Fields | |
uint8_t | EID17_15: 3 |
Extended Format Identifier 17-15. | |
uint8_t | R_TEIDE: 1 |
ID Extended. | |
uint8_t | R_TSRR: 1 |
Substitute Remote Request. | |
uint8_t | EID20_18_OR_SID2_0: 3 |
Extended Format Identifier 18-20 or standard format bit 0-2. | |
struct MSCAN_IDR3Type |
union IDR1_3_UNION |
Data Fields | |
MSCAN_IDR1Type | IDR1 |
structure for identifier 1 | |
MSCAN_IDR3Type | IDR3 |
structure for identifier 3 | |
uint8_t | Bytes |
bytes | |
struct MSCAN_ExtendIDType |
struct mscan_mb_t |
Data Fields | |
uint8_t | EIDR0 |
Extended Identifier Register 0. | |
uint8_t | EIDR1 |
Extended Identifier Register 1. | |
uint8_t | EIDR2 |
Extended Identifier Register 2. | |
uint8_t | EIDR3 |
Extended Identifier Register 3. | |
uint8_t | EDSR [8] |
Extended Data Segment Register. | |
uint8_t | DLR |
data length field | |
uint8_t | BPR |
Buffer Priority Register. | |
uint8_t | TSRH |
Time Stamp Register High. | |
uint8_t | TSRL |
Time Stamp Register Low. | |
struct mscan_frame_t |
Data Fields | |
union { | |
MSCAN_StandardIDType StdID | |
standard format | |
MSCAN_ExtendIDType ExtID | |
extend format | |
uint32_t ID | |
Identifire with 32 bit format. | |
} | ID_Type |
identifier union | |
uint8_t | DLR |
data length | |
uint8_t | BPR |
transmit buffer priority | |
mscan_frame_type_t | type |
remote frame or data frame | |
mscan_frame_format_t | format |
extend frame or standard frame | |
uint8_t | TSRH |
time stamp high byte | |
uint8_t | TSRL |
time stamp low byte | |
uint8_t | DSR [8] |
data segment | |
uint32_t | dataWord0 |
MSCAN Frame payload word0. More... | |
uint32_t | dataWord1 |
MSCAN Frame payload word1. More... | |
uint8_t | dataByte0 |
MSCAN Frame payload byte0. More... | |
uint8_t | dataByte1 |
MSCAN Frame payload byte1. More... | |
uint8_t | dataByte2 |
MSCAN Frame payload byte2. More... | |
uint8_t | dataByte3 |
MSCAN Frame payload byte3. More... | |
uint8_t | dataByte4 |
MSCAN Frame payload byte4. More... | |
uint8_t | dataByte5 |
MSCAN Frame payload byte5. More... | |
uint8_t | dataByte6 |
MSCAN Frame payload byte6. More... | |
uint8_t | dataByte7 |
MSCAN Frame payload byte7. More... | |
uint32_t mscan_frame_t::dataWord0 |
uint32_t mscan_frame_t::dataWord1 |
uint8_t mscan_frame_t::dataByte0 |
uint8_t mscan_frame_t::dataByte1 |
uint8_t mscan_frame_t::dataByte2 |
uint8_t mscan_frame_t::dataByte3 |
uint8_t mscan_frame_t::dataByte4 |
uint8_t mscan_frame_t::dataByte5 |
uint8_t mscan_frame_t::dataByte6 |
uint8_t mscan_frame_t::dataByte7 |
struct mscan_idfilter_config_t |
Data Fields | |
mscan_id_filter_mode_t | filterMode |
MSCAN Identifier Acceptance Filter Mode. | |
uint32_t | u32IDAR0 |
MSCAN Identifier Acceptance Register n of First Bank. | |
uint32_t | u32IDAR1 |
MSCAN Identifier Acceptance Register n of Second Bank. | |
uint32_t | u32IDMR0 |
MSCAN Identifier Mask Register n of First Bank. | |
uint32_t | u32IDMR1 |
MSCAN Identifier Mask Register n of Second Bank. | |
struct mscan_timing_config_t |
Data Fields | |
uint8_t | priDiv |
Baud rate prescaler. More... | |
uint8_t | sJumpwidth |
Sync Jump Width. More... | |
uint8_t | timeSeg1 |
Time Segment 1. More... | |
uint8_t | timeSeg2 |
Time Segment 2. More... | |
uint8_t | samp |
Number of samples per bit time. More... | |
uint8_t mscan_timing_config_t::priDiv |
uint8_t mscan_timing_config_t::sJumpwidth |
uint8_t mscan_timing_config_t::timeSeg1 |
uint8_t mscan_timing_config_t::timeSeg2 |
uint8_t mscan_timing_config_t::samp |
struct mscan_config_t |
Data Fields | |
bool | enableTimer |
Enable or Disable free running timer. More... | |
bool | enableWakeup |
Enable or Disable Wakeup Mode. More... | |
mscan_clock_source_t | clkSrc |
Clock source for MsCAN Protocol Engine. More... | |
bool | enableLoopBack |
Enable or Disable Loop Back Self Test Mode. More... | |
bool | enableListen |
Enable or Disable Listen Only Mode. More... | |
mscan_busoffrec_mode_t | busoffrecMode |
Bus-Off Recovery Mode. More... | |
mscan_idfilter_config_t | filterConfig |
MsCAN acceptance filter configuration. More... | |
bool | enableTimingCalc |
Enable or Disable automatically calculate bit timing during initialization. More... | |
uint32_t | baudRate |
MsCAN baud rate in bps. More... | |
uint32_t | sourceClock |
MsCAN peripheral clock in HZ. More... | |
mscan_timing_config_t | timingConfig |
User's precise MsCAN protocol timing characteristic configuration. More... | |
bool mscan_config_t::enableTimer |
bool mscan_config_t::enableWakeup |
mscan_clock_source_t mscan_config_t::clkSrc |
bool mscan_config_t::enableLoopBack |
bool mscan_config_t::enableListen |
mscan_busoffrec_mode_t mscan_config_t::busoffrecMode |
mscan_idfilter_config_t mscan_config_t::filterConfig |
bool mscan_config_t::enableTimingCalc |
uint32_t mscan_config_t::baudRate |
Only meaningful when the enableTimingCalc is true.
uint32_t mscan_config_t::sourceClock |
Only meaningful when the enableTimingCalc is true.
mscan_timing_config_t mscan_config_t::timingConfig |
Only meaningful when the enableTimingCalc is false.
struct mscan_mb_transfer_t |
Data Fields | |
mscan_frame_t * | frame |
The buffer of CAN Message to be transfer. More... | |
uint8_t | mask |
The mask of Tx buffer. More... | |
mscan_frame_t* mscan_mb_transfer_t::frame |
uint8_t mscan_mb_transfer_t::mask |
struct _mscan_handle |
MsCAN handle structure definition.
Data Fields | |
mscan_transfer_callback_t | callback |
Callback function. More... | |
void * | userData |
MsCAN callback function parameter. More... | |
mscan_frame_t *volatile | mbFrameBuf |
The buffer for received data from Message Buffers. More... | |
volatile uint8_t | mbStateTx |
Message Buffer transfer state. More... | |
volatile uint8_t | mbStateRx |
Message Buffer transfer state. More... | |
mscan_transfer_callback_t mscan_handle_t::callback |
void* mscan_handle_t::userData |
mscan_frame_t* volatile mscan_handle_t::mbFrameBuf |
volatile uint8_t mscan_handle_t::mbStateTx |
volatile uint8_t mscan_handle_t::mbStateRx |
#define FSL_MSCAN_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) |
#define MSCAN_RX_MB_STD_MASK | ( | id | ) |
Standard Rx Message Buffer Mask helper macro.
#define MSCAN_R_TSRR (1U) |
#define MSCAN_R_TEIDE (1U) |
typedef void(* mscan_transfer_callback_t)(CAN_Type *base, mscan_handle_t *handle, status_t status, void *userData) |
The MsCAN transfer callback returns a value from the underlying layer. If the status equals to kStatus_MSCAN_ErrorStatus, the result parameter is the Content of MsCAN status register which can be used to get the working status(or error status) of MsCAN module. If the status equals to other MsCAN Message Buffer transfer status, the result is the index of Message Buffer that generate transfer event. If the status equals to other MsCAN Message Buffer transfer status, the result is meaningless and should be Ignored. If the status equals kStatus_MSCAN_DataLengthError, it means the received frame data length code (DLC) is wrong.
anonymous enum |
enum mscan_frame_format_t |
enum mscan_frame_type_t |
enum mscan_clock_source_t |
This structure contains the settings for all of the MsCAN Module interrupt configurations.
void MSCAN_Init | ( | CAN_Type * | base, |
const mscan_config_t * | config | ||
) |
This function initializes the MsCAN module with user-defined settings. This example shows how to set up the mscan_config_t parameters and how to call the MSCAN_Init function by passing in these parameters.When mscanConfig.enableTimingCalc is true and the clock and baudrate parameters are not completely matched, there will be a certain error in the automatically calculated bit timing value. The user can know whether the clock and baudrate match by calling MSCAN_CalculateImprovedTimingValues() API, and get the calculated bit timing.
param base MsCAN peripheral base address. param config Pointer to the user-defined configuration structure.
void MSCAN_Deinit | ( | CAN_Type * | base | ) |
This function disables the MsCAN module clock and sets all register values to the reset value.
base | MsCAN peripheral base address. |
void MSCAN_GetDefaultConfig | ( | mscan_config_t * | config, |
uint32_t | sourceClock_Hz | ||
) |
This function initializes the MsCAN configuration structure to default values. User is requested to provide the clock frequency for the peripheral.
config | Pointer to the MsCAN configuration structure. |
sourceClock_Hz | MsCAN peripheral clock |
|
inlinestatic |
This flag indicates that the associated transmit message buffer is empty.
base | MsCAN peripheral base address. |
|
inlinestatic |
To get the next available transmit buffer, read the TFLG register and write its value back into the TBSEL register.
base | MsCAN peripheral base address. |
txBuf | The value read from TFLG. |
|
inlinestatic |
After write TFLG value back into the TBSEL register, read again CANBSEL to get the actual trasnsmit message buffer.
base | MsCAN peripheral base address. |
|
inlinestatic |
The CPU must clear the flag after a message is set up in the transmit buffer and is due for transmission.
base | MsCAN peripheral base address. |
txBuf | Message buffer(s) to be cleared. |
|
inlinestatic |
The bit is set after successful transmission.
base | MsCAN peripheral base address. |
mask | Message buffer(s) mask. |
|
inlinestatic |
RXF is set by the MSCAN when a new message is shifted in the receiver FIFO. This flag indicates whether the shifted buffer is loaded with a correctly received message.
base | MsCAN peripheral base address. |
|
inlinestatic |
After the CPU has read that message from the RxFG buffer in the receiver FIFO The RXF flag must be cleared to release the buffer.
base | MsCAN peripheral base address. |
bool MSCAN_CalculateImprovedTimingValues | ( | uint32_t | baudRate, |
uint32_t | sourceClock_Hz, | ||
mscan_timing_config_t * | pconfig | ||
) |
baudRate | The classical MSCAN speed in bps defined by user |
sourceClock_Hz | The Source clock frequency in Hz. |
pconfig | Pointer to the MSCAN timing configuration structure. |
void MSCAN_SetTimingConfig | ( | CAN_Type * | base, |
const mscan_timing_config_t * | config | ||
) |
This function gives user settings to CAN bus timing characteristic. The function is for an experienced user. For less experienced users, call the MSCAN_GetDefaultConfig() and the MSCAN_Init() to fill the baud rate field with auto-calculates values (base on the default baud rate). This provides the default timing characteristics to the module. Users also can call MSCAN_SetBaudRate() to set auto-calculates timing values base on the desired baud rate.
base | MsCAN peripheral base address. |
config | Pointer to the timing configuration structure. |
status_t MSCAN_SetBaudRate | ( | CAN_Type * | base, |
uint32_t | sourceClock_Hz, | ||
uint32_t | baudRate_Bps | ||
) |
This function calculation and configuration the protocol timing characteristic of MsCAN based on the peripheral clock and target bit rate.
base | MsCAN peripheral base address. |
sourceClock_Hz | Source Clock in Hz. |
baudRate_Bps | Baud Rate in Bps. |
kStatus_Success | Set baud rate success. |
kStatus_Fail | Set baud rate fail. |
|
inlinestatic |
This function gets MsCAN Tx buffer empty flags. It's returned as the value of the enumerators _mscan_tx_buffer_empty_flag.
base | MsCAN peripheral base address. |
|
inlinestatic |
This function enables the MsCAN Tx empty interrupts according to the mask.
base | MsCAN peripheral base address. |
mask | The Tx interrupts mask to enable. |
|
inlinestatic |
This function disables the MsCAN Tx emtpy interrupts according to the mask.
base | MsCAN peripheral base address. |
mask | The Tx interrupts mask to disable. |
|
inlinestatic |
This function enables the MsCAN Rx interrupts according to the provided mask which is a logical OR of enumeration members, see _mscan_interrupt_enable.
base | MsCAN peripheral base address. |
mask | The interrupts to enable. Logical OR of _mscan_interrupt_enable. |
|
inlinestatic |
This function disables the MsCAN Rx interrupts according to the provided mask which is a logical OR of enumeration members, see _mscan_interrupt_enable.
base | MsCAN peripheral base address. |
mask | The interrupts to disable. Logical OR of _mscan_interrupt_enable. |
|
inlinestatic |
This function allows abort request of queued messages.
base | MsCAN peripheral base address. |
mask | The Tx mask to abort. |
|
inlinestatic |
This function enables or disables the MsCAN module.
base | MsCAN base pointer. |
enable | true to enable, false to disable. |
status_t MSCAN_WriteTxMb | ( | CAN_Type * | base, |
mscan_frame_t * | pTxFrame | ||
) |
This function writes a CAN Message to the specified Transmit Message Buffer and changes the Message Buffer state to start CAN Message transmit. After that the function returns immediately.
base | MsCAN peripheral base address. |
pTxFrame | Pointer to CAN message frame to be sent. |
kStatus_Success | - Write Tx Message Buffer Successfully. |
kStatus_Fail | - Tx Message Buffer is currently in use. |
kStatus_MSCAN_DataLengthError | - Tx Message Buffer data length is wrong. |
status_t MSCAN_ReadRxMb | ( | CAN_Type * | base, |
mscan_frame_t * | pRxFrame | ||
) |
This function reads a CAN message from a specified Receive Message Buffer. The function fills a receive CAN message frame structure with just received data and activates the Message Buffer again. The function returns immediately.
base | MsCAN peripheral base address. |
pRxFrame | Pointer to CAN message frame structure for reception. |
kStatus_Success | - Rx Message Buffer is full and has been read successfully. |
kStatus_Fail | - Rx Message Buffer is empty. |
kStatus_MSCAN_DataLengthError | - Rx Message data length is wrong. |
void MSCAN_TransferCreateHandle | ( | CAN_Type * | base, |
mscan_handle_t * | handle, | ||
mscan_transfer_callback_t | callback, | ||
void * | userData | ||
) |
This function initializes the MsCAN handle, which can be used for other MsCAN transactional APIs. Usually, for a specified MsCAN instance, call this API once to get the initialized handle.
base | MsCAN peripheral base address. |
handle | MsCAN handle pointer. |
callback | The callback function. |
userData | The parameter of the callback function. |
status_t MSCAN_TransferSendBlocking | ( | CAN_Type * | base, |
mscan_frame_t * | pTxFrame | ||
) |
Note that a transfer handle does not need to be created before calling this API.
base | MsCAN peripheral base pointer. |
pTxFrame | Pointer to CAN message frame to be sent. |
kStatus_Success | - Write Tx Message Buffer Successfully. |
kStatus_Fail | - Tx Message Buffer is currently in use. |
kStatus_MSCAN_DataLengthError | - Tx Message Buffer data length is wrong. |
status_t MSCAN_TransferReceiveBlocking | ( | CAN_Type * | base, |
mscan_frame_t * | pRxFrame | ||
) |
Note that a transfer handle does not need to be created before calling this API.
base | MsCAN peripheral base pointer. |
pRxFrame | Pointer to CAN message frame to be received. |
kStatus_Success | - Read Rx Message Buffer Successfully. |
kStatus_Fail | - Tx Message Buffer is currently in use. |
kStatus_MSCAN_DataLengthError | - Rx Message data length is wrong. |
status_t MSCAN_TransferSendNonBlocking | ( | CAN_Type * | base, |
mscan_handle_t * | handle, | ||
mscan_mb_transfer_t * | xfer | ||
) |
This function sends a message using IRQ. This is a non-blocking function, which returns right away. When messages have been sent out, the send callback function is called.
base | MsCAN peripheral base address. |
handle | MsCAN handle pointer. |
xfer | MsCAN Message Buffer transfer structure. See the mscan_mb_transfer_t. |
kStatus_Success | Start Tx Message Buffer sending process successfully. |
kStatus_Fail | Write Tx Message Buffer failed. |
kStatus_MSCAN_DataLengthError | - Tx Message Buffer data length is wrong. |
status_t MSCAN_TransferReceiveNonBlocking | ( | CAN_Type * | base, |
mscan_handle_t * | handle, | ||
mscan_mb_transfer_t * | xfer | ||
) |
This function receives a message using IRQ. This is non-blocking function, which returns right away. When the message has been received, the receive callback function is called.
base | MsCAN peripheral base address. |
handle | MsCAN handle pointer. |
xfer | MsCAN Message Buffer transfer structure. See the mscan_mb_transfer_t. |
kStatus_Success | - Start Rx Message Buffer receiving process successfully. |
kStatus_MSCAN_RxBusy | - Rx Message Buffer is in use. |
void MSCAN_TransferAbortSend | ( | CAN_Type * | base, |
mscan_handle_t * | handle, | ||
uint8_t | mask | ||
) |
This function aborts the interrupt driven message send process.
base | MsCAN peripheral base address. |
handle | MsCAN handle pointer. |
mask | The MsCAN Tx Message Buffer mask. |
void MSCAN_TransferAbortReceive | ( | CAN_Type * | base, |
mscan_handle_t * | handle, | ||
uint8_t | mask | ||
) |
This function aborts the interrupt driven message receive process.
base | MsCAN peripheral base address. |
handle | MsCAN handle pointer. |
mask | The MsCAN Rx Message Buffer mask. |
void MSCAN_TransferHandleIRQ | ( | CAN_Type * | base, |
mscan_handle_t * | handle | ||
) |
This function handles the MSCAN Error, the Message Buffer, and the Rx FIFO IRQ request.
base | MSCAN peripheral base address. |
handle | MSCAN handle pointer. |