MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Overview

The MCUXpresso SDK provides a peripheral driver for the Universal Asynchronous Receiver/Transmitter (LPSCI) module of MCUXpresso SDK devices.

The LPSCI driver can be split into 2 parts: functional APIs and transactional APIs.

Functional APIs are feature/property target low level APIs. Functional APIs can be used for the LPSCI initialization/configuration/operation for optimization/customization purpose. Using the functional API requires knowledge of the LPSCI peripheral and how to organize functional APIs to meet the application requirements. All functional APIs use the peripheral base address as the first parameter. The LPSCI functional operation groups provide the functional APIs set.

The transactional APIs are transaction target high level APIs. Transactional APIs can be used to enable the peripheral quickly and also in the user's application if the code size and performance of transactional APIs can satisfy the user's requirements. If there are special requirements for the code size and performance, see the transactional API implementation and write custom code. All transactional APIs use the lpsci_handle_t as the second parameter. Initialize the handle by calling the LPSCI_TransferCreateHandle() API.

Transactional APIs support queue feature for both transmit/receive. Whenever the user calls the LPSCI_TransferSendNonBlocking() or LPSCI_TransferReceiveNonBlocking(), the transfer structure is queued into the internally maintained software queue. The driver automatically continues the transmit/receive if the queue is not empty. When a transfer is finished, the callback is called to inform the user about the completion.

The LPSCI transactional APIs support the background receive. Provide the ringbuffer address and size while calling the LPSCI_TransferCreateHandle() API. The driver automatically starts receiving the data from the receive buffer into the ringbuffer. When the user makes subsequent calls to the LPSCI_ReceiveDataIRQ(), the driver provides the received data in the ringbuffer for user buffer directly and queues the left buffer into the receive queue.

Function groups

LPSCI functional Operation

This function group implements the LPSCI functional API. Functional APIs are feature-oriented.

LPSCI transactional Operation

This function group implements the LPSCI transactional API.

LPSCI transactional Operation

This function group implements the LPSCI DMA transactional API.

Typical use case

LPSCI Operation

uint8_t ch;
LPSCI_GetDefaultConfig(UART0,&user_config);
user_config.baudRate = 115200U;
LPSCI_Init(UART0,&user_config,120000000U);
LPSCI_EnableTx(UART0, true);
LPSCI_EnableRx(UART0, true);
LPSCI_WriteBlocking(UART0, txbuff, sizeof(txbuff)-1);
while(1)
{
LPSCI_ReadBlocking(UART0,&ch, 1);
LPSCI_WriteBlocking(UART0, &ch, 1);
}

LPSCI Send/Receive using an interrupt method

LPSCI Receive using the ringbuffer feature

LPSCI Send/Receive using the DMA method

Data Structures

struct  lpsci_config_t
 LPSCI configure structure. More...
 
struct  lpsci_transfer_t
 LPSCI transfer structure. More...
 

Driver version

enum  _lpsci_status {
  kStatus_LPSCI_TxBusy = MAKE_STATUS(kStatusGroup_LPSCI, 0),
  kStatus_LPSCI_RxBusy = MAKE_STATUS(kStatusGroup_LPSCI, 1),
  kStatus_LPSCI_TxIdle = MAKE_STATUS(kStatusGroup_LPSCI, 2),
  kStatus_LPSCI_RxIdle = MAKE_STATUS(kStatusGroup_LPSCI, 3),
  kStatus_LPSCI_FlagCannotClearManually,
  kStatus_LPSCI_BaudrateNotSupport,
  kStatus_LPSCI_Error = MAKE_STATUS(kStatusGroup_LPSCI, 6),
  kStatus_LPSCI_RxRingBufferOverrun,
  kStatus_LPSCI_RxHardwareOverrun = MAKE_STATUS(kStatusGroup_LPSCI, 8),
  kStatus_LPSCI_NoiseError = MAKE_STATUS(kStatusGroup_LPSCI, 9),
  kStatus_LPSCI_FramingError = MAKE_STATUS(kStatusGroup_LPSCI, 10),
  kStatus_LPSCI_ParityError = MAKE_STATUS(kStatusGroup_LPSCI, 11)
}
 Error codes for the LPSCI driver. More...
 
enum  lpsci_parity_mode_t {
  kLPSCI_ParityDisabled = 0x0U,
  kLPSCI_ParityEven = 0x2U,
  kLPSCI_ParityOdd = 0x3U
}
 LPSCI parity mode. More...
 
