RTEMS 6.1-rc1
Data Structures | Enumerator | Variables
Flexio_uart

Data Structures

struct  _flexio_uart_type
 Define FlexIO UART access structure typedef. More...
 
struct  _flexio_uart_config
 Define FlexIO UART user configuration structure. More...
 
struct  _flexio_uart_transfer
 Define FlexIO UART transfer structure. More...
 
struct  _flexio_uart_handle
 Define FLEXIO UART handle structure. More...
 

Variables

FLEXIO_Type_flexio_uart_type::flexioBase
 
uint8_t _flexio_uart_type::TxPinIndex
 
uint8_t _flexio_uart_type::RxPinIndex
 
uint8_t _flexio_uart_type::shifterIndex [2]
 
uint8_t _flexio_uart_type::timerIndex [2]
 
bool _flexio_uart_config::enableUart
 
bool _flexio_uart_config::enableInDoze
 
bool _flexio_uart_config::enableInDebug
 
bool _flexio_uart_config::enableFastAccess
 
uint32_t _flexio_uart_config::baudRate_Bps
 
flexio_uart_bit_count_per_char_t _flexio_uart_config::bitCountPerChar
 
uint8_t *   _flexio_uart_transfer::data
 
uint8_t *   _flexio_uart_transfer::rxData
 
const uint8_t *   _flexio_uart_transfer::txData
 
union {
   uint8_t *   _flexio_uart_transfer::data
 
   uint8_t *   _flexio_uart_transfer::rxData
 
   const uint8_t *   _flexio_uart_transfer::txData
 
}; 
 
size_t _flexio_uart_transfer::dataSize
 
const uint8_t *volatile _flexio_uart_handle::txData
 
volatile size_t _flexio_uart_handle::txDataSize
 
uint8_t *volatile _flexio_uart_handle::rxData
 
volatile size_t _flexio_uart_handle::rxDataSize
 
size_t _flexio_uart_handle::txDataSizeAll
 
size_t _flexio_uart_handle::rxDataSizeAll
 
uint8_t * _flexio_uart_handle::rxRingBuffer
 
size_t _flexio_uart_handle::rxRingBufferSize
 
volatile uint16_t _flexio_uart_handle::rxRingBufferHead
 
volatile uint16_t _flexio_uart_handle::rxRingBufferTail
 
flexio_uart_transfer_callback_t _flexio_uart_handle::callback
 
void * _flexio_uart_handle::userData
 
volatile uint8_t _flexio_uart_handle::txState
 
volatile uint8_t _flexio_uart_handle::rxState
 

Driver version

enum  {
  kStatus_FLEXIO_UART_TxBusy = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 0) , kStatus_FLEXIO_UART_RxBusy = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 1) , kStatus_FLEXIO_UART_TxIdle = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 2) , kStatus_FLEXIO_UART_RxIdle = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 3) ,
  kStatus_FLEXIO_UART_ERROR = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 4) , kStatus_FLEXIO_UART_RxRingBufferOverrun , kStatus_FLEXIO_UART_RxHardwareOverrun = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 6) , kStatus_FLEXIO_UART_Timeout = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 7) ,
  kStatus_FLEXIO_UART_BaudrateNotSupport
}
 Error codes for the UART driver. More...
 
enum  _flexio_uart_bit_count_per_char { kFLEXIO_UART_7BitsPerChar = 7U , kFLEXIO_UART_8BitsPerChar = 8U , kFLEXIO_UART_9BitsPerChar = 9U }
 FlexIO UART bit count per char. More...
 
enum  _flexio_uart_interrupt_enable { kFLEXIO_UART_TxDataRegEmptyInterruptEnable = 0x1U , kFLEXIO_UART_RxDataRegFullInterruptEnable = 0x2U }
 Define FlexIO UART interrupt mask. More...
 
enum  _flexio_uart_status_flags { kFLEXIO_UART_TxDataRegEmptyFlag = 0x1U , kFLEXIO_UART_RxDataRegFullFlag = 0x2U , kFLEXIO_UART_RxOverRunFlag = 0x4U }
 Define FlexIO UART status mask. More...
 
typedef enum _flexio_uart_bit_count_per_char flexio_uart_bit_count_per_char_t
 FlexIO UART bit count per char.
 
typedef struct _flexio_uart_type FLEXIO_UART_Type
 Define FlexIO UART access structure typedef.
 
