Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
USB Host Interface (UHI) for Communication Class Device (CDC)

USB Host Interface (UHI) for Communication Class Device (CDC) provides an interface for the configuration and management of USB CDC serial host.

The outline of this documentation is as follows:

For more details for Atmel® Software Framework (ASF) USB Host Stack, refer to following application note:

API Overview

Interface with USB Host Core (UHC)

Definition and functions required by UHC.

#define UHI_CDC
 Global definition which contains standard UHI API for UHC. More...
 

Functions Required by UHC

uhc_enum_status_t uhi_cdc_install (uhc_device_t *dev)
 Install interface. More...
 
void uhi_cdc_enable (uhc_device_t *dev)
 Enable the interface. More...
 
void uhi_cdc_uninstall (uhc_device_t *dev)
 Uninstall the interface (if installed). More...
 
void uhi_cdc_sof (bool b_micro)
 Signal that a SOF has occurred. More...
 

UHI for Communication Device Class

Common APIs used by high level application to use this USB host class.

These routines are used by memory to transfer its data to/from USB CDC endpoint.

bool uhi_cdc_open (uint8_t port, usb_cdc_line_coding_t *configuration)
 Open a port of UHI CDC interface. More...
 
void uhi_cdc_close (uint8_t port)
 Close a port. More...
 
bool uhi_cdc_is_rx_ready (uint8_t port)
 This function checks if a character has been received on the CDC line. 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...
 
iram_size_t uhi_cdc_read_buf (uint8_t port, void *buf, iram_size_t size)
 Reads a RAM buffer on CDC line. More...
 
bool uhi_cdc_is_tx_ready (uint8_t port)
 This function checks if a new character sent is possible. More...
 
int uhi_cdc_putc (uint8_t port, int value)
 Puts a byte 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...
 

#define UHI_CDC
Value:
{ \
.install = uhi_cdc_install, \
.enable = uhi_cdc_enable, \
.uninstall = uhi_cdc_uninstall, \
.sof_notify = uhi_cdc_sof, \
}
uhc_enum_status_t uhi_cdc_install(uhc_device_t *dev)
Install interface.
void uhi_cdc_enable(uhc_device_t *dev)
Enable the interface.
void uhi_cdc_uninstall(uhc_device_t *dev)
Uninstall the interface (if installed).
void uhi_cdc_sof(bool b_micro)
Signal that a SOF has occurred.

Global definition which contains standard UHI API for UHC.

It must be added in USB_HOST_UHI define from conf_usb_host.h file.

void uhi_cdc_close ( uint8_t  port)

Close a port.

Parameters
[in]portCommunication port number
void uhi_cdc_enable ( uhc_device_t dev)

Enable the interface.

Enable a USB interface corresponding to UHI.

Parameters
[in]uhc_device_tDevice to request
iram_size_t uhi_cdc_get_nb_received ( uint8_t  port)

This function returns the number of character available on the CDC line.

Parameters
[in]portCommunication port number
Returns
The number of data received.
int uhi_cdc_getc ( uint8_t  port)

Waits and gets a value on CDC line.

Parameters
[in]portCommunication port number
Returns
Value read on CDC line.
uhc_enum_status_t uhi_cdc_install ( uhc_device_t dev)

Install interface.

Allocate interface endpoints if supported.

Parameters
[in]uhc_device_tDevice to request
Returns
Status of the install.
bool uhi_cdc_is_rx_ready ( uint8_t  port)

This function checks if a character has been received on the CDC line.

Parameters
[in]portCommunication port number
Returns
true if a byte is ready to be read.
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.

Parameters
[in]portCommunication port number
Returns
true if a new character can be sent.
bool uhi_cdc_open ( uint8_t  port,
usb_cdc_line_coding_t configuration 
)

Open a port of UHI CDC interface.

Parameters
[in]portCommunication port number
[in]configurationPointer on port configuration
Returns
true if the port is available.
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.

Parameters
[in]portCommunication port number
[in]valueValue to put
Returns
true if function was successfully done, otherwise false.
iram_size_t uhi_cdc_read_buf ( uint8_t  port,
void *  buf,
iram_size_t  size 
)

Reads a RAM buffer on CDC line.

Parameters
[in]portCommunication port number
[out]bufValues read
[in]sizeNumber of value read
Returns
The number of data remaining.
void uhi_cdc_sof ( bool  b_micro)

Signal that a SOF has occurred.

void uhi_cdc_uninstall ( uhc_device_t dev)

Uninstall the interface (if installed).

Parameters
[in]uhc_device_tDevice to request
iram_size_t uhi_cdc_write_buf ( uint8_t  port,
const void *  buf,
iram_size_t  size 
)

Writes a RAM buffer on CDC line.

Parameters
[in]portCommunication port number
[in]bufValues to write
[in]sizeNumber of value to write
Returns
The number of data remaining.