Universal Serial Bus OTG Controller
UG0331 User Guide Revision 15.0
307
Refer to the
SmartFusion2 MSS USB Device Core Driver’s User Guide
for more information on the
API detailed description and parameters to the APIs.
uint8_t* (*usb_class_get_descriptor)
(uint8_t recipient, uint8_t type, uint32_t*
length);
This function is called when USB device receives GET_DESCRIPTOR
request from USB host requesting a class specific descriptor
(configuration, class, interface, endpoint, OTG, vendor descriptors). The
parameter recipient indicates the intended recipient by the USB host
(endpoint, interface or device). The parameter type indicates the type of
descriptor requested.
uint8_t (*usb_class_process_requests)
(uint8_t** buf_p, uint8_t request, uint32_t*
length, uint8_t* data_buf_p, uint32_t
data_len);
This function is called when USB device receives class specific request
from USB host. The parameter request indicates the class specific
request that need to be processed. The function should return a pointer to
the data requested structure in the return parameter buf_p and length of
the buffer in the return parameter length. If the host provides data along
with the request to be processed, a pointer to this data will be passed in
the parameter data_buf_p, and the size of the buffer will be passed in the
parameter data_len.
uint8_t (*usb_class_datain)
(mss_usb_ep_num_t num, uint8_t status);
This function is called when provided data is transferred on previously
configured transmit endpoint. The endpoint on which data is received is
indicated by parameter num. The parameter status indicates error status
of the transmit transaction. A non-zero status value indicates that there
was error in last receive transaction.
uint8_t (*usb_class_dataout)
(mss_usb_ep_num_t num, uint8_t status,
uint32_t rx_count);
This function is called when data is received on previously configured
receive endpoint. The endpoint on which data is received is indicated by
parameter num. The parameter status indicates error status of the receive
transaction. A non-zero status value indicates that there was error in last
receive transaction. The rx_count parameter indicates the number of
bytes received in the last receive transaction.
uint8_t (*usb_class_cep_datain)
(uint8_t status);
This function is called when data packet is transmitted on previously
configured control endpoint. The parameter status indicates error status
of the transmit transaction. A non-zero status value indicates that there
was error in last transmit transaction.
uint8_t (*usb_class_cep_dataout)
(uint8_t status);
This function is called when data packet is received on previously
configured control endpoint. The parameter status indicates error status
of the receive transaction. A non-zero status value indicates that there
was error in last receive transaction.
uint8_t *(*usb_device_descriptor)
(uint32_t* length);
This function is called when USB device receives the
GET_DESCRIPTOR command requesting device descriptor from USB
host. This function should return a pointer to the device descriptor and
provide the length of the descriptor in the return parameter.
uint8_t *(*usb_device_qual_descriptor)
(mss_usb_device_speed_t speed,
uint32_t* length);
This function is called when USB device receives the
GET_DESCRIPTOR command requesting device qualifier descriptor
from USB host. This function should return a pointer to the device
qualifier descriptor and provide the length of the descriptor in the return
parameter.
uint8_t *(*usb_string_descriptor)
(uint8_t index, uint32_t* length);
This function is called when USB device receives the
GET_DESCRIPTOR command requesting specific string descriptor from
USB host. Requested string descriptor number is provided in parameter
index. This function should return a pointer to the requested string
descriptor and provide the length of the descriptor in the return parameter
length.
Table 196 •
Functional Descriptions of Callback APIs
(continued)
Callback API
Description