rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Data Structures | Enumerator | Variables
Lpuart_driver

Data Structures

struct  _lpuart_config
 LPUART configuration structure. More...
 
struct  _lpuart_transfer
 LPUART transfer structure. More...
 
struct  _lpuart_handle
 LPUART handle structure. More...
 

Variables

uint32_t _lpuart_config::baudRate_Bps
 
lpuart_parity_mode_t _lpuart_config::parityMode
 
lpuart_data_bits_t _lpuart_config::dataBitsCount
 
bool _lpuart_config::isMsb
 
lpuart_stop_bit_count_t _lpuart_config::stopBitCount
 
uint8_t _lpuart_config::txFifoWatermark
 
uint8_t _lpuart_config::rxFifoWatermark
 
bool _lpuart_config::enableRxRTS
 
bool _lpuart_config::enableTxCTS
 
lpuart_transmit_cts_source_t _lpuart_config::txCtsSource
 
lpuart_transmit_cts_config_t _lpuart_config::txCtsConfig
 
lpuart_idle_type_select_t _lpuart_config::rxIdleType
 
lpuart_idle_config_t _lpuart_config::rxIdleConfig
 
bool _lpuart_config::enableTx
 
bool _lpuart_config::enableRx
 
uint8_t * _lpuart_transfer::data
 
size_t _lpuart_transfer::dataSize
 
uint8_t *volatile _lpuart_handle::txData
 
volatile size_t _lpuart_handle::txDataSize
 
size_t _lpuart_handle::txDataSizeAll
 
uint8_t *volatile _lpuart_handle::rxData
 
volatile size_t _lpuart_handle::rxDataSize
 
size_t _lpuart_handle::rxDataSizeAll
 
uint8_t * _lpuart_handle::rxRingBuffer
 
size_t _lpuart_handle::rxRingBufferSize
 
volatile uint16_t _lpuart_handle::rxRingBufferHead
 
volatile uint16_t _lpuart_handle::rxRingBufferTail
 
lpuart_transfer_callback_t _lpuart_handle::callback
 
void * _lpuart_handle::userData
 
volatile uint8_t _lpuart_handle::txState
 
volatile uint8_t _lpuart_handle::rxState
 
bool _lpuart_handle::isSevenDataBits
 

Driver version

enum  _lpuart_status {
  kStatus_LPUART_TxBusy = MAKE_STATUS(kStatusGroup_LPUART, 0) , kStatus_LPUART_RxBusy = MAKE_STATUS(kStatusGroup_LPUART, 1) , kStatus_LPUART_TxIdle = MAKE_STATUS(kStatusGroup_LPUART, 2) , kStatus_LPUART_RxIdle = MAKE_STATUS(kStatusGroup_LPUART, 3) ,
  kStatus_LPUART_TxWatermarkTooLarge = MAKE_STATUS(kStatusGroup_LPUART, 4) , kStatus_LPUART_RxWatermarkTooLarge = MAKE_STATUS(kStatusGroup_LPUART, 5) , kStatus_LPUART_FlagCannotClearManually = MAKE_STATUS(kStatusGroup_LPUART, 6) , kStatus_LPUART_Error = MAKE_STATUS(kStatusGroup_LPUART, 7) ,
  kStatus_LPUART_RxRingBufferOverrun , kStatus_LPUART_RxHardwareOverrun = MAKE_STATUS(kStatusGroup_LPUART, 9) , kStatus_LPUART_NoiseError = MAKE_STATUS(kStatusGroup_LPUART, 10) , kStatus_LPUART_FramingError = MAKE_STATUS(kStatusGroup_LPUART, 11) ,
  kStatus_LPUART_ParityError = MAKE_STATUS(kStatusGroup_LPUART, 12) , kStatus_LPUART_BaudrateNotSupport , kStatus_LPUART_IdleLineDetected = MAKE_STATUS(kStatusGroup_LPUART, 14)
}
 Error codes for the LPUART driver. More...
 
enum  _lpuart_parity_mode { kLPUART_ParityDisabled = 0x0U , kLPUART_ParityEven = 0x2U , kLPUART_ParityOdd = 0x3U }
 LPUART parity mode. More...
 
enum  _lpuart_data_bits { kLPUART_EightDataBits = 0x0U , kLPUART_SevenDataBits = 0x1U }
 LPUART data bits count. More...
 
enum  _lpuart_stop_bit_count { kLPUART_OneStopBit = 0U , kLPUART_TwoStopBit = 1U }
 LPUART stop bit count. More...
 
enum  _lpuart_transmit_cts_source { kLPUART_CtsSourcePin = 0U , kLPUART_CtsSourceMatchResult = 1U }
 LPUART transmit CTS source. More...
 
enum  _lpuart_transmit_cts_config { kLPUART_CtsSampleAtStart = 0U , kLPUART_CtsSampleAtIdle = 1U }
 LPUART transmit CTS configure. More...
 
enum  _lpuart_idle_type_select { kLPUART_IdleTypeStartBit = 0U , kLPUART_IdleTypeStopBit = 1U }
 LPUART idle flag type defines when the receiver starts counting. More...
 
enum  _lpuart_idle_config {
  kLPUART_IdleCharacter1 = 0U , kLPUART_IdleCharacter2 = 1U , kLPUART_IdleCharacter4 = 2U , kLPUART_IdleCharacter8 = 3U ,
  kLPUART_IdleCharacter16 = 4U , kLPUART_IdleCharacter32 = 5U , kLPUART_IdleCharacter64 = 6U , kLPUART_IdleCharacter128 = 7U
}
 LPUART idle detected configuration. This structure defines the number of idle characters that must be received before the IDLE flag is set. More...
 
enum  _lpuart_interrupt_enable {
  kLPUART_LinBreakInterruptEnable = (LPUART_BAUD_LBKDIE_MASK >> 8) , kLPUART_RxActiveEdgeInterruptEnable = (LPUART_BAUD_RXEDGIE_MASK >> 8) , kLPUART_TxDataRegEmptyInterruptEnable = (LPUART_CTRL_TIE_MASK) , kLPUART_TransmissionCompleteInterruptEnable = (LPUART_CTRL_TCIE_MASK) ,
  kLPUART_RxDataRegFullInterruptEnable = (LPUART_CTRL_RIE_MASK) , kLPUART_IdleLineInterruptEnable = (LPUART_CTRL_ILIE_MASK) , kLPUART_RxOverrunInterruptEnable = (LPUART_CTRL_ORIE_MASK) , kLPUART_NoiseErrorInterruptEnable = (LPUART_CTRL_NEIE_MASK) ,
  kLPUART_FramingErrorInterruptEnable = (LPUART_CTRL_FEIE_MASK) , kLPUART_ParityErrorInterruptEnable = (LPUART_CTRL_PEIE_MASK) , kLPUART_TxFifoOverflowInterruptEnable = (LPUART_FIFO_TXOFE_MASK >> 8) , kLPUART_RxFifoUnderflowInterruptEnable = (LPUART_FIFO_RXUFE_MASK >> 8)
}
 LPUART interrupt configuration structure, default settings all disabled. More...
 
enum  _lpuart_flags {
  kLPUART_TxDataRegEmptyFlag , kLPUART_TransmissionCompleteFlag , kLPUART_RxDataRegFullFlag , kLPUART_IdleLineFlag = (LPUART_STAT_IDLE_MASK) ,
  kLPUART_RxOverrunFlag = (LPUART_STAT_OR_MASK) , kLPUART_NoiseErrorFlag = (LPUART_STAT_NF_MASK) , kLPUART_FramingErrorFlag , kLPUART_ParityErrorFlag = (LPUART_STAT_PF_MASK) ,
  kLPUART_LinBreakFlag , kLPUART_RxActiveEdgeFlag , kLPUART_RxActiveFlag , kLPUART_DataMatch1Flag = LPUART_STAT_MA1F_MASK ,
  kLPUART_DataMatch2Flag = LPUART_STAT_MA2F_MASK , kLPUART_NoiseErrorInRxDataRegFlag , kLPUART_ParityErrorInRxDataRegFlag , kLPUART_TxFifoEmptyFlag = (LPUART_FIFO_TXEMPT_MASK >> 16) ,
  kLPUART_RxFifoEmptyFlag = (LPUART_FIFO_RXEMPT_MASK >> 16) , kLPUART_TxFifoOverflowFlag , kLPUART_RxFifoUnderflowFlag
}
 LPUART status flags. More...
 
typedef enum _lpuart_parity_mode lpuart_parity_mode_t
 LPUART parity mode.
 
typedef enum _lpuart_data_bits lpuart_data_bits_t
 LPUART data bits count.
 
typedef enum _lpuart_stop_bit_count lpuart_stop_bit_count_t
 LPUART stop bit count.
 
typedef enum _lpuart_transmit_cts_source lpuart_transmit_cts_source_t
 LPUART transmit CTS source.
 
typedef enum _lpuart_transmit_cts_config lpuart_transmit_cts_config_t
 LPUART transmit CTS configure.
 
typedef enum _lpuart_idle_type_select lpuart_idle_type_select_t
 LPUART idle flag type defines when the receiver starts counting.
 
typedef enum _lpuart_idle_config lpuart_idle_config_t
 LPUART idle detected configuration. This structure defines the number of idle characters that must be received before the IDLE flag is set.
 
typedef struct _lpuart_config lpuart_config_t
 LPUART configuration structure.
 
typedef struct _lpuart_transfer lpuart_transfer_t
 LPUART transfer structure.
 
typedef struct _lpuart_handle lpuart_handle_t
 
typedef void(* lpuart_transfer_callback_t) (LPUART_Type *base, lpuart_handle_t *handle, status_t status, void *userData)
 LPUART transfer callback function.
 

Software Reset

static void LPUART_SoftwareReset (LPUART_Type *base)
 Resets the LPUART using software.
 

Initialization and deinitialization

status_t LPUART_Init (LPUART_Type *base, const lpuart_config_t *config, uint32_t srcClock_Hz)
 Initializes an LPUART instance with the user configuration structure and the peripheral clock.
 
void LPUART_Deinit (LPUART_Type *base)
 Deinitializes a LPUART instance.
 
void LPUART_GetDefaultConfig (lpuart_config_t *config)
 Gets the default configuration structure.
 
status_t LPUART_SetBaudRate (LPUART_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz)
 Sets the LPUART instance baudrate.
 

Status

uint32_t LPUART_GetStatusFlags (LPUART_Type *base)
 Gets LPUART status flags.
 
status_t LPUART_ClearStatusFlags (LPUART_Type *base, uint32_t mask)
 Clears status flags with a provided mask.
 

Interrupts

void LPUART_EnableInterrupts (LPUART_Type *base, uint32_t mask)
 Enables LPUART interrupts according to a provided mask.
 
void LPUART_DisableInterrupts (LPUART_Type *base, uint32_t mask)
 Disables LPUART interrupts according to a provided mask.
 
uint32_t LPUART_GetEnabledInterrupts (LPUART_Type *base)
 Gets enabled LPUART interrupts.
 
static uint32_t LPUART_GetDataRegisterAddress (LPUART_Type *base)
 Gets the LPUART data register address.
 
static void LPUART_EnableTxDMA (LPUART_Type *base, bool enable)
 Enables or disables the LPUART transmitter DMA request.
 
static void LPUART_EnableRxDMA (LPUART_Type *base, bool enable)
 Enables or disables the LPUART receiver DMA.
 

Bus Operations

uint32_t LPUART_GetInstance (LPUART_Type *base)
 Get the LPUART instance from peripheral base address.
 
static void LPUART_EnableTx (LPUART_Type *base, bool enable)
 Enables or disables the LPUART transmitter.
 
static void LPUART_EnableRx (LPUART_Type *base, bool enable)
 Enables or disables the LPUART receiver.
 
static void LPUART_WriteByte (LPUART_Type *base, uint8_t data)
 Writes to the transmitter register.
 
static uint8_t LPUART_ReadByte (LPUART_Type *base)
 Reads the receiver register.
 
void LPUART_WriteBlocking (LPUART_Type *base, const uint8_t *data, size_t length)
 Writes to the transmitter register using a blocking method.
 
status_t LPUART_ReadBlocking (LPUART_Type *base, uint8_t *data, size_t length)
 Reads the receiver data register using a blocking method.
 

Transactional

void LPUART_TransferCreateHandle (LPUART_Type *base, lpuart_handle_t *handle, lpuart_transfer_callback_t callback, void *userData)
 Initializes the LPUART handle.
 
status_t LPUART_TransferSendNonBlocking (LPUART_Type *base, lpuart_handle_t *handle, lpuart_transfer_t *xfer)
 Transmits a buffer of data using the interrupt method.
 
void LPUART_TransferStartRingBuffer (LPUART_Type *base, lpuart_handle_t *handle, uint8_t *ringBuffer, size_t ringBufferSize)
 Sets up the RX ring buffer.
 
void LPUART_TransferStopRingBuffer (LPUART_Type *base, lpuart_handle_t *handle)
 Aborts the background transfer and uninstalls the ring buffer.
 
size_t LPUART_TransferGetRxRingBufferLength (LPUART_Type *base, lpuart_handle_t *handle)
 Get the length of received data in RX ring buffer.
 
void LPUART_TransferAbortSend (LPUART_Type *base, lpuart_handle_t *handle)
 Aborts the interrupt-driven data transmit.
 
status_t LPUART_TransferGetSendCount (LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count)
 Gets the number of bytes that have been written to the LPUART transmitter register.
 
status_t LPUART_TransferReceiveNonBlocking (LPUART_Type *base, lpuart_handle_t *handle, lpuart_transfer_t *xfer, size_t *receivedBytes)
 Receives a buffer of data using the interrupt method.
 
void LPUART_TransferAbortReceive (LPUART_Type *base, lpuart_handle_t *handle)
 Aborts the interrupt-driven data receiving.
 
status_t LPUART_TransferGetReceiveCount (LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count)
 Gets the number of bytes that have been received.
 
void LPUART_TransferHandleIRQ (LPUART_Type *base, lpuart_handle_t *handle)
 LPUART IRQ handle function.
 
void LPUART_TransferHandleErrorIRQ (LPUART_Type *base, lpuart_handle_t *handle)
 LPUART Error IRQ handle function.
 

Detailed Description

Typedef Documentation

◆ lpuart_config_t

LPUART configuration structure.

◆ lpuart_data_bits_t

LPUART data bits count.

◆ lpuart_handle_t

Definition at line 222 of file fsl_lpuart.h.

◆ lpuart_idle_config_t

LPUART idle detected configuration. This structure defines the number of idle characters that must be received before the IDLE flag is set.

◆ lpuart_idle_type_select_t

LPUART idle flag type defines when the receiver starts counting.

◆ lpuart_parity_mode_t

LPUART parity mode.

◆ lpuart_stop_bit_count_t

LPUART stop bit count.

◆ lpuart_transfer_callback_t

typedef void(* lpuart_transfer_callback_t) (LPUART_Type *base, lpuart_handle_t *handle, status_t status, void *userData)

LPUART transfer callback function.

Definition at line 225 of file fsl_lpuart.h.

◆ lpuart_transfer_t

LPUART transfer structure.

◆ lpuart_transmit_cts_config_t

LPUART transmit CTS configure.

◆ lpuart_transmit_cts_source_t