typedef struct _flexio_uart_config flexio_uart_config_t
 Define FlexIO UART user configuration structure.
 
typedef struct _flexio_uart_transfer flexio_uart_transfer_t
 Define FlexIO UART transfer structure.
 
typedef struct _flexio_uart_handle flexio_uart_handle_t
 
typedef void(* flexio_uart_transfer_callback_t) (FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, status_t status, void *userData)
 FlexIO UART transfer callback function.
 
#define FSL_FLEXIO_UART_DRIVER_VERSION   (MAKE_VERSION(2, 4, 0))
 FlexIO UART driver version.
 
#define UART_RETRY_TIMES   0U /* Defining to zero means to keep waiting for the flag until it is assert/deassert. */
 Retry times for waiting flag.
 

Initialization and deinitialization

status_t FLEXIO_UART_Init (FLEXIO_UART_Type *base, const flexio_uart_config_t *userConfig, uint32_t srcClock_Hz)
 Ungates the FlexIO clock, resets the FlexIO module, configures FlexIO UART hardware, and configures the FlexIO UART with FlexIO UART configuration. The configuration structure can be filled by the user or be set with default values by FLEXIO_UART_GetDefaultConfig(). More...
 
void FLEXIO_UART_Deinit (FLEXIO_UART_Type *base)
 Resets the FlexIO UART shifter and timer config. More...
 
void FLEXIO_UART_GetDefaultConfig (flexio_uart_config_t *userConfig)
 Gets the default configuration to configure the FlexIO UART. The configuration can be used directly for calling the FLEXIO_UART_Init(). Example: More...
 

Status

uint32_t FLEXIO_UART_GetStatusFlags (FLEXIO_UART_Type *base)
 Gets the FlexIO UART status flags. More...
 
void FLEXIO_UART_ClearStatusFlags (FLEXIO_UART_Type *base, uint32_t mask)
 Gets the FlexIO UART status flags. More...
 

Interrupts

void FLEXIO_UART_EnableInterrupts (FLEXIO_UART_Type *base, uint32_t mask)
 Enables the FlexIO UART interrupt. More...
 
void FLEXIO_UART_DisableInterrupts (FLEXIO_UART_Type *base, uint32_t mask)
 Disables the FlexIO UART interrupt. More...
 

Bus Operations

status_t FLEXIO_UART_WriteBlocking (FLEXIO_UART_Type *base, const uint8_t *txData, size_t txSize)
 Sends a buffer of data bytes. More...
 
status_t FLEXIO_UART_ReadBlocking (FLEXIO_UART_Type *base, uint8_t *rxData, size_t rxSize)
 Receives a buffer of bytes. More...
 

Transactional

status_t FLEXIO_UART_TransferCreateHandle (FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, flexio_uart_transfer_callback_t callback, void *userData)
 Initializes the UART handle. More...
 
void FLEXIO_UART_TransferStartRingBuffer (FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, uint8_t *ringBuffer, size_t ringBufferSize)
 Sets up the RX ring buffer. More...
 
void FLEXIO_UART_TransferStopRingBuffer (FLEXIO_UART_Type *base, flexio_uart_handle_t *handle)
 Aborts the background transfer and uninstalls the ring buffer. More...
 
status_t FLEXIO_UART_TransferSendNonBlocking (FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, flexio_uart_transfer_t *xfer)
 Transmits a buffer of data using the interrupt method. More...
 
void FLEXIO_UART_TransferAbortSend (FLEXIO_UART_Type *base, flexio_uart_handle_t *handle)
 Aborts the interrupt-driven data transmit. More...
 
status_t FLEXIO_UART_TransferGetSendCount (FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count)
 Gets the number of bytes sent. More...
 
status_t FLEXIO_UART_TransferReceiveNonBlocking (FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, flexio_uart_transfer_t *xfer, size_t *receivedBytes)
 Receives a buffer of data using the interrupt method. More...
 
void FLEXIO_UART_TransferAbortReceive (FLEXIO_UART_Type *base, flexio_uart_handle_t *handle)
 Aborts the receive data which was using IRQ. More...
 
status_t FLEXIO_UART_TransferGetReceiveCount (FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count)
 Gets the number of bytes received. More...
 
void FLEXIO_UART_TransferHandleIRQ (void *uartType, void *uartHandle)
 FlexIO UART IRQ handler function. More...
 

Detailed Description

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Error codes for the UART driver.

