Kinetis SDK v.1.3 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Overview

This section describes the programming interface of the LPUART Peripheral driver.

Data Structures

struct  lpuart_dma_state_t
 Runtime state structure for UART driver with DMA. More...
 
struct  lpuart_dma_user_config_t
 LPUART configuration structure. More...
 
struct  lpuart_state_t
 Runtime state of the LPUART driver. More...
 
struct  lpuart_user_config_t
 LPUART configuration structure. More...
 
struct  lpuart_edma_state_t
 Runtime state structure for UART driver with DMA. More...
 
struct  lpuart_edma_user_config_t
 LPUART configuration structure. More...
 

Typedefs

typedef void(* lpuart_rx_callback_t )(uint32_t instance, void *lpuartState)
 LPUART receive callback function type. More...
 
typedef void(* lpuart_tx_callback_t )(uint32_t instance, void *lpuartState)
 UART transmit callback function type.
 

Variables

LPUART_Type *const g_lpuartBase [LPUART_INSTANCE_COUNT]
 Table of base addresses for LPUART instances. More...
 
LPUART_Type *const g_lpuartBase [LPUART_INSTANCE_COUNT]
 Table of base addresses for LPUART instances. More...
 
const IRQn_Type g_lpuartRxTxIrqId [LPUART_INSTANCE_COUNT]
 Table to save LPUART IRQ enumeration numbers defined in the CMSIS header file.
 
LPUART_Type *const g_lpuartBase [LPUART_INSTANCE_COUNT]
 Table of base addresses for LPUART instances. More...
 

LPUART DMA Driver

lpuart_status_t LPUART_DRV_DmaInit (uint32_t instance, lpuart_dma_state_t *lpuartDmaStatePtr, const lpuart_dma_user_config_t *lpuartUserConfig)
 Initializes an LPUART instance to work with DMA. More...
 
lpuart_status_t LPUART_DRV_DmaDeinit (uint32_t instance)
 Shuts down the LPUART. More...
 
lpuart_status_t LPUART_DRV_DmaSendDataBlocking (uint32_t instance, const uint8_t *txBuff, uint32_t txSize, uint32_t timeout)
 Sends (transmits) data out through the LPUART-DMA module using a blocking method. More...
 
lpuart_status_t LPUART_DRV_DmaSendData (uint32_t instance, const uint8_t *txBuff, uint32_t txSize)
 Sends (transmits) data through the LPUART-DMA module using a non-blocking method. More...
 
lpuart_status_t LPUART_DRV_DmaGetTransmitStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous LPUART-DMA transmit has finished. More...
 
lpuart_status_t LPUART_DRV_DmaAbortSendingData (uint32_t instance)
 Terminates a non-blocking LPUART-DMA transmission early. More...
 
lpuart_status_t LPUART_DRV_DmaReceiveDataBlocking (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize, uint32_t timeout)
 Gets (receives) data from the LPUART-DMA module using a blocking method. More...
 
lpuart_status_t LPUART_DRV_DmaReceiveData (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize)
 Gets (receives) data from the LPUART-DMA module using a non-blocking method. More...
 
lpuart_status_t LPUART_DRV_DmaGetReceiveStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous LPUART-DMA receive is complete. More...
 
lpuart_status_t LPUART_DRV_DmaAbortReceivingData (uint32_t instance)
 Terminates a non-blocking LPUART-DMA receive early. More...
 

LPUART Driver

lpuart_status_t LPUART_DRV_Init (uint32_t instance, lpuart_state_t *lpuartStatePtr, const lpuart_user_config_t *lpuartUserConfig)
 Initializes an LPUART operation instance. More...
 
lpuart_status_t LPUART_DRV_Deinit (uint32_t instance)
 Shuts down the LPUART by disabling interrupts and transmitter/receiver. More...
 
lpuart_rx_callback_t LPUART_DRV_InstallRxCallback (uint32_t instance, lpuart_rx_callback_t function, uint8_t *rxBuff, void *callbackParam, bool alwaysEnableRxIrq)
 Installs callback function for the LPUART receive. More...
 
