Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Implementation of UHI Vendor

Class internal implementation.

Data Structures

struct  uhi_vendor_dev_t
 

Macros

#define UHI_VENDOR_TIMEOUT   20000
 Timeout on Vendor transfer. More...
 

Functions

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_is_available (void)
 Check if a transfer on BULK is possible. 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_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_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_is_available (void)
 Check if a transfer on INTERRUPT is possible. 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_is_available (void)
 Check if a transfer on ISO is possible. 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...
 

Structure to store information about USB Device Vendor

static uhi_vendor_dev_t uhi_vendor_dev
 

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...
 

#define UHI_VENDOR_TIMEOUT   20000

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 transfered.

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

References uhc_device_t::address, uhi_vendor_dev_t::dev, uhi_vendor_dev_t::ep_bulk_in, uhd_ep_run(), uhi_vendor_bulk_is_available(), and UHI_VENDOR_TIMEOUT.

Referenced by main_loop_back_bulk().

bool uhi_vendor_bulk_is_available ( void  )

Check if a transfer on BULK is possible.

Returns
1 if possible, otherwise 0.

References uhi_vendor_dev_t::dev, uhi_vendor_dev_t::ep_bulk_in, uhi_vendor_dev_t::ep_bulk_out, and NULL.

Referenced by uhi_vendor_bulk_in_run(), and uhi_vendor_bulk_out_run().

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 transfered.

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

References uhc_device_t::address, uhi_vendor_dev_t::dev, uhi_vendor_dev_t::ep_bulk_out, uhd_ep_run(), uhi_vendor_bulk_is_available(), and UHI_VENDOR_TIMEOUT.

Referenced by main_loop_back_bulk().

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 byte transfered.

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

References uhc_device_t::address, usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, uhi_vendor_dev_t::dev, NULL, uhd_setup_request(), USB_REQ_DIR_IN, USB_REQ_RECIP_INTERFACE, USB_REQ_TYPE_VENDOR, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.

Referenced by main_loop_back_control().

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 transfered.

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

References uhc_device_t::address, usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, uhi_vendor_dev_t::dev, NULL, uhd_setup_request(), USB_REQ_RECIP_INTERFACE, USB_REQ_TYPE_VENDOR, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.

Referenced by main_loop_back_control().

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 transfered.

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

References uhc_device_t::address, uhi_vendor_dev_t::dev, uhi_vendor_dev_t::ep_int_in, uhd_ep_run(), uhi_vendor_int_is_available(), and UHI_VENDOR_TIMEOUT.

Referenced by main_loop_back_int().

bool uhi_vendor_int_is_available ( void  )

Check if a transfer on INTERRUPT is possible.

Returns
1 if possible, otherwise 0.

References uhi_vendor_dev_t::dev, uhi_vendor_dev_t::ep_int_in, uhi_vendor_dev_t::ep_int_out, and NULL.

Referenced by uhi_vendor_int_in_run(), and uhi_vendor_int_out_run().

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 transfered.

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

References uhc_device_t::address, uhi_vendor_dev_t::dev, uhi_vendor_dev_t::ep_int_out, uhd_ep_run(), uhi_vendor_int_is_available(), and UHI_VENDOR_TIMEOUT.

Referenced by main_loop_back_int().

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 transfered.

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

References uhc_device_t::address, uhi_vendor_dev_t::dev, uhi_vendor_dev_t::ep_iso_in, uhd_ep_run(), uhi_vendor_iso_is_available(), and UHI_VENDOR_TIMEOUT.

Referenced by main_iso_in_done(), and main_loop_back_iso().

bool uhi_vendor_iso_is_available ( void  )

Check if a transfer on ISO is possible.

Returns
1 if possible, otherwise 0.

References uhi_vendor_dev_t::dev, uhi_vendor_dev_t::ep_iso_in, uhi_vendor_dev_t::ep_iso_out, and NULL.

Referenced by uhi_vendor_iso_in_run(), and uhi_vendor_iso_out_run().

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 transfered.

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

References uhc_device_t::address, uhi_vendor_dev_t::dev, uhi_vendor_dev_t::ep_iso_out, uhd_ep_run(), uhi_vendor_iso_is_available(), and UHI_VENDOR_TIMEOUT.

Referenced by main_iso_out_done(), and main_loop_back_iso().

void uhi_vendor_uninstall ( uhc_device_t dev)

Uninstall the interface (if installed).

Parameters
[in]uhc_device_tDevice to request

References uhi_vendor_dev_t::dev, NULL, and UHI_VENDOR_CHANGE.

uhi_vendor_dev_t uhi_vendor_dev
static
Initial value:
= {
.dev = NULL
}
#define NULL
Definition: def.h:47