enum  lpsci_stop_bit_count_t {
  kLPSCI_OneStopBit = 0U,
  kLPSCI_TwoStopBit = 1U
}
 LPSCI stop bit count. More...
 
enum  _lpsci_interrupt_enable_t {
  kLPSCI_LinBreakInterruptEnable = (UART0_BDH_LBKDIE_MASK),
  kLPSCI_RxActiveEdgeInterruptEnable = (UART0_BDH_RXEDGIE_MASK),
  kLPSCI_TxDataRegEmptyInterruptEnable = (UART0_C2_TIE_MASK << 8),
  kLPSCI_TransmissionCompleteInterruptEnable = (UART0_C2_TCIE_MASK << 8),
  kLPSCI_RxDataRegFullInterruptEnable = (UART0_C2_RIE_MASK << 8),
  kLPSCI_IdleLineInterruptEnable = (UART0_C2_ILIE_MASK << 8),
  kLPSCI_RxOverrunInterruptEnable = (UART0_C3_ORIE_MASK << 16),
  kLPSCI_NoiseErrorInterruptEnable = (UART0_C3_NEIE_MASK << 16),
  kLPSCI_FramingErrorInterruptEnable = (UART0_C3_FEIE_MASK << 16),
  kLPSCI_ParityErrorInterruptEnable = (UART0_C3_PEIE_MASK << 16)
}
 LPSCI interrupt configuration structure, default settings all disabled. More...
 
enum  _lpsci_status_flag_t {
  kLPSCI_TxDataRegEmptyFlag = (UART0_S1_TDRE_MASK),
  kLPSCI_TransmissionCompleteFlag,
  kLPSCI_RxDataRegFullFlag,
  kLPSCI_IdleLineFlag = (UART0_S1_IDLE_MASK),
  kLPSCI_RxOverrunFlag,
  kLPSCI_NoiseErrorFlag = (UART0_S1_NF_MASK),
  kLPSCI_FramingErrorFlag,
  kLPSCI_ParityErrorFlag = (UART0_S1_PF_MASK),
  kLPSCI_LinBreakFlag,
  kLPSCI_RxActiveEdgeFlag,
  kLPSCI_RxActiveFlag
}
 LPSCI status flags. More...
 
typedef void(* lpsci_transfer_callback_t )(UART0_Type *base, lpsci_handle_t *handle, status_t status, void *userData)
 LPSCI transfer callback function. More...
 
#define FSL_LPSCI_DRIVER_VERSION   (MAKE_VERSION(2, 0, 3))
 LPSCI driver version 2.0.3. More...
 

Initialization and deinitialization

status_t LPSCI_Init (UART0_Type *base, const lpsci_config_t *config, uint32_t srcClock_Hz)
 Initializes an LPSCI instance with the user configuration structure and the peripheral clock. More...
 
void LPSCI_Deinit (UART0_Type *base)
 Deinitializes an LPSCI instance. More...
 
void LPSCI_GetDefaultConfig (lpsci_config_t *config)
 Gets the default configuration structure and saves the configuration to a user-provided pointer. More...
 
status_t LPSCI_SetBaudRate (UART0_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz)
 Sets the LPSCI instance baudrate. More...
 

Status

uint32_t LPSCI_GetStatusFlags (UART0_Type *base)
 Gets LPSCI status flags. More...
 
status_t LPSCI_ClearStatusFlags (UART0_Type *base, uint32_t mask)
 

Interrupts

void LPSCI_EnableInterrupts (UART0_Type *base, uint32_t mask)
 Enables an LPSCI interrupt according to a provided mask. More...
 
void LPSCI_DisableInterrupts (UART0_Type *base, uint32_t mask)
 Disables the LPSCI interrupt according to a provided mask. More...
 
uint32_t LPSCI_GetEnabledInterrupts (UART0_Type *base)
 Gets the enabled LPSCI interrupts. More...
 

DMA Control

static uint32_t LPSCI_GetDataRegisterAddress (UART0_Type *base)
 Gets the LPSCI data register address. More...
 
static void LPSCI_EnableTxDMA (UART0_Type *base, bool enable)
 Enables or disable LPSCI transmitter DMA request. More...
 
static void LPSCI_EnableRxDMA (UART0_Type *base, bool enable)
 Enables or disables the LPSCI receiver DMA. More...
 

Bus Operations

static void LPSCI_EnableTx (UART0_Type *base, bool enable)
 Enables or disables the LPSCI transmitter. More...
 