Enumerator
kStatus_FLEXIO_UART_TxBusy 

Transmitter is busy.

kStatus_FLEXIO_UART_RxBusy 

Receiver is busy.

kStatus_FLEXIO_UART_TxIdle 

UART transmitter is idle.

kStatus_FLEXIO_UART_RxIdle 

UART receiver is idle.

kStatus_FLEXIO_UART_ERROR 

ERROR happens on UART.

kStatus_FLEXIO_UART_RxRingBufferOverrun 

UART RX software ring buffer overrun.

kStatus_FLEXIO_UART_RxHardwareOverrun 

UART RX receiver overrun.

kStatus_FLEXIO_UART_Timeout 

UART times out.

kStatus_FLEXIO_UART_BaudrateNotSupport 

Baudrate is not supported in current clock source

◆ _flexio_uart_bit_count_per_char

FlexIO UART bit count per char.

Enumerator
kFLEXIO_UART_7BitsPerChar 

7-bit data characters

kFLEXIO_UART_8BitsPerChar 

8-bit data characters

kFLEXIO_UART_9BitsPerChar 

9-bit data characters

◆ _flexio_uart_interrupt_enable

Define FlexIO UART interrupt mask.

Enumerator
kFLEXIO_UART_TxDataRegEmptyInterruptEnable 

Transmit buffer empty interrupt enable.

kFLEXIO_UART_RxDataRegFullInterruptEnable 

Receive buffer full interrupt enable.

◆ _flexio_uart_status_flags

Define FlexIO UART status mask.

Enumerator
kFLEXIO_UART_TxDataRegEmptyFlag 

Transmit buffer empty flag.

kFLEXIO_UART_RxDataRegFullFlag 

Receive buffer full flag.

kFLEXIO_UART_RxOverRunFlag 

Receive buffer over run flag.

Function Documentation

◆ FLEXIO_UART_ClearStatusFlags()

void FLEXIO_UART_ClearStatusFlags ( FLEXIO_UART_Type base,
uint32_t  mask 
)

Gets the FlexIO UART status flags.

Parameters
basePointer to the FLEXIO_UART_Type structure.
maskStatus flag. The parameter can be any combination of the following values:
  • kFLEXIO_UART_TxDataRegEmptyFlag
  • kFLEXIO_UART_RxEmptyFlag
  • kFLEXIO_UART_RxOverRunFlag
brief Gets the FlexIO UART status flags.

param base Pointer to the FLEXIO_UART_Type structure. param mask Status flag. The parameter can be any combination of the following values: arg kFLEXIO_UART_TxDataRegEmptyFlag arg kFLEXIO_UART_RxEmptyFlag arg kFLEXIO_UART_RxOverRunFlag

◆ FLEXIO_UART_Deinit()

void FLEXIO_UART_Deinit ( FLEXIO_UART_Type base)

Resets the FlexIO UART shifter and timer config.

Note
After calling this API, call the FLEXO_UART_Init to use the FlexIO UART module.
Parameters
basePointer to FLEXIO_UART_Type structure

brief Resets the FlexIO UART shifter and timer config.

note After calling this API, call the FLEXO_UART_Init to use the FlexIO UART module.

param base Pointer to FLEXIO_UART_Type structure

◆ FLEXIO_UART_DisableInterrupts()

void FLEXIO_UART_DisableInterrupts ( FLEXIO_UART_Type base,
uint32_t  mask 
)

Disables the FlexIO UART interrupt.

This function disables the FlexIO UART interrupt.

Parameters
basePointer to the FLEXIO_UART_Type structure.
maskInterrupt source.

brief Disables the FlexIO UART interrupt.

This function disables the FlexIO UART interrupt.

param base Pointer to the FLEXIO_UART_Type structure. param mask Interrupt source.

◆ FLEXIO_UART_EnableInterrupts()

void FLEXIO_UART_EnableInterrupts ( FLEXIO_UART_Type base,
uint32_t  mask 
)

Enables the FlexIO UART interrupt.

This function enables the FlexIO UART interrupt.

Parameters
basePointer to the FLEXIO_UART_Type structure.
maskInterrupt source.

brief Enables the FlexIO UART interrupt.

This function enables the FlexIO UART interrupt.

param base Pointer to the FLEXIO_UART_Type structure. param mask Interrupt source.

◆ FLEXIO_UART_GetDefaultConfig()

void FLEXIO_UART_GetDefaultConfig ( flexio_uart_config_t userConfig)