lpuart_tx_callback_t LPUART_DRV_InstallTxCallback (uint32_t instance, lpuart_tx_callback_t function, uint8_t *txBuff, void *callbackParam)
 Installs callback function for the LPUART transmit. More...
 
lpuart_status_t LPUART_DRV_SendDataBlocking (uint32_t instance, const uint8_t *txBuff, uint32_t txSize, uint32_t timeout)
 Sends data out through the LPUART module using a blocking method. More...
 
lpuart_status_t LPUART_DRV_SendData (uint32_t instance, const uint8_t *txBuff, uint32_t txSize)
 Sends data out through the LPUART module using a non-blocking method. More...
 
lpuart_status_t LPUART_DRV_GetTransmitStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous transmit is complete. More...
 
lpuart_status_t LPUART_DRV_AbortSendingData (uint32_t instance)
 Terminates a non-blocking transmission early. More...
 
lpuart_status_t LPUART_DRV_ReceiveDataBlocking (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize, uint32_t timeout)
 Gets data from the LPUART module by using a blocking method. More...
 
lpuart_status_t LPUART_DRV_ReceiveData (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize)
 Gets data from the LPUART module by using a non-blocking method. More...
 
lpuart_status_t LPUART_DRV_GetReceiveStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous receive is complete. More...
 
lpuart_status_t LPUART_DRV_AbortReceivingData (uint32_t instance)
 Terminates a non-blocking receive early. More...
 

LPUART DMA Driver

lpuart_status_t LPUART_DRV_EdmaInit (uint32_t instance, lpuart_edma_state_t *lpuartEdmaStatePtr, const lpuart_edma_user_config_t *lpuartUserConfig)
 Initializes an LPUART instance to work with DMA. More...
 
lpuart_status_t LPUART_DRV_EdmaDeinit (uint32_t instance)
 Shuts down the LPUART. More...
 
lpuart_status_t LPUART_DRV_EdmaSendDataBlocking (uint32_t instance, const uint8_t *txBuff, uint32_t txSize, uint32_t timeout)
 Sends (transmits) data out through the LPUART-DMA module using a blocking method. More...
 
lpuart_status_t LPUART_DRV_EdmaSendData (uint32_t instance, const uint8_t *txBuff, uint32_t txSize)
 Sends (transmits) data through the LPUART-DMA module using a non-blocking method. More...
 
lpuart_status_t LPUART_DRV_EdmaGetTransmitStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous LPUART-DMA transmit has finished. More...
 
lpuart_status_t LPUART_DRV_EdmaAbortSendingData (uint32_t instance)
 Terminates a non-blocking LPUART-DMA transmission early. More...
 
lpuart_status_t LPUART_DRV_EdmaReceiveDataBlocking (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize, uint32_t timeout)
 Gets (receives) data from the LPUART-DMA module using a blocking method. More...
 
lpuart_status_t LPUART_DRV_EdmaReceiveData (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize)
 Gets (receives) data from the LPUART-DMA module using a non-blocking method. More...
 
lpuart_status_t LPUART_DRV_EdmaGetReceiveStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous LPUART-DMA receive is complete. More...
 
lpuart_status_t LPUART_DRV_EdmaAbortReceivingData (uint32_t instance)
 Terminates a non-blocking LPUART-DMA receive early. More...
 

Data Structure Documentation

struct lpuart_dma_state_t

Data Fields

volatile bool isTxBusy
 True if there is an active transmit. More...
 
volatile bool isRxBusy
 True if there is an active receive. More...
 
volatile bool isTxBlocking
 True if transmit is blocking transaction. More...
 
volatile bool isRxBlocking
 True if receive is blocking transaction. More...
 
semaphore_t txIrqSync
 Used to wait for ISR to complete its TX business. More...
 
semaphore_t rxIrqSync
 Used to wait for ISR to complete its RX business. More...
 
dma_channel_t dmaLpuartTx
 Structure definition for the DMA channel.
 
dma_channel_t dmaLpuartRx
 Structure definition for the DMA channel.
 