static void LPSCI_EnableRx (UART0_Type *base, bool enable)
 Enables or disables the LPSCI receiver. More...
 
static void LPSCI_WriteByte (UART0_Type *base, uint8_t data)
 Writes to the TX register. More...
 
static uint8_t LPSCI_ReadByte (UART0_Type *base)
 Reads the RX data register. More...
 
void LPSCI_WriteBlocking (UART0_Type *base, const uint8_t *data, size_t length)
 Writes to the TX register using a blocking method. More...
 
status_t LPSCI_ReadBlocking (UART0_Type *base, uint8_t *data, size_t length)
 Reads the RX register using a blocking method. More...
 

Transactional

void LPSCI_TransferCreateHandle (UART0_Type *base, lpsci_handle_t *handle, lpsci_transfer_callback_t callback, void *userData)
 Initializes the LPSCI handle. More...
 
void LPSCI_TransferStartRingBuffer (UART0_Type *base, lpsci_handle_t *handle, uint8_t *ringBuffer, size_t ringBufferSize)
 Sets up the RX ring buffer. More...
 
void LPSCI_TransferStopRingBuffer (UART0_Type *base, lpsci_handle_t *handle)
 Aborts the background transfer and uninstalls the ring buffer. More...
 
status_t LPSCI_TransferSendNonBlocking (UART0_Type *base, lpsci_handle_t *handle, lpsci_transfer_t *xfer)
 Transmits a buffer of data using the interrupt method. More...
 
void LPSCI_TransferAbortSend (UART0_Type *base, lpsci_handle_t *handle)
 Aborts the interrupt-driven data transmit. More...
 
status_t LPSCI_TransferGetSendCount (UART0_Type *base, lpsci_handle_t *handle, uint32_t *count)
 Get the number of bytes that have been written to LPSCI TX register. More...
 
status_t LPSCI_TransferReceiveNonBlocking (UART0_Type *base, lpsci_handle_t *handle, lpsci_transfer_t *xfer, size_t *receivedBytes)
 Receives buffer of data using the interrupt method. More...
 
void LPSCI_TransferAbortReceive (UART0_Type *base, lpsci_handle_t *handle)
 Aborts interrupt driven data receiving. More...
 
status_t LPSCI_TransferGetReceiveCount (UART0_Type *base, lpsci_handle_t *handle, uint32_t *count)
 Get the number of bytes that have been received. More...
 
void LPSCI_TransferHandleIRQ (UART0_Type *base, lpsci_handle_t *handle)
 LPSCI IRQ handle function. More...
 
void LPSCI_TransferHandleErrorIRQ (UART0_Type *base, lpsci_handle_t *handle)
 LPSCI Error IRQ handle function. More...
 

Data Structure Documentation

struct lpsci_config_t

Data Fields

uint32_t baudRate_Bps
 LPSCI baud rate.
 
lpsci_parity_mode_t parityMode
 Parity mode, disabled (default), even, odd.
 
lpsci_stop_bit_count_t stopBitCount
 Number of stop bits, 1 stop bit (default) or 2 stop bits.
 
bool enableTx
 Enable TX.
 
bool enableRx
 Enable RX.
 
struct lpsci_transfer_t

Data Fields

uint8_t * data
 The buffer of data to be transfer. More...
 
size_t dataSize
 The byte count to be transfer. More...
 

Field Documentation

uint8_t* lpsci_transfer_t::data
size_t lpsci_transfer_t::dataSize

Macro Definition Documentation

#define FSL_LPSCI_DRIVER_VERSION   (MAKE_VERSION(2, 0, 3))

Typedef Documentation

typedef void(* lpsci_transfer_callback_t)(UART0_Type *base, lpsci_handle_t *handle, status_t status, void *userData)

Enumeration Type Documentation

Enumerator
kStatus_LPSCI_TxBusy 

Transmitter is busy.

kStatus_LPSCI_RxBusy 

Receiver is busy.

kStatus_LPSCI_TxIdle 

Transmitter is idle.

kStatus_LPSCI_RxIdle 

Receiver is idle.

kStatus_LPSCI_FlagCannotClearManually 

Status flag can't be manually cleared.

kStatus_LPSCI_BaudrateNotSupport 

Baudrate is not support in current clock source.

kStatus_LPSCI_Error 

Error happens on LPSCI.

kStatus_LPSCI_RxRingBufferOverrun 

LPSCI RX software ring buffer overrun.