Gets the default configuration to configure the FlexIO UART. The configuration can be used directly for calling the FLEXIO_UART_Init(). Example:

void FLEXIO_UART_GetDefaultConfig(flexio_uart_config_t *userConfig)
Gets the default configuration to configure the FlexIO UART. The configuration can be used directly f...
Definition: fsl_flexio_uart.c:290
Define FlexIO UART user configuration structure.
Definition: fsl_flexio_uart.h:86
Definition: deflate.c:114
Parameters
userConfigPointer to the flexio_uart_config_t structure.

brief Gets the default configuration to configure the FlexIO UART. The configuration can be used directly for calling the FLEXIO_UART_Init(). Example: code flexio_uart_config_t config; FLEXIO_UART_GetDefaultConfig(&userConfig); endcode param userConfig Pointer to the flexio_uart_config_t structure.

◆ FLEXIO_UART_GetStatusFlags()

uint32_t FLEXIO_UART_GetStatusFlags ( FLEXIO_UART_Type base)

Gets the FlexIO UART status flags.

Parameters
basePointer to the FLEXIO_UART_Type structure.
Returns
FlexIO UART status flags.

brief Gets the FlexIO UART status flags.

param base Pointer to the FLEXIO_UART_Type structure. return FlexIO UART status flags.

◆ FLEXIO_UART_Init()

status_t FLEXIO_UART_Init ( FLEXIO_UART_Type base,
const flexio_uart_config_t userConfig,
uint32_t  srcClock_Hz 
)

Ungates the FlexIO clock, resets the FlexIO module, configures FlexIO UART hardware, and configures the FlexIO UART with FlexIO UART configuration. The configuration structure can be filled by the user or be set with default values by FLEXIO_UART_GetDefaultConfig().

Example

.flexioBase = FLEXIO,
.TxPinIndex = 0,
.RxPinIndex = 1,
.shifterIndex = {0,1},
.timerIndex = {0,1}
};
.enableInDoze = false,
.enableInDebug = true,
.enableFastAccess = false,
.baudRate_Bps = 115200U,
.bitCountPerChar = 8
};
FLEXIO_UART_Init(base, &config, srcClock_Hz);
status_t FLEXIO_UART_Init(FLEXIO_UART_Type *base, const flexio_uart_config_t *userConfig, uint32_t srcClock_Hz)
Ungates the FlexIO clock, resets the FlexIO module, configures FlexIO UART hardware,...
Definition: fsl_flexio_uart.c:124
Define FlexIO UART access structure typedef.
Definition: fsl_flexio_uart.h:76
Parameters
basePointer to the FLEXIO_UART_Type structure.
userConfigPointer to the flexio_uart_config_t structure.
srcClock_HzFlexIO source clock in Hz.
Return values
kStatus_SuccessConfiguration success.
kStatus_FLEXIO_UART_BaudrateNotSupportBaudrate is not supported for current clock source frequency.

brief Ungates the FlexIO clock, resets the FlexIO module, configures FlexIO UART hardware, and configures the FlexIO UART with FlexIO UART configuration. The configuration structure can be filled by the user or be set with default values by FLEXIO_UART_GetDefaultConfig().

Example code FLEXIO_UART_Type base = { .flexioBase = FLEXIO, .TxPinIndex = 0, .RxPinIndex = 1, .shifterIndex = {0,1}, .timerIndex = {0,1} }; flexio_uart_config_t config = { .enableInDoze = false, .enableInDebug = true, .enableFastAccess = false, .baudRate_Bps = 115200U, .bitCountPerChar = 8 }; FLEXIO_UART_Init(base, &config, srcClock_Hz); endcode

param base Pointer to the FLEXIO_UART_Type structure. param userConfig Pointer to the flexio_uart_config_t structure. param srcClock_Hz FlexIO source clock in Hz. retval kStatus_Success Configuration success. retval kStatus_FLEXIO_UART_BaudrateNotSupport Baudrate is not supported for current clock source frequency.

◆ FLEXIO_UART_ReadBlocking()

status_t FLEXIO_UART_ReadBlocking ( FLEXIO_UART_Type base,
uint8_t *  rxData,
size_t  rxSize 
)

Receives a buffer of bytes.

