![]() |
MCUXpresso SDK API Reference Manual
Rev 2.12.1
NXP Semiconductors
|
Data Structures | |
| struct | lpuart_baud_t |
| LPUART driver baudrate configuration. More... | |
| struct | lpuart_data_t |
| lpuart data transfer configurations. More... | |
| union | lpuart_config_t |
| Union type to access the LPUART control bit configurations. More... | |
Macros | |
| #define | FSL_LPUART_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
| Defines LPUART driver version 2.0.1. More... | |
Typedefs | |
| typedef void(* | lpuartCallBack )(uint8_t *data, uint32_t length, status_t status) |
| lpuart callback pointer. More... | |
Enumerations | |
| enum | { 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), kStatus_LPUART_Timeout = MAKE_STATUS(kStatusGroup_LPUART, 15) } |
| Error codes for the LPUART driver. More... | |
| enum | _lpuart_flags { kLPUART_TxDataRegEmptyFlag, kLPUART_TransmissionCompleteFlag, kLPUART_RxDataRegFullFlag = (LPUART_STAT_RDRF_MASK), 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_RxActiveEdgeFlag = (LPUART_STAT_RXEDGIF_MASK), kLPUART_RxActiveFlag } |
| LPUART status flags. More... | |
| enum | _lpuart_interrupt_enable { kLPUART_RxActiveEdgeInterruptEnable = (LPUART_BAUD_RXEDGIE_MASK >> 8U), 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) } |
| LPUART interrupt configuration structure, default settings all disabled. More... | |
| enum | lpuart_source_clock_t |
| LPUART driver source clock. | |
| enum | lpuart_baudrate_t { kLPUART_BaudRate9600 = 0, kLPUART_BaudRate19200 = 1, kLPUART_BaudRate38400 = 2, kLPUART_BaudRate57600 = 3, kLPUART_BaudRate115200 = 4, kLPUART_BaudRate230400 = 5, kLPUART_BaudRate460800 = 6, kLPUART_BaudRate921600 = 7 } |
| LPUART driver source clock. More... | |
Functions | |
| status_t | LPUART_Init (LPUART_Type *base, const lpuart_config_t *lpuartConfig, uint32_t sourceClock) |
| Initializes an LPUART instance with the user configuration structure and the peripheral clock. More... | |
| void | LPUART_DeInit (LPUART_Type *base) |
| Deinitializes a LPUART instance. More... | |
| static void | LPUART_SoftwareReset (LPUART_Type *base) |
| Resets the LPUART using software. More... | |
| status_t | LPUART_Receive (LPUART_Type *base, uint8_t *data, uint32_t bufferSize, lpuartCallBack rxCallBack) |
| Enable Lpuart Receive operation in interrupt mode with callback registered. More... | |
| status_t | LPUART_Transmit (LPUART_Type *base, uint8_t *data, uint32_t length, lpuartCallBack txCallBack) |
| Perform Lpuart Transmit operation in interrupt mode with callback registered. More... | |
| status_t | LPUART_PollReceive (LPUART_Type *base, uint8_t *data, uint32_t *length) |
| Enable Lpuart Receive operation in polling mode. More... | |
| status_t | LPUART_PollTransmit (LPUART_Type *base, uint8_t *data, uint32_t length) |
| Enable Lpuart transmit operation in polling mode. More... | |
| static void | LPUART_EnableTxGPDMA (LPUART_Type *base, bool enable) |
| Enables or disables the LPUART transmitter DMA request. More... | |
| static void | LPUART_EnableRxGPDMA (LPUART_Type *base, bool enable) |
| Enables or disables the LPUART receiver DMA. More... | |
| static void | LPUART_EnableTx (LPUART_Type *base, bool enable) |
| Enables or disables the LPUART transmitter. More... | |
| static void | LPUART_EnableRx (LPUART_Type *base, bool enable) |
| Enables or disables the LPUART receiver. More... | |
| void | LPUART_ClearTxFlagsInterrupts (LPUART_Type *base) |
| Clears LPUART TX interrupt flags. More... | |
| void | LPUART_ClearRxFlagsInterrupts (LPUART_Type *base) |
| Clears LPUART RX interrupt flags. More... | |
| static uint32_t | LPUART_GetDataRegisterAddress (LPUART_Type *base) |
| Gets the LPUART data register address. More... | |
| void | LPUART_EnableInterrupts (LPUART_Type *base, uint32_t mask) |
| Enables LPUART interrupts according to a provided mask. More... | |
| void | LPUART_DisableInterrupts (LPUART_Type *base, uint32_t mask) |
| Disables LPUART interrupts according to a provided mask. More... | |
| uint32_t | LPUART_GetStatusFlags (LPUART_Type *base) |
| Gets LPUART status flags. More... | |
| status_t | LPUART_RegisterRXCallBack (LPUART_Type *base, lpuartCallBack rxCallBack) |
| Register the RX callback. More... | |
| status_t | LPUART_RegisterTXCallBack (LPUART_Type *base, lpuartCallBack txCallBack) |
| Register the TX callback. More... | |
| struct lpuart_baud_t |
| struct lpuart_data_t |
| union lpuart_config_t |
| uint32_t lpuart_config_t::ParityEnable |
Byte 0, bit[2:0]: Baud rate selection: 000 -> 9600, 001 -> 19200, 010 -> 38400, 011 -> 57600, 100 -> 115200, 101 -> 230400, 110 -> 460800, 111 -> 921600
| uint32_t lpuart_config_t::ParityType |
Byte 0, bit3: Parity Enable/Disable: 0 -> Disable, 1 -> Enable.
| uint32_t lpuart_config_t::StopBits |
Byte 0, bit4: Parity Type: 0 -> Even, 1 -> Odd
| uint32_t lpuart_config_t::_reserved1 |
Byte 0, bit5: Stop bits: Number of stop bits. 0 -> 1 stop bit, 1 -> 2 stop bits
| uint32_t lpuart_config_t::TXCTSE |
Byte 0, bit[7:6]: RFU
| uint32_t lpuart_config_t::TXRTSE |
Byte 1, bit[0] : TXCTSE : Transmitter clear-to-send enable, controls the operation of the transmitter. 0-> CTS has no effect on the transmitter. 1-> Enables clear-to-send operation. Transmitter checks the state of CTS each time it is ready to send a character. If CTS is asserted, the character is sent. If CTS is deasserted, remains in mark state and transmission is delayed until CTS is asserted. NOTE: Do not set both RXRTSE and TXRTSE
| uint32_t lpuart_config_t::TXRTSPOL |
Byte 1, bit[1] : TXRTSE : Transmitter request-to-send enable. Controls RTS before and after a transmission. 0-> Transmitter has no effect on RTS. 1-> When a character is placed into an empty transmitter data buffer, RTS asserts one bit time before the start bit is transmitted. RTS deasserts one bit time after all characters are completely sent, including stop bit.
| uint32_t lpuart_config_t::RXRTSE |
Byte 1, bit[2] : TXRTSPOL : Transmitter request-to-send polarity. Controls the polarity of the transmitter RTS. TXRTSPOL does not affect the polarity of the receiver RTS. RTS will remain negated in the active low state unless TXRTSE is set. 0-> Transmitter RTS is active low. 1-> Transmitter RTS is active high.
| uint32_t lpuart_config_t::TXCTSC |
Byte 1, bit[3] : RXRTSE: Receiver request-to-send enable. Allows the RTS output to control the CTS input of the transmitting device to prevent receiver overrun. 0-> Receiver has no effect on RTS. 1-> RTS is deasserted if the receiver data register is full or a start bit has been detected that would cause receiver data reg to become full. RTS is asserted if the receiver data register is not full and has not detected a start bit that would cause the receiver data register to become full.
| uint32_t lpuart_config_t::TXCTSSRC |
Byte 1, bit[4] : TXCTSC: Transmit CTS Configuration: configure if CTS state is checked at start of each character or only when the transmitter is idle. 0-> CTS input is sampled at start of each character. 1-> Sampled when the transmitter is idle.
| uint32_t lpuart_config_t::RTSWATER |
Byte 1, bit[5] : TXCTSSRC: Transmit CTS Source: 0-> CTS input is CTS_B pin. 1-> CTS input is inverted Receiver Match result.
| uint32_t lpuart_config_t::TxWaterMark |
Byte 1, bit[7:6] : RTSWATER: Configures the assertion and negation of the RX RTS_B output.
| uint32_t lpuart_config_t::RxWaterMark |
Byte 2, bit[1:0]: Transmit Watermark, when the number of datawords in the transmit FIFO/buffer is equal to or less than the TxWaterMark value, an interrupt or a DMA request is generated.
| #define FSL_LPUART_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
| typedef void(* lpuartCallBack)(uint8_t *data, uint32_t length, status_t status) |
| anonymous enum |
| enum _lpuart_flags |
This provides constants for the LPUART status flags for use in the LPUART functions.
This structure contains the settings for all LPUART interrupt configurations.
| enum lpuart_baudrate_t |
| status_t LPUART_Init | ( | LPUART_Type * | base, |
| const lpuart_config_t * | lpuartConfig, | ||
| uint32_t | sourceClock | ||
| ) |
This function configures the LPUART module with user-defined settings, see the LPUART_CTRL_t.
| base | LPUART peripheral base address. |
| lpuartConfig | LPUART configuration pointer. |
| sourceClock | LPUART source clock frequency. |
| void LPUART_DeInit | ( | LPUART_Type * | base | ) |
This function waits for transmit to complete, disables TX and RX, and disables the LPUART clock.
| base | LPUART peripheral base address. |
|
inlinestatic |
This function resets all internal logic and registers except the Global Register. Remains set until cleared by software.
| base | LPUART peripheral base address. |
| status_t LPUART_Receive | ( | LPUART_Type * | base, |
| uint8_t * | data, | ||
| uint32_t | bufferSize, | ||
| lpuartCallBack | rxCallBack | ||
| ) |
This function is non-blocking call, clears error flags, enables reception with FIFO enabled in half duplex mode.
| data | Pointer to memory to store received Lpuart data. |
| length | Pointer to memory to store length of received Lpuart data. |
| bufferSize | Size of the Rx buffer Pointer. Data received beyond this size will lead to loss of data and overflow error. |
| rxCallBack | Pointer to callback function on completion/error during Lpuart communication. |
| status_t LPUART_Transmit | ( | LPUART_Type * | base, |
| uint8_t * | data, | ||
| uint32_t | length, | ||
| lpuartCallBack | txCallBack | ||
| ) |
This function is non-blocking call, clears error flags, enable FIFO, kisk start Transmit in half duplex mode.
| data | Pointer to memory to store received Lpuart data. |
| length | Pointer to memory to store length of received Lpuart data. |
| bufferSize | Size of the Rx buffer Pointer. Data received beyond this size will lead to loss of data and overflow error. |
| rxCallBack | Pointer to callback function on completion/error during Lpuart communication. |
| status_t LPUART_PollReceive | ( | LPUART_Type * | base, |
| uint8_t * | data, | ||
| uint32_t * | length | ||
| ) |
This function is blocking call, clears error flags, enables reception with FIFO enabled in half duplex mode.
| data | Pointer to memory to store received Lpuart data. |
| length | Pointer to memory to store length of received Lpuart data. |
| status_t LPUART_PollTransmit | ( | LPUART_Type * | base, |
| uint8_t * | data, | ||
| uint32_t | length | ||
| ) |
This function is blocking call, clears error flags, enables transmission with FIFO enabled in half duplex mode.
| data | Pointer to memory to store received Lpuart data. |
| length | Pointer to memory to store length of received Lpuart data. |
|
inlinestatic |
This function enables or disables the transmit data register empty flag, STAT[TDRE], to generate DMA requests.
| base | LPUART peripheral base address. |
| enable | True to enable, false to disable. |
|
inlinestatic |
This function enables or disables the receiver data register full flag, STAT[RDRF], to generate DMA requests.
| base | LPUART peripheral base address. |
| enable | True to enable, false to disable. |
|
inlinestatic |
This function enables or disables the LPUART transmitter.
| base | LPUART peripheral base address. |
| enable | True to enable, false to disable. |
|
inlinestatic |
This function enables or disables the LPUART receiver.
| base | LPUART peripheral base address. |
| enable | True to enable, false to disable. |
| void LPUART_ClearTxFlagsInterrupts | ( | LPUART_Type * | base | ) |
| base | LPUART peripheral base address. |
| void LPUART_ClearRxFlagsInterrupts | ( | LPUART_Type * | base | ) |
| base | LPUART peripheral base address. |
|
inlinestatic |
This function returns the LPUART data register address, which is mainly used by the GPDMA.
| base | LPUART peripheral base address. |
| void LPUART_EnableInterrupts | ( | LPUART_Type * | base, |
| uint32_t | 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.
| base | LPUART peripheral base address. |
| mask | The interrupts to enable. Logical OR of _lpuart_interrupt_enable. |
| void LPUART_DisableInterrupts | ( | LPUART_Type * | base, |
| uint32_t | 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.
| base | LPUART peripheral base address. |
| mask | The interrupts to disable. Logical OR of _lpuart_interrupt_enable. |
| uint32_t LPUART_GetStatusFlags | ( | LPUART_Type * | base | ) |
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.
| base | LPUART peripheral base address. |
| status_t LPUART_RegisterRXCallBack | ( | LPUART_Type * | base, |
| lpuartCallBack | rxCallBack | ||
| ) |
This function can be used to monitor the error status during DMA transfer, note that in this case, the callback parameter data and length are invalid.
| base | LPUART peripheral base address. |
| rxCallBack | Callback to register. |
| kStatus_Success | Register succeed. |
| kStatus_InvalidArgument | Invalid parameter. |
| status_t LPUART_RegisterTXCallBack | ( | LPUART_Type * | base, |
| lpuartCallBack | txCallBack | ||
| ) |
This function can be used to monitor the error status during DMA transfer.
| base | LPUART peripheral base address. |
| txCallBack | Callback to register. |
| kStatus_Success | Register succeed. |
| kStatus_InvalidArgument | Invalid parameter. |