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

Overview

The section describes the programming interface of the LPSCI Peripheral driver. The LPSCI peripheral driver transfers data to and from external devices on the Universal Asynchronous Receiver/Transmitter (LPSCI) serial bus with a single function call.

LPSCI Device structures

The driver uses an instantiation of the lpsci_state_t structure to maintain the current state of a particular LPSCI instance module driver. This structure holds data used by the LPSCI Peripheral driver to communicate between the transmit and receive transfer functions and the interrupt handler. The interrupt handler also uses this information to keep track of its progress. Because the driver itself does not statically allocate memory, the caller provides memory for the driver state structure during initialization. The user is required to pass in the memory for the run-time state structure. The LPSCI driver populates the structure members.

LPSCI User configuration structures

The LPSCI driver uses instances of the user configuration structure, lpsci_user_config_t, for the LPSCI driver. As a result, the most common settings of the LPSCI are configured with a single function call. Settings include: LPSCI baud rate; LPSCI parity mode: disabled (default), or even or odd; the number of stop bits; the number of bits per data word.

LPSCI Initialization

  1. To initialize the LPSCI driver, call the LPSCI_DRV_Init() function and pass the instance number of the relevant LPSCI peripheral, memory for the run-time state structure, and a pointer to the user configuration structure. For example, to use LPSCI0 pass a value of 0 to the initialization function.
  2. Then, pass the memory for the run-time state structure and, finally, pass a user configuration structure of the type lpsci_user_config_t as shown here:
// LPSCI configuration structure
typedef struct LpsciUserConfig {
uint32_t baudRate;
lpsci_parity_mode_t parityMode;
lpsci_stop_bit_count_t stopBitCount;
lpsci_bit_count_per_char_t bitCountPerChar;

Typically, the lpsci_user_config_t instantiation is configured as a 8-bit-character, no-parity, 1-stop-bit (8-n-1) with a 9600 bps baud rate. The lpsci_user_config_t instantiation can be easily modified to configure the LPSCI Peripheral driver either to a different baud rate or character transfer features. This is an example code to set up a user LPSCI configuration instantiation:

lpsci_user_config_t lpsciConfig;
lpsciConfig.baudRate = 9600;

This example shows how to call the LPSCI_DRV_Init() function given the user configuration structure and the LPSCI instance 0.

uint32_t lpsciInstance = 0;
lpsci_state_t lpsciState; // user provides memory for the driver state structure
LPSCI_DRV_Init(lpsciInstance, &lpsciConfig, &lpsciState);

LPSCI Transfers

The driver implements transmit and receive functions to transfer buffers of data. The driver also supports two different modes for transferring data: blocking and non-blocking.

The non-blocking transmit and receive functions include the LPSCI_DRV_SendData() and LPSCI_DRV_ReceiveData() functions.

The blocking (async) transmit and receive functions include the LPSCI_DRV_SendDataBlocking() and LPSCI_DRV_ReceiveDataBlocking() functions.

In all cases mentioned here, the functions are interrupt-driven.

These code examples show how to use previously mentioned functions and assume that the LPSCI module has been initialized as described previously in the Initialization Section.

For blocking transfer functions transmit and receive:

uint8_t sourceBuff[26] ={0}; // sourceBuff is populated with desired data
uint8_t readBuffer[10] = {0}; // readBuffer is populated with LPSCI_DRV_ReceiveData function
uint32_t byteCount = sizeof(sourceBuff);
uint32_t rxRemainingSize = sizeof(readBuffer);
// for each use there, set timeout as "1"
// lpsciState is the run-time state. Pass in memory for this
// declared previously in the initialization section
LPSCI_DRV_SendDataBlocking(&lpsciState, sourceBuff, byteCount, 1); // function won't return until transmit is complete
LPSCI_DRV_ReceiveDataBlocking(&lpsciState, readBuffer, 1, timeoutValue); // function won't return until it receives all data

For non-blocking (async) transfer functions transmit and receive:

uint8_t *pTxBuff;
uint8_t rxBuff[10];
uint32_t txBytesRemaining, rxBytesRemaining;
// assume pTxBuff and txSize have been initialized
LPSCI_DRV_SendData(&lpsciState, pTxBuff, txSize);
// now check on status of transmit and wait until done, the code can do something else and
// check back later, this is just an example
while (LPSCI_DRV_GetTransmitStatus(&lpsciState, &txBytesRemaining) == kStatus_LPSCI_TxBusy);
// for receive, assume rxBuff is set up to receive data and rxSize is initialized
LPSCI_DRV_ReceiveData(&lpsciState, rxBuff, rxSize);
// now check on status of receive and wait until done, the code can do something else and
// check back later, this is just an example
while (LPSCI_DRV_GetReceiveStatus(&lpsciState, &rxBytesRemaining) == kStatus_LPSCI_RxBusy);

Files

file  fsl_lpsci_driver.h
 This driver is for UART0 if UART0 is a separate chapter in the chip reference manual.
 

Data Structures

struct  lpsci_dma_state_t
 Runtime state structure for LPSCI driver with DMA. More...
 
struct  lpsci_dma_user_config_t
 User configuration structure for the LPSCI driver. More...
 
struct  lpsci_state_t
 Runtime state of the LPSCI driver. More...
 
struct  lpsci_user_config_t
 User configuration structure for the LPSCI driver. More...
 

Typedefs

typedef void(* lpsci_rx_callback_t )(uint32_t instance, void *lpsciState)
 LPSCI receive callback function type. More...
 
typedef void(* lpsci_tx_callback_t )(uint32_t instance, void *lpsciState)
 LPSCI transmit callback function type.
 

Variables

UART0_Type *const g_lpsciBase [UART0_INSTANCE_COUNT]
 Table of base addresses for LPSCI instances. More...
 
UART0_Type *const g_lpsciBase [UART0_INSTANCE_COUNT]
 Table of base addresses for LPSCI instances. More...
 
const IRQn_Type g_lpsciRxTxIrqId [UART0_INSTANCE_COUNT]
 Table to save LPSCI IRQ enumeration numbers defined in CMSIS header file.
 

LPSCI DMA Driver

lpsci_status_t LPSCI_DRV_DmaInit (uint32_t instance, lpsci_dma_state_t *lpsciDmaStatePtr, const lpsci_dma_user_config_t *lpsciUserConfig)
 Initializes an LPSCI instance to work with DMA. More...
 
lpsci_status_t LPSCI_DRV_DmaDeinit (uint32_t instance)
 Shuts down the LPSCI. More...
 
lpsci_status_t LPSCI_DRV_DmaSendDataBlocking (uint32_t instance, const uint8_t *txBuff, uint32_t txSize, uint32_t timeout)
 Sends (transmits) data out through the LPSCI-DMA module using blocking method. More...
 
lpsci_status_t LPSCI_DRV_DmaSendData (uint32_t instance, const uint8_t *txBuff, uint32_t txSize)
 Sends (transmits) data through the LPSCI-DMA module using a non-blocking method. More...
 
lpsci_status_t LPSCI_DRV_DmaGetTransmitStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous LPSCI-DMA transmit has finished. More...
 
lpsci_status_t LPSCI_DRV_DmaAbortSendingData (uint32_t instance)
 Terminates a non-blocking LPSCI-DMA transmission early. More...
 
lpsci_status_t LPSCI_DRV_DmaReceiveDataBlocking (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize, uint32_t timeout)
 Gets (receives) data from the LPSCI-DMA module using a blocking method. More...
 
lpsci_status_t LPSCI_DRV_DmaReceiveData (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize)
 Gets (receives) data from the LPSCI-DMA module using a non-blocking method. More...
 
lpsci_status_t LPSCI_DRV_DmaGetReceiveStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous LPSCI-DMA receive is complete. More...
 
lpsci_status_t LPSCI_DRV_DmaAbortReceivingData (uint32_t instance)
 Terminates a non-blocking LPSCI-DMA receive early. More...
 

LPSCI Interrupt Driver

lpsci_status_t LPSCI_DRV_Init (uint32_t instance, lpsci_state_t *lpsciStatePtr, const lpsci_user_config_t *lpsciUserConfig)
 Initializes an LPSCI instance for operation. More...
 
lpsci_status_t LPSCI_DRV_Deinit (uint32_t instance)
 Shuts down the LPSCI by disabling interrupts and the transmitter/receiver. More...
 
lpsci_rx_callback_t LPSCI_DRV_InstallRxCallback (uint32_t instance, lpsci_rx_callback_t function, uint8_t *rxBuff, void *callbackParam, bool alwaysEnableRxIrq)
 Installs callback function for the LPSCI receive. More...
 
lpsci_tx_callback_t LPSCI_DRV_InstallTxCallback (uint32_t instance, lpsci_tx_callback_t function, uint8_t *txBuff, void *callbackParam)
 Installs callback function for the LPSCI transmit. More...
 
lpsci_status_t LPSCI_DRV_SendDataBlocking (uint32_t instance, const uint8_t *txBuff, uint32_t txSize, uint32_t timeout)
 Sends (transmits) data out through the LPSCI module using a blocking method. More...
 
lpsci_status_t LPSCI_DRV_SendData (uint32_t instance, const uint8_t *txBuff, uint32_t txSize)
 Sends (transmits) data through the LPSCI module using a non-blocking method. More...
 
lpsci_status_t LPSCI_DRV_GetTransmitStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous LPSCI transmit has finished. More...
 
lpsci_status_t LPSCI_DRV_AbortSendingData (uint32_t instance)
 Terminates an asynchronous LPSCI transmission early. More...
 
lpsci_status_t LPSCI_DRV_ReceiveDataBlocking (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize, uint32_t timeout)
 Gets (receives) data from the LPSCI module using a blocking method. More...
 
lpsci_status_t LPSCI_DRV_ReceiveData (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize)
 Gets (receives) data from the LPSCI module using a non-blocking method. More...
 
lpsci_status_t LPSCI_DRV_GetReceiveStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous LPSCI receive is complete. More...
 
lpsci_status_t LPSCI_DRV_AbortReceivingData (uint32_t instance)
 Terminates an asynchronous LPSCI receive early. More...
 

Data Structure Documentation

struct lpsci_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 dmaLpsciTx
 DMA channel used for send. More...
 
dma_channel_t dmaLpsciRx
 DMA channel used for receive. More...
 

Field Documentation

volatile bool lpsci_dma_state_t::isTxBusy
volatile bool lpsci_dma_state_t::isRxBusy
volatile bool lpsci_dma_state_t::isTxBlocking
volatile bool lpsci_dma_state_t::isRxBlocking
semaphore_t lpsci_dma_state_t::txIrqSync
semaphore_t lpsci_dma_state_t::rxIrqSync
dma_channel_t lpsci_dma_state_t::dmaLpsciTx
dma_channel_t lpsci_dma_state_t::dmaLpsciRx
struct lpsci_dma_user_config_t

Use an instance of this structure with the LPSCI_DRV_Init()function. This enables configuration of the most common settings of the LPSCI peripheral with a single function call. Settings include: LPSCI baud rate, LPSCI parity mode: disabled (default), or even or odd, the number of stop bits, and the number of bits per data word.

Data Fields

clock_lpsci_src_t clockSource
 LPSCI clock source in fsl_sim_hal_<device>.h.
 
uint32_t baudRate
 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
 
lpsci_bit_count_per_char_t bitCountPerChar
 number of bits, 8-bit (default) or 9-bit in a word (up to 10-bits in some LPSCI instances)
 
struct lpsci_state_t

This structure holds data used by the LPSCI peripheral driver to communicate between the transfer function and the interrupt handler. The interrupt handler also uses this information to keep track of its progress. The user passes in the memory for the run-time state structure. The LPSCI driver populates the members.

Data Fields

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 its TX business. More...
 
semaphore_t rxIrqSync
 Used to wait for ISR to complete its RX business. More...
 
lpsci_rx_callback_t rxCallback
 Callback to invoke after receiving byte. More...
 
void * rxCallbackParam
 Receive callback parameter pointer. More...
 
lpsci_tx_callback_t txCallback
 Callback to invoke after transmitting byte. More...
 
void * txCallbackParam
 Transmit callback parameter pointer. More...
 

Field Documentation

const uint8_t* lpsci_state_t::txBuff
uint8_t* lpsci_state_t::rxBuff
volatile size_t lpsci_state_t::txSize
volatile size_t lpsci_state_t::rxSize
volatile bool lpsci_state_t::isTxBusy
volatile bool lpsci_state_t::isRxBusy
volatile bool lpsci_state_t::isTxBlocking
volatile bool lpsci_state_t::isRxBlocking
semaphore_t lpsci_state_t::txIrqSync
semaphore_t lpsci_state_t::rxIrqSync
lpsci_rx_callback_t lpsci_state_t::rxCallback
void* lpsci_state_t::rxCallbackParam
lpsci_tx_callback_t lpsci_state_t::txCallback
void* lpsci_state_t::txCallbackParam
struct lpsci_user_config_t

Data Fields

clock_lpsci_src_t clockSource
 LPSCI clock source in fsl_sim_hal_'device'.h.
 
uint32_t baudRate
 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
 
lpsci_bit_count_per_char_t bitCountPerChar
 number of bits, 8-bit (default) or 9-bit in a word (up to 10-bits in some LPSCI instances)
 

Typedef Documentation

typedef void(* lpsci_rx_callback_t)(uint32_t instance, void *lpsciState)

Function Documentation

lpsci_status_t LPSCI_DRV_DmaInit ( uint32_t  instance,
lpsci_dma_state_t lpsciDmaStatePtr,
const lpsci_dma_user_config_t lpsciUserConfig 
)

This function initializes the run-time state structure to keep track of the on-going transfers, un-gates the clock to the LPSCI 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, the LPSCI module transmitter and receiver. This example shows how to set up the lpsci_dma_state_t and the lpsci_user_config_t parameters and how to call the LPSCI_DRV_DmaInit function by passing in these parameters:

lpsci_user_config_t lpsciConfig;
lpsciConfig.baudRate = 9600;
lpsci_dma_state_t lpsciDmaState;
LPSCI_DRV_DmaInit(instance, &lpsciDmaState, &lpsciConfig);
Parameters
instanceThe LPSCI instance number.
lpsciDmaStatePtrA pointer to the LPSCI driver state structure memory. The user passes in the memory for the run-time state structure. The LPSCI driver populates the members. This run-time state structure keeps track of the current transfer in progress.
lpsciUserConfigThe user configuration structure of type lpsci_user_config_t. The user populates the members of this structure and passes the pointer of this structure to this function.
Returns
An error code or kStatus_LPSCI_Success.
lpsci_status_t LPSCI_DRV_DmaDeinit ( uint32_t  instance)

This function disables the LPSCI-DMA trigger and disables the transmitter and receiver.

Parameters
instanceThe LPSCI instance number.
Returns
An error code or kStatus_LPSCI_Success.
lpsci_status_t LPSCI_DRV_DmaSendDataBlocking ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize,
uint32_t  timeout 
)
Parameters
instanceThe LPSCI 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_LPSCI_Success.
lpsci_status_t LPSCI_DRV_DmaSendData ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize 
)
Parameters
instanceThe LPSCI 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_LPSCI_Success.
lpsci_status_t LPSCI_DRV_DmaGetTransmitStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)
Parameters
instanceThe LPSCI module base address.
bytesRemainingA pointer to a value that is populated with the number of bytes that are remaining in the active transfer.
Returns
An error code or kStatus_LPSCI_Success.
Return values
kStatus_LPSCI_SuccessThe transmit has completed successfully.
kStatus_LPSCI_TxBusyThe transmit is still in progress. bytesTransmitted is filled with the number of bytes which are transmitted up to that point.
lpsci_status_t LPSCI_DRV_DmaAbortSendingData ( uint32_t  instance)
Parameters
instanceThe LPSCI module base address.
Returns
An error code or kStatus_LPSCI_Success.
Return values
kStatus_LPSCI_SuccessThe transmit was successful.
kStatus_LPSCI_NoTransmitInProgressNo transmission is currently in progress.
lpsci_status_t LPSCI_DRV_DmaReceiveDataBlocking ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize,
uint32_t  timeout 
)
Parameters
instanceThe LPSCI 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_LPSCI_Success.
lpsci_status_t LPSCI_DRV_DmaReceiveData ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize 
)
Parameters
instanceThe LPSCI 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_LPSCI_Success.
lpsci_status_t LPSCI_DRV_DmaGetReceiveStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)
Parameters
instanceThe LPSCI module base address.
bytesRemainingA pointer to a value that is populated with the number of bytes which still need to be received in the active transfer.
Returns
An error code or kStatus_LPSCI_Success.
Return values
kStatus_LPSCI_SuccessThe receive has completed successfully.
kStatus_LPSCI_RxBusyThe receive is still in progress. bytesReceived is filled with the number of bytes which are received up to that point.
lpsci_status_t LPSCI_DRV_DmaAbortReceivingData ( uint32_t  instance)
Parameters
instanceThe LPSCI module base address.
Returns
An error code or kStatus_LPSCI_Success.
Return values
kStatus_LPSCI_SuccessThe receive was successful.
kStatus_LPSCI_NoTransmitInProgressNo receive is currently in progress.
lpsci_status_t LPSCI_DRV_Init ( uint32_t  instance,
lpsci_state_t lpsciStatePtr,
const lpsci_user_config_t lpsciUserConfig 
)