Note
This function blocks using the polling method until all bytes have been received.
Parameters
basePointer to the FLEXIO_UART_Type structure.
rxDataThe buffer to store the received bytes.
rxSizeThe number of data bytes to be received.
Return values
kStatus_FLEXIO_UART_TimeoutTransmission timed out and was aborted.
kStatus_SuccessSuccessfully received all data.

brief Receives a buffer of bytes.

note This function blocks using the polling method until all bytes have been received.

param base Pointer to the FLEXIO_UART_Type structure. param rxData The buffer to store the received bytes. param rxSize The number of data bytes to be received. retval kStatus_FLEXIO_UART_Timeout Transmission timed out and was aborted. retval kStatus_Success Successfully received all data.

◆ FLEXIO_UART_TransferAbortReceive()

void FLEXIO_UART_TransferAbortReceive ( FLEXIO_UART_Type base,
flexio_uart_handle_t handle 
)

Aborts the receive data which was using IRQ.

This function aborts the receive data which was using IRQ.

Parameters
basePointer to the FLEXIO_UART_Type structure.
handlePointer to the flexio_uart_handle_t structure to store the transfer state.

brief Aborts the receive data which was using IRQ.

This function aborts the receive data which was using IRQ.

param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state.

◆ FLEXIO_UART_TransferAbortSend()

void FLEXIO_UART_TransferAbortSend ( FLEXIO_UART_Type base,
flexio_uart_handle_t handle 
)

Aborts the interrupt-driven data transmit.

This function aborts the interrupt-driven data sending. Get the remainBytes to find out how many bytes are still not sent out.

Parameters
basePointer to the FLEXIO_UART_Type structure.
handlePointer to the flexio_uart_handle_t structure to store the transfer state.

brief Aborts the interrupt-driven data transmit.

This function aborts the interrupt-driven data sending. Get the remainBytes to find out how many bytes are still not sent out.

param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state.

◆ FLEXIO_UART_TransferCreateHandle()

status_t FLEXIO_UART_TransferCreateHandle ( FLEXIO_UART_Type base,
flexio_uart_handle_t handle,
flexio_uart_transfer_callback_t  callback,
void *  userData 
)

Initializes the UART handle.

This function initializes the FlexIO UART handle, which can be used for other FlexIO UART transactional APIs. Call this API once to get the initialized handle.

The UART driver supports the "background" receiving, which means that users can set up a RX ring buffer optionally. Data received is stored into the ring buffer even when the user doesn't call the FLEXIO_UART_TransferReceiveNonBlocking() API. If there is already data received in the ring buffer, users can get the received data from the ring buffer directly. The ring buffer is disabled if passing NULL as ringBuffer.

Parameters
baseto FLEXIO_UART_Type structure.
handlePointer to the flexio_uart_handle_t structure to store the transfer state.
callbackThe callback function.
userDataThe parameter of the callback function.
Return values
kStatus_SuccessSuccessfully create the handle.
kStatus_OutOfRangeThe FlexIO type/handle/ISR table out of range.

brief Initializes the UART handle.

This function initializes the FlexIO UART handle, which can be used for other FlexIO UART transactional APIs. Call this API once to get the initialized handle.

The UART driver supports the "background" receiving, which means that users can set up a RX ring buffer optionally. Data received is stored into the ring buffer even when the user doesn't call the FLEXIO_UART_TransferReceiveNonBlocking() API. If there is already data received in the ring buffer, users can get the received data from the ring buffer directly. The ring buffer is disabled if passing NULL as p ringBuffer.

param base to FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param callback The callback function. param userData The parameter of the callback function. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRange The FlexIO type/handle/ISR table out of range.

◆ FLEXIO_UART_TransferGetReceiveCount()

status_t FLEXIO_UART_TransferGetReceiveCount ( FLEXIO_UART_Type base,
flexio_uart_handle_t handle,
size_t *  count 
)

Gets the number of bytes received.

This function gets the number of bytes received driven by interrupt.

Parameters
basePointer to the FLEXIO_UART_Type structure.
handlePointer to the flexio_uart_handle_t structure to store the transfer state.
countNumber of bytes received so far by the non-blocking transaction.
Return values
kStatus_NoTransferInProgresstransfer has finished or no transfer in progress.
kStatus_SuccessSuccessfully return the count.

brief Gets the number of bytes received.

This function gets the number of bytes received driven by interrupt.

param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param count Number of bytes received so far by the non-blocking transaction. retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress. retval kStatus_Success Successfully return the count.

◆ FLEXIO_UART_TransferGetSendCount()