Field Documentation

volatile bool lpuart_dma_state_t::isTxBusy
volatile bool lpuart_dma_state_t::isRxBusy
volatile bool lpuart_dma_state_t::isTxBlocking
volatile bool lpuart_dma_state_t::isRxBlocking
semaphore_t lpuart_dma_state_t::txIrqSync
semaphore_t lpuart_dma_state_t::rxIrqSync
struct lpuart_dma_user_config_t

Data Fields

clock_lpuart_src_t clockSource
 LPUART clock source in fsl_sim_hal_<device>.h.
 
uint32_t baudRate
 LPUART baud rate.
 
lpuart_parity_mode_t parityMode
 parity mode, disabled (default), even, odd
 
lpuart_stop_bit_count_t stopBitCount
 number of stop bits, 1 stop bit (default) or 2 stop bits
 
lpuart_bit_count_per_char_t bitCountPerChar
 number of bits, 8-bit (default) or 9-bit in a char (up to 10-bits in some LPUART instances. More...
 

Field Documentation

lpuart_bit_count_per_char_t lpuart_dma_user_config_t::bitCountPerChar
struct lpuart_state_t

Note that the caller must provide memory for the driver state structures during initialization because the driver does not statically allocate memory.

Data Fields

uint8_t txFifoEntryCount
 Number of data word entries in transmit FIFO. More...
 
const uint8_t * txBuff
 The buffer of data being sent. More...
 
uint8_t * rxBuff
 The buffer of received data. More...
 
volatile size_t txSize
 The remaining number of bytes to be transmitted. More...
 
volatile size_t rxSize
 The remaining number of bytes to be received. More...
 
volatile bool isTxBusy
 True if there is an active transmit. More...
 
volatile bool isRxBusy
 True if there is an active receive. More...
 
volatile bool isTxBlocking
 True if transmit is blocking transaction. More...
 
volatile bool isRxBlocking
 True if receive is blocking transaction. More...
 
semaphore_t txIrqSync
 Used to wait for ISR to complete transmit. More...
 
semaphore_t rxIrqSync
 Used to wait for ISR to complete receive. More...
 
lpuart_rx_callback_t rxCallback
 Callback to invoke after receiving byte. More...
 
void * rxCallbackParam
 Receive callback parameter pointer. More...
 
lpuart_tx_callback_t txCallback
 Callback to invoke after transmitting byte. More...
 
void * txCallbackParam
 Transmit callback parameter pointer. More...
 

Field Documentation

uint8_t lpuart_state_t::txFifoEntryCount
const uint8_t* lpuart_state_t::txBuff
uint8_t* lpuart_state_t::rxBuff
volatile size_t lpuart_state_t::txSize
volatile size_t lpuart_state_t::rxSize
volatile bool lpuart_state_t::isTxBusy
volatile bool lpuart_state_t::isRxBusy
volatile bool lpuart_state_t::isTxBlocking
volatile bool lpuart_state_t::isRxBlocking
semaphore_t lpuart_state_t::txIrqSync
semaphore_t lpuart_state_t::rxIrqSync
lpuart_rx_callback_t lpuart_state_t::rxCallback
void* lpuart_state_t::rxCallbackParam
lpuart_tx_callback_t lpuart_state_t::txCallback
void* lpuart_state_t::txCallbackParam
struct lpuart_user_config_t

Data Fields

clock_lpuart_src_t clockSource
 LPUART clock source.
 
uint32_t baudRate
 LPUART baud rate.
 
lpuart_parity_mode_t parityMode
 parity mode, disabled (default), even, odd
 
lpuart_stop_bit_count_t stopBitCount
 number of stop bits, 1 stop bit (default) or 2 stop bits
 
lpuart_bit_count_per_char_t bitCountPerChar
 number of bits, 8-bit (default) or 9-bit in a char (up to 10-bits in some LPUART instances.
 
struct lpuart_edma_state_t

Data Fields

volatile bool isTxBusy
 True if there is an active transmit. More...
 
volatile bool isRxBusy
 True if there is an active receive. More...
 
volatile bool isTxBlocking
 True if transmit is blocking transaction. More...
 
volatile bool isRxBlocking
 True if receive is blocking transaction. More...
 
semaphore_t txIrqSync
 Used to wait for ISR to complete its TX business. More...
 
semaphore_t rxIrqSync
 Used to wait for ISR to complete its RX business. More...
 
edma_chn_state_t edmaLpuartTx
 Structure definition for the eDMA channel.
 
edma_chn_state_t edmaLpuartRx
 Structure definition for the eDMA channel.
 

Field Documentation

volatile bool lpuart_edma_state_t::isTxBusy
volatile bool lpuart_edma_state_t::isRxBusy
volatile bool lpuart_edma_state_t::isTxBlocking
volatile bool lpuart_edma_state_t::isRxBlocking
semaphore_t lpuart_edma_state_t::txIrqSync
semaphore_t lpuart_edma_state_t::rxIrqSync
struct lpuart_edma_user_config_t

Data Fields

clock_lpuart_src_t clockSource
 LPUART clock source in fsl_sim_hal_<device>.h.
 
uint32_t baudRate
 LPUART baud rate.
 
lpuart_parity_mode_t parityMode
 parity mode, disabled (default), even, odd
 
lpuart_stop_bit_count_t stopBitCount
 number of stop bits, 1 stop bit (default) or 2 stop bits
 
lpuart_bit_count_per_char_t bitCountPerChar
 number of bits, 8-bit (default) or 9-bit in a char (up to 10-bits in some LPUART instances. More...
 

Field Documentation

lpuart_bit_count_per_char_t lpuart_edma_user_config_t::bitCountPerChar

Typedef Documentation

typedef void(* lpuart_rx_callback_t)(uint32_t instance, void *lpuartState)

Function Documentation

lpuart_status_t LPUART_DRV_DmaInit ( uint32_t  instance,
lpuart_dma_state_t lpuartDmaStatePtr,
const lpuart_dma_user_config_t lpuartUserConfig 
)

This function initializes the run-time state structure to keep track of the on-going transfers, un-gates the clock to the LPUART module, initializes the module to user-defined settings and default settings, configures the IRQ state structure and enables the module-level interrupt to the core, and enables the LPUART module transmitter and receiver. This example shows how to set up the lpuart_dma_state_t and the lpuart_user_config_t parameters and how to call the LPUART_DRV_DmaInit function by passing in these parameters:

lpuart_user_config_t lpuartConfig;
lpuartConfig.baudRate = 9600;
lpuart_dma_state_t lpuartDmaState;
LPUART_DRV_DmaInit(instance, &lpuartDmaState, &lpuartConfig);
Parameters
instanceThe LPUART instance number.
lpuartDmaStatePtrA pointer to the LPUART driver state structure memory. The user passes in the memory for the run-time state structure. The LPUART driver populates the members. This run-time state structure keeps track of the current transfer in progress.
lpuartUserConfigThe user configuration structure of type lpuart_user_config_t. The user populates the members of this structure and passes the pointer of this structure into this function.
Returns
An error code or kStatus_LPUART_Success.
lpuart_status_t LPUART_DRV_DmaDeinit ( uint32_t  instance)

This function disables the LPUART-DMA trigger, the transmitter, and the receiver.

Parameters
instanceThe LPUART instance number.
Returns
An error code or kStatus_LPUART_Success.
lpuart_status_t LPUART_DRV_DmaSendDataBlocking ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize,
uint32_t  timeout 
)
Parameters
instanceThe LPUART instance number.
txBuffA pointer to the source buffer containing 8-bit data chars to send.
txSizeThe number of bytes to send.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_LPUART_Success.
lpuart_status_t LPUART_DRV_DmaSendData ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize 
)
Parameters
instanceThe LPUART module base address.
txBuffA pointer to the source buffer containing 8-bit data chars to send.
txSizeThe number of bytes to send.
Returns
An error code or kStatus_LPUART_Success.
lpuart_status_t LPUART_DRV_DmaGetTransmitStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)
Parameters
instanceThe LPUART module base address.
bytesRemainingA pointer to a value that is populated with the number of bytes that are remaining in the active transfer.
Returns
Current transmit status.
Return values
kStatus_LPUART_SuccessThe transmit has completed successfully.
kStatus_LPUART_TxBusyThe transmit is still in progress. bytesTransmitted is filled with the number of bytes which are transmitted up to that point.
lpuart_status_t LPUART_DRV_DmaAbortSendingData ( uint32_t  instance)
Parameters
instanceThe LPUART module base address.
Returns
Whether the abort of transmitting was successful or not.
Return values
kStatus_LPUART_SuccessThe transmit was successful.
kStatus_LPUART_NoTransmitInProgressNo transmission is currently in progress.
lpuart_status_t LPUART_DRV_DmaReceiveDataBlocking ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize,
uint32_t  timeout 
)
Parameters
instanceThe LPUART module base address.
rxBuffA pointer to the buffer containing 8-bit read data chars received.
rxSizeThe number of bytes to receive.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_LPUART_Success.
lpuart_status_t LPUART_DRV_DmaReceiveData ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize 
)
Parameters
instanceThe LPUART module base address.
rxBuffA pointer to the buffer containing 8-bit read data chars received.
rxSizeThe number of bytes to receive.
Returns
An error code or kStatus_LPUART_Success.
lpuart_status_t LPUART_DRV_DmaGetReceiveStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)
Parameters
instanceThe LPUART module base address.
bytesRemainingA pointer to a value that populated with the number of bytes which still need to be received in the active transfer.
Returns
Current receiving status.
Return values
kStatus_LPUART_SuccessThe receive has completed successfully.
kStatus_LPUART_RxBusyThe receive is still in progress. bytesReceived is filled with the number of bytes which are received up to that point.
lpuart_status_t LPUART_DRV_DmaAbortReceivingData ( uint32_t  instance)
Parameters
instanceThe LPUART module base address.
Returns
Whether the abort of receiving was successful or not.
Return values
kStatus_LPUART_SuccessThe receive was successful.
kStatus_LPUART_NoTransmitInProgressNo receive is currently in progress.
lpuart_status_t LPUART_DRV_Init ( uint32_t  instance,
lpuart_state_t lpuartStatePtr,
const lpuart_user_config_t lpuartUserConfig 
)

