Microchip® Advanced Software Framework

uhi_cdc.c File Reference

USB host Communication Device Class interface.

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

#include "conf_usb_host.h"
#include "usb_protocol.h"
#include "uhd.h"
#include "uhc.h"
#include "uhi_cdc.h"
#include <string.h>

Data Structures

struct  uhi_cdc_buf_t
 Internal buffer information. More...
 
struct  uhi_cdc_dev_t
 USB CDC device information. More...
 
struct  uhi_cdc_line_t
 Communication line information. More...
 
struct  uhi_cdc_port_t
 Communication port information. More...
 

Macros

#define UHI_CDC_BUFFER_SIZE   (5*64)
 Define the minimum internal buffer size. More...
 
#define UHI_CDC_RX_NOTIFY()
 

Functions

void uhi_cdc_close (uint8_t port)
 Close a port. More...
 
iram_size_t uhi_cdc_get_nb_received (uint8_t port)
 This function returns the number of character available on the CDC line. More...
 
int uhi_cdc_getc (uint8_t port)
 Waits and gets a value on CDC line. More...
 
bool uhi_cdc_is_rx_ready (uint8_t port)
 This function checks if a character has been received on the CDC line. More...
 
bool uhi_cdc_is_tx_ready (uint8_t port)
 This function checks if a new character sent is possible The type int is used to support scanf redirection from compiler LIB. More...
 
bool uhi_cdc_open (uint8_t port, usb_cdc_line_coding_t *configuration)
 Open a port of UHI CDC interface. More...
 
int uhi_cdc_putc (uint8_t port, int value)
 Puts a byte on CDC line The type int is used to support printf redirection from compiler LIB. More...
 
iram_size_t uhi_cdc_read_buf (uint8_t port, void *buf, iram_size_t size)
 Reads a RAM buffer on CDC line. More...
 
iram_size_t uhi_cdc_write_buf (uint8_t port, const void *buf, iram_size_t size)
 Writes a RAM buffer on CDC line. More...
 
Internal routines
static void uhi_cdc_free_device (void)
 Free all CDC device structures. More...
 
static uhi_cdc_port_tuhi_cdc_get_port (uint8_t port_num)
 Returns a port structure information. More...
 
static bool uhi_cdc_set_conf (uint8_t port, usb_cdc_line_coding_t *configuration)
 Changes the port configuration. More...
 
static bool uhi_cdc_set_ctrl_line (uint8_t port, le16_t wValue)
 Sends a control line command on the port. More...
 
static bool uhi_cdc_rx_update (uhi_cdc_line_t *line)
 Update the transfer endpoint IN (RX) Valid the reception of the previous transfer. More...
 
static void uhi_cdc_rx_received (usb_add_t add, usb_ep_t ep, uhd_trans_status_t status, iram_size_t nb_transferred)
 Manage the end of RX transfer. More...
 
static bool uhi_cdc_tx_update (uhi_cdc_line_t *line)
 Update the transfer endpoint OUT (TX) Start a new transfer on endpoint OUT, if a data must be send and a new USB frame is occurred since last transfer. More...
 
static void uhi_cdc_tx_send (usb_add_t add, usb_ep_t ep, uhd_trans_status_t status, iram_size_t nb_transferred)
 Manage the end of TX transfer. More...
 
Interface used by UHC module
uhc_enum_status_t uhi_cdc_install (uhc_device_t *dev)
 
void uhi_cdc_enable (uhc_device_t *dev)
 
void uhi_cdc_uninstall (uhc_device_t *dev)
 
void uhi_cdc_sof (bool b_micro)
 

Variables

Internal defines and variables to manage CDC device
static uhi_cdc_dev_t uhi_cdc_dev
 Information about the enumerated USB CDC device. More...
 

#define UHI_CDC_BUFFER_SIZE   (5*64)

Define the minimum internal buffer size.

Referenced by uhi_cdc_install().

#define UHI_CDC_RX_NOTIFY ( )

Referenced by uhi_cdc_rx_update().