status_t FLEXIO_UART_TransferGetSendCount ( FLEXIO_UART_Type base,
flexio_uart_handle_t handle,
size_t *  count 
)

Gets the number of bytes sent.

This function gets the number of bytes sent driven by interrupt.

Parameters
basePointer to the FLEXIO_UART_Type structure.
handlePointer to the flexio_uart_handle_t structure to store the transfer state.
countNumber of bytes sent so far by the non-blocking transaction.
Return values
kStatus_NoTransferInProgresstransfer has finished or no transfer in progress.
kStatus_SuccessSuccessfully return the count.

brief Gets the number of bytes sent.

This function gets the number of bytes sent driven by interrupt.

param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param count Number of bytes sent so far by the non-blocking transaction. retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress. retval kStatus_Success Successfully return the count.

◆ FLEXIO_UART_TransferHandleIRQ()

void FLEXIO_UART_TransferHandleIRQ ( void *  uartType,
void *  uartHandle 
)

FlexIO UART IRQ handler function.

This function processes the FlexIO UART transmit and receives the IRQ request.

Parameters
uartTypePointer to the FLEXIO_UART_Type structure.
uartHandlePointer to the flexio_uart_handle_t structure to store the transfer state.

brief FlexIO UART IRQ handler function.

This function processes the FlexIO UART transmit and receives the IRQ request.

param uartType Pointer to the FLEXIO_UART_Type structure. param uartHandle Pointer to the flexio_uart_handle_t structure to store the transfer state.

◆ FLEXIO_UART_TransferReceiveNonBlocking()

status_t FLEXIO_UART_TransferReceiveNonBlocking ( FLEXIO_UART_Type base,
flexio_uart_handle_t handle,
flexio_uart_transfer_t xfer,
size_t *  receivedBytes 
)

Receives a buffer of data using the interrupt method.

This function receives data using the interrupt method. This is a non-blocking function, which returns without waiting for all data to be received. If the RX ring buffer is used and not empty, the data in ring buffer is copied and the parameter receivedBytes shows how many bytes are copied from the ring buffer. After copying, if the data in ring buffer is not enough to read, the receive request is saved by the UART driver. When new data arrives, the receive request is serviced first. When all data is received, the UART driver notifies the upper layer through a callback function and passes the status parameter kStatus_UART_RxIdle. For example, if the upper layer needs 10 bytes but there are only 5 bytes in the ring buffer, the 5 bytes are copied to xfer->data. This function returns with the parameter receivedBytes set to 5. For the last 5 bytes, newly arrived data is saved from the xfer->data[5]. When 5 bytes are received, the UART driver notifies upper layer. If the RX ring buffer is not enabled, this function enables the RX and RX interrupt to receive data to xfer->data. When all data is received, the upper layer is notified.

Parameters
basePointer to the FLEXIO_UART_Type structure.
handlePointer to the flexio_uart_handle_t structure to store the transfer state.
xferUART transfer structure. See flexio_uart_transfer_t.
receivedBytesBytes received from the ring buffer directly.
Return values
kStatus_SuccessSuccessfully queue the transfer into the transmit queue.
kStatus_FLEXIO_UART_RxBusyPrevious receive request is not finished.

brief Receives a buffer of data using the interrupt method.

This function receives data using the interrupt method. This is a non-blocking function, which returns without waiting for all data to be received. If the RX ring buffer is used and not empty, the data in ring buffer is copied and the parameter p receivedBytes shows how many bytes are copied from the ring buffer. After copying, if the data in ring buffer is not enough to read, the receive request is saved by the UART driver. When new data arrives, the receive request is serviced first. When all data is received, the UART driver notifies the upper layer through a callback function and passes the status parameter ref kStatus_UART_RxIdle. For example, if the upper layer needs 10 bytes but there are only 5 bytes in the ring buffer, the 5 bytes are copied to xfer->data. This function returns with the parameter p receivedBytes set to 5. For the last 5 bytes, newly arrived data is saved from the xfer->data[5]. When 5 bytes are received, the UART driver notifies upper layer. If the RX ring buffer is not enabled, this function enables the RX and RX interrupt to receive data to xfer->data. When all data is received, the upper layer is notified.

param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param xfer UART transfer structure. See flexio_uart_transfer_t. param receivedBytes Bytes received from the ring buffer directly. retval kStatus_Success Successfully queue the transfer into the transmit queue. retval kStatus_FLEXIO_UART_RxBusy Previous receive request is not finished.