kStatus_LPSCI_RxHardwareOverrun 

LPSCI RX receiver overrun.

kStatus_LPSCI_NoiseError 

LPSCI noise error.

kStatus_LPSCI_FramingError 

LPSCI framing error.

kStatus_LPSCI_ParityError 

LPSCI parity error.

Enumerator
kLPSCI_ParityDisabled 

Parity disabled.

kLPSCI_ParityEven 

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

kLPSCI_ParityOdd 

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

Enumerator
kLPSCI_OneStopBit 

One stop bit.

kLPSCI_TwoStopBit 

Two stop bits.

This structure contains the settings for all LPSCI interrupt configurations.

Enumerator
kLPSCI_LinBreakInterruptEnable 

LIN break detect interrupt.

kLPSCI_RxActiveEdgeInterruptEnable 

RX Active Edge interrupt.

kLPSCI_TxDataRegEmptyInterruptEnable 

Transmit data register empty interrupt.

kLPSCI_TransmissionCompleteInterruptEnable 

Transmission complete interrupt.

kLPSCI_RxDataRegFullInterruptEnable 

Receiver data register full interrupt.

kLPSCI_IdleLineInterruptEnable 

Idle line interrupt.

kLPSCI_RxOverrunInterruptEnable 

Receiver Overrun interrupt.

kLPSCI_NoiseErrorInterruptEnable 

Noise error flag interrupt.

kLPSCI_FramingErrorInterruptEnable 

Framing error flag interrupt.

kLPSCI_ParityErrorInterruptEnable 

Parity error flag interrupt.

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

Enumerator
kLPSCI_TxDataRegEmptyFlag 

Tx data register empty flag, sets when Tx buffer is empty.

kLPSCI_TransmissionCompleteFlag 

Transmission complete flag, sets when transmission activity complete.

kLPSCI_RxDataRegFullFlag 

Rx data register full flag, sets when the receive data buffer is full.

kLPSCI_IdleLineFlag 

Idle line detect flag, sets when idle line detected.

kLPSCI_RxOverrunFlag 

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

kLPSCI_NoiseErrorFlag 

Rx takes 3 samples of each received bit.

If any of these samples differ, noise flag sets

kLPSCI_FramingErrorFlag 

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

kLPSCI_ParityErrorFlag 

If parity enabled, sets upon parity error detection.

kLPSCI_LinBreakFlag 

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

kLPSCI_RxActiveEdgeFlag 

Rx pin active edge interrupt flag, sets when active edge detected.

kLPSCI_RxActiveFlag 

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

Function Documentation

status_t LPSCI_Init ( UART0_Type *  base,
const lpsci_config_t config,
uint32_t  srcClock_Hz 
)

This function configures the LPSCI module with user-defined settings. The user can configure the configuration structure and can also get the default configuration by calling the LPSCI_GetDefaultConfig() function. Example below shows how to use this API to configure the LPSCI.

* lpsci_config_t lpsciConfig;
* lpsciConfig.baudRate_Bps = 115200U;
* LPSCI_Init(UART0, &lpsciConfig, 20000000U);
*
Parameters
baseLPSCI peripheral base address.
configPointer to user-defined configuration structure.
srcClock_HzLPSCI clock source frequency in HZ.
Return values
kStatus_LPSCI_BaudrateNotSupportBaudrate is not support in current clock source.
kStatus_SuccessLPSCI initialize succeed
void LPSCI_Deinit ( UART0_Type *  base)

This function waits for TX complete, disables TX and RX, and disables the LPSCI clock.

Parameters
baseLPSCI peripheral base address.
void LPSCI_GetDefaultConfig ( lpsci_config_t config)

This function initializes the LPSCI configure structure to default value. the default value are: lpsciConfig->baudRate_Bps = 115200U; lpsciConfig->parityMode = kLPSCI_ParityDisabled; lpsciConfig->stopBitCount = kLPSCI_OneStopBit; lpsciConfig->enableTx = false; lpsciConfig->enableRx = false;

Parameters
configPointer to configuration structure.
status_t LPSCI_SetBaudRate ( UART0_Type *  base,
uint32_t  baudRate_Bps,
uint32_t  srcClock_Hz 
)

This function configures the LPSCI module baudrate. This function is used to update the LPSCI module baudrate after the LPSCI module is initialized with the LPSCI_Init.

