1: uhs_status_t Usbh_Api_GetInterface(
2:
struct usb_control_block* ucb,
3:
struct usbd_usb_deviceinfo* usbdev,
4:
const uhs_ubit16_t wIndex,
5:
void *buf
6: )
7: {
8: uhs_status_t retval =
UDI_OK;
9:
10:
11:
if( Usbh_susres_get_state() != USBH_SUSRES_STS_IDLE ){
12: uhs_debug_print (DBG_ERR, ("ERROR : Don't Call Current State!!"));
13: CORE_REPORT_ERROR(
USBC_ILLEGAL_ERROR );
14:
return UDI_STAT_INVALID_STATE;
15: }
16:
17:
if (( ucb == NULL ) || ( usbdev == NULL ) || ( buf == NULL )) {
18: CORE_REPORT_ERROR(
USBC_INVALID_PARAMETER );
19:
return UDI_STAT_DATA_ERROR;
20: }
21:
22: 23:
Usbh_Api_FixupPipeInfo(
24: &ucb->pipe,
25: ucb->usbdev->usbdev_DevNum,
26:
USB_DEFAULT_EP_NUM,
27:
USB_PACKETID_IN,
28:
USB_TRANS_CONTROL, 29: ucb->usbdev->usbdev_EpMaxpktOut[
USB_DEFAULT_EP_NUM]
30: );
31:
32: retval =
Usbh_Api_SyncControlMsg(
33: ucb,
34: USB_DEVICE_REQUEST_TYPE_DEVICE_TO_HOST |
35: USB_DEVICE_REQUEST_TYPE_STANDARD_TYPE |
36: USB_DEVICE_REQUEST_TYPE_INTERFACE_RECIPIENT,
37: USB_DEVICE_REQUEST_GET_INTERFACE,
38: 0,
39: 0,
40: wIndex & 0xffU,
41: wIndex >> 8,
42: buf,
43: 1 );
44:
45:
if( retval !=
UDI_OK) {
46: CORE_REPORT_WARNING(
USBC_ILLEGAL_ERROR);
47: }
48:
49:
return retval;
50: }