pub unsafe extern "C" fn MSS_USBH_construct_get_descr_command(
buf: *mut u8,
xfr_dir: u8,
req_type: u8,
recip_type: u8,
request: u8,
desc_type: u8,
strng_idx: u8,
length: u16,
)Expand description
The MSS_USBH_construct_get_descr_command() function is be used to construct the setup packet which is to be sent on the USB bus. This function formats the provided parameters into a USB standard format GET_DESCRIPTOR request and stores it in the location provided by the buf parameter.
@param buf The buf parameter is the address of the buffer where the formatted GET_DESCRIPTOR request is stored.
@param xfr_dir The xfr_dir parameter indicates the direction of the data transfer on the USB bus. The value USB_STD_REQ_DATA_DIR_IN indicates that the direction of the data transfer is from the USB device to USB host (USB IN transaction). The value USB_STD_REQ_DATA_DIR_OUT indicates that the direction of the data transfer is from the USB host to the USB device (USB OUT transaction).
@param req_type The req_type parameter indicates the request type. The request type can be one of the following: standard request, class request or vendor request.
@param recip_type The recip_type parameter indicates the recipient type on the USB device. The request recipient on the attached device can be one of the following: device, endpoint or interface.
@param request The request parameter indicates the request that needs to be sent to the attached device.
@param desc_type The desc_type parameter indicates the descriptor type that needs to be requested from the attached device.
@param strng_idx The strng_idx parameter indicates the index of the string descriptor when the desc_type parameter indicates STRING TYPE.
@param length The length parameter indicates the number of bytes to be received from attached device as part of the requested descriptor.
@return This function does not return any value.
Example: @code MSS_USBH_configure_control_pipe(g_msd_tdev_addr); memset(std_req_buf, 0u, 8*(sizeof(uint8_t))); MSS_USBH_construct_get_descr_command(std_req_buf, USB_STD_REQ_DATA_DIR_IN, USB_STANDARD_REQUEST, USB_STD_REQ_RECIPIENT_DEVICE, USB_STD_REQ_GET_DESCRIPTOR, USB_CONFIGURATION_DESCRIPTOR_TYPE, 0, 32u);
g_msc_state = USBH_MSC_WAIT_GET_CLASS_DESCR; MSS_USBH_start_control_xfr(std_req_buf, (uint8_t*)&g_msd_conf_desc, USB_STD_REQ_DATA_DIR_IN, 32u); @endcode