Microchip® Advanced Software Framework

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

USB Host Interface (UHI) for Vendor Class Device provides an interface for the configuration and management of USB Vendor 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_VENDOR
 Global definition which contains standard UHI API for UHC It must be added in USB_HOST_UHI definition from conf_usb_host.h file. More...
 

Functions Required by UHC

uhc_enum_status_t uhi_vendor_install (uhc_device_t *dev)
 Install interface. More...
 
void uhi_vendor_enable (uhc_device_t *dev)
 Enable the interface. More...
 
void uhi_vendor_uninstall (uhc_device_t *dev)
 Uninstall the interface (if installed). More...
 

UHI for Vendor Class

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

This Vendor Class implementation supports one endpoint for all endpoint types on all directions: Control IN, control OUT, interrupt IN, interrupt OUT, bulk IN, bulk OUT, isochronous IN, isochronous OUT.

This implementation is an example and can be a base to create another Vendor Class which supports more endpoint as two bulk IN endpoints.

bool uhi_vendor_control_in_run (uint8_t *buf, iram_size_t buf_size, uhd_callback_setup_end_t callback)
 Start a transfer on control IN. More...
 
bool uhi_vendor_control_out_run (uint8_t *buf, iram_size_t buf_size, uhd_callback_setup_end_t callback)
 Start a transfer on control OUT. More...
 
bool uhi_vendor_bulk_in_run (uint8_t *buf, iram_size_t buf_size, uhd_callback_trans_t callback)
 Start a transfer on bulk IN. More...
 
bool uhi_vendor_bulk_out_run (uint8_t *buf, iram_size_t buf_size, uhd_callback_trans_t callback)
 Start a transfer on bulk OUT. More...
 
bool uhi_vendor_int_in_run (uint8_t *buf, iram_size_t buf_size, uhd_callback_trans_t callback)
 Start a transfer on interrupt IN. More...
 
bool uhi_vendor_int_out_run (uint8_t *buf, iram_size_t buf_size, uhd_callback_trans_t callback)
 Start a transfer on interrupt OUT. More...
 
bool uhi_vendor_iso_in_run (uint8_t *buf, iram_size_t buf_size, uhd_callback_trans_t callback)
 Start a transfer on ISO IN. More...
 
bool uhi_vendor_iso_out_run (uint8_t *buf, iram_size_t buf_size, uhd_callback_trans_t callback)
 Start a transfer on ISO OUT. More...
 
bool uhi_vendor_bulk_is_available (void)
 Check if a transfer on BULK is possible. More...
 
bool uhi_vendor_int_is_available (void)
 Check if a transfer on INTERRUPT is possible. More...
 
bool uhi_vendor_iso_is_available (void)
 Check if a transfer on ISO is possible. More...
 

#define UHI_VENDOR
Value:
{ \
.install = uhi_vendor_install, \
.enable = uhi_vendor_enable, \
.uninstall = uhi_vendor_uninstall, \
.sof_notify = NULL, \
}
uhc_enum_status_t uhi_vendor_install(uhc_device_t *dev)
Install interface.
void uhi_vendor_uninstall(uhc_device_t *dev)
Uninstall the interface (if installed).
void uhi_vendor_enable(uhc_device_t *dev)
Enable the interface.

Global definition which contains standard UHI API for UHC It must be added in USB_HOST_UHI definition from conf_usb_host.h file.

bool uhi_vendor_bulk_in_run ( uint8_t *  buf,
iram_size_t  buf_size,
uhd_callback_trans_t  callback 
)

Start a transfer on bulk IN.

When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of byte transferred.

Parameters
[out]bufBuffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED.
[in]buf_sizeBuffer size to send or fill
[in]callbackNULL or function to call at the end of transfer
Returns
1 if function was successfully done, otherwise 0.
bool uhi_vendor_bulk_is_available ( void  )

Check if a transfer on BULK is possible.

Returns
1 if possible, otherwise 0.
bool uhi_vendor_bulk_out_run ( uint8_t *  buf,
iram_size_t  buf_size,
uhd_callback_trans_t  callback 
)

Start a transfer on bulk OUT.

When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of byte transferred.

Parameters
[in]bufBuffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED.
[in]buf_sizeBuffer size to send or fill
[in]callbackNULL or function to call at the end of transfer
Returns
1 if function was successfully done, otherwise 0.
bool uhi_vendor_control_in_run ( uint8_t *  buf,
iram_size_t  buf_size,
uhd_callback_setup_end_t  callback 
)

Start a transfer on control IN.

When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of bytes transferred.

Parameters
[out]bufBuffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED.
[in]buf_sizeBuffer size to send or fill
[in]callbackNULL or function to call at the end of transfer
Returns
1 if function was successfully done, otherwise 0.
bool uhi_vendor_control_out_run ( uint8_t *  buf,
iram_size_t  buf_size,
uhd_callback_setup_end_t  callback 
)

Start a transfer on control OUT.

When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of byte transferred.

Parameters
[in]bufBuffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED.
[in]buf_sizeBuffer size to send or fill
[in]callbackNULL or function to call at the end of transfer
Returns
1 if function was successfully done, otherwise 0.
void uhi_vendor_enable ( uhc_device_t dev)

Enable the interface.

Enable a USB interface corresponding to UHI.

Parameters
[in]uhc_device_tDevice to request
uhc_enum_status_t uhi_vendor_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_vendor_int_in_run ( uint8_t *  buf,
iram_size_t  buf_size,
uhd_callback_trans_t  callback 
)

Start a transfer on interrupt IN.

When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of byte transferred.

Parameters
[out]bufBuffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED.
[in]buf_sizeBuffer size to send or fill
[in]callbackNULL or function to call at the end of transfer
Returns
1 if function was successfully done, otherwise 0.
bool uhi_vendor_int_is_available ( void  )

Check if a transfer on INTERRUPT is possible.

Returns
1 if possible, otherwise 0.
bool uhi_vendor_int_out_run ( uint8_t *  buf,
iram_size_t  buf_size,
uhd_callback_trans_t  callback 
)

Start a transfer on interrupt OUT.

When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of byte transferred.

Parameters
[in]bufBuffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED.
[in]buf_sizeBuffer size to send or fill
[in]callbackNULL or function to call at the end of transfer
Returns
1 if function was successfully done, otherwise 0.
bool uhi_vendor_iso_in_run ( uint8_t *  buf,
iram_size_t  buf_size,
uhd_callback_trans_t  callback 
)

Start a transfer on ISO IN.

When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of byte transferred.

Parameters
[out]bufBuffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED.
[in]buf_sizeBuffer size to send or fill
[in]callbackNULL or function to call at the end of transfer
Returns
1 if function was successfully done, otherwise 0.
bool uhi_vendor_iso_is_available ( void  )

Check if a transfer on ISO is possible.

Returns
1 if possible, otherwise 0.
bool uhi_vendor_iso_out_run ( uint8_t *  buf,
iram_size_t  buf_size,
uhd_callback_trans_t  callback 
)

Start a transfer on ISO OUT.

When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of byte transferred.

Parameters
[in]bufBuffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED.
[in]buf_sizeBuffer size to send or fill
[in]callbackNULL or function to call at the end of transfer
Returns
1 if function was successfully done, otherwise 0.
void uhi_vendor_uninstall ( uhc_device_t dev)

Uninstall the interface (if installed).

Parameters
[in]uhc_device_tDevice to request