The caller provides memory for the driver state structures during initialization. The user must select the LPUART clock source in the application to initialize the LPUART.

Parameters
instanceLPUART instance number
lpuartUserConfiguser configuration structure of type lpuart_user_config_t
lpuartStatePtrpointer to the LPUART driver state structure
Returns
An error code or kStatus_LPUART_Success
lpuart_status_t LPUART_DRV_Deinit ( uint32_t  instance)

This function disables the LPUART interrupts, the transmitter and receiver, and flushes the FIFOs (for modules that support FIFOs).

Parameters
instanceLPUART instance number
Returns
An error code or kStatus_LPUART_Success
lpuart_rx_callback_t LPUART_DRV_InstallRxCallback ( uint32_t  instance,
lpuart_rx_callback_t  function,
uint8_t *  rxBuff,
void *  callbackParam,
bool  alwaysEnableRxIrq 
)
Note
After a callback is installed, it bypasses part of the LPUART IRQHandler logic. Therefore, the callback needs to handle the indexes of txBuff and txSize.
Parameters
instanceThe LPUART instance number.
functionThe LPUART receive callback function.
rxBuffThe receive buffer used inside IRQHandler. This buffer must be kept as long as the callback is alive.
callbackParamThe LPUART receive callback parameter pointer.
alwaysEnableRxIrqWhether always enable receive IRQ or not.
Returns
Former LPUART receive callback function pointer.
lpuart_tx_callback_t LPUART_DRV_InstallTxCallback ( uint32_t  instance,
lpuart_tx_callback_t  function,
uint8_t *  txBuff,
void *  callbackParam 
)
Note
After a callback is installed, it bypasses part of the LPUART IRQHandler logic. Therefore, the callback needs to handle the indexes of txBuff and txSize.
Parameters
instanceThe LPUART instance number.
functionThe LPUART transmit callback function.
txBuffThe transmit buffer used inside IRQHandler. This buffer must be kept as long as the callback is alive.
callbackParamThe LPUART transmit callback parameter pointer.
Returns
Former LPUART transmit callback function pointer.
lpuart_status_t LPUART_DRV_SendDataBlocking ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize,
uint32_t  timeout 
)