◆ FLEXIO_UART_TransferSendNonBlocking()

status_t FLEXIO_UART_TransferSendNonBlocking ( FLEXIO_UART_Type base,
flexio_uart_handle_t handle,
flexio_uart_transfer_t xfer 
)

Transmits a buffer of data using the interrupt method.

This function sends data using an interrupt method. This is a non-blocking function, which returns directly without waiting for all data to be written to the TX register. When all data is written to the TX register in ISR, the FlexIO UART driver calls the callback function and passes the kStatus_FLEXIO_UART_TxIdle as status parameter.

Note
The kStatus_FLEXIO_UART_TxIdle is passed to the upper layer when all data is written to the TX register. However, it does not ensure that all data is sent out.
Parameters
basePointer to the FLEXIO_UART_Type structure.
handlePointer to the flexio_uart_handle_t structure to store the transfer state.
xferFlexIO UART transfer structure. See flexio_uart_transfer_t.
Return values
kStatus_SuccessSuccessfully starts the data transmission.
kStatus_UART_TxBusyPrevious transmission still not finished, data not written to the TX register.

brief Transmits a buffer of data using the interrupt method.

This function sends data using an interrupt method. This is a non-blocking function, which returns directly without waiting for all data to be written to the TX register. When all data is written to the TX register in ISR, the FlexIO UART driver calls the callback function and passes the ref kStatus_FLEXIO_UART_TxIdle as status parameter.

note The kStatus_FLEXIO_UART_TxIdle is passed to the upper layer when all data is written to the TX register. However, it does not ensure that all data is sent out.

param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param xfer FlexIO UART transfer structure. See flexio_uart_transfer_t. retval kStatus_Success Successfully starts the data transmission. retval kStatus_UART_TxBusy Previous transmission still not finished, data not written to the TX register.

◆ FLEXIO_UART_TransferStartRingBuffer()

void FLEXIO_UART_TransferStartRingBuffer ( FLEXIO_UART_Type base,
flexio_uart_handle_t handle,
uint8_t *  ringBuffer,
size_t  ringBufferSize 
)

Sets up the RX ring buffer.

This function sets up the RX ring buffer to a specific UART handle.

When the RX ring buffer is used, data received is stored into the ring buffer even when the user doesn't call the UART_ReceiveNonBlocking() API. If there is already data received in the ring buffer, users can get the received data from the ring buffer directly.

Note
When using the RX ring buffer, one byte is reserved for internal use. In other words, if ringBufferSize is 32, only 31 bytes are used for saving data.
Parameters
basePointer to the FLEXIO_UART_Type structure.
handlePointer to the flexio_uart_handle_t structure to store the transfer state.
ringBufferStart address of ring buffer for background receiving. Pass NULL to disable the ring buffer.
ringBufferSizeSize of the ring buffer.

brief Sets up the RX ring buffer.

This function sets up the RX ring buffer to a specific UART handle.

When the RX ring buffer is used, data received is stored into the ring buffer even when the user doesn't call the UART_ReceiveNonBlocking() API. If there is already data received in the ring buffer, users can get the received data from the ring buffer directly.

note When using the RX ring buffer, one byte is reserved for internal use. In other words, if p ringBufferSize is 32, only 31 bytes are used for saving data.

param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param ringBuffer Start address of ring buffer for background receiving. Pass NULL to disable the ring buffer. param ringBufferSize Size of the ring buffer.

◆ FLEXIO_UART_TransferStopRingBuffer()

void FLEXIO_UART_TransferStopRingBuffer ( FLEXIO_UART_Type base,
flexio_uart_handle_t handle 
)

Aborts the background transfer and uninstalls the ring buffer.

This function aborts the background transfer and uninstalls the ring buffer.

Parameters
basePointer to the FLEXIO_UART_Type structure.
handlePointer to the flexio_uart_handle_t structure to store the transfer state.

brief Aborts the background transfer and uninstalls the ring buffer.

This function aborts the background transfer and uninstalls the ring buffer.

param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state.

◆ FLEXIO_UART_WriteBlocking()

status_t FLEXIO_UART_WriteBlocking ( FLEXIO_UART_Type base,
const uint8_t *  txData,
size_t  txSize 
)

Sends a buffer of data bytes.

