22static int cdc_parse_cs_interface(
CDC_DEV_T *cdev, uint8_t *buffer,
int size)
30 while(size >=
sizeof(DESC_HDR_T))
32 header = (DESC_HDR_T *)buffer;
34 if(header->bLength < 2)
36 CDC_DBGMSG(
"Invalid descriptor length of %d\n", header->bLength);
40 if(header->bDescriptorType != CDC_CS_INTERFACE)
43 cifd = (CDC_IF_HDR_T *)header;
45 CDC_DBGMSG(
"CS_INTERFACE: 0x%x, ", cifd->bDescriptorSubtype);
47 switch(cifd->bDescriptorSubtype)
50 CDC_DBGMSG(
"Header Functional\n");
52 case CDC_DT_CALL_MANAGE:
53 CDC_DBGMSG(
"Call Management\n");
56 CDC_DBGMSG(
"Abstract Control Management\n");
58 case CDC_DT_LINE_MANAGE:
59 CDC_DBGMSG(
"Direct Line Management\n");
61 case CDC_DT_TEL_RINGER:
62 CDC_DBGMSG(
"Telephone Ringer\n");
64 case CDC_DT_TEL_OPER_MODES:
65 CDC_DBGMSG(
"Telephone Operational Modes\n");
67 case CDC_DT_CALL_LINE_CAP:
68 CDC_DBGMSG(
"Telephone Call and Line State Reporting Capabilities\n");
71 CDC_DBGMSG(
"Union Functional\n");
72 if(cifd->bLength >= 5)
74 if(cifd->bLength >= 6)
76 CDC_DBGMSG(
"Union Functional length %d, not supported!\n", cifd->bLength);
79 case CDC_DT_COUNTRY_SEL:
80 CDC_DBGMSG(
"Country Selection\n");
82 case CDC_DT_USB_TERMINAL:
83 CDC_DBGMSG(
"USB Terminal\n");
85 case CDC_DT_NET_CHANNEL:
86 CDC_DBGMSG(
"Network Channel Terminal\n");
88 case CDC_DT_PROTO_UNIT:
89 CDC_DBGMSG(
"Protocol Unit\n");
91 case CDC_DT_EXTENT_UNIT:
92 CDC_DBGMSG(
"Extension Unit\n");
94 case CDC_DT_MULTI_CHANNEL:
95 CDC_DBGMSG(
"Multi-Channel Management\n");
97 case CDC_DT_CAPI_CTRL:
98 CDC_DBGMSG(
"CAPI Control Management\n");
100 case CDC_DT_ETHERNET_FUNC:
101 CDC_DBGMSG(
"Ethernet Networking Functional\n");
103 case CDC_DT_ATM_FUNC:
104 CDC_DBGMSG(
"ATM Networking Functional\n");
108 buffer += header->bLength;
109 parsed += header->bLength;
110 size -= header->bLength;
120 UDEV_T *udev = cdev->
udev;
127 config = (DESC_CONF_T *)udev->cfd_buff;
128 bptr = (uint8_t *)config;
129 bptr += config->bLength;
130 size = config->wTotalLength - config->bLength;
132 while(size >=
sizeof(DESC_HDR_T))
134 header = (DESC_HDR_T *)bptr;
136 if((header->bLength > size) || (header->bLength < 2))
138 CDC_DBGMSG(
"Error - invalid descriptor length of %d\n", header->bLength);
145 if(header->bDescriptorType == USB_DT_INTERFACE)
147 ifd = (DESC_IF_T *)header;
148 if(ifd->bInterfaceNumber == cdev->
iface_cdc->if_num)
150 bptr += header->bLength;
151 size -= header->bLength;
155 bptr += header->bLength;
156 size -= header->bLength;
163 while(size >=
sizeof(DESC_HDR_T))
165 header = (DESC_HDR_T *)bptr;
167 if((header->bLength > size) || (header->bLength < 2))
169 CDC_DBGMSG(
"Error - invalid descriptor length of %d\n", header->bLength);
176 if(header->bDescriptorType != CDC_CS_INTERFACE)
179 result = cdc_parse_cs_interface(cdev, bptr, size);
186 CDC_DBGMSG(
"CDC ifnum_cdc = %d\n", cdev->
iface_cdc->if_num);
189 CDC_DBGMSG(
"CDC ifnum_data = %d\n", cdev->
iface_data->if_num);
NuMicro peripheral access layer header file.
#define USBH_ERR_NOT_SUPPORTED
USB Host library header file.
USB Host CDC(Communication Device Class) driver header file.
USB Host library exported header file.