Blocking means that the function does not return until the transmission is complete.

Parameters
instanceLPUART instance number
txBuffsource buffer containing 8-bit data characters to send
txSizethe number of bytes to send
timeouttimeout value for RTOS abstraction sync control
Returns
An error code or kStatus_LPUART_Success
lpuart_status_t LPUART_DRV_SendData ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize 
)

This enables an a-sync method for transmitting data. When used with a non-blocking receive, the LPUART can perform a full duplex operation. Non-blocking means that the function returns immediately. The application has to get the transmit status to know when the transmit is complete.

Parameters
instanceLPUART instance number
txBuffsource buffer containing 8-bit data characters to send
txSizethe number of bytes to send
Returns
An error code or kStatus_LPUART_Success
lpuart_status_t LPUART_DRV_GetTransmitStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)
Parameters
instanceLPUART instance number
bytesRemainingPointer to value that is populated with the number of bytes that have been sent in the active transfer
Returns
The transmit status.
Return values
kStatus_LPUART_SuccessThe transmit has completed successfully.
kStatus_LPUART_TxBusyThe transmit is still in progress. bytesTransmitted will be filled with the number of bytes that have been transmitted so far.
lpuart_status_t LPUART_DRV_AbortSendingData ( uint32_t  instance)
Parameters
instanceLPUART instance number
Returns
Whether the aborting is successful or not.
lpuart_status_t LPUART_DRV_ReceiveDataBlocking ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize,
uint32_t  timeout 
)