Note
This function blocks using the polling method until all bytes have been sent.
Parameters
basePointer to the FLEXIO_UART_Type structure.
txDataThe data bytes to send.
txSizeThe number of data bytes to send.
Return values
kStatus_FLEXIO_UART_TimeoutTransmission timed out and was aborted.
kStatus_SuccessSuccessfully wrote all data.

brief Sends a buffer of data bytes.

note This function blocks using the polling method until all bytes have been sent.

param base Pointer to the FLEXIO_UART_Type structure. param txData The data bytes to send. param txSize The number of data bytes to send. retval kStatus_FLEXIO_UART_Timeout Transmission timed out and was aborted. retval kStatus_Success Successfully wrote all data.

Variable Documentation

◆ baudRate_Bps

uint32_t _flexio_uart_config::baudRate_Bps

Baud rate in Bps.

◆ bitCountPerChar

flexio_uart_bit_count_per_char_t _flexio_uart_config::bitCountPerChar

number of bits, 7/8/9 -bit

◆ callback

flexio_uart_transfer_callback_t _flexio_uart_handle::callback

Callback function.

◆ data [1/2]

uint8_t* _flexio_uart_transfer::data

The buffer of data to be transfer.

◆  [2/2]

uint8_t* { ... } ::data

The buffer of data to be transfer.

◆ dataSize

size_t _flexio_uart_transfer::dataSize

Transfer size

◆ enableFastAccess

bool _flexio_uart_config::enableFastAccess

Enable/disable fast access to FlexIO registers, fast access requires the FlexIO clock to be at least twice the frequency of the bus clock.

◆ enableInDebug

bool _flexio_uart_config::enableInDebug

Enable/disable FlexIO operation in debug mode

◆ enableInDoze

bool _flexio_uart_config::enableInDoze

Enable/disable FlexIO operation in doze mode

◆ enableUart

bool _flexio_uart_config::enableUart

Enable/disable FlexIO UART TX & RX.

◆ flexioBase

FLEXIO_Type* _flexio_uart_type::flexioBase

FlexIO base pointer.

◆ rxData [1/3]

uint8_t* _flexio_uart_transfer::rxData

The buffer to receive data.

◆  [2/3]

uint8_t* { ... } ::rxData

The buffer to receive data.

◆ rxData [3/3]

uint8_t* volatile _flexio_uart_handle::rxData

Address of remaining data to receive.

◆ rxDataSize

volatile size_t _flexio_uart_handle::rxDataSize

Size of the remaining data to receive.

◆ rxDataSizeAll

size_t _flexio_uart_handle::rxDataSizeAll

Total bytes to be received.

◆ RxPinIndex

uint8_t _flexio_uart_type::RxPinIndex

Pin select for UART_Rx.

◆ rxRingBuffer

uint8_t* _flexio_uart_handle::rxRingBuffer

Start address of the receiver ring buffer.

◆ rxRingBufferHead

volatile uint16_t _flexio_uart_handle::rxRingBufferHead

Index for the driver to store received data into ring buffer.

◆ rxRingBufferSize

size_t _flexio_uart_handle::rxRingBufferSize

Size of the ring buffer.

◆ rxRingBufferTail

volatile uint16_t _flexio_uart_handle::rxRingBufferTail

Index for the user to get data from the ring buffer.

◆ rxState

volatile uint8_t _flexio_uart_handle::rxState

RX transfer state

◆ shifterIndex

uint8_t _flexio_uart_type::shifterIndex[2]

Shifter index used in FlexIO UART.

◆ timerIndex

uint8_t _flexio_uart_type::timerIndex[2]

Timer index used in FlexIO UART.

◆ txData [1/3]

const uint8_t* _flexio_uart_transfer::txData

The buffer of data to be sent.

◆  [2/3]

const uint8_t* { ... } ::txData

The buffer of data to be sent.

◆ txData [3/3]

const uint8_t* volatile _flexio_uart_handle::txData

Address of remaining data to send.

◆ txDataSize

volatile size_t _flexio_uart_handle::txDataSize

Size of the remaining data to send.

◆ txDataSizeAll

size_t _flexio_uart_handle::txDataSizeAll

Total bytes to be sent.

◆ TxPinIndex

uint8_t _flexio_uart_type::TxPinIndex

Pin select for UART_Tx.

◆ txState

volatile uint8_t _flexio_uart_handle::txState

TX transfer state.

◆ userData

void* _flexio_uart_handle::userData

UART callback function parameter.