This function initializes the run-time state structure to keep track of the on-going transfers, un-gates the clock to the LPSCI 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 LPSCI module transmitter and receiver. This example shows how to set up the lpsci_state_t and the lpsci_user_config_t parameters and how to call the LPSCI_DRV_Init function by passing in these parameters:

lpsci_user_config_t lpsciConfig;
lpsciConfig.clockSource = kClockLpsciSrcPllFllSel;
lpsciConfig.baudRate = 9600;
lpsci_state_t lpsciState;
LPSCI_DRV_Init(instance, &lpsciState, &lpsciConfig);
Parameters
instanceThe LPSCI instance number.
lpsciStatePtrA pointer to the LPSCI driver state structure memory. The user passes in the memory for the run-time state structure. The LPSCI driver populates the members. The run-time state structure keeps track of the current transfer in progress.
lpsciUserConfigThe user configuration structure of type lpsci_user_config_t. The user populates the members of this structure and passes the pointer of the structure to the function.
Returns
An error code or kStatus_LPSCI_Success.
lpsci_status_t LPSCI_DRV_Deinit ( uint32_t  instance)

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

Parameters
instanceThe LPSCI instance number.
Returns
An error code or kStatus_LPSCI_Success.
lpsci_rx_callback_t LPSCI_DRV_InstallRxCallback ( uint32_t  instance,
lpsci_rx_callback_t  function,
uint8_t *  rxBuff,
void *  callbackParam,
bool  alwaysEnableRxIrq 
)
Parameters
instanceThe LPSCI instance number.
functionThe LPSCI receive callback function.
rxBuffThe receive buffer used inside IRQHandler. This buffer must be kept as long as the callback is functional.
callbackParamThe LPSCI receive callback parameter pointer.
alwaysEnableRxIrqWhether always enable receive IRQ or not.
Returns
Former LPSCI receive callback function pointer.
lpsci_tx_callback_t LPSCI_DRV_InstallTxCallback ( uint32_t  instance,
lpsci_tx_callback_t  function,
uint8_t *  txBuff,
void *  callbackParam 
)
Note
After the callback is installed, it bypasses part of the LPSCI IRQHandler logic. Therefore, the callback needs to handle the indexes of txBuff and txSize.
Parameters
instanceThe LPSCI instance number.
functionThe LPSCI transmit callback function.
txBuffThe transmit buffer used inside IRQHandler. This buffer must be kept as long as the callback is alive.
callbackParamThe LPSCI transmit callback parameter pointer.
Returns
Former LPSCI transmit callback function pointer.
lpsci_status_t LPSCI_DRV_SendDataBlocking ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize,
uint32_t  timeout 
)