Blocking means that the function does not return until the receive is complete.

Parameters
instanceLPUART instance number
rxBuffbuffer containing 8-bit read data characters received
rxSizethe number of bytes to receive
timeouttimeout value for RTOS abstraction sync control
Returns
An error code or kStatus_LPUART_Success
lpuart_status_t LPUART_DRV_ReceiveData ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize 
)

This enables an a-sync method for receiving data. When used with a non-blocking transmission, the LPUART can perform a full duplex operation. Non-blocking means that the function returns immediately. The application has to get the receive status to know when the receive is complete.

Parameters
instanceLPUART instance number
rxBuffbuffer containing 8-bit read data characters received
rxSizethe number of bytes to receive
Returns
An error code or kStatus_LPUART_Success
lpuart_status_t LPUART_DRV_GetReceiveStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)
Parameters
instanceLPUART instance number
bytesRemainingpointer to value that is filled with the number of bytes that still need to be received in the active transfer.
Returns
The receive status.
Return values
kStatus_LPUART_Successthe receive has completed successfully.
kStatus_LPUART_RxBusythe receive is still in progress. bytesReceived will be filled with the number of bytes that have been received so far.
lpuart_status_t LPUART_DRV_AbortReceivingData ( uint32_t  instance)
Parameters
instanceLPUART instance number
Returns
Whether the receiving was successful or not.
lpuart_status_t LPUART_DRV_EdmaInit ( uint32_t  instance,
lpuart_edma_state_t lpuartEdmaStatePtr,
const lpuart_edma_user_config_t lpuartUserConfig 
)

This function initializes the run-time state structure to keep track of the on-going transfers, un-gates the clock to the LPUART module, initializes the module to user-defined settings and default settings, configures the IRQ state structure and enables the module-level interrupt to the core, and enables the LPUART module transmitter and receiver. This example shows how to set up the lpuart_edma_state_t and the lpuart_user_config_t parameters and how to call the LPUART_DRV_EdmaInit function by passing in these parameters:

