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

Overview

Files

file  fsl_uart_ucosii.h
 

Data Structures

struct  rtos_uart_config
 UART configuration structure. More...
 
struct  uart_rtos_handle_t
 UART FreeRTOS handle. More...
 

Driver version

#define FSL_UART_UCOSII_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
 UART µCOS-II driver version 2.0.0. More...
 

UART RTOS Operation

int UART_RTOS_Init (uart_rtos_handle_t *handle, uart_handle_t *t_handle, const struct rtos_uart_config *cfg)
 Initializes a UART instance for operation in RTOS. More...
 
int UART_RTOS_Deinit (uart_rtos_handle_t *handle)
 Deinitializes a UART instance for operation. More...
 

UART transactional Operation

int UART_RTOS_Send (uart_rtos_handle_t *handle, const uint8_t *buffer, uint32_t length)
 Sends data in the background. More...
 
int UART_RTOS_Receive (uart_rtos_handle_t *handle, uint8_t *buffer, uint32_t length, size_t *received)
 Receives data. More...
 

Data Structure Documentation

struct rtos_uart_config

Data Fields

UART_Type * base
 UART base address.
 
uint32_t srcclk
 UART source clock in Hz.
 
uint32_t baudrate
 Desired communication speed.
 
uart_parity_mode_t parity
 Parity setting.
 
uart_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 uart_rtos_handle_t

Data Fields

UART_Type * base
 UART base address.
 
struct _uart_transfer tx_xfer
 TX transfer structure.
 
struct _uart_transfer rx_xfer
 RX transfer structure.
 
SemaphoreHandle_t rx_sem
 RX semaphore for resource sharing.
 
SemaphoreHandle_t tx_sem
 TX semaphore for resource sharing.
 
EventGroupHandle_t rx_event
 RX completion event.
 
EventGroupHandle_t tx_event
 TX completion event.
 
void * t_state
 Transactional state of the underlying driver.
 
OS_EVENT * rx_sem
 RX semaphore for resource sharing.
 
OS_EVENT * tx_sem
 TX semaphore for resource sharing.
 
OS_FLAG_GRP * rx_event
 RX completion event.
 
OS_FLAG_GRP * tx_event
 TX completion event.
 
OS_SEM rx_sem
 RX semaphore for resource sharing.
 
OS_SEM tx_sem
 TX semaphore for resource sharing.
 
OS_FLAG_GRP rx_event
 RX completion event.
 
OS_FLAG_GRP tx_event
 TX completion event.
 

Macro Definition Documentation

#define FSL_UART_UCOSII_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))

Function Documentation

int UART_RTOS_Init ( uart_rtos_handle_t handle,
uart_handle_t *  t_handle,
const struct rtos_uart_config cfg 
)
Parameters
handleThe RTOS UART handle, the pointer to allocated space for RTOS context.
uart_t_handleThe pointer to allocated space where to store transactional layer internal state.
cfgThe pointer to the parameters required to configure the UART after initialization.
Returns
0 Succeed, others fail.
int UART_RTOS_Deinit ( uart_rtos_handle_t handle)

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

Parameters
handleThe RTOS UART handle.
int UART_RTOS_Send ( uart_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 UART handle.
bufferThe pointer to buffer to send.
lengthThe number of bytes to send.
int UART_RTOS_Receive ( uart_rtos_handle_t handle,
uint8_t *  buffer,
uint32_t  length,
size_t *  received 
)

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

Parameters
handleThe RTOS UART 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.