Microchip® Advanced Software Framework

serial_drv.c File Reference

Handles Serial driver functionalities.

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

#include "asf.h"
#include "serial_drv.h"
#include "serial_fifo.h"
#include "ble_utils.h"
#include "conf_serialdrv.h"

Functions

uint8_t configure_serial_drv (uint32_t bus_baudrate)
 Initializes the Serial IO Module. More...
 
void configure_usart_after_patch (uint32_t baudrate)
 
void platform_configure_sleep_manager (void)
 
void platform_enter_critical_section (void)
 
void platform_leave_critical_section (void)
 
void platform_process_rxdata (uint8_t t_rx_data)
 
void platform_restore_from_sleep (void)
 
uint32_t platform_serial_drv_tx_status (void)
 
void platform_set_ble_rts_high (void)
 
void platform_set_ble_rts_low (void)
 
void platform_set_hostsleep (void)
 
void platform_start_rx (void)
 This module performs serial input/output functionalities via UART. More...
 
uint16_t serial_drive_rx_data_count (void)
 
static void serial_drv_read_cb (struct usart_module *const usart_module)
 
uint16_t serial_drv_send (uint8_t *data, uint16_t len)
 Transmits data via UART. More...
 
static void serial_drv_write_cb (struct usart_module *const usart_module)
 
uint8_t serial_read_byte (uint16_t *data)
 
uint8_t serial_read_data (uint8_t *data, uint16_t max_len)
 Receives data from UART. More...
 
static void usart_configure_flowcontrol (uint32_t baudrate)
 

Variables

static uint16_t rx_data
 
struct usart_module usart_instance
 [module_inst] More...
 
volatile bool wakeup_pin_status = true
 

void configure_usart_after_patch ( uint32_t  baudrate)
void platform_configure_sleep_manager ( void  )

Referenced by platform_init().

void platform_enter_critical_section ( void  )
void platform_leave_critical_section ( void  )
void platform_process_rxdata ( uint8_t  t_rx_data)
void platform_restore_from_sleep ( void  )

Referenced by platform_enter_sleep().

uint32_t platform_serial_drv_tx_status ( void  )
void platform_set_ble_rts_high ( void  )
void platform_set_ble_rts_low ( void  )
void platform_set_hostsleep ( void  )
void platform_start_rx ( void  )

This module performs serial input/output functionalities via UART.

References rx_data, and serial_read_byte().

Referenced by main(), platform_dtm_interface_receive(), and platform_recv_async().

uint16_t serial_drive_rx_data_count ( void  )
static void serial_drv_read_cb ( struct usart_module *const  usart_module)
static
uint16_t serial_drv_send ( uint8_t *  data,
uint16_t  len 
)

Transmits data via UART.

Parameters
dataPointer to the buffer where the data to be transmitted is present
lengthNumber of bytes to be transmitted
Returns
Number of bytes actually transmitted

References STATUS_OK, usart_get_job_status(), usart_instance, USART_TRANSCEIVER_TX, and usart_write_buffer_job().

Referenced by platform_send_sync().

static void serial_drv_write_cb ( struct usart_module *const  usart_module)
static
uint8_t serial_read_byte ( uint16_t *  data)
uint8_t serial_read_data ( uint8_t *  data,
uint16_t  max_len 
)

Receives data from UART.

Parameters
datapointer to the buffer where the received data is to be stored
max_lengthmaximum length of data to be received
Returns
actual number of bytes received

References usart_instance, and usart_read_buffer_job().

struct usart_module usart_instance

[module_inst]

volatile bool wakeup_pin_status = true