lpuart_user_config_t lpuartConfig;
lpuartConfig.baudRate = 9600;
lpuart_edma_state_t lpuartEdmaState;
LPUART_DRV_EdmaInit(instance, &lpuartEdmaState, &lpuartConfig);
Parameters
instanceThe LPUART instance number.
lpuartEdmaStatePtrA pointer to the LPUART driver state structure memory. The user passes in the memory for the run-time state structure. The LPUART driver populates the members. This run-time state structure keeps track of the current transfer in progress.
lpuartUserConfigThe user configuration structure of type lpuart_user_config_t. The user populates the members of this structure and passes the pointer of this structure into this function.
Returns
An error code or kStatus_LPUART_Success.
lpuart_status_t LPUART_DRV_EdmaDeinit ( uint32_t  instance)

This function disables the LPUART-DMA trigger, the transmitter, and the receiver.

Parameters
instanceThe LPUART instance number.
Returns
An error code or kStatus_LPUART_Success.
lpuart_status_t LPUART_DRV_EdmaSendDataBlocking ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize,
uint32_t  timeout 
)
Parameters
instanceThe LPUART instance number.
txBuffA pointer to the source buffer containing 8-bit data chars to send.
txSizeThe number of bytes to send.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_LPUART_Success.
lpuart_status_t LPUART_DRV_EdmaSendData ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize 
)
Parameters
instanceThe LPUART module base address.
txBuffA pointer to the source buffer containing 8-bit data chars to send.
txSizeThe number of bytes to send.
Returns
An error code or kStatus_LPUART_Success.
lpuart_status_t LPUART_DRV_EdmaGetTransmitStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)
Parameters
instanceThe LPUART module base address.
bytesRemainingA pointer to a value that is populated with the number of bytes that are remaining in the active transfer.
Returns
Current transmit status.
Return values
kStatus_LPUART_SuccessThe transmit has completed successfully.
kStatus_LPUART_TxBusyThe transmit is still in progress. bytesTransmitted is filled with the number of bytes which are transmitted up to that point.
lpuart_status_t LPUART_DRV_EdmaAbortSendingData ( uint32_t  instance)
Parameters
instanceThe LPUART module base address.
Returns
Whether the abort of transmitting was successful or not.
Return values
kStatus_LPUART_SuccessThe transmit was successful.
kStatus_LPUART_NoTransmitInProgressNo transmission is currently in progress.
lpuart_status_t LPUART_DRV_EdmaReceiveDataBlocking ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize,
uint32_t  timeout 
)
Parameters
instanceThe LPUART module base address.
rxBuffA pointer to the buffer containing 8-bit read data chars received.
rxSizeThe number of bytes to receive.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_LPUART_Success.
lpuart_status_t LPUART_DRV_EdmaReceiveData ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize 
)
Parameters
instanceThe LPUART module base address.
rxBuffA pointer to the buffer containing 8-bit read data chars received.
rxSizeThe number of bytes to receive.
Returns
An error code or kStatus_LPUART_Success.
lpuart_status_t LPUART_DRV_EdmaGetReceiveStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)
Parameters
instanceThe LPUART module base address.
bytesRemainingA pointer to a value that populated with the number of bytes which still need to be received in the active transfer.
Returns
Current receiving status.
Return values
kStatus_LPUART_SuccessThe receive has completed successfully.
kStatus_LPUART_RxBusyThe receive is still in progress. bytesReceived is filled with the number of bytes which are received up to that point.
lpuart_status_t LPUART_DRV_EdmaAbortReceivingData ( uint32_t  instance)
Parameters
instanceThe LPUART module base address.
Returns
Whether the abort of receiving was successful or not.
Return values
kStatus_LPUART_SuccessThe receive was successful.
kStatus_LPUART_NoTransmitInProgressNo receive is currently in progress.

Variable Documentation

LPUART_Type* const g_lpuartBase[LPUART_INSTANCE_COUNT]
LPUART_Type* const g_lpuartBase[LPUART_INSTANCE_COUNT]
LPUART_Type* const g_lpuartBase[LPUART_INSTANCE_COUNT]