* LPSCI_SetBaudRate(UART0, 115200U, 20000000U);
*
Parameters
baseLPSCI peripheral base address.
baudRate_BpsLPSCI baudrate to be set.
srcClock_HzLPSCI clock source frequency in HZ.
Return values
kStatus_LPSCI_BaudrateNotSupportBaudrate is not supported in the current clock source.
kStatus_SuccessSet baudrate succeed
uint32_t LPSCI_GetStatusFlags ( UART0_Type *  base)

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

* {
* ...
* }
*
Parameters
baseLPSCI peripheral base address.
Returns
LPSCI status flags which are ORed by the enumerators in the _lpsci_flags.
void LPSCI_EnableInterrupts ( UART0_Type *  base,
uint32_t  mask 
)

This function enables the LPSCI interrupts according to a provided mask. The mask is a logical OR of enumeration members. See _lpsci_interrupt_enable. For example, to enable the TX empty interrupt and RX full interrupt:

Parameters
baseLPSCI peripheral base address.
maskThe interrupts to enable. Logical OR of _lpsci_interrupt_enable.
void LPSCI_DisableInterrupts ( UART0_Type *  base,
uint32_t  mask 
)

This function disables the LPSCI interrupts according to a provided mask. The mask is a logical OR of enumeration members. See _lpsci_interrupt_enable. For example, to disable TX empty interrupt and RX full interrupt:

Parameters
baseLPSCI peripheral base address.
maskThe interrupts to disable. Logical OR of _LPSCI_interrupt_enable.
uint32_t LPSCI_GetEnabledInterrupts ( UART0_Type *  base)

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

* uint32_t enabledInterrupts = LPSCI_GetEnabledInterrupts(UART0);
*
* if (kLPSCI_TxDataRegEmptyInterruptEnable & enabledInterrupts)
* {
* ...
* }
*
Parameters
baseLPSCI peripheral base address.
Returns
LPSCI interrupt flags which are logical OR of the enumerators in _LPSCI_interrupt_enable.
static uint32_t LPSCI_GetDataRegisterAddress ( UART0_Type *  base)
inlinestatic

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

Parameters
baseLPSCI peripheral base address.
Returns
LPSCI data register address which are used both by transmitter and receiver.
static void LPSCI_EnableTxDMA ( UART0_Type *  base,
bool  enable 
)
inlinestatic

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

Parameters
baseLPSCI peripheral base address.
enableTrue to enable, false to disable.
static void LPSCI_EnableRxDMA ( UART0_Type *  base,
bool  enable 
)
inlinestatic

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

Parameters
baseLPSCI peripheral base address.
enableTrue to enable, false to disable.
static void LPSCI_EnableTx ( UART0_Type *  base,
bool  enable 
)
inlinestatic

This function enables or disables the LPSCI transmitter.

Parameters
baseLPSCI peripheral base address.
enableTrue to enable, false to disable.
static void LPSCI_EnableRx ( UART0_Type *  base,
bool  enable 
)
inlinestatic

This function enables or disables the LPSCI receiver.

Parameters
baseLPSCI peripheral base address.
enableTrue to enable, false to disable.
static void LPSCI_WriteByte ( UART0_Type *  base,
uint8_t  data 
)
inlinestatic

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

Parameters
baseLPSCI peripheral base address.
dataData write to TX register.
static uint8_t LPSCI_ReadByte ( UART0_Type *  base)
inlinestatic

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

Parameters
baseLPSCI peripheral base address.
Returns
Data read from RX data register.
void LPSCI_WriteBlocking ( UART0_Type *  base,
const uint8_t *  data,
size_t  length 
)

This function polls the TX register, waits for the TX register empty, and writes data to the TX buffer.

Note
This function does not check whether all the data has been sent out to bus, so before disable TX, check kLPSCI_TransmissionCompleteFlag to ensure the TX is finished.
Parameters
baseLPSCI peripheral base address.
dataStart address of the data to write.
lengthSize of the data to write.
status_t LPSCI_ReadBlocking ( UART0_Type *  base,
uint8_t *  data,
size_t  length 
)

This function polls the RX register, waits for the RX register to be full, and reads data from the RX register.

Parameters
baseLPSCI peripheral base address.
dataStart address of the buffer to store the received data.
lengthSize of the buffer.
Return values
kStatus_LPSCI_RxHardwareOverrunReceiver overrun happened while receiving data.
kStatus_LPSCI_NoiseErrorNoise error happened while receiving data.
kStatus_LPSCI_FramingErrorFraming error happened while receiving data.
kStatus_LPSCI_ParityErrorParity error happened while receiving data.
kStatus_SuccessSuccessfully received all data.
void LPSCI_TransferCreateHandle ( UART0_Type *  base,
lpsci_handle_t *  handle,
lpsci_transfer_callback_t  callback,
void *  userData 
)

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

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

