Microchip® Advanced Software Framework

freertos_uart_serial.c File Reference

FreeRTOS Peripheral Control API For the UART.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <string.h>
#include "serial.h"
#include "freertos_uart_serial.h"
#include "freertos_peripheral_control_private.h"

Macros

#define IER_ERROR_INTERRUPTS   (UART_IER_OVRE | UART_IER_FRAME | UART_IER_PARE)
 
#define MASK_ALL_INTERRUPTS   (0xffffffffUL)
 
#define RX_NOT_USED   (uint8_t *) 0x1
 
#define SR_ERROR_INTERRUPTS   (UART_SR_OVRE | UART_SR_FRAME |UART_SR_PARE)
 

Enumerations

enum  buffer_operations {
  data_added = 0,
  data_removed,
  data_added = 0,
  data_removed
}
 

Functions

static void configure_rx_dma (uint32_t uart_index, enum buffer_operations operation_performed)
 
freertos_uart_if freertos_uart_serial_init (Uart *p_uart, const sam_uart_opt_t *const uart_parameters, const freertos_peripheral_options_t *const freertos_driver_parameters)
 Initializes the FreeRTOS ASF UART driver for the specified UART port. More...
 
uint32_t freertos_uart_serial_read_packet (freertos_uart_if p_uart, uint8_t *data, uint32_t len, portTickType block_time_ticks)
 Initiate a completely multi-byte read operation on a UART peripheral. More...
 
status_code_t freertos_uart_write_packet_async (freertos_uart_if p_uart, const uint8_t *data, size_t len, portTickType block_time_ticks, xSemaphoreHandle notification_semaphore)
 Initiate a completely asynchronous multi-byte write operation on a UART peripheral. More...
 
static void local_uart_handler (const portBASE_TYPE uart_index)
 

Variables

static const
freertos_pdc_peripheral_parameters_t 
all_uart_definitions [MAX_UARTS]
 
static freertos_pdc_rx_control_t rx_buffer_definitions [MAX_UARTS]
 
static freertos_dma_event_control_t tx_dma_control [MAX_UARTS]
 

#define IER_ERROR_INTERRUPTS   (UART_IER_OVRE | UART_IER_FRAME | UART_IER_PARE)
#define MASK_ALL_INTERRUPTS   (0xffffffffUL)
#define RX_NOT_USED   (uint8_t *) 0x1
#define SR_ERROR_INTERRUPTS   (UART_SR_OVRE | UART_SR_FRAME |UART_SR_PARE)

Referenced by local_uart_handler().

Enumerator
data_added 
data_removed 
data_added 
data_removed 

static void local_uart_handler ( const portBASE_TYPE  uart_index)
static

Normally the uart_status can't be "0" when the interrupt happened. It happened only when in PDC mode with TXRDY and RXRDY interrupts since the flags has been cleared by PDC. As the TXRDY is never enabled in this service, here we check the RXRDY interrupt case.

References configASSERT, configure_rx_dma(), data_added, freertos_pdc_rx_control::next_byte_to_read, NULL, freertos_pdc_rx_control::past_rx_buffer_end_address, pdFALSE, freertos_pdc_rx_control::rx_buffer_start_address, freertos_pdc_rx_control::rx_event_semaphore, RX_NOT_USED, freertos_pdc_rx_control::rx_pdc_parameters, SR_ERROR_INTERRUPTS, uart_disable_interrupt(), uart_get_interrupt_mask(), uart_get_status(), uart_reset_status(), pdc_packet::ul_addr, pdc_packet::ul_size, and xSemaphoreGiveFromISR.

const freertos_pdc_peripheral_parameters_t all_uart_definitions[MAX_UARTS]
static
Initial value:
= {
}
freertos_pdc_rx_control_t rx_buffer_definitions[MAX_UARTS]
static
freertos_dma_event_control_t tx_dma_control[MAX_UARTS]
static