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

Files

file  fsl_usart_freertos.h
 

Data Structures

struct  rtos_usart_config
 FLEX USART configuration structure. More...
 
struct  usart_rtos_handle_t
 FLEX USART FreeRTOS handle. More...
 

Driver version

#define FSL_USART_FREERTOS_DRIVER_VERSION   (MAKE_VERSION(2, 1, 1))
 USART FreeRTOS driver version 2.1.1. More...
 

USART RTOS Operation

int USART_RTOS_Init (usart_rtos_handle_t *handle, usart_handle_t *t_handle, const struct rtos_usart_config *cfg)
 Initializes a USART instance for operation in RTOS. More...
 
int USART_RTOS_Deinit (usart_rtos_handle_t *handle)
 Deinitializes a USART instance for operation. More...
 

USART transactional Operation

int USART_RTOS_Send (usart_rtos_handle_t *handle, const uint8_t *buffer, uint32_t length)
 Sends data in the background. More...
 
int USART_RTOS_Receive (usart_rtos_handle_t *handle, uint8_t *buffer, uint32_t length, size_t *received)
 Receives data. More...
 

Detailed Description


Data Structure Documentation

struct rtos_usart_config

Data Fields

USART_Type * base
 USART base address.
 
uint32_t srcclk
 USART source clock in Hz.
 
uint32_t baudrate
 Desired communication speed.
 
usart_parity_mode_t parity
 Parity setting.
 
usart_stop_bit_count_t stopbits
 Number of stop bits to use.
 
uint8_t * buffer
 Buffer for background reception.
 
uint32_t buffer_size
 Size of buffer for background reception.
 
struct usart_rtos_handle_t

Data Fields

USART_Type * base
 USART base address.
 
usart_transfer_t txTransfer
 TX transfer structure.
 
usart_transfer_t rxTransfer
 RX transfer structure.
 
SemaphoreHandle_t rxSemaphore
 RX semaphore for resource sharing.
 
SemaphoreHandle_t txSemaphore
 TX semaphore for resource sharing.
 
EventGroupHandle_t rxEvent
 RX completion event.
 
EventGroupHandle_t txEvent
 TX completion event.
 
void * t_state
 Transactional state of the underlying driver.
 

Macro Definition Documentation

#define FSL_USART_FREERTOS_DRIVER_VERSION   (MAKE_VERSION(2, 1, 1))

Function Documentation

int USART_RTOS_Init ( usart_rtos_handle_t handle,
usart_handle_t *  t_handle,
const struct rtos_usart_config cfg 
)
Parameters
handleThe RTOS USART handle, the pointer to allocated space for RTOS context.
t_handleThe pointer to allocated space where to store transactional layer internal state.
cfgThe pointer to the parameters required to configure the USART after initialization.
Returns
0 succeed, others fail.
int USART_RTOS_Deinit ( usart_rtos_handle_t handle)

This function deinitializes the USART module, sets all register values to reset value, and releases the resources.

Parameters
handleThe RTOS USART handle.
int USART_RTOS_Send ( usart_rtos_handle_t handle,
const uint8_t *  buffer,
uint32_t  length 
)

This function sends data. It is a synchronous API. If the hardware buffer is full, the task is in the blocked state.

Parameters
handleThe RTOS USART handle.
bufferThe pointer to buffer to send.
lengthThe number of bytes to send.
int USART_RTOS_Receive ( usart_rtos_handle_t handle,
uint8_t *  buffer,
uint32_t  length,
size_t *  received 
)

This function receives data from USART. It is a synchronous API. If data is immediately available, it is returned immediately and the number of bytes received.

Parameters
handleThe RTOS USART handle.
bufferThe pointer to buffer where to write received data.
lengthThe number of bytes to receive.
receivedThe pointer to a variable of size_t where the number of received data is filled.