Parameters
handleLPSCI handle pointer.
baseLPSCI peripheral base address.
ringBufferStart address of ring buffer for background receiving. Pass NULL to disable the ring buffer.
ringBufferSizesize of the ring buffer.
void LPSCI_TransferStartRingBuffer ( UART0_Type *  base,
lpsci_handle_t *  handle,
uint8_t *  ringBuffer,
size_t  ringBufferSize 
)

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

When the RX ring buffer is used, data received is stored into the ring buffer even when the user doesn't call the LPSCI_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 the RX ring buffer, one byte is reserved for internal use. In other words, if ringBufferSize is 32, only 31 bytes are used for saving data.
Parameters
baseLPSCI peripheral base address.
handleLPSCI handle pointer.
ringBufferStart address of ring buffer for background receiving. Pass NULL to disable the ring buffer.
ringBufferSizesize of the ring buffer.
void LPSCI_TransferStopRingBuffer ( UART0_Type *  base,
lpsci_handle_t *  handle 
)

This function aborts the background transfer and uninstalls the ringbuffer.

Parameters
baseLPSCI peripheral base address.
handleLPSCI handle pointer.
status_t LPSCI_TransferSendNonBlocking ( UART0_Type *  base,
lpsci_handle_t *  handle,
lpsci_transfer_t xfer 
)

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

Note
The kStatus_LPSCI_TxIdle is passed to the upper layer when all data is written to the TX register. However, it does not ensure that all data is sent out. Before disabling the TX, check the kLPSCI_TransmissionCompleteFlag to ensure that the TX is complete.
Parameters
handleLPSCI handle pointer.
xferLPSCI transfer structure, refer to #LPSCI_transfer_t.
Return values
kStatus_SuccessSuccessfully start the data transmission.
kStatus_LPSCI_TxBusyPrevious transmission still not finished, data not all written to the TX register.
kStatus_InvalidArgumentInvalid argument.
void LPSCI_TransferAbortSend ( UART0_Type *  base,
lpsci_handle_t *  handle 
)

This function aborts the interrupt driven data send.

Parameters
handleLPSCI handle pointer.
status_t LPSCI_TransferGetSendCount ( UART0_Type *  base,
lpsci_handle_t *  handle,
uint32_t *  count 
)

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

Parameters
baseLPSCI peripheral base address.
handleLPSCI handle pointer.
countSend bytes count.
Return values
kStatus_NoTransferInProgressNo send in progress.
kStatus_InvalidArgumentParameter is invalid.
kStatus_SuccessGet successfully through the parameter count;
status_t LPSCI_TransferReceiveNonBlocking ( UART0_Type *  base,
lpsci_handle_t *  handle,
lpsci_transfer_t xfer,
size_t *  receivedBytes 
)

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

Parameters
handleLPSCI handle pointer.
xferlpsci transfer structure. See lpsci_transfer_t.
receivedBytesBytes received from the ring buffer directly.
Return values
kStatus_SuccessSuccessfully queue the transfer into transmit queue.
kStatus_LPSCI_RxBusyPrevious receive request is not finished.
kStatus_InvalidArgumentInvalid argument.
void LPSCI_TransferAbortReceive ( UART0_Type *  base,
lpsci_handle_t *  handle 
)

This function aborts interrupt driven data receiving.

Parameters
handleLPSCI handle pointer.
status_t LPSCI_TransferGetReceiveCount ( UART0_Type *  base,
lpsci_handle_t *  handle,
uint32_t *  count 
)

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

Parameters
baseLPSCI peripheral base address.
handleLPSCI handle pointer.
countReceive bytes count.
Return values
kStatus_NoTransferInProgressNo receive in progress.
kStatus_InvalidArgumentParameter is invalid.
kStatus_SuccessGet successfully through the parameter count;
void LPSCI_TransferHandleIRQ ( UART0_Type *  base,
lpsci_handle_t *  handle 
)

This function handles the LPSCI transmit and receive IRQ request.

Parameters
handleLPSCI handle pointer.
void LPSCI_TransferHandleErrorIRQ ( UART0_Type *  base,
lpsci_handle_t *  handle 
)

This function handle the LPSCI error IRQ request.

Parameters
handleLPSCI handle pointer.