LPUART transmit CTS source.

Enumeration Type Documentation

◆ _lpuart_data_bits

LPUART data bits count.

Enumerator
kLPUART_EightDataBits 

Eight data bit

kLPUART_SevenDataBits 

Seven data bit

Definition at line 59 of file fsl_lpuart.h.

60{
61 kLPUART_EightDataBits = 0x0U, /*!< Eight data bit */
62#if defined(FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT) && FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT
63 kLPUART_SevenDataBits = 0x1U, /*!< Seven data bit */
64#endif
enum _lpuart_data_bits lpuart_data_bits_t
LPUART data bits count.
@ kLPUART_SevenDataBits
Definition fsl_lpuart.h:63
@ kLPUART_EightDataBits
Definition fsl_lpuart.h:61

◆ _lpuart_flags

LPUART status flags.

This provides constants for the LPUART status flags for use in the LPUART functions.

Enumerator
kLPUART_TxDataRegEmptyFlag 

Transmit data register empty flag, sets when transmit buffer is empty

kLPUART_TransmissionCompleteFlag 

Transmission complete flag, sets when transmission activity complete

kLPUART_RxDataRegFullFlag 

Receive data register full flag, sets when the receive data buffer is full

kLPUART_IdleLineFlag 

Idle line detect flag, sets when idle line detected

kLPUART_RxOverrunFlag 

Receive Overrun, sets when new data is received before data is read from receive register

kLPUART_NoiseErrorFlag 

Receive takes 3 samples of each received bit. If any of these samples differ, noise flag sets

kLPUART_FramingErrorFlag 

Frame error flag, sets if logic 0 was detected where stop bit expected

kLPUART_ParityErrorFlag 

If parity enabled, sets upon parity error detection

kLPUART_LinBreakFlag 

LIN break detect interrupt flag, sets when LIN break char detected and LIN circuit enabled

kLPUART_RxActiveEdgeFlag 

Receive pin active edge interrupt flag, sets when active edge detected

kLPUART_RxActiveFlag 

Receiver Active Flag (RAF), sets at beginning of valid start bit

kLPUART_DataMatch1Flag 

The next character to be read from LPUART_DATA matches MA1

kLPUART_DataMatch2Flag 

The next character to be read from LPUART_DATA matches MA2

kLPUART_NoiseErrorInRxDataRegFlag 

NOISY bit, sets if noise detected in current data word

kLPUART_ParityErrorInRxDataRegFlag 

PARITYE bit, sets if noise detected in current data word

kLPUART_TxFifoEmptyFlag 

TXEMPT bit, sets if transmit buffer is empty

kLPUART_RxFifoEmptyFlag 

RXEMPT bit, sets if receive buffer is empty

kLPUART_TxFifoOverflowFlag 

TXOF bit, sets if transmit buffer overflow occurred

kLPUART_RxFifoUnderflowFlag 

RXUF bit, sets if receive buffer underflow occurred

Definition at line 143 of file fsl_lpuart.h.

144{
146 (LPUART_STAT_TDRE_MASK), /*!< Transmit data register empty flag, sets when transmit buffer is empty */
148 (LPUART_STAT_TC_MASK), /*!< Transmission complete flag, sets when transmission activity complete */
150 (LPUART_STAT_RDRF_MASK), /*!< Receive data register full flag, sets when the receive data buffer is full */
151 kLPUART_IdleLineFlag = (LPUART_STAT_IDLE_MASK), /*!< Idle line detect flag, sets when idle line detected */
152 kLPUART_RxOverrunFlag = (LPUART_STAT_OR_MASK), /*!< Receive Overrun, sets when new data is received before data is
153 read from receive register */
154 kLPUART_NoiseErrorFlag = (LPUART_STAT_NF_MASK), /*!< Receive takes 3 samples of each received bit. If any of these
155 samples differ, noise flag sets */
157 (LPUART_STAT_FE_MASK), /*!< Frame error flag, sets if logic 0 was detected where stop bit expected */
158 kLPUART_ParityErrorFlag = (LPUART_STAT_PF_MASK), /*!< If parity enabled, sets upon parity error detection */
159#if defined(FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT) && FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT
161 (int)(LPUART_STAT_LBKDIF_MASK), /*!< LIN break detect interrupt flag, sets when LIN break char
162 detected and LIN circuit enabled */
163#endif
165 (LPUART_STAT_RXEDGIF_MASK), /*!< Receive pin active edge interrupt flag, sets when active edge detected */
167 (LPUART_STAT_RAF_MASK), /*!< Receiver Active Flag (RAF), sets at beginning of valid start bit */
168#if defined(FSL_FEATURE_LPUART_HAS_ADDRESS_MATCHING) && FSL_FEATURE_LPUART_HAS_ADDRESS_MATCHING
169 kLPUART_DataMatch1Flag = LPUART_STAT_MA1F_MASK, /*!< The next character to be read from LPUART_DATA matches MA1*/
170 kLPUART_DataMatch2Flag = LPUART_STAT_MA2F_MASK, /*!< The next character to be read from LPUART_DATA matches MA2*/
171#endif
172#if defined(FSL_FEATURE_LPUART_HAS_EXTENDED_DATA_REGISTER_FLAGS) && FSL_FEATURE_LPUART_HAS_EXTENDED_DATA_REGISTER_FLAGS
174 (LPUART_DATA_NOISY_MASK >> 10), /*!< NOISY bit, sets if noise detected in current data word */
176 (LPUART_DATA_PARITYE_MASK >> 10), /*!< PARITYE bit, sets if noise detected in current data word */
177#endif
178#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
179 kLPUART_TxFifoEmptyFlag = (LPUART_FIFO_TXEMPT_MASK >> 16), /*!< TXEMPT bit, sets if transmit buffer is empty */
180 kLPUART_RxFifoEmptyFlag = (LPUART_FIFO_RXEMPT_MASK >> 16), /*!< RXEMPT bit, sets if receive buffer is empty */
182 (LPUART_FIFO_TXOF_MASK >> 16), /*!< TXOF bit, sets if transmit buffer overflow occurred */
184 (LPUART_FIFO_RXUF_MASK >> 16), /*!< RXUF bit, sets if receive buffer underflow occurred */
185#endif
186};
@ kLPUART_RxFifoUnderflowFlag
Definition fsl_lpuart.h:183
@ kLPUART_NoiseErrorInRxDataRegFlag
Definition fsl_lpuart.h:173
@ kLPUART_RxActiveFlag
Definition fsl_lpuart.h:166
@ kLPUART_NoiseErrorFlag
Definition fsl_lpuart.h:154
@ kLPUART_ParityErrorInRxDataRegFlag
Definition fsl_lpuart.h:175
@ kLPUART_ParityErrorFlag
Definition fsl_lpuart.h:158
@ kLPUART_TxFifoOverflowFlag
Definition fsl_lpuart.h:181
@ kLPUART_DataMatch2Flag
Definition fsl_lpuart.h:170
@ kLPUART_RxFifoEmptyFlag
Definition fsl_lpuart.h:180
@ kLPUART_RxOverrunFlag
Definition fsl_lpuart.h:152
@ kLPUART_RxDataRegFullFlag
Definition fsl_lpuart.h:149
@ kLPUART_TxDataRegEmptyFlag
Definition fsl_lpuart.h:145
@ kLPUART_IdleLineFlag
Definition fsl_lpuart.h:151
@ kLPUART_FramingErrorFlag
Definition fsl_lpuart.h:156
@ kLPUART_TxFifoEmptyFlag
Definition fsl_lpuart.h:179
@ kLPUART_DataMatch1Flag
Definition fsl_lpuart.h:169
@ kLPUART_TransmissionCompleteFlag
Definition fsl_lpuart.h:147
@ kLPUART_LinBreakFlag
Definition fsl_lpuart.h:160
@ kLPUART_RxActiveEdgeFlag
Definition fsl_lpuart.h:164

◆ _lpuart_idle_config

LPUART idle detected configuration. This structure defines the number of idle characters that must be received before the IDLE flag is set.

Enumerator
kLPUART_IdleCharacter1 

the number of idle characters.

kLPUART_IdleCharacter2 

the number of idle characters.

kLPUART_IdleCharacter4 

the number of idle characters.

kLPUART_IdleCharacter8 

the number of idle characters.

kLPUART_IdleCharacter16 

the number of idle characters.

kLPUART_IdleCharacter32 

the number of idle characters.

kLPUART_IdleCharacter64 

the number of idle characters.

kLPUART_IdleCharacter128 

the number of idle characters.

Definition at line 101 of file fsl_lpuart.h.

102{
103 kLPUART_IdleCharacter1 = 0U, /*!< the number of idle characters. */
104 kLPUART_IdleCharacter2 = 1U, /*!< the number of idle characters. */
105 kLPUART_IdleCharacter4 = 2U, /*!< the number of idle characters. */
106 kLPUART_IdleCharacter8 = 3U, /*!< the number of idle characters. */
107 kLPUART_IdleCharacter16 = 4U, /*!< the number of idle characters. */
108 kLPUART_IdleCharacter32 = 5U, /*!< the number of idle characters. */
109 kLPUART_IdleCharacter64 = 6U, /*!< the number of idle characters. */
110 kLPUART_IdleCharacter128 = 7U, /*!< the number of idle characters. */
enum _lpuart_idle_config lpuart_idle_config_t
LPUART idle detected configuration. This structure defines the number of idle characters that must be...
@ kLPUART_IdleCharacter32
Definition fsl_lpuart.h:108
@ kLPUART_IdleCharacter2
Definition fsl_lpuart.h:104
@ kLPUART_IdleCharacter128
Definition fsl_lpuart.h:110
@ kLPUART_IdleCharacter1
Definition fsl_lpuart.h:103
@ kLPUART_IdleCharacter64
Definition fsl_lpuart.h:109
@ kLPUART_IdleCharacter4
Definition fsl_lpuart.h:105
@ kLPUART_IdleCharacter16
Definition fsl_lpuart.h:107
@ kLPUART_IdleCharacter8
Definition fsl_lpuart.h:106

◆ _lpuart_idle_type_select

LPUART idle flag type defines when the receiver starts counting.

Enumerator
kLPUART_IdleTypeStartBit 

Start counting after a valid start bit.

kLPUART_IdleTypeStopBit 

Start counting after a stop bit.

Definition at line 91 of file fsl_lpuart.h.

92{
93 kLPUART_IdleTypeStartBit = 0U, /*!< Start counting after a valid start bit. */
94 kLPUART_IdleTypeStopBit = 1U, /*!< Start counting after a stop bit. */
enum _lpuart_idle_type_select lpuart_idle_type_select_t
LPUART idle flag type defines when the receiver starts counting.
@ kLPUART_IdleTypeStartBit
Definition fsl_lpuart.h:93
@ kLPUART_IdleTypeStopBit
Definition fsl_lpuart.h:94

◆ _lpuart_interrupt_enable

LPUART interrupt configuration structure, default settings all disabled.

This structure contains the settings for all LPUART interrupt configurations.

Enumerator
kLPUART_LinBreakInterruptEnable 

LIN break detect.

kLPUART_RxActiveEdgeInterruptEnable 

Receive Active Edge.

kLPUART_TxDataRegEmptyInterruptEnable 

Transmit data register empty.

kLPUART_TransmissionCompleteInterruptEnable 

Transmission complete.

kLPUART_RxDataRegFullInterruptEnable 

Receiver data register full.

kLPUART_IdleLineInterruptEnable 

Idle line.

kLPUART_RxOverrunInterruptEnable 

Receiver Overrun.

kLPUART_NoiseErrorInterruptEnable 

Noise error flag.

kLPUART_FramingErrorInterruptEnable 

Framing error flag.

kLPUART_ParityErrorInterruptEnable 

Parity error flag.

kLPUART_TxFifoOverflowInterruptEnable 

Transmit FIFO Overflow.

kLPUART_RxFifoUnderflowInterruptEnable 

Receive FIFO Underflow.

Definition at line 118 of file fsl_lpuart.h.

119{
120#if defined(FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT) && FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT
121 kLPUART_LinBreakInterruptEnable = (LPUART_BAUD_LBKDIE_MASK >> 8), /*!< LIN break detect. */
122#endif
123 kLPUART_RxActiveEdgeInterruptEnable = (LPUART_BAUD_RXEDGIE_MASK >> 8), /*!< Receive Active Edge. */
124 kLPUART_TxDataRegEmptyInterruptEnable = (LPUART_CTRL_TIE_MASK), /*!< Transmit data register empty. */
125 kLPUART_TransmissionCompleteInterruptEnable = (LPUART_CTRL_TCIE_MASK), /*!< Transmission complete. */
126 kLPUART_RxDataRegFullInterruptEnable = (LPUART_CTRL_RIE_MASK), /*!< Receiver data register full. */
127 kLPUART_IdleLineInterruptEnable = (LPUART_CTRL_ILIE_MASK), /*!< Idle line. */
128 kLPUART_RxOverrunInterruptEnable = (LPUART_CTRL_ORIE_MASK), /*!< Receiver Overrun. */
129 kLPUART_NoiseErrorInterruptEnable = (LPUART_CTRL_NEIE_MASK), /*!< Noise error flag. */
130 kLPUART_FramingErrorInterruptEnable = (LPUART_CTRL_FEIE_MASK), /*!< Framing error flag. */
131 kLPUART_ParityErrorInterruptEnable = (LPUART_CTRL_PEIE_MASK), /*!< Parity error flag. */
132#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
133 kLPUART_TxFifoOverflowInterruptEnable = (LPUART_FIFO_TXOFE_MASK >> 8), /*!< Transmit FIFO Overflow. */
134 kLPUART_RxFifoUnderflowInterruptEnable = (LPUART_FIFO_RXUFE_MASK >> 8), /*!< Receive FIFO Underflow. */
135#endif
136};
@ kLPUART_TransmissionCompleteInterruptEnable
Definition fsl_lpuart.h:125
@ kLPUART_TxDataRegEmptyInterruptEnable
Definition fsl_lpuart.h:124
@ kLPUART_ParityErrorInterruptEnable
Definition fsl_lpuart.h:131
@ kLPUART_FramingErrorInterruptEnable
Definition fsl_lpuart.h:130
@ kLPUART_TxFifoOverflowInterruptEnable
Definition fsl_lpuart.h:133
@ kLPUART_RxActiveEdgeInterruptEnable
Definition fsl_lpuart.h:123
@ kLPUART_RxDataRegFullInterruptEnable
Definition fsl_lpuart.h:126
@ kLPUART_RxOverrunInterruptEnable
Definition fsl_lpuart.h:128
@ kLPUART_RxFifoUnderflowInterruptEnable
Definition fsl_lpuart.h:134
@ kLPUART_NoiseErrorInterruptEnable
Definition fsl_lpuart.h:129
@ kLPUART_LinBreakInterruptEnable
Definition fsl_lpuart.h:121
@ kLPUART_IdleLineInterruptEnable
Definition fsl_lpuart.h:127

◆ _lpuart_parity_mode

LPUART parity mode.

Enumerator
kLPUART_ParityDisabled 

Parity disabled

kLPUART_ParityEven 

Parity enabled, type even, bit setting: PE|PT = 10

kLPUART_ParityOdd 

Parity enabled, type odd, bit setting: PE|PT = 11

Definition at line 51 of file fsl_lpuart.h.

52{
53 kLPUART_ParityDisabled = 0x0U, /*!< Parity disabled */
54 kLPUART_ParityEven = 0x2U, /*!< Parity enabled, type even, bit setting: PE|PT = 10 */
55 kLPUART_ParityOdd = 0x3U, /*!< Parity enabled, type odd, bit setting: PE|PT = 11 */
enum _lpuart_parity_mode lpuart_parity_mode_t
LPUART parity mode.
@ kLPUART_ParityDisabled
Definition fsl_lpuart.h:53
@ kLPUART_ParityEven
Definition fsl_lpuart.h:54
@ kLPUART_ParityOdd
Definition fsl_lpuart.h:55

◆ _lpuart_status

Error codes for the LPUART driver.

Enumerator
kStatus_LPUART_TxBusy 

TX busy

kStatus_LPUART_RxBusy 

RX busy

kStatus_LPUART_TxIdle 

LPUART transmitter is idle.

kStatus_LPUART_RxIdle 

LPUART receiver is idle.

kStatus_LPUART_TxWatermarkTooLarge 

TX FIFO watermark too large

kStatus_LPUART_RxWatermarkTooLarge 

RX FIFO watermark too large

kStatus_LPUART_FlagCannotClearManually 

Some flag can't manually clear

kStatus_LPUART_Error 

Error happens on LPUART.

kStatus_LPUART_RxRingBufferOverrun 

LPUART RX software ring buffer overrun.

kStatus_LPUART_RxHardwareOverrun 

LPUART RX receiver overrun.

kStatus_LPUART_NoiseError 

LPUART noise error.

kStatus_LPUART_FramingError 

LPUART framing error.

kStatus_LPUART_ParityError 

LPUART parity error.

kStatus_LPUART_BaudrateNotSupport 

Baudrate is not support in current clock source

kStatus_LPUART_IdleLineDetected 

IDLE flag.

Definition at line 29 of file fsl_lpuart.h.

30{
31 kStatus_LPUART_TxBusy = MAKE_STATUS(kStatusGroup_LPUART, 0), /*!< TX busy */
32 kStatus_LPUART_RxBusy = MAKE_STATUS(kStatusGroup_LPUART, 1), /*!< RX busy */
33 kStatus_LPUART_TxIdle = MAKE_STATUS(kStatusGroup_LPUART, 2), /*!< LPUART transmitter is idle. */
34 kStatus_LPUART_RxIdle = MAKE_STATUS(kStatusGroup_LPUART, 3), /*!< LPUART receiver is idle. */
35 kStatus_LPUART_TxWatermarkTooLarge = MAKE_STATUS(kStatusGroup_LPUART, 4), /*!< TX FIFO watermark too large */
36 kStatus_LPUART_RxWatermarkTooLarge = MAKE_STATUS(kStatusGroup_LPUART, 5), /*!< RX FIFO watermark too large */
37 kStatus_LPUART_FlagCannotClearManually = MAKE_STATUS(kStatusGroup_LPUART, 6), /*!< Some flag can't manually clear */
38 kStatus_LPUART_Error = MAKE_STATUS(kStatusGroup_LPUART, 7), /*!< Error happens on LPUART. */
40 MAKE_STATUS(kStatusGroup_LPUART, 8), /*!< LPUART RX software ring buffer overrun. */
41 kStatus_LPUART_RxHardwareOverrun = MAKE_STATUS(kStatusGroup_LPUART, 9), /*!< LPUART RX receiver overrun. */
42 kStatus_LPUART_NoiseError = MAKE_STATUS(kStatusGroup_LPUART, 10), /*!< LPUART noise error. */
43 kStatus_LPUART_FramingError = MAKE_STATUS(kStatusGroup_LPUART, 11), /*!< LPUART framing error. */
44 kStatus_LPUART_ParityError = MAKE_STATUS(kStatusGroup_LPUART, 12), /*!< LPUART parity error. */
46 MAKE_STATUS(kStatusGroup_LPUART, 13), /*!< Baudrate is not support in current clock source */
47 kStatus_LPUART_IdleLineDetected = MAKE_STATUS(kStatusGroup_LPUART, 14), /*!< IDLE flag. */
48};
@ kStatusGroup_LPUART
Definition fsl_common.h:73
@ kStatus_LPUART_RxIdle
Definition fsl_lpuart.h:34
@ kStatus_LPUART_TxIdle
Definition fsl_lpuart.h:33
@ kStatus_LPUART_FlagCannotClearManually
Definition fsl_lpuart.h:37
@ kStatus_LPUART_FramingError
Definition fsl_lpuart.h:43
@ kStatus_LPUART_IdleLineDetected
Definition fsl_lpuart.h:47
@ kStatus_LPUART_RxRingBufferOverrun
Definition fsl_lpuart.h:39
@ kStatus_LPUART_NoiseError
Definition fsl_lpuart.h:42
@ kStatus_LPUART_RxBusy
Definition fsl_lpuart.h:32
@ kStatus_LPUART_BaudrateNotSupport
Definition fsl_lpuart.h:45
@ kStatus_LPUART_TxWatermarkTooLarge
Definition fsl_lpuart.h:35
@ kStatus_LPUART_TxBusy
Definition fsl_lpuart.h:31
@ kStatus_LPUART_RxWatermarkTooLarge
Definition fsl_lpuart.h:36
@ kStatus_LPUART_ParityError
Definition fsl_lpuart.h:44
@ kStatus_LPUART_Error
Definition fsl_lpuart.h:38
@ kStatus_LPUART_RxHardwareOverrun
Definition fsl_lpuart.h:41

◆ _lpuart_stop_bit_count

LPUART stop bit count.

Enumerator
kLPUART_OneStopBit 

One stop bit

kLPUART_TwoStopBit 

Two stop bits

Definition at line 68 of file fsl_lpuart.h.

69{
70 kLPUART_OneStopBit = 0U, /*!< One stop bit */
71 kLPUART_TwoStopBit = 1U, /*!< Two stop bits */
enum _lpuart_stop_bit_count lpuart_stop_bit_count_t
LPUART stop bit count.
@ kLPUART_OneStopBit
Definition fsl_lpuart.h:70
@ kLPUART_TwoStopBit
Definition fsl_lpuart.h:71

◆ _lpuart_transmit_cts_config

LPUART transmit CTS configure.

Enumerator
kLPUART_CtsSampleAtStart 

CTS input is sampled at the start of each character.

kLPUART_CtsSampleAtIdle 

CTS input is sampled when the transmitter is idle

Definition at line 83 of file fsl_lpuart.h.

84{
85 kLPUART_CtsSampleAtStart = 0U, /*!< CTS input is sampled at the start of each character. */
86 kLPUART_CtsSampleAtIdle = 1U, /*!< CTS input is sampled when the transmitter is idle */
enum _lpuart_transmit_cts_config lpuart_transmit_cts_config_t
LPUART transmit CTS configure.
@ kLPUART_CtsSampleAtStart
Definition fsl_lpuart.h:85
@ kLPUART_CtsSampleAtIdle
Definition fsl_lpuart.h:86

◆ _lpuart_transmit_cts_source

LPUART transmit CTS source.

Enumerator
kLPUART_CtsSourcePin 

CTS resource is the LPUART_CTS pin.

kLPUART_CtsSourceMatchResult 

CTS resource is the match result.

Definition at line 76 of file fsl_lpuart.h.

77{
78 kLPUART_CtsSourcePin = 0U, /*!< CTS resource is the LPUART_CTS pin. */
79 kLPUART_CtsSourceMatchResult = 1U, /*!< CTS resource is the match result. */
enum _lpuart_transmit_cts_source lpuart_transmit_cts_source_t
LPUART transmit CTS source.
@ kLPUART_CtsSourceMatchResult
Definition fsl_lpuart.h:79
@ kLPUART_CtsSourcePin
Definition fsl_lpuart.h:78

Function Documentation

◆ LPUART_ClearStatusFlags()

status_t LPUART_ClearStatusFlags ( LPUART_Type *  base,
uint32_t  mask 
)

Clears status flags with a provided mask.

This function clears LPUART status flags with a provided mask. Automatically cleared flags can't be cleared by this function. Flags that can only cleared or set by hardware are: kLPUART_TxDataRegEmptyFlag, kLPUART_TransmissionCompleteFlag, kLPUART_RxDataRegFullFlag, kLPUART_RxActiveFlag, kLPUART_NoiseErrorInRxDataRegFlag, kLPUART_ParityErrorInRxDataRegFlag, kLPUART_TxFifoEmptyFlag,kLPUART_RxFifoEmptyFlag Note: This API should be called when the Tx/Rx is idle, otherwise it takes no effects.

Parameters
baseLPUART peripheral base address.
maskthe status flags to be cleared. The user can use the enumerators in the _lpuart_status_flag_t to do the OR operation and get the mask.
Returns
0 succeed, others failed.
Return values
kStatus_LPUART_FlagCannotClearManuallyThe flag can't be cleared by this function but it is cleared automatically by hardware.
kStatus_SuccessStatus in the mask are cleared.

brief Clears status flags with a provided mask.

This function clears LPUART status flags with a provided mask. Automatically cleared flags can't be cleared by this function. Flags that can only cleared or set by hardware are: kLPUART_TxDataRegEmptyFlag, kLPUART_TransmissionCompleteFlag, kLPUART_RxDataRegFullFlag, kLPUART_RxActiveFlag, kLPUART_NoiseErrorInRxDataRegFlag, kLPUART_ParityErrorInRxDataRegFlag, kLPUART_TxFifoEmptyFlag,kLPUART_RxFifoEmptyFlag Note: This API should be called when the Tx/Rx is idle, otherwise it takes no effects.

param base LPUART peripheral base address. param mask the status flags to be cleared. The user can use the enumerators in the _lpuart_status_flag_t to do the OR operation and get the mask. return 0 succeed, others failed. retval kStatus_LPUART_FlagCannotClearManually The flag can't be cleared by this function but it is cleared automatically by hardware. retval kStatus_Success Status in the mask are cleared.

Definition at line 777 of file fsl_lpuart.c.

778{
779 uint32_t temp;
780 status_t status;
781#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
782 temp = (uint32_t)base->FIFO;
783 temp &= (uint32_t)(~(LPUART_FIFO_TXOF_MASK | LPUART_FIFO_RXUF_MASK));
784 temp |= (mask << 16) & (LPUART_FIFO_TXOF_MASK | LPUART_FIFO_RXUF_MASK);
785 base->FIFO = temp;
786#endif
787 temp = (uint32_t)base->STAT;
788#if defined(FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT) && FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT
789 temp &= (uint32_t)(~(LPUART_STAT_LBKDIF_MASK));
790 temp |= mask & LPUART_STAT_LBKDIF_MASK;
791#endif
792 temp &= (uint32_t)(~(LPUART_STAT_RXEDGIF_MASK | LPUART_STAT_IDLE_MASK | LPUART_STAT_OR_MASK | LPUART_STAT_NF_MASK |
793 LPUART_STAT_FE_MASK | LPUART_STAT_PF_MASK));
794 temp |= mask & (LPUART_STAT_RXEDGIF_MASK | LPUART_STAT_IDLE_MASK | LPUART_STAT_OR_MASK | LPUART_STAT_NF_MASK |
795 LPUART_STAT_FE_MASK | LPUART_STAT_PF_MASK);
796#if defined(FSL_FEATURE_LPUART_HAS_ADDRESS_MATCHING) && FSL_FEATURE_LPUART_HAS_ADDRESS_MATCHING
797 temp &= (uint32_t)(~(LPUART_STAT_MA2F_MASK | LPUART_STAT_MA1F_MASK));
798 temp |= mask & (LPUART_STAT_MA2F_MASK | LPUART_STAT_MA1F_MASK);
799#endif
800 base->STAT = temp;
801 /* If some flags still pending. */
802 if (mask & LPUART_GetStatusFlags(base))
803 {
804 /* Some flags can only clear or set by the hardware itself, these flags are: kLPUART_TxDataRegEmptyFlag,
805 kLPUART_TransmissionCompleteFlag, kLPUART_RxDataRegFullFlag, kLPUART_RxActiveFlag,
806 kLPUART_NoiseErrorInRxDataRegFlag, kLPUART_ParityErrorInRxDataRegFlag,
807 kLPUART_TxFifoEmptyFlag, kLPUART_RxFifoEmptyFlag. */
808 status = kStatus_LPUART_FlagCannotClearManually; /* flags can not clear manually */
809 }
810 else
811 {
812 status = kStatus_Success;
813 }
814
815 return status;
816}
int32_t status_t
Type used for all status and error return values.
Definition fsl_common.h:169
@ kStatus_Success
Definition fsl_common.h:159
uint32_t LPUART_GetStatusFlags(LPUART_Type *base)
Gets LPUART status flags.
Definition fsl_lpuart.c:746

Referenced by LPUART_ReadBlocking().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LPUART_Deinit()

void LPUART_Deinit ( LPUART_Type *  base)

Deinitializes a LPUART instance.

This function waits for transmit to complete, disables TX and RX, and disables the LPUART clock.

Parameters
baseLPUART peripheral base address.

brief Deinitializes a LPUART instance.

This function waits for transmit to complete, disables TX and RX, and disables the LPUART clock.

param base LPUART peripheral base address.

Definition at line 455 of file fsl_lpuart.c.

456{
457 uint32_t temp;
458
459#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
460 /* Wait tx FIFO send out*/
461 while (0 != ((base->WATER & LPUART_WATER_TXCOUNT_MASK) >> LPUART_WATER_TXWATER_SHIFT))
462 {
463 }
464#endif
465 /* Wait last char shift out */
466 while (0 == (base->STAT & LPUART_STAT_TC_MASK))
467 {
468 }
469
470 /* Clear all status flags */
471 temp = (LPUART_STAT_RXEDGIF_MASK | LPUART_STAT_IDLE_MASK | LPUART_STAT_OR_MASK | LPUART_STAT_NF_MASK |
472 LPUART_STAT_FE_MASK | LPUART_STAT_PF_MASK);
473
474#if defined(FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT) && FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT
475 temp |= LPUART_STAT_LBKDIF_MASK;
476#endif
477
478#if defined(FSL_FEATURE_LPUART_HAS_ADDRESS_MATCHING) && FSL_FEATURE_LPUART_HAS_ADDRESS_MATCHING
479 temp |= (LPUART_STAT_MA1F_MASK | LPUART_STAT_MA2F_MASK);
480#endif
481
482 base->STAT |= temp;
483
484 /* Disable the module. */
485 base->CTRL = 0;
486
487#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
488 uint32_t instance = LPUART_GetInstance(base);
489
490 /* Disable lpuart clock */
492
493#if defined(LPUART_PERIPH_CLOCKS)
495#endif
496
497#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
498}
static BenchController instance
static const clock_ip_name_t s_lpuartClock[]
Definition fsl_lpuart.c:90
static const clock_ip_name_t s_lpuartPeriphClocks[]
Definition fsl_lpuart.c:94
static void CLOCK_DisableClock(clock_ip_name_t name)
Disable the clock for specific IP.
Definition fsl_clock.h:653
uint32_t LPUART_GetInstance(LPUART_Type *base)
Get the LPUART instance from peripheral base address.
Definition fsl_lpuart.c:111

Referenced by uart_lld_stop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LPUART_DisableInterrupts()

void LPUART_DisableInterrupts ( LPUART_Type *  base,
uint32_t  mask 
)

Disables LPUART interrupts according to a provided mask.

This function disables the LPUART interrupts according to a provided mask. The mask is a logical OR of enumeration members. See _lpuart_interrupt_enable. This example shows how to disable the TX empty interrupt and RX full interrupt:

void LPUART_DisableInterrupts(LPUART_Type *base, uint32_t mask)
Disables LPUART interrupts according to a provided mask.
Definition fsl_lpuart.c:686
Parameters
baseLPUART peripheral base address.
maskThe interrupts to disable. Logical OR of _lpuart_interrupt_enable.

brief Disables LPUART interrupts according to a provided mask.

This function disables the LPUART interrupts according to a provided mask. The mask is a logical OR of enumeration members. See ref _lpuart_interrupt_enable. This example shows how to disable the TX empty interrupt and RX full interrupt: code LPUART_DisableInterrupts(LPUART1,kLPUART_TxDataRegEmptyInterruptEnable | kLPUART_RxDataRegFullInterruptEnable); endcode

param base LPUART peripheral base address. param mask The interrupts to disable. Logical OR of ref _lpuart_interrupt_enable.

Definition at line 686 of file fsl_lpuart.c.

687{
688 base->BAUD &= ~((mask << 8) & (LPUART_BAUD_LBKDIE_MASK | LPUART_BAUD_RXEDGIE_MASK));
689#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
690 base->FIFO = (base->FIFO & ~(LPUART_FIFO_TXOF_MASK | LPUART_FIFO_RXUF_MASK)) &
691 ~((mask << 8) & (LPUART_FIFO_TXOFE_MASK | LPUART_FIFO_RXUFE_MASK));
692#endif
693 mask &= 0xFFFFFF00U;
694 base->CTRL &= ~mask;
695}

Referenced by LPUART_TransferAbortReceive(), LPUART_TransferAbortSend(), LPUART_TransferHandleIRQ(), LPUART_TransferReceiveNonBlocking(), and LPUART_TransferStopRingBuffer().

Here is the caller graph for this function:

◆ LPUART_EnableInterrupts()

void LPUART_EnableInterrupts ( LPUART_Type *  base,
uint32_t  mask 
)

Enables LPUART interrupts according to a provided mask.

This function enables the LPUART interrupts according to a provided mask. The mask is a logical OR of enumeration members. See the _lpuart_interrupt_enable. This examples shows how to enable TX empty interrupt and RX full interrupt:

void LPUART_EnableInterrupts(LPUART_Type *base, uint32_t mask)
Enables LPUART interrupts according to a provided mask.
Definition fsl_lpuart.c:662
Parameters
baseLPUART peripheral base address.
maskThe interrupts to enable. Logical OR of _uart_interrupt_enable.

brief Enables LPUART interrupts according to a provided mask.

This function enables the LPUART interrupts according to a provided mask. The mask is a logical OR of enumeration members. See the ref _lpuart_interrupt_enable. This examples shows how to enable TX empty interrupt and RX full interrupt: code LPUART_EnableInterrupts(LPUART1,kLPUART_TxDataRegEmptyInterruptEnable | kLPUART_RxDataRegFullInterruptEnable); endcode

param base LPUART peripheral base address. param mask The interrupts to enable. Logical OR of ref _uart_interrupt_enable.

Definition at line 662 of file fsl_lpuart.c.

663{
664 base->BAUD |= ((mask << 8) & (LPUART_BAUD_LBKDIE_MASK | LPUART_BAUD_RXEDGIE_MASK));
665#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
666 base->FIFO = (base->FIFO & ~(LPUART_FIFO_TXOF_MASK | LPUART_FIFO_RXUF_MASK)) |
667 ((mask << 8) & (LPUART_FIFO_TXOFE_MASK | LPUART_FIFO_RXUFE_MASK));
668#endif
669 mask &= 0xFFFFFF00U;
670 base->CTRL |= mask;
671}

Referenced by LPUART_TransferReceiveNonBlocking(), LPUART_TransferSendNonBlocking(), LPUART_TransferStartRingBuffer(), and uart_lld_start_receive().

Here is the caller graph for this function:

◆ LPUART_EnableRx()

static void LPUART_EnableRx ( LPUART_Type *  base,
bool  enable 
)
inlinestatic

Enables or disables the LPUART receiver.

This function enables or disables the LPUART receiver.

Parameters
baseLPUART peripheral base address.
enableTrue to enable, false to disable.

Definition at line 566 of file fsl_lpuart.h.

567{
568 if (enable)
569 {
570 base->CTRL |= LPUART_CTRL_RE_MASK;
571 }
572 else
573 {
574 base->CTRL &= ~LPUART_CTRL_RE_MASK;
575 }
576}
static void enable(const char *param)
Definition settings.cpp:441
Here is the call graph for this function:

◆ LPUART_EnableRxDMA()

static void LPUART_EnableRxDMA ( LPUART_Type *  base,
bool  enable 
)
inlinestatic

Enables or disables the LPUART receiver DMA.

This function enables or disables the receiver data register full flag, STAT[RDRF], to generate DMA requests.

Parameters
baseLPUART peripheral base address.
enableTrue to enable, false to disable.

Definition at line 510 of file fsl_lpuart.h.

511{
512 if (enable)
513 {
514 base->BAUD |= LPUART_BAUD_RDMAE_MASK;
515 }
516 else
517 {
518 base->BAUD &= ~LPUART_BAUD_RDMAE_MASK;
519 }
520}

Referenced by LPUART_ReceiveEDMA(), LPUART_TransferAbortReceiveEDMA(), and uart_lld_stop_receive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LPUART_EnableTx()

static void LPUART_EnableTx ( LPUART_Type *  base,
bool  enable 
)
inlinestatic

Enables or disables the LPUART transmitter.

This function enables or disables the LPUART transmitter.

Parameters
baseLPUART peripheral base address.
enableTrue to enable, false to disable.

Definition at line 546 of file fsl_lpuart.h.

547{
548 if (enable)
549 {
550 base->CTRL |= LPUART_CTRL_TE_MASK;
551 }
552 else
553 {
554 base->CTRL &= ~LPUART_CTRL_TE_MASK;
555 }
556}
Here is the call graph for this function:

◆ LPUART_EnableTxDMA()

static void LPUART_EnableTxDMA ( LPUART_Type *  base,
bool  enable 
)
inlinestatic

Enables or disables the LPUART transmitter DMA request.

This function enables or disables the transmit data register empty flag, STAT[TDRE], to generate DMA requests.

Parameters
baseLPUART peripheral base address.
enableTrue to enable, false to disable.

Definition at line 490 of file fsl_lpuart.h.

491{
492 if (enable)
493 {
494 base->BAUD |= LPUART_BAUD_TDMAE_MASK;
495 }
496 else
497 {
498 base->BAUD &= ~LPUART_BAUD_TDMAE_MASK;
499 }
500}

Referenced by LPUART_SendEDMA(), and LPUART_TransferAbortSendEDMA().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LPUART_GetDataRegisterAddress()

static uint32_t LPUART_GetDataRegisterAddress ( LPUART_Type *  base)
inlinestatic

Gets the LPUART data register address.

This function returns the LPUART data register address, which is mainly used by the DMA/eDMA.

Parameters
baseLPUART peripheral base address.
Returns
LPUART data register addresses which are used both by the transmitter and receiver.

Definition at line 477 of file fsl_lpuart.h.

478{
479 return (uint32_t) & (base->DATA);
480}

Referenced by LPUART_ReceiveEDMA(), and LPUART_SendEDMA().

Here is the caller graph for this function:

◆ LPUART_GetDefaultConfig()

void LPUART_GetDefaultConfig ( lpuart_config_t config)

Gets the default configuration structure.

This function initializes the LPUART configuration structure to a default value. The default values are: lpuartConfig->baudRate_Bps = 115200U; lpuartConfig->parityMode = kLPUART_ParityDisabled; lpuartConfig->dataBitsCount = kLPUART_EightDataBits; lpuartConfig->isMsb = false; lpuartConfig->stopBitCount = kLPUART_OneStopBit; lpuartConfig->txFifoWatermark = 0; lpuartConfig->rxFifoWatermark = 1; lpuartConfig->rxIdleType = kLPUART_IdleTypeStartBit; lpuartConfig->rxIdleConfig = kLPUART_IdleCharacter1; lpuartConfig->enableTx = false; lpuartConfig->enableRx = false;

Parameters
configPointer to a configuration structure.

brief Gets the default configuration structure.

This function initializes the LPUART configuration structure to a default value. The default values are: lpuartConfig->baudRate_Bps = 115200U; lpuartConfig->parityMode = kLPUART_ParityDisabled; lpuartConfig->dataBitsCount = kLPUART_EightDataBits; lpuartConfig->isMsb = false; lpuartConfig->stopBitCount = kLPUART_OneStopBit; lpuartConfig->txFifoWatermark = 0; lpuartConfig->rxFifoWatermark = 1; lpuartConfig->rxIdleType = kLPUART_IdleTypeStartBit; lpuartConfig->rxIdleConfig = kLPUART_IdleCharacter1; lpuartConfig->enableTx = false; lpuartConfig->enableRx = false;

param config Pointer to a configuration structure.

Definition at line 519 of file fsl_lpuart.c.

520{
521 assert(config);
522
523 /* Initializes the configure structure to zero. */
524 memset(config, 0, sizeof(*config));
525
526 config->baudRate_Bps = 115200U;
527 config->parityMode = kLPUART_ParityDisabled;
528 config->dataBitsCount = kLPUART_EightDataBits;
529 config->isMsb = false;
530#if defined(FSL_FEATURE_LPUART_HAS_STOP_BIT_CONFIG_SUPPORT) && FSL_FEATURE_LPUART_HAS_STOP_BIT_CONFIG_SUPPORT
531 config->stopBitCount = kLPUART_OneStopBit;
532#endif
533#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
534 config->txFifoWatermark = 0;
535 config->rxFifoWatermark = 0;
536#endif
537#if defined(FSL_FEATURE_LPUART_HAS_MODEM_SUPPORT) && FSL_FEATURE_LPUART_HAS_MODEM_SUPPORT
538 config->enableRxRTS = false;
539 config->enableTxCTS = false;
540 config->txCtsConfig = kLPUART_CtsSampleAtStart;
541 config->txCtsSource = kLPUART_CtsSourcePin;
542#endif
543 config->rxIdleType = kLPUART_IdleTypeStartBit;
544 config->rxIdleConfig = kLPUART_IdleCharacter1;
545 config->enableTx = false;
546 config->enableRx = false;
547}
static constexpr persistent_config_s * config

Referenced by uart_lld_start().

Here is the caller graph for this function:

◆ LPUART_GetEnabledInterrupts()

uint32_t LPUART_GetEnabledInterrupts ( LPUART_Type *  base)

Gets enabled LPUART interrupts.

This function gets the enabled LPUART interrupts. The enabled interrupts are returned as the logical OR value of the enumerators _lpuart_interrupt_enable. To check a specific interrupt enable status, compare the return value with enumerators in _lpuart_interrupt_enable. For example, to check whether the TX empty interrupt is enabled:

uint32_t enabledInterrupts = LPUART_GetEnabledInterrupts(LPUART1);
if (kLPUART_TxDataRegEmptyInterruptEnable & enabledInterrupts)
{
...
}
uint32_t LPUART_GetEnabledInterrupts(LPUART_Type *base)
Gets enabled LPUART interrupts.
Definition fsl_lpuart.c:717
Parameters
baseLPUART peripheral base address.
Returns
LPUART interrupt flags which are logical OR of the enumerators in _lpuart_interrupt_enable.

brief Gets enabled LPUART interrupts.

This function gets the enabled LPUART interrupts. The enabled interrupts are returned as the logical OR value of the enumerators ref _lpuart_interrupt_enable. To check a specific interrupt enable status, compare the return value with enumerators in ref _lpuart_interrupt_enable. For example, to check whether the TX empty interrupt is enabled: code uint32_t enabledInterrupts = LPUART_GetEnabledInterrupts(LPUART1);

if (kLPUART_TxDataRegEmptyInterruptEnable & enabledInterrupts) { ... } endcode

param base LPUART peripheral base address. return LPUART interrupt flags which are logical OR of the enumerators in ref _lpuart_interrupt_enable.

Definition at line 717 of file fsl_lpuart.c.

718{
719 uint32_t temp;
720 temp = (base->BAUD & (LPUART_BAUD_LBKDIE_MASK | LPUART_BAUD_RXEDGIE_MASK)) >> 8;
721#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
722 temp |= (base->FIFO & (LPUART_FIFO_TXOFE_MASK | LPUART_FIFO_RXUFE_MASK)) >> 8;
723#endif
724 temp |= (base->CTRL & 0xFF0C000);
725
726 return temp;
727}

Referenced by LPUART_TransferHandleIRQ().

Here is the caller graph for this function:

◆ LPUART_GetInstance()

uint32_t LPUART_GetInstance ( LPUART_Type *  base)

Get the LPUART instance from peripheral base address.

Parameters
baseLPUART peripheral base address.
Returns
LPUART instance.

brief Get the LPUART instance from peripheral base address.

param base LPUART peripheral base address. return LPUART instance.

Definition at line 111 of file fsl_lpuart.c.

112{
113 uint32_t instance;
114
115 /* Find the instance index from base address mappings. */
116 for (instance = 0; instance < ARRAY_SIZE(s_lpuartBases); instance++)
117 {
118 if (s_lpuartBases[instance] == base)
119 {
120 break;
121 }
122 }
123
124 assert(instance < ARRAY_SIZE(s_lpuartBases));
125
126 return instance;
127}
static LPUART_Type *const s_lpuartBases[]
Definition fsl_lpuart.c:78

Referenced by ADMA_UART0_INT_DriverIRQHandler(), ADMA_UART1_INT_DriverIRQHandler(), ADMA_UART2_INT_DriverIRQHandler(), ADMA_UART3_INT_DriverIRQHandler(), DMA_UART0_INT_DriverIRQHandler(), DMA_UART1_INT_DriverIRQHandler(), DMA_UART2_INT_DriverIRQHandler(), DMA_UART3_INT_DriverIRQHandler(), DMA_UART4_INT_DriverIRQHandler(), LPUART_Deinit(), LPUART_Init(), LPUART_TransferCreateHandle(), LPUART_TransferCreateHandleEDMA(), M4_0_LPUART_DriverIRQHandler(), M4_1_LPUART_DriverIRQHandler(), and M4_LPUART_DriverIRQHandler().

Here is the caller graph for this function:

◆ LPUART_GetStatusFlags()

uint32_t LPUART_GetStatusFlags ( LPUART_Type *  base)

Gets LPUART status flags.

This function gets all LPUART status flags. The flags are returned as the logical OR value of the enumerators _lpuart_flags. To check for a specific status, compare the return value with enumerators in the _lpuart_flags. For example, to check whether the TX is empty:

Parameters
baseLPUART peripheral base address.
Returns
LPUART status flags which are ORed by the enumerators in the _lpuart_flags.

brief Gets LPUART status flags.

This function gets all LPUART status flags. The flags are returned as the logical OR value of the enumerators ref _lpuart_flags. To check for a specific status, compare the return value with enumerators in the ref _lpuart_flags. For example, to check whether the TX is empty: code if (kLPUART_TxDataRegEmptyFlag & LPUART_GetStatusFlags(LPUART1)) { ... } endcode

param base LPUART peripheral base address. return LPUART status flags which are ORed by the enumerators in the _lpuart_flags.

Definition at line 746 of file fsl_lpuart.c.

747{
748 uint32_t temp;
749 temp = base->STAT;
750#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
751 temp |= (base->FIFO &
752 (LPUART_FIFO_TXEMPT_MASK | LPUART_FIFO_RXEMPT_MASK | LPUART_FIFO_TXOF_MASK | LPUART_FIFO_RXUF_MASK)) >>
753 16;
754#endif
755 return temp;
756}

Referenced by LPUART_ClearStatusFlags(), LPUART_ReadBlocking(), and LPUART_TransferHandleIRQ().

Here is the caller graph for this function:

◆ LPUART_Init()

status_t LPUART_Init ( LPUART_Type *  base,
const lpuart_config_t config,
uint32_t  srcClock_Hz 
)

Initializes an LPUART instance with the user configuration structure and the peripheral clock.

This function configures the LPUART module with user-defined settings. Call the LPUART_GetDefaultConfig() function to configure the configuration structure and get the default configuration. The example below shows how to use this API to configure the LPUART.

lpuart_config_t lpuartConfig;
lpuartConfig.baudRate_Bps = 115200U;
lpuartConfig.isMsb = false;
lpuartConfig.txFifoWatermark = 0;
lpuartConfig.rxFifoWatermark = 1;
LPUART_Init(LPUART1, &lpuartConfig, 20000000U);
uint8_t rxFifoWatermark
Definition fsl_lpuart.h:200
uint8_t txFifoWatermark
Definition fsl_lpuart.h:199
status_t LPUART_Init(LPUART_Type *base, const lpuart_config_t *config, uint32_t srcClock_Hz)
Initializes an LPUART instance with the user configuration structure and the peripheral clock.
Definition fsl_lpuart.c:239
lpuart_parity_mode_t parityMode
Definition fsl_lpuart.h:192
lpuart_stop_bit_count_t stopBitCount
Definition fsl_lpuart.h:196
uint32_t baudRate_Bps
Definition fsl_lpuart.h:191
lpuart_data_bits_t dataBitsCount
Definition fsl_lpuart.h:193
LPUART configuration structure.
Definition fsl_lpuart.h:190
Parameters
baseLPUART peripheral base address.
configPointer to a user-defined configuration structure.
srcClock_HzLPUART clock source frequency in HZ.
Return values
kStatus_LPUART_BaudrateNotSupportBaudrate is not support in current clock source.
kStatus_SuccessLPUART initialize succeed

brief Initializes an LPUART instance with the user configuration structure and the peripheral clock.

This function configures the LPUART module with user-defined settings. Call the LPUART_GetDefaultConfig() function to configure the configuration structure and get the default configuration. The example below shows how to use this API to configure the LPUART. code lpuart_config_t lpuartConfig; lpuartConfig.baudRate_Bps = 115200U; lpuartConfig.parityMode = kLPUART_ParityDisabled; lpuartConfig.dataBitsCount = kLPUART_EightDataBits; lpuartConfig.isMsb = false; lpuartConfig.stopBitCount = kLPUART_OneStopBit; lpuartConfig.txFifoWatermark = 0; lpuartConfig.rxFifoWatermark = 1; LPUART_Init(LPUART1, &lpuartConfig, 20000000U); endcode

param base LPUART peripheral base address. param config Pointer to a user-defined configuration structure. param srcClock_Hz LPUART clock source frequency in HZ. retval kStatus_LPUART_BaudrateNotSupport Baudrate is not support in current clock source. retval kStatus_Success LPUART initialize succeed

Definition at line 239 of file fsl_lpuart.c.

240{
241 assert(config);
242 assert(config->baudRate_Bps);
243#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
244 assert(FSL_FEATURE_LPUART_FIFO_SIZEn(base) >= config->txFifoWatermark);
245 assert(FSL_FEATURE_LPUART_FIFO_SIZEn(base) >= config->rxFifoWatermark);
246#endif
247
248 uint32_t temp;
249 uint16_t sbr, sbrTemp;
250 uint32_t osr, osrTemp, tempDiff, calculatedBaud, baudDiff;
251
252 /* This LPUART instantiation uses a slightly different baud rate calculation
253 * The idea is to use the best OSR (over-sampling rate) possible
254 * Note, OSR is typically hard-set to 16 in other LPUART instantiations
255 * loop to find the best OSR value possible, one that generates minimum baudDiff
256 * iterate through the rest of the supported values of OSR */
257
258 baudDiff = config->baudRate_Bps;
259 osr = 0;
260 sbr = 0;
261 for (osrTemp = 4; osrTemp <= 32; osrTemp++)
262 {
263 /* calculate the temporary sbr value */
264 sbrTemp = (srcClock_Hz / (config->baudRate_Bps * osrTemp));
265 /*set sbrTemp to 1 if the sourceClockInHz can not satisfy the desired baud rate*/
266 if (sbrTemp == 0)
267 {
268 sbrTemp = 1;
269 }
270 /* Calculate the baud rate based on the temporary OSR and SBR values */
271 calculatedBaud = (srcClock_Hz / (osrTemp * sbrTemp));
272
273 tempDiff = calculatedBaud - config->baudRate_Bps;
274
275 /* Select the better value between srb and (sbr + 1) */
276 if (tempDiff > (config->baudRate_Bps - (srcClock_Hz / (osrTemp * (sbrTemp + 1)))))
277 {
278 tempDiff = config->baudRate_Bps - (srcClock_Hz / (osrTemp * (sbrTemp + 1)));
279 sbrTemp++;
280 }
281
282 if (tempDiff <= baudDiff)
283 {
284 baudDiff = tempDiff;
285 osr = osrTemp; /* update and store the best OSR value calculated */
286 sbr = sbrTemp; /* update store the best SBR value calculated */
287 }
288 }
289
290 /* Check to see if actual baud rate is within 3% of desired baud rate
291 * based on the best calculate OSR value */
292 if (baudDiff > ((config->baudRate_Bps / 100) * 3))
293 {
294 /* Unacceptable baud rate difference of more than 3%*/
296 }
297
298#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
299
300 uint32_t instance = LPUART_GetInstance(base);
301
302 /* Enable lpuart clock */
304#if defined(LPUART_PERIPH_CLOCKS)
306#endif
307
308#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
309
310#if defined(FSL_FEATURE_LPUART_HAS_GLOBAL) && FSL_FEATURE_LPUART_HAS_GLOBAL
311 /*Reset all internal logic and registers, except the Global Register */
313#else
314 /* Disable LPUART TX RX before setting. */
315 base->CTRL &= ~(LPUART_CTRL_TE_MASK | LPUART_CTRL_RE_MASK);
316#endif
317
318 temp = base->BAUD;
319
320 /* Acceptable baud rate, check if OSR is between 4x and 7x oversampling.
321 * If so, then "BOTHEDGE" sampling must be turned on */
322 if ((osr > 3) && (osr < 8))
323 {
324 temp |= LPUART_BAUD_BOTHEDGE_MASK;
325 }
326
327 /* program the osr value (bit value is one less than actual value) */
328 temp &= ~LPUART_BAUD_OSR_MASK;
329 temp |= LPUART_BAUD_OSR(osr - 1);
330
331 /* write the sbr value to the BAUD registers */
332 temp &= ~LPUART_BAUD_SBR_MASK;
333 base->BAUD = temp | LPUART_BAUD_SBR(sbr);
334
335 /* Set bit count and parity mode. */
336 base->BAUD &= ~LPUART_BAUD_M10_MASK;
337
338 temp = base->CTRL &
339 ~(LPUART_CTRL_PE_MASK | LPUART_CTRL_PT_MASK | LPUART_CTRL_M_MASK | LPUART_CTRL_ILT_MASK |
340 LPUART_CTRL_IDLECFG_MASK);
341
342 temp |=
343 (uint8_t)config->parityMode | LPUART_CTRL_IDLECFG(config->rxIdleConfig) | LPUART_CTRL_ILT(config->rxIdleType);
344
345#if defined(FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT) && FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT
346 if (kLPUART_SevenDataBits == config->dataBitsCount)
347 {
348 if (kLPUART_ParityDisabled != config->parityMode)
349 {
350 temp &= ~LPUART_CTRL_M7_MASK; /* Seven data bits and one parity bit */
351 }
352 else
353 {
354 temp |= LPUART_CTRL_M7_MASK;
355 }
356 }
357 else
358#endif
359 {
360 if (kLPUART_ParityDisabled != config->parityMode)
361 {
362 temp |= LPUART_CTRL_M_MASK; /* Eight data bits and one parity bit */
363 }
364 }
365
366 base->CTRL = temp;
367
368#if defined(FSL_FEATURE_LPUART_HAS_STOP_BIT_CONFIG_SUPPORT) && FSL_FEATURE_LPUART_HAS_STOP_BIT_CONFIG_SUPPORT
369 /* set stop bit per char */
370 temp = base->BAUD & ~LPUART_BAUD_SBNS_MASK;
371 base->BAUD = temp | LPUART_BAUD_SBNS((uint8_t)config->stopBitCount);
372#endif
373
374#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
375 /* Set tx/rx WATER watermark
376 Note:
377 Take care of the RX FIFO, RX interrupt request only assert when received bytes
378 equal or more than RX water mark, there is potential issue if RX water
379 mark larger than 1.
380 For example, if RX FIFO water mark is 2, upper layer needs 5 bytes and
381 5 bytes are received. the last byte will be saved in FIFO but not trigger
382 RX interrupt because the water mark is 2.
383 */
384 base->WATER = (((uint32_t)(config->rxFifoWatermark) << 16) | config->txFifoWatermark);
385
386 /* Enable tx/rx FIFO */
387 base->FIFO |= (LPUART_FIFO_TXFE_MASK | LPUART_FIFO_RXFE_MASK);
388
389 /* Flush FIFO */
390 base->FIFO |= (LPUART_FIFO_TXFLUSH_MASK | LPUART_FIFO_RXFLUSH_MASK);
391#endif
392
393 /* Clear all status flags */
394 temp = (LPUART_STAT_RXEDGIF_MASK | LPUART_STAT_IDLE_MASK | LPUART_STAT_OR_MASK | LPUART_STAT_NF_MASK |
395 LPUART_STAT_FE_MASK | LPUART_STAT_PF_MASK);
396
397#if defined(FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT) && FSL_FEATURE_LPUART_HAS_LIN_BREAK_DETECT
398 temp |= LPUART_STAT_LBKDIF_MASK;
399#endif
400
401#if defined(FSL_FEATURE_LPUART_HAS_ADDRESS_MATCHING) && FSL_FEATURE_LPUART_HAS_ADDRESS_MATCHING
402 temp |= (LPUART_STAT_MA1F_MASK | LPUART_STAT_MA2F_MASK);
403#endif
404
405#if defined(FSL_FEATURE_LPUART_HAS_MODEM_SUPPORT) && FSL_FEATURE_LPUART_HAS_MODEM_SUPPORT
406 /* Set the CTS configuration/TX CTS source. */
407 base->MODIR |= LPUART_MODIR_TXCTSC(config->txCtsConfig) | LPUART_MODIR_TXCTSSRC(config->txCtsSource);
408 if (config->enableRxRTS)
409 {
410 /* Enable the receiver RTS(request-to-send) function. */
411 base->MODIR |= LPUART_MODIR_RXRTSE_MASK;
412 }
413 if (config->enableTxCTS)
414 {
415 /* Enable the CTS(clear-to-send) function. */
416 base->MODIR |= LPUART_MODIR_TXCTSE_MASK;
417 }
418#endif
419
420 /* Set data bits order. */
421 if (config->isMsb)
422 {
423 temp |= LPUART_STAT_MSBF_MASK;
424 }
425 else
426 {
427 temp &= ~LPUART_STAT_MSBF_MASK;
428 }
429
430 base->STAT |= temp;
431
432 /* Enable TX/RX base on configure structure. */
433 temp = base->CTRL;
434 if (config->enableTx)
435 {
436 temp |= LPUART_CTRL_TE_MASK;
437 }
438
439 if (config->enableRx)
440 {
441 temp |= LPUART_CTRL_RE_MASK;
442 }
443
444 base->CTRL = temp;
445
446 return kStatus_Success;
447}
static void CLOCK_EnableClock(clock_ip_name_t name)
Enable the clock for specific IP.
Definition fsl_clock.h:641
static void LPUART_SoftwareReset(LPUART_Type *base)
Resets the LPUART using software.
Definition fsl_lpuart.h:276

Referenced by uart_lld_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LPUART_ReadBlocking()

status_t LPUART_ReadBlocking ( LPUART_Type *  base,
uint8_t *  data,
size_t  length 
)

Reads the receiver data register using a blocking method.

This function polls the receiver register, waits for the receiver register full or receiver FIFO has data, and reads data from the TX register.

Parameters
baseLPUART peripheral base address.
dataStart address of the buffer to store the received data.
lengthSize of the buffer.
Return values
kStatus_LPUART_RxHardwareOverrunReceiver overrun happened while receiving data.
kStatus_LPUART_NoiseErrorNoise error happened while receiving data.
kStatus_LPUART_FramingErrorFraming error happened while receiving data.
kStatus_LPUART_ParityErrorParity error happened while receiving data.
kStatus_SuccessSuccessfully received all data.

brief Reads the receiver data register using a blocking method.

This function polls the receiver register, waits for the receiver register full or receiver FIFO has data, and reads data from the TX register.

param base LPUART peripheral base address. param data Start address of the buffer to store the received data. param length Size of the buffer. retval kStatus_LPUART_RxHardwareOverrun Receiver overrun happened while receiving data. retval kStatus_LPUART_NoiseError Noise error happened while receiving data. retval kStatus_LPUART_FramingError Framing error happened while receiving data. retval kStatus_LPUART_ParityError Parity error happened while receiving data. retval kStatus_Success Successfully received all data.

Definition at line 862 of file fsl_lpuart.c.

863{
864 assert(data);
865
866 uint32_t statusFlag;
867#if defined(FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT) && FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT
868 uint32_t ctrl = base->CTRL;
869 bool isSevenDataBits =
870 ((ctrl & LPUART_CTRL_M7_MASK) || ((!(ctrl & LPUART_CTRL_M_MASK)) && (ctrl & LPUART_CTRL_PE_MASK)));
871#endif
872
873 while (length--)
874 {
875#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
876 while (0 == ((base->WATER & LPUART_WATER_RXCOUNT_MASK) >> LPUART_WATER_RXCOUNT_SHIFT))
877#else
878 while (!(base->STAT & LPUART_STAT_RDRF_MASK))
879#endif
880 {
881 statusFlag = LPUART_GetStatusFlags(base);
882
883 if (statusFlag & kLPUART_RxOverrunFlag)
884 {
887 }
888
889 if (statusFlag & kLPUART_NoiseErrorFlag)
890 {
893 }
894
895 if (statusFlag & kLPUART_FramingErrorFlag)
896 {
899 }
900
901 if (statusFlag & kLPUART_ParityErrorFlag)
902 {
905 }
906 }
907#if defined(FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT) && FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT
908 if (isSevenDataBits)
909 {
910 *(data++) = (base->DATA & 0x7F);
911 }
912 else
913 {
914 *(data++) = base->DATA;
915 }
916#else
917 *(data++) = base->DATA;
918#endif
919 }
920
921 return kStatus_Success;
922}
status_t LPUART_ClearStatusFlags(LPUART_Type *base, uint32_t mask)
Clears status flags with a provided mask.
Definition fsl_lpuart.c:777
Here is the call graph for this function:

◆ LPUART_ReadByte()

static uint8_t LPUART_ReadByte ( LPUART_Type *  base)
inlinestatic

Reads the receiver register.

This function reads data from the receiver register directly. The upper layer must ensure that the receiver register is full or that the RX FIFO has data before calling this function.

Parameters
baseLPUART peripheral base address.
Returns
Data read from data register.

Definition at line 601 of file fsl_lpuart.h.

602{
603#if defined(FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT) && FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT
604 uint32_t ctrl = base->CTRL;
605 bool isSevenDataBits =
606 ((ctrl & LPUART_CTRL_M7_MASK) ||
607 ((!(ctrl & LPUART_CTRL_M7_MASK)) && (!(ctrl & LPUART_CTRL_M_MASK)) && (ctrl & LPUART_CTRL_PE_MASK)));
608
609 if (isSevenDataBits)
610 {
611 return (base->DATA & 0x7F);
612 }
613 else
614 {
615 return base->DATA;
616 }
617#else
618 return base->DATA;
619#endif
620}

◆ LPUART_SetBaudRate()

status_t LPUART_SetBaudRate ( LPUART_Type *  base,
uint32_t  baudRate_Bps,
uint32_t  srcClock_Hz 
)

Sets the LPUART instance baudrate.

This function configures the LPUART module baudrate. This function is used to update the LPUART module baudrate after the LPUART module is initialized by the LPUART_Init.

LPUART_SetBaudRate(LPUART1, 115200U, 20000000U);
status_t LPUART_SetBaudRate(LPUART_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz)
Sets the LPUART instance baudrate.
Definition fsl_lpuart.c:564
Parameters
baseLPUART peripheral base address.
baudRate_BpsLPUART baudrate to be set.
srcClock_HzLPUART clock source frequency in HZ.
Return values
kStatus_LPUART_BaudrateNotSupportBaudrate is not supported in the current clock source.
kStatus_SuccessSet baudrate succeeded.

brief Sets the LPUART instance baudrate.

This function configures the LPUART module baudrate. This function is used to update the LPUART module baudrate after the LPUART module is initialized by the LPUART_Init. code LPUART_SetBaudRate(LPUART1, 115200U, 20000000U); endcode

param base LPUART peripheral base address. param baudRate_Bps LPUART baudrate to be set. param srcClock_Hz LPUART clock source frequency in HZ. retval kStatus_LPUART_BaudrateNotSupport Baudrate is not supported in the current clock source. retval kStatus_Success Set baudrate succeeded.

Definition at line 564 of file fsl_lpuart.c.

565{
566 assert(baudRate_Bps);
567
568 uint32_t temp, oldCtrl;
569 uint16_t sbr, sbrTemp;
570 uint32_t osr, osrTemp, tempDiff, calculatedBaud, baudDiff;
571
572 /* This LPUART instantiation uses a slightly different baud rate calculation
573 * The idea is to use the best OSR (over-sampling rate) possible
574 * Note, OSR is typically hard-set to 16 in other LPUART instantiations
575 * loop to find the best OSR value possible, one that generates minimum baudDiff
576 * iterate through the rest of the supported values of OSR */
577
578 baudDiff = baudRate_Bps;
579 osr = 0;
580 sbr = 0;
581 for (osrTemp = 4; osrTemp <= 32; osrTemp++)
582 {
583 /* calculate the temporary sbr value */
584 sbrTemp = (srcClock_Hz / (baudRate_Bps * osrTemp));
585 /*set sbrTemp to 1 if the sourceClockInHz can not satisfy the desired baud rate*/
586 if (sbrTemp == 0)
587 {
588 sbrTemp = 1;
589 }
590 /* Calculate the baud rate based on the temporary OSR and SBR values */
591 calculatedBaud = (srcClock_Hz / (osrTemp * sbrTemp));
592
593 tempDiff = calculatedBaud - baudRate_Bps;
594
595 /* Select the better value between srb and (sbr + 1) */
596 if (tempDiff > (baudRate_Bps - (srcClock_Hz / (osrTemp * (sbrTemp + 1)))))
597 {
598 tempDiff = baudRate_Bps - (srcClock_Hz / (osrTemp * (sbrTemp + 1)));
599 sbrTemp++;
600 }
601
602 if (tempDiff <= baudDiff)
603 {
604 baudDiff = tempDiff;
605 osr = osrTemp; /* update and store the best OSR value calculated */
606 sbr = sbrTemp; /* update store the best SBR value calculated */
607 }
608 }
609
610 /* Check to see if actual baud rate is within 3% of desired baud rate
611 * based on the best calculate OSR value */
612 if (baudDiff < ((baudRate_Bps / 100) * 3))
613 {
614 /* Store CTRL before disable Tx and Rx */
615 oldCtrl = base->CTRL;
616
617 /* Disable LPUART TX RX before setting. */
618 base->CTRL &= ~(LPUART_CTRL_TE_MASK | LPUART_CTRL_RE_MASK);
619
620 temp = base->BAUD;
621
622 /* Acceptable baud rate, check if OSR is between 4x and 7x oversampling.
623 * If so, then "BOTHEDGE" sampling must be turned on */
624 if ((osr > 3) && (osr < 8))
625 {
626 temp |= LPUART_BAUD_BOTHEDGE_MASK;
627 }
628
629 /* program the osr value (bit value is one less than actual value) */
630 temp &= ~LPUART_BAUD_OSR_MASK;
631 temp |= LPUART_BAUD_OSR(osr - 1);
632
633 /* write the sbr value to the BAUD registers */
634 temp &= ~LPUART_BAUD_SBR_MASK;
635 base->BAUD = temp | LPUART_BAUD_SBR(sbr);
636
637 /* Restore CTRL. */
638 base->CTRL = oldCtrl;
639
640 return kStatus_Success;
641 }
642 else
643 {
644 /* Unacceptable baud rate difference of more than 3%*/
646 }
647}

Referenced by ke1xf_clock_init().

Here is the caller graph for this function:

◆ LPUART_SoftwareReset()

static void LPUART_SoftwareReset ( LPUART_Type *  base)
inlinestatic

Resets the LPUART using software.

This function resets all internal logic and registers except the Global Register. Remains set until cleared by software.

Parameters
baseLPUART peripheral base address.

Definition at line 276 of file fsl_lpuart.h.

277{
278 base->GLOBAL |= LPUART_GLOBAL_RST_MASK;
279 base->GLOBAL &= ~LPUART_GLOBAL_RST_MASK;
280}

Referenced by LPUART_Init().

Here is the caller graph for this function:

◆ LPUART_TransferAbortReceive()

void LPUART_TransferAbortReceive ( LPUART_Type *  base,
lpuart_handle_t handle 
)

Aborts the interrupt-driven data receiving.

This function aborts the interrupt-driven data receiving. The user can get the remainBytes to find out how many bytes not received yet.

Parameters
baseLPUART peripheral base address.
handleLPUART handle pointer.

brief Aborts the interrupt-driven data receiving.

This function aborts the interrupt-driven data receiving. The user can get the remainBytes to find out how many bytes not received yet.

param base LPUART peripheral base address. param handle LPUART handle pointer.

Definition at line 1294 of file fsl_lpuart.c.

1295{
1296 assert(handle);
1297
1298 /* Only abort the receive to handle->rxData, the RX ring buffer is still working. */
1299 if (!handle->rxRingBuffer)
1300 {
1301 /* Disable RX interrupt. */
1304 }
1305
1306 handle->rxDataSize = 0U;
1307 handle->rxState = kLPUART_RxIdle;
1308}
@ kLPUART_RxIdle
Definition fsl_lpuart.c:26
uint8_t * rxRingBuffer
Definition fsl_lpuart.h:237
volatile uint8_t rxState
Definition fsl_lpuart.h:246
volatile size_t rxDataSize
Definition fsl_lpuart.h:234

Referenced by uart_lld_stop_receive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LPUART_TransferAbortSend()

void LPUART_TransferAbortSend ( LPUART_Type *  base,
lpuart_handle_t handle 
)

Aborts the interrupt-driven data transmit.

This function aborts the interrupt driven data sending. The user can get the remainBtyes to find out how many bytes are not sent out.

Parameters
baseLPUART peripheral base address.
handleLPUART handle pointer.

brief Aborts the interrupt-driven data transmit.

This function aborts the interrupt driven data sending. The user can get the remainBtyes to find out how many bytes are not sent out.

param base LPUART peripheral base address. param handle LPUART handle pointer.

Definition at line 1105 of file fsl_lpuart.c.

1106{
1107 assert(handle);
1108
1110
1111 handle->txDataSize = 0;
1112 handle->txState = kLPUART_TxIdle;
1113}
@ kLPUART_TxIdle
Definition fsl_lpuart.c:24
volatile uint8_t txState
Definition fsl_lpuart.h:245
volatile size_t txDataSize
Definition fsl_lpuart.h:231
Here is the call graph for this function:

◆ LPUART_TransferCreateHandle()

void LPUART_TransferCreateHandle ( LPUART_Type *  base,
lpuart_handle_t handle,
lpuart_transfer_callback_t  callback,
void *  userData 
)

Initializes the LPUART handle.

This function initializes the LPUART handle, which can be used for other LPUART transactional APIs. Usually, for a specified LPUART instance, call this API once to get the initialized handle.

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

Parameters
baseLPUART peripheral base address.
handleLPUART handle pointer.
callbackCallback function.
userDataUser data.

brief Initializes the LPUART handle.

This function initializes the LPUART handle, which can be used for other LPUART transactional APIs. Usually, for a specified LPUART instance, call this API once to get the initialized handle.

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

param base LPUART peripheral base address. param handle LPUART handle pointer. param callback Callback function. param userData User data.

Definition at line 942 of file fsl_lpuart.c.

946{
947 assert(handle);
948
949 uint32_t instance;
950#if defined(FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT) && FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT
951 uint32_t ctrl = base->CTRL;
952 bool isSevenDataBits =
953 ((ctrl & LPUART_CTRL_M7_MASK) || ((!(ctrl & LPUART_CTRL_M_MASK)) && (ctrl & LPUART_CTRL_PE_MASK)));
954#endif
955
956 /* Zero the handle. */
957 memset(handle, 0, sizeof(lpuart_handle_t));
958
959 /* Set the TX/RX state. */
960 handle->rxState = kLPUART_RxIdle;
961 handle->txState = kLPUART_TxIdle;
962
963 /* Set the callback and user data. */
964 handle->callback = callback;
965 handle->userData = userData;
966
967#if defined(FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT) && FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT
968 /* Initial seven data bits flag */
969 handle->isSevenDataBits = isSevenDataBits;
970#endif
971
972 /* Get instance from peripheral base address. */
974
975 /* Save the handle in global variables to support the double weak mechanism. */
976 s_lpuartHandle[instance] = handle;
977
979
980/* Enable interrupt in NVIC. */
981#if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
982 EnableIRQ(s_lpuartRxIRQ[instance]);
983 EnableIRQ(s_lpuartTxIRQ[instance]);
984#else
985 EnableIRQ(s_lpuartIRQ[instance]);
986#endif
987}
static lpuart_handle_t * s_lpuartHandle[ARRAY_SIZE(s_lpuartBases)]
Definition fsl_lpuart.c:80
static const IRQn_Type s_lpuartTxIRQ[]
Definition fsl_lpuart.c:84
static lpuart_isr_t s_lpuartIsr
Definition fsl_lpuart.c:100
static const IRQn_Type s_lpuartIRQ[]
Definition fsl_lpuart.c:86
static const IRQn_Type s_lpuartRxIRQ[]
Definition fsl_lpuart.c:83
lpuart_transfer_callback_t callback
Definition fsl_lpuart.h:242
void LPUART_TransferHandleIRQ(LPUART_Type *base, lpuart_handle_t *handle)
LPUART IRQ handle function.
LPUART handle structure.
Definition fsl_lpuart.h:229

Referenced by uart_lld_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LPUART_TransferGetReceiveCount()

status_t LPUART_TransferGetReceiveCount ( LPUART_Type *  base,
lpuart_handle_t handle,
uint32_t *  count 
)

Gets the number of bytes that have been received.

This function gets the number of bytes that have been received.

Parameters
baseLPUART peripheral base address.
handleLPUART handle pointer.
countReceive bytes count.
Return values
kStatus_NoTransferInProgressNo receive in progress.
kStatus_InvalidArgumentParameter is invalid.
kStatus_SuccessGet successfully through the parameter count;

brief Gets the number of bytes that have been received.

This function gets the number of bytes that have been received.

param base LPUART peripheral base address. param handle LPUART handle pointer. param count Receive bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter count;

Definition at line 1322 of file fsl_lpuart.c.

1323{
1324 assert(handle);
1325 assert(count);
1326
1327 if (kLPUART_RxIdle == handle->rxState)
1328 {
1330 }
1331
1332 *count = handle->rxDataSizeAll - handle->rxDataSize;
1333
1334 return kStatus_Success;
1335}
@ kStatus_NoTransferInProgress
Definition fsl_common.h:165
size_t rxDataSizeAll
Definition fsl_lpuart.h:235
uint16_t count
Definition tunerstudio.h:1

Referenced by uart_lld_stop_receive().

Here is the caller graph for this function:

◆ LPUART_TransferGetRxRingBufferLength()

size_t LPUART_TransferGetRxRingBufferLength ( LPUART_Type *  base,
lpuart_handle_t handle 
)

Get the length of received data in RX ring buffer.

Parameters
handleLPUART handle pointer.
Returns
Length of received data in RX ring buffer.

brief Get the length of received data in RX ring buffer.

userData handle LPUART handle pointer. return Length of received data in RX ring buffer.

Definition at line 135 of file fsl_lpuart.c.

136{
137 assert(handle);
138
139 size_t size;
140
141 if (handle->rxRingBufferTail > handle->rxRingBufferHead)
142 {
143 size = (size_t)(handle->rxRingBufferHead + handle->rxRingBufferSize - handle->rxRingBufferTail);
144 }
145 else
146 {
147 size = (size_t)(handle->rxRingBufferHead - handle->rxRingBufferTail);
148 }
149
150 return size;
151}
size_t rxRingBufferSize
Definition fsl_lpuart.h:238
volatile uint16_t rxRingBufferHead
Definition fsl_lpuart.h:239
volatile uint16_t rxRingBufferTail
Definition fsl_lpuart.h:240
composite packet size

Referenced by LPUART_TransferIsRxRingBufferFull(), and LPUART_TransferReceiveNonBlocking().

Here is the caller graph for this function:

◆ LPUART_TransferGetSendCount()

status_t LPUART_TransferGetSendCount ( LPUART_Type *  base,
lpuart_handle_t handle,
uint32_t *  count 
)

Gets the number of bytes that have been written to the LPUART transmitter register.

This function gets the number of bytes that have been written to LPUART TX register by an interrupt method.

Parameters
baseLPUART peripheral base address.
handleLPUART handle pointer.
countSend bytes count.
Return values
kStatus_NoTransferInProgressNo send in progress.
kStatus_InvalidArgumentParameter is invalid.
kStatus_SuccessGet successfully through the parameter count;

brief Gets the number of bytes that have been written to the LPUART transmitter register.

This function gets the number of bytes that have been written to LPUART TX register by an interrupt method.

param base LPUART peripheral base address. param handle LPUART handle pointer. param count Send bytes count. retval kStatus_NoTransferInProgress No send in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter count;

Definition at line 1128 of file fsl_lpuart.c.

1129{
1130 assert(handle);
1131 assert(count);
1132
1133 if (kLPUART_TxIdle == handle->txState)
1134 {
1136 }
1137
1138 *count = handle->txDataSizeAll - handle->txDataSize;
1139
1140 return kStatus_Success;
1141}
size_t txDataSizeAll
Definition fsl_lpuart.h:232

◆ LPUART_TransferHandleErrorIRQ()

void LPUART_TransferHandleErrorIRQ ( LPUART_Type *  base,
lpuart_handle_t handle 
)

LPUART Error IRQ handle function.

This function handles the LPUART error IRQ request.

Parameters
baseLPUART peripheral base address.
handleLPUART handle pointer.

brief LPUART Error IRQ handle function.

This function handles the LPUART error IRQ request.

param base LPUART peripheral base address. param handle LPUART handle pointer.

Definition at line 1573 of file fsl_lpuart.c.

1574{
1575 /* To be implemented by User. */
1576}

◆ LPUART_TransferHandleIRQ()

void LPUART_TransferHandleIRQ ( LPUART_Type *  base,
lpuart_handle_t handle 
)

LPUART IRQ handle function.

This function handles the LPUART transmit and receive IRQ request.

Parameters
baseLPUART peripheral base address.
handleLPUART handle pointer.

brief LPUART IRQ handle function.

This function handles the LPUART transmit and receive IRQ request.

param base LPUART peripheral base address. param handle LPUART handle pointer.

Definition at line 1345 of file fsl_lpuart.c.

1346{
1347 assert(handle);
1348
1349 uint8_t count;
1350 uint8_t tempCount;
1351 uint32_t status = LPUART_GetStatusFlags(base);
1352 uint32_t enabledInterrupts = LPUART_GetEnabledInterrupts(base);
1353
1354 /////////////////////////////////////////////////////////////////////////////////////////
1355 // [andreika][rusefi]: we use this 'fake' unused status to trigger the callback via IRQ in software
1356 if (LPUART_STAT_RXINV_MASK & status)
1357 {
1358 base->STAT &= ~LPUART_STAT_RXINV_MASK;
1359 if (handle->callback)
1360 {
1361 handle->callback(base, handle, kStatus_LPUART_RxIdle, handle->userData);
1362 }
1363 }
1364 /////////////////////////////////////////////////////////////////////////////////////////
1365
1366 /* If RX overrun. */
1367 if (kLPUART_RxOverrunFlag & status)
1368 {
1369 /* Clear overrun flag, otherwise the RX does not work. */
1370 base->STAT = ((base->STAT & 0x3FE00000U) | LPUART_STAT_OR_MASK);
1371
1372 /* Trigger callback. */
1373 if (handle->callback)
1374 {
1375 handle->callback(base, handle, kStatus_LPUART_RxHardwareOverrun, handle->userData);
1376 }
1377 }
1378
1379 /* If IDLE flag is set and the IDLE interrupt is enabled. */
1380 if ((kLPUART_IdleLineFlag & status) && (kLPUART_IdleLineInterruptEnable & enabledInterrupts))
1381 {
1382#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
1383 count = ((uint8_t)((base->WATER & LPUART_WATER_RXCOUNT_MASK) >> LPUART_WATER_RXCOUNT_SHIFT));
1384
1385 while ((count) && (handle->rxDataSize))
1386 {
1387 tempCount = MIN(handle->rxDataSize, count);
1388
1389 /* Using non block API to read the data from the registers. */
1390 LPUART_ReadNonBlocking(base, handle->rxData, tempCount);
1391 handle->rxData += tempCount;
1392 handle->rxDataSize -= tempCount;
1393 count -= tempCount;
1394
1395 /* If rxDataSize is 0, disable idle line interrupt.*/
1396 if (!(handle->rxDataSize))
1397 {
1398 handle->rxState = kLPUART_RxIdle;
1399
1401 if (handle->callback)
1402 {
1403 handle->callback(base, handle, kStatus_LPUART_RxIdle, handle->userData);
1404 }
1405 }
1406 }
1407#endif
1408 /* Clear IDLE flag.*/
1409 base->STAT |= LPUART_STAT_IDLE_MASK;
1410
1411 /* If rxDataSize is 0, disable idle line interrupt.*/
1412 if (!(handle->rxDataSize))
1413 {
1415 }
1416 /* If callback is not NULL and rxDataSize is not 0. */
1417 if ((handle->callback) && (handle->rxDataSize))
1418 {
1419 handle->callback(base, handle, kStatus_LPUART_IdleLineDetected, handle->userData);
1420 }
1421 }
1422 /* Receive data register full */
1423 if ((kLPUART_RxDataRegFullFlag & status) && (kLPUART_RxDataRegFullInterruptEnable & enabledInterrupts))
1424 {
1425/* Get the size that can be stored into buffer for this interrupt. */
1426#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
1427 count = ((uint8_t)((base->WATER & LPUART_WATER_RXCOUNT_MASK) >> LPUART_WATER_RXCOUNT_SHIFT));
1428#else
1429 count = 1;
1430#endif
1431
1432 /* If handle->rxDataSize is not 0, first save data to handle->rxData. */
1433 while ((count) && (handle->rxDataSize))
1434 {
1435#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
1436 tempCount = MIN(handle->rxDataSize, count);
1437#else
1438 tempCount = 1;
1439#endif
1440
1441 /* Using non block API to read the data from the registers. */
1442 LPUART_ReadNonBlocking(base, handle->rxData, tempCount);
1443 handle->rxData += tempCount;
1444 handle->rxDataSize -= tempCount;
1445 count -= tempCount;
1446
1447 /* If all the data required for upper layer is ready, trigger callback. */
1448 if (!handle->rxDataSize)
1449 {
1450 handle->rxState = kLPUART_RxIdle;
1451
1452 if (handle->callback)
1453 {
1454 handle->callback(base, handle, kStatus_LPUART_RxIdle, handle->userData);
1455 }
1456 }
1457 }
1458
1459 /* If use RX ring buffer, receive data to ring buffer. */
1460 if (handle->rxRingBuffer)
1461 {
1462 while (count--)
1463 {
1464 /* If RX ring buffer is full, trigger callback to notify over run. */
1465 if (LPUART_TransferIsRxRingBufferFull(base, handle))
1466 {
1467 if (handle->callback)
1468 {
1469 handle->callback(base, handle, kStatus_LPUART_RxRingBufferOverrun, handle->userData);
1470 }
1471 }
1472
1473 /* If ring buffer is still full after callback function, the oldest data is overrided. */
1474 if (LPUART_TransferIsRxRingBufferFull(base, handle))
1475 {
1476 /* Increase handle->rxRingBufferTail to make room for new data. */
1477 if (handle->rxRingBufferTail + 1U == handle->rxRingBufferSize)
1478 {
1479 handle->rxRingBufferTail = 0U;
1480 }
1481 else
1482 {
1483 handle->rxRingBufferTail++;
1484 }
1485 }
1486
1487/* Read data. */
1488#if defined(FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT) && FSL_FEATURE_LPUART_HAS_7BIT_DATA_SUPPORT
1489 if (handle->isSevenDataBits)
1490 {
1491 handle->rxRingBuffer[handle->rxRingBufferHead] = (base->DATA & 0x7F);
1492 }
1493 else
1494 {
1495 handle->rxRingBuffer[handle->rxRingBufferHead] = base->DATA;
1496 }
1497#else
1498 handle->rxRingBuffer[handle->rxRingBufferHead] = base->DATA;
1499#endif
1500
1501 /* Increase handle->rxRingBufferHead. */
1502 if (handle->rxRingBufferHead + 1U == handle->rxRingBufferSize)
1503 {
1504 handle->rxRingBufferHead = 0U;
1505 }
1506 else
1507 {
1508 handle->rxRingBufferHead++;
1509 }
1510 }
1511 }
1512 /* If no receive requst pending, stop RX interrupt. */
1513 else if (!handle->rxDataSize)
1514 {
1516 }
1517 else
1518 {
1519 }
1520 }
1521
1522 /* Send data register empty and the interrupt is enabled. */
1523 if ((kLPUART_TxDataRegEmptyFlag & status) && (kLPUART_TxDataRegEmptyInterruptEnable & enabledInterrupts))
1524 {
1525/* Get the bytes that available at this moment. */
1526#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
1527 count = FSL_FEATURE_LPUART_FIFO_SIZEn(base) -
1528 ((base->WATER & LPUART_WATER_TXCOUNT_MASK) >> LPUART_WATER_TXCOUNT_SHIFT);
1529#else
1530 count = 1;
1531#endif
1532
1533 while ((count) && (handle->txDataSize))
1534 {
1535#if defined(FSL_FEATURE_LPUART_HAS_FIFO) && FSL_FEATURE_LPUART_HAS_FIFO
1536 tempCount = MIN(handle->txDataSize, count);
1537#else
1538 tempCount = 1;
1539#endif
1540
1541 /* Using non block API to write the data to the registers. */
1542 LPUART_WriteNonBlocking(base, handle->txData, tempCount);
1543 handle->txData += tempCount;
1544 handle->txDataSize -= tempCount;
1545 count -= tempCount;
1546
1547 /* If all the data are written to data register, notify user with the callback, then TX finished. */
1548 if (!handle->txDataSize)
1549 {
1550 handle->txState = kLPUART_TxIdle;
1551
1552 /* Disable TX register empty interrupt. */
1553 base->CTRL = (base->CTRL & ~LPUART_CTRL_TIE_MASK);
1554
1555 /* Trigger callback. */
1556 if (handle->callback)
1557 {
1558 handle->callback(base, handle, kStatus_LPUART_TxIdle, handle->userData);
1559 }
1560 }
1561 }
1562 }
1563}
void LPUART_WriteNonBlocking(LPUART_Type *base, const uint8_t *data, size_t length)
Write to TX register using non-blocking method.
Definition fsl_lpuart.c:171
static bool LPUART_TransferIsRxRingBufferFull(LPUART_Type *base, lpuart_handle_t *handle)
Check whether the RX ring buffer is full.
Definition fsl_lpuart.c:153
static void LPUART_ReadNonBlocking(LPUART_Type *base, uint8_t *data, size_t length)
Read RX register using non-blocking method.
Definition fsl_lpuart.c:185
uint8_t *volatile rxData
Definition fsl_lpuart.h:233
uint8_t *volatile txData
Definition fsl_lpuart.h:230

Referenced by LPUART_TransferCreateHandle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LPUART_TransferReceiveNonBlocking()

status_t LPUART_TransferReceiveNonBlocking ( LPUART_Type *  base,
lpuart_handle_t handle,
lpuart_transfer_t xfer,
size_t receivedBytes 
)

Receives a buffer of data using the interrupt method.

This function receives data using an interrupt method. This is a non-blocking function which returns without waiting to ensure that all data are received. If the RX ring buffer is used and not empty, the data in the ring buffer is copied and the parameter receivedBytes shows how many bytes are copied from the ring buffer. After copying, if the data in the ring buffer is not enough for read, the receive request is saved by the LPUART driver. When the new data arrives, the receive request is serviced first. When all data is received, the LPUART driver notifies the upper layer through a callback function and passes a status parameter kStatus_UART_RxIdle. For example, the upper layer needs 10 bytes but there are only 5 bytes in ring buffer. The 5 bytes are copied to xfer->data, which returns with the parameter receivedBytes set to 5. For the remaining 5 bytes, the newly arrived data is saved from xfer->data[5]. When 5 bytes are received, the LPUART driver notifies the 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
baseLPUART peripheral base address.
handleLPUART handle pointer.
xferLPUART transfer structure, see #uart_transfer_t.
receivedBytesBytes received from the ring buffer directly.
Return values
kStatus_SuccessSuccessfully queue the transfer into the transmit queue.
kStatus_LPUART_RxBusyPrevious receive request is not finished.
kStatus_InvalidArgumentInvalid argument.

brief Receives a buffer of data using the interrupt method.

This function receives data using an interrupt method. This is a non-blocking function which returns without waiting to ensure that all data are received. If the RX ring buffer is used and not empty, the data in the 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 the ring buffer is not enough for read, the receive request is saved by the LPUART driver. When the new data arrives, the receive request is serviced first. When all data is received, the LPUART driver notifies the upper layer through a callback function and passes a status parameter ref kStatus_UART_RxIdle. For example, the upper layer needs 10 bytes but there are only 5 bytes in ring buffer. The 5 bytes are copied to xfer->data, which returns with the parameter p receivedBytes set to 5. For the remaining 5 bytes, the newly arrived data is saved from xfer->data[5]. When 5 bytes are received, the LPUART driver notifies the 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 LPUART peripheral base address. param handle LPUART handle pointer. param xfer LPUART transfer structure, see #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_LPUART_RxBusy Previous receive request is not finished. retval kStatus_InvalidArgument Invalid argument.

Definition at line 1169 of file fsl_lpuart.c.

1173{
1174 assert(handle);
1175 assert(xfer);
1176 assert(xfer->data);
1177 assert(xfer->dataSize);
1178
1179 uint32_t i;
1180 status_t status;
1181 /* How many bytes to copy from ring buffer to user memory. */
1182 size_t bytesToCopy = 0U;
1183 /* How many bytes to receive. */
1184 size_t bytesToReceive;
1185 /* How many bytes currently have received. */
1186 size_t bytesCurrentReceived;
1187
1188 /* How to get data:
1189 1. If RX ring buffer is not enabled, then save xfer->data and xfer->dataSize
1190 to lpuart handle, enable interrupt to store received data to xfer->data. When
1191 all data received, trigger callback.
1192 2. If RX ring buffer is enabled and not empty, get data from ring buffer first.
1193 If there are enough data in ring buffer, copy them to xfer->data and return.
1194 If there are not enough data in ring buffer, copy all of them to xfer->data,
1195 save the xfer->data remained empty space to lpuart handle, receive data
1196 to this empty space and trigger callback when finished. */
1197
1198 if (kLPUART_RxBusy == handle->rxState)
1199 {
1200 status = kStatus_LPUART_RxBusy;
1201 }
1202 else
1203 {
1204 bytesToReceive = xfer->dataSize;
1205 bytesCurrentReceived = 0;
1206
1207 /* If RX ring buffer is used. */
1208 if (handle->rxRingBuffer)
1209 {
1210 /* Disable LPUART RX IRQ, protect ring buffer. */
1212
1213 /* How many bytes in RX ring buffer currently. */
1214 bytesToCopy = LPUART_TransferGetRxRingBufferLength(base, handle);
1215
1216 if (bytesToCopy)
1217 {
1218 bytesToCopy = MIN(bytesToReceive, bytesToCopy);
1219
1220 bytesToReceive -= bytesToCopy;
1221
1222 /* Copy data from ring buffer to user memory. */
1223 for (i = 0U; i < bytesToCopy; i++)
1224 {
1225 xfer->data[bytesCurrentReceived++] = handle->rxRingBuffer[handle->rxRingBufferTail];
1226
1227 /* Wrap to 0. Not use modulo (%) because it might be large and slow. */
1228 if (handle->rxRingBufferTail + 1U == handle->rxRingBufferSize)
1229 {
1230 handle->rxRingBufferTail = 0U;
1231 }
1232 else
1233 {
1234 handle->rxRingBufferTail++;
1235 }
1236 }
1237 }
1238
1239 /* If ring buffer does not have enough data, still need to read more data. */
1240 if (bytesToReceive)
1241 {
1242 /* No data in ring buffer, save the request to LPUART handle. */
1243 handle->rxData = xfer->data + bytesCurrentReceived;
1244 handle->rxDataSize = bytesToReceive;
1245 handle->rxDataSizeAll = bytesToReceive;
1246 handle->rxState = kLPUART_RxBusy;
1247 }
1248 /* Enable LPUART RX IRQ if previously enabled. */
1250
1251 /* Call user callback since all data are received. */
1252 if (0 == bytesToReceive)
1253 {
1254 if (handle->callback)
1255 {
1256 handle->callback(base, handle, kStatus_LPUART_RxIdle, handle->userData);
1257 }
1258 }
1259 }
1260 /* Ring buffer not used. */
1261 else
1262 {
1263 handle->rxData = xfer->data + bytesCurrentReceived;
1264 handle->rxDataSize = bytesToReceive;
1265 handle->rxDataSizeAll = bytesToReceive;
1266 handle->rxState = kLPUART_RxBusy;
1267
1268 /* Enable RX interrupt. */
1271 }
1272
1273 /* Return the how many bytes have read. */
1274 if (receivedBytes)
1275 {
1276 *receivedBytes = bytesCurrentReceived;
1277 }
1278
1279 status = kStatus_Success;
1280 }
1281
1282 return status;
1283}
@ kLPUART_RxBusy
Definition fsl_lpuart.c:27
size_t LPUART_TransferGetRxRingBufferLength(LPUART_Type *base, lpuart_handle_t *handle)
Get the length of received data in RX ring buffer.
Definition fsl_lpuart.c:135

Referenced by uart_lld_start_receive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LPUART_TransferSendNonBlocking()

status_t LPUART_TransferSendNonBlocking ( LPUART_Type *  base,
lpuart_handle_t handle,
lpuart_transfer_t xfer 
)

Transmits a buffer of data using the interrupt method.

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

Note
The kStatus_LPUART_TxIdle is passed to the upper layer when all data are written to the TX register. However, there is no check to ensure that all the data sent out. Before disabling the TX, check the kLPUART_TransmissionCompleteFlag to ensure that the transmit is finished.
Parameters
baseLPUART peripheral base address.
handleLPUART handle pointer.
xferLPUART transfer structure, see lpuart_transfer_t.
Return values
kStatus_SuccessSuccessfully start the data transmission.
kStatus_LPUART_TxBusyPrevious transmission still not finished, data not all written to the TX register.
kStatus_InvalidArgumentInvalid argument.

brief Transmits a buffer of data using the interrupt method.

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

note The kStatus_LPUART_TxIdle is passed to the upper layer when all data are written to the TX register. However, there is no check to ensure that all the data sent out. Before disabling the TX, check the kLPUART_TransmissionCompleteFlag to ensure that the transmit is finished.

param base LPUART peripheral base address. param handle LPUART handle pointer. param xfer LPUART transfer structure, see lpuart_transfer_t. retval kStatus_Success Successfully start the data transmission. retval kStatus_LPUART_TxBusy Previous transmission still not finished, data not all written to the TX register. retval kStatus_InvalidArgument Invalid argument.

Definition at line 1066 of file fsl_lpuart.c.

1067{
1068 assert(handle);
1069 assert(xfer);
1070 assert(xfer->data);
1071 assert(xfer->dataSize);
1072
1073 status_t status;
1074
1075 /* Return error if current TX busy. */
1076 if (kLPUART_TxBusy == handle->txState)
1077 {
1078 status = kStatus_LPUART_TxBusy;
1079 }
1080 else
1081 {
1082 handle->txData = xfer->data;
1083 handle->txDataSize = xfer->dataSize;
1084 handle->txDataSizeAll = xfer->dataSize;
1085 handle->txState = kLPUART_TxBusy;
1086
1087 /* Enable transmitter interrupt. */
1089
1090 status = kStatus_Success;
1091 }
1092
1093 return status;
1094}
@ kLPUART_TxBusy
Definition fsl_lpuart.c:25
Here is the call graph for this function:

◆ LPUART_TransferStartRingBuffer()

void LPUART_TransferStartRingBuffer ( LPUART_Type *  base,
lpuart_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_TransferReceiveNonBlocking() API. If there is already data received in the ring buffer, the user can get the received data from the ring buffer directly.

Note
When using RX ring buffer, one byte is reserved for internal use. In other words, if ringBufferSize is 32, then only 31 bytes are used for saving data.
Parameters
baseLPUART peripheral base address.
handleLPUART handle pointer.
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_TransferReceiveNonBlocking() API. If there is already data received in the ring buffer, the user can get the received data from the ring buffer directly.

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

param base LPUART peripheral base address. param handle LPUART handle pointer. param ringBuffer Start address of ring buffer for background receiving. Pass NULL to disable the ring buffer. param ringBufferSize size of the ring buffer.

Definition at line 1006 of file fsl_lpuart.c.

1010{
1011 assert(handle);
1012 assert(ringBuffer);
1013
1014 /* Setup the ring buffer address */
1015 handle->rxRingBuffer = ringBuffer;
1016 handle->rxRingBufferSize = ringBufferSize;
1017 handle->rxRingBufferHead = 0U;
1018 handle->rxRingBufferTail = 0U;
1019
1020 /* Enable the interrupt to accept the data when user need the ring buffer. */
1022}

Referenced by uart_lld_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LPUART_TransferStopRingBuffer()

void LPUART_TransferStopRingBuffer ( LPUART_Type *  base,
lpuart_handle_t handle 
)

Aborts the background transfer and uninstalls the ring buffer.

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

Parameters
baseLPUART peripheral base address.
handleLPUART handle pointer.

brief Aborts the background transfer and uninstalls the ring buffer.

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

param base LPUART peripheral base address. param handle LPUART handle pointer.

Definition at line 1032 of file fsl_lpuart.c.

1033{
1034 assert(handle);
1035
1036 if (handle->rxState == kLPUART_RxIdle)
1037 {
1039 }
1040
1041 handle->rxRingBuffer = NULL;
1042 handle->rxRingBufferSize = 0U;
1043 handle->rxRingBufferHead = 0U;
1044 handle->rxRingBufferTail = 0U;
1045}
Here is the call graph for this function:

◆ LPUART_WriteBlocking()

void LPUART_WriteBlocking ( LPUART_Type *  base,
const uint8_t *  data,
size_t  length 
)

Writes to the transmitter register using a blocking method.

This function polls the transmitter register, waits for the register to be empty or for TX FIFO to have room, and writes data to the transmitter buffer.

Note
This function does not check whether all data has been sent out to the bus. Before disabling the transmitter, check the kLPUART_TransmissionCompleteFlag to ensure that the transmit is finished.
Parameters
baseLPUART peripheral base address.
dataStart address of the data to write.
lengthSize of the data to write.

brief Writes to the transmitter register using a blocking method.

This function polls the transmitter register, waits for the register to be empty or for TX FIFO to have room, and writes data to the transmitter buffer.

note This function does not check whether all data has been sent out to the bus. Before disabling the transmitter, check the kLPUART_TransmissionCompleteFlag to ensure that the transmit is finished.

param base LPUART peripheral base address. param data Start address of the data to write. param length Size of the data to write.

Definition at line 832 of file fsl_lpuart.c.

833{
834 assert(data);
835
836 /* This API can only ensure that the data is written into the data buffer but can't
837 ensure all data in the data buffer are sent into the transmit shift buffer. */
838 while (length--)
839 {
840 while (!(base->STAT & LPUART_STAT_TDRE_MASK))
841 {
842 }
843 base->DATA = *(data++);
844 }
845}

Referenced by uart_lld_blocking_send().

Here is the caller graph for this function:

◆ LPUART_WriteByte()

static void LPUART_WriteByte ( LPUART_Type *  base,
uint8_t  data 
)
inlinestatic

Writes to the transmitter register.

This function writes data to the transmitter register directly. The upper layer must ensure that the TX register is empty or that the TX FIFO has room before calling this function.

Parameters
baseLPUART peripheral base address.
dataData write to the TX register.

Definition at line 587 of file fsl_lpuart.h.

588{
589 base->DATA = data;
590}

Variable Documentation

◆ baudRate_Bps

uint32_t _lpuart_config::baudRate_Bps

LPUART baud rate

Definition at line 191 of file fsl_lpuart.h.

Referenced by uart_lld_start().

◆ callback

lpuart_transfer_callback_t _lpuart_handle::callback

Callback function.

Definition at line 242 of file fsl_lpuart.h.

Referenced by LPUART_TransferCreateHandle(), LPUART_TransferHandleIRQ(), and LPUART_TransferReceiveNonBlocking().

◆ data

uint8_t* _lpuart_transfer::data

◆ dataBitsCount

lpuart_data_bits_t _lpuart_config::dataBitsCount

Data bits count, eight (default), seven

Definition at line 193 of file fsl_lpuart.h.

Referenced by uart_lld_start().

◆ dataSize

size_t _lpuart_transfer::dataSize

◆ enableRx

bool _lpuart_config::enableRx

Enable RX

Definition at line 211 of file fsl_lpuart.h.

Referenced by uart_lld_start().

◆ enableRxRTS

bool _lpuart_config::enableRxRTS

RX RTS enable

Definition at line 203 of file fsl_lpuart.h.

◆ enableTx

bool _lpuart_config::enableTx

Enable TX

Definition at line 210 of file fsl_lpuart.h.

Referenced by uart_lld_start().

◆ enableTxCTS

bool _lpuart_config::enableTxCTS

TX CTS enable

Definition at line 204 of file fsl_lpuart.h.

◆ isMsb

bool _lpuart_config::isMsb

Data bits order, LSB (default), MSB

Definition at line 194 of file fsl_lpuart.h.

◆ isSevenDataBits

bool _lpuart_handle::isSevenDataBits

Seven data bits flag.

Definition at line 249 of file fsl_lpuart.h.

Referenced by LPUART_TransferCreateHandle(), and LPUART_TransferHandleIRQ().

◆ parityMode

lpuart_parity_mode_t _lpuart_config::parityMode

Parity mode, disabled (default), even, odd

Definition at line 192 of file fsl_lpuart.h.

Referenced by uart_lld_start().

◆ rxData

uint8_t* volatile _lpuart_handle::rxData

Address of remaining data to receive.

Definition at line 233 of file fsl_lpuart.h.

Referenced by LPUART_TransferHandleIRQ(), and LPUART_TransferReceiveNonBlocking().

◆ rxDataSize

volatile size_t _lpuart_handle::rxDataSize

Size of the remaining data to receive.

Definition at line 234 of file fsl_lpuart.h.

Referenced by LPUART_TransferAbortReceive(), LPUART_TransferGetReceiveCount(), LPUART_TransferHandleIRQ(), and LPUART_TransferReceiveNonBlocking().

◆ rxDataSizeAll

size_t _lpuart_handle::rxDataSizeAll

Size of the data to receive.

Definition at line 235 of file fsl_lpuart.h.

Referenced by LPUART_TransferGetReceiveCount(), LPUART_TransferReceiveNonBlocking(), and uart_lld_stop_receive().

◆ rxFifoWatermark

uint8_t _lpuart_config::rxFifoWatermark

RX FIFO watermark

Definition at line 200 of file fsl_lpuart.h.

Referenced by uart_lld_start().

◆ rxIdleConfig

lpuart_idle_config_t _lpuart_config::rxIdleConfig

RX IDLE configuration.

Definition at line 209 of file fsl_lpuart.h.

◆ rxIdleType

lpuart_idle_type_select_t _lpuart_config::rxIdleType

RX IDLE type.

Definition at line 208 of file fsl_lpuart.h.

◆ rxRingBuffer

uint8_t* _lpuart_handle::rxRingBuffer

◆ rxRingBufferHead

volatile uint16_t _lpuart_handle::rxRingBufferHead

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

Definition at line 239 of file fsl_lpuart.h.

Referenced by LPUART_TransferGetRxRingBufferLength(), LPUART_TransferHandleIRQ(), LPUART_TransferStartRingBuffer(), and LPUART_TransferStopRingBuffer().

◆ rxRingBufferSize

size_t _lpuart_handle::rxRingBufferSize

◆ rxRingBufferTail

volatile uint16_t _lpuart_handle::rxRingBufferTail

◆ rxState

volatile uint8_t _lpuart_handle::rxState

◆ stopBitCount

lpuart_stop_bit_count_t _lpuart_config::stopBitCount

Number of stop bits, 1 stop bit (default) or 2 stop bits

Definition at line 196 of file fsl_lpuart.h.

Referenced by uart_lld_start().

◆ txCtsConfig

lpuart_transmit_cts_config_t _lpuart_config::txCtsConfig

TX CTS configure

Definition at line 206 of file fsl_lpuart.h.

◆ txCtsSource

lpuart_transmit_cts_source_t _lpuart_config::txCtsSource

TX CTS source

Definition at line 205 of file fsl_lpuart.h.

◆ txData

uint8_t* volatile _lpuart_handle::txData

Address of remaining data to send.

Definition at line 230 of file fsl_lpuart.h.

Referenced by LPUART_TransferHandleIRQ(), and LPUART_TransferSendNonBlocking().

◆ txDataSize

volatile size_t _lpuart_handle::txDataSize

Size of the remaining data to send.

Definition at line 231 of file fsl_lpuart.h.

Referenced by LPUART_TransferAbortSend(), LPUART_TransferGetSendCount(), LPUART_TransferHandleIRQ(), and LPUART_TransferSendNonBlocking().

◆ txDataSizeAll

size_t _lpuart_handle::txDataSizeAll

Size of the data to send out.

Definition at line 232 of file fsl_lpuart.h.

Referenced by LPUART_TransferGetSendCount(), and LPUART_TransferSendNonBlocking().

◆ txFifoWatermark

uint8_t _lpuart_config::txFifoWatermark

TX FIFO watermark

Definition at line 199 of file fsl_lpuart.h.

Referenced by uart_lld_start().

◆ txState

volatile uint8_t _lpuart_handle::txState

◆ userData

void* _lpuart_handle::userData

LPUART callback function parameter.

Definition at line 243 of file fsl_lpuart.h.

Referenced by LPUART_TransferCreateHandle(), LPUART_TransferHandleIRQ(), and LPUART_TransferReceiveNonBlocking().