A blocking (also known as synchronous) function means that the function does not return until the transmit is complete. This blocking function sends data through the LPSCI port.

Parameters
instanceThe LPSCI 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_LPSCI_Success.
lpsci_status_t LPSCI_DRV_SendData ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize 
)

A non-blocking (also known as synchronous) function means that the function returns immediately after initiating the transmit function. The application has to get the transmit status to see when the transmit is complete. In other words, after calling non-blocking (asynchronous) send function, the application must get the transmit status to check if transmit is complete. The asynchronous method of transmitting and receiving allows the LPSCI to perform a full duplex operation (simultaneously transmit and receive).

Parameters
instanceThe LPSCI 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_LPSCI_Success.
lpsci_status_t LPSCI_DRV_GetTransmitStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)

When performing an a-sync transmit, call this function to ascertain the state of the current transmission: in progress (or busy) or complete (success). If the transmission is still in progress, the user can obtain the number of words that have been transferred.

Parameters
instanceThe LPSCI module base address.
bytesRemainingA pointer to a value that is filled in with the number of bytes that are remaining in the active transfer.
Returns
Current transmission status.
Return values
kStatus_LPSCI_SuccessThe transmit has completed successfully.
kStatus_LPSCI_TxBusyThe transmit is still in progress. bytesRemaining is filled with the number of bytes which are transmitted up to that point.
lpsci_status_t LPSCI_DRV_AbortSendingData ( uint32_t  instance)

During an a-sync LPSCI transmission, the user can terminate the transmission early if the transmission is still in progress.

Parameters
instanceThe LPSCI module base address.
Returns
Whether the aborting was successful or not.
Return values
kStatus_LPSCI_SuccessThe transmit was successful.
kStatus_LPSCI_NoTransmitInProgressNo transmission is currently in progress.
lpsci_status_t LPSCI_DRV_ReceiveDataBlocking ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize,
uint32_t  timeout 
)

A blocking (also known as synchronous) function does not return until the receive is complete. This blocking function sends data through the LPSCI port.

Parameters
instanceThe LPSCI 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_LPSCI_Success.
lpsci_status_t LPSCI_DRV_ReceiveData ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize 
)

A non-blocking (also known as synchronous) function returns immediately after initiating the receive function. The application has to get the receive status to see when the receive is complete. The asynchronous method of transmitting and receiving allows the LPSCI to perform a full duplex operation (simultaneously transmit and receive).

Parameters
instanceThe LPSCI 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_LPSCI_Success.
lpsci_status_t LPSCI_DRV_GetReceiveStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)

When performing an a-sync receive, call this function to ascertain the state of the current receive progress: in progress (or busy) or complete (success). If the receive is still in progress, the user can obtain the number of words that have been received.

Parameters
instanceThe LPSCI module base address.
bytesRemainingA pointer to a value that is filled in with the number of bytes which still need to be received in the active transfer.
Returns
Current receive status.
Return values
kStatus_LPSCI_SuccessThe receive has completed successfully.
kStatus_LPSCI_RxBusyThe receive is still in progress. bytesRemaining is filled with the number of bytes which are received up to that point.
lpsci_status_t LPSCI_DRV_AbortReceivingData ( uint32_t  instance)

During an a-sync LPSCI receive, the user can terminate the receive early if the receive is still in progress.

Parameters
instanceThe LPSCI module base address.
Returns
Whether the action success or not.
Return values
kStatus_LPSCI_SuccessThe receive was successful.
kStatus_LPSCI_NoTransmitInProgressNo receive is currently in progress.

Variable Documentation

UART0_Type* const g_lpsciBase[UART0_INSTANCE_COUNT]
UART0_Type* const g_lpsciBase[UART0_INSTANCE_COUNT]