cdc.h
001:
002:
003:
004:
005:
006:
007:
008:
009: #ifndef __LINUX_USB_CDC_H
010: #define __LINUX_USB_CDC_H
011:
012: #include <linux/types.h>
013:
014: #define USB_CDC_SUBCLASS_ACM 0x02
015: #define USB_CDC_SUBCLASS_ETHERNET 0x06
016: #define USB_CDC_SUBCLASS_WHCM 0x08
017: #define USB_CDC_SUBCLASS_DMM 0x09
018: #define USB_CDC_SUBCLASS_MDLM 0x0a
019: #define USB_CDC_SUBCLASS_OBEX 0x0b
020: #define USB_CDC_SUBCLASS_EEM 0x0c
021: #define USB_CDC_SUBCLASS_NCM 0x0d
022:
023: #define USB_CDC_PROTO_NONE 0
024:
025: #define USB_CDC_ACM_PROTO_AT_V25TER 1
026: #define USB_CDC_ACM_PROTO_AT_PCCA101 2
027: #define USB_CDC_ACM_PROTO_AT_PCCA101_WAKE 3
028: #define USB_CDC_ACM_PROTO_AT_GSM 4
029: #define USB_CDC_ACM_PROTO_AT_3G 5
030: #define USB_CDC_ACM_PROTO_AT_CDMA 6
031: #define USB_CDC_ACM_PROTO_VENDOR 0xff
032:
033: #define USB_CDC_PROTO_EEM 7
034:
035: #define USB_CDC_NCM_PROTO_NTB 1
036:
037:
038:
039:
040:
041:
042:
043: #define USB_CDC_HEADER_TYPE 0x00
044: #define USB_CDC_CALL_MANAGEMENT_TYPE 0x01
045: #define USB_CDC_ACM_TYPE 0x02
046: #define USB_CDC_UNION_TYPE 0x06
047: #define USB_CDC_COUNTRY_TYPE 0x07
048: #define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a
049: #define USB_CDC_ETHERNET_TYPE 0x0f
050: #define USB_CDC_WHCM_TYPE 0x11
051: #define USB_CDC_MDLM_TYPE 0x12
052: #define USB_CDC_MDLM_DETAIL_TYPE 0x13
053: #define USB_CDC_DMM_TYPE 0x14
054: #define USB_CDC_OBEX_TYPE 0x15
055: #define USB_CDC_NCM_TYPE 0x1a
056:
057:
058: struct usb_cdc_header_desc {
059: __u8 bLength;
060: __u8 bDescriptorType;
061: __u8 bDescriptorSubType;
062:
063: __le16 bcdCDC;
064: } __attribute__ ((packed));
065:
066:
067: struct usb_cdc_call_mgmt_descriptor {
068: __u8 bLength;
069: __u8 bDescriptorType;
070: __u8 bDescriptorSubType;
071:
072: __u8 bmCapabilities;
073: #define USB_CDC_CALL_MGMT_CAP_CALL_MGMT 0x01
074: #define USB_CDC_CALL_MGMT_CAP_DATA_INTF 0x02
075:
076: __u8 bDataInterface;
077: } __attribute__ ((packed));
078:
079:
080: struct usb_cdc_acm_descriptor {
081: __u8 bLength;
082: __u8 bDescriptorType;
083: __u8 bDescriptorSubType;
084:
085: __u8 bmCapabilities;
086: } __attribute__ ((packed));
087:
088:
089:
090: #define USB_CDC_COMM_FEATURE 0x01
091: #define USB_CDC_CAP_LINE 0x02
092: #define USB_CDC_CAP_BRK 0x04
093: #define USB_CDC_CAP_NOTIFY 0x08
094:
095:
096: struct usb_cdc_union_desc {
097: __u8 bLength;
098: __u8 bDescriptorType;
099: __u8 bDescriptorSubType;
100:
101: __u8 bMasterInterface0;
102: __u8 bSlaveInterface0;
103:
104: } __attribute__ ((packed));
105:
106:
107: struct usb_cdc_country_functional_desc {
108: __u8 bLength;
109: __u8 bDescriptorType;
110: __u8 bDescriptorSubType;
111:
112: __u8 iCountryCodeRelDate;
113: __le16 wCountyCode0;
114:
115: } __attribute__ ((packed));
116:
117:
118: struct usb_cdc_network_terminal_desc {
119: __u8 bLength;
120: __u8 bDescriptorType;
121: __u8 bDescriptorSubType;
122:
123: __u8 bEntityId;
124: __u8 iName;
125: __u8 bChannelIndex;
126: __u8 bPhysicalInterface;
127: } __attribute__ ((packed));
128:
129:
130: struct usb_cdc_ether_desc {
131: __u8 bLength;
132: __u8 bDescriptorType;
133: __u8 bDescriptorSubType;
134:
135: __u8 iMACAddress;
136: __le32 bmEthernetStatistics;
137: __le16 wMaxSegmentSize;
138: __le16 wNumberMCFilters;
139: __u8 bNumberPowerFilters;
140: } __attribute__ ((packed));
141:
142:
143: struct usb_cdc_dmm_desc {
144: __u8 bFunctionLength;
145: __u8 bDescriptorType;
146: __u8 bDescriptorSubtype;
147: __u16 bcdVersion;
148: __le16 wMaxCommand;
149: } __attribute__ ((packed));
150:
151:
152: struct usb_cdc_mdlm_desc {
153: __u8 bLength;
154: __u8 bDescriptorType;
155: __u8 bDescriptorSubType;
156:
157: __le16 bcdVersion;
158: __u8 bGUID[16];
159: } __attribute__ ((packed));
160:
161:
162: struct usb_cdc_mdlm_detail_desc {
163: __u8 bLength;
164: __u8 bDescriptorType;
165: __u8 bDescriptorSubType;
166:
167:
168: __u8 bGuidDescriptorType;
169: __u8 bDetailData[0];
170: } __attribute__ ((packed));
171:
172:
173: struct usb_cdc_obex_desc {
174: __u8 bLength;
175: __u8 bDescriptorType;
176: __u8 bDescriptorSubType;
177:
178: __le16 bcdVersion;
179: } __attribute__ ((packed));
180:
181:
182: struct usb_cdc_ncm_desc {
183: __u8 bLength;
184: __u8 bDescriptorType;
185: __u8 bDescriptorSubType;
186:
187: __le16 bcdNcmVersion;
188: __u8 bmNetworkCapabilities;
189: } __attribute__ ((packed));
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202: #define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00
203: #define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01
204: #define USB_CDC_REQ_SET_LINE_CODING 0x20
205: #define USB_CDC_REQ_GET_LINE_CODING 0x21
206: #define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22
207: #define USB_CDC_REQ_SEND_BREAK 0x23
208: #define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40
209: #define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41
210: #define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42
211: #define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43
212: #define USB_CDC_GET_ETHERNET_STATISTIC 0x44
213: #define USB_CDC_GET_NTB_PARAMETERS 0x80
214: #define USB_CDC_GET_NET_ADDRESS 0x81
215: #define USB_CDC_SET_NET_ADDRESS 0x82
216: #define USB_CDC_GET_NTB_FORMAT 0x83
217: #define USB_CDC_SET_NTB_FORMAT 0x84
218: #define USB_CDC_GET_NTB_INPUT_SIZE 0x85
219: #define USB_CDC_SET_NTB_INPUT_SIZE 0x86
220: #define USB_CDC_GET_MAX_DATAGRAM_SIZE 0x87
221: #define USB_CDC_SET_MAX_DATAGRAM_SIZE 0x88
222: #define USB_CDC_GET_CRC_MODE 0x89
223: #define USB_CDC_SET_CRC_MODE 0x8a
224:
225:
226: struct usb_cdc_line_coding {
227: __le32 dwDTERate;
228: __u8 bCharFormat;
229: #define USB_CDC_1_STOP_BITS 0
230: #define USB_CDC_1_5_STOP_BITS 1
231: #define USB_CDC_2_STOP_BITS 2
232:
233: __u8 bParityType;
234: #define USB_CDC_NO_PARITY 0
235: #define USB_CDC_ODD_PARITY 1
236: #define USB_CDC_EVEN_PARITY 2
237: #define USB_CDC_MARK_PARITY 3
238: #define USB_CDC_SPACE_PARITY 4
239:
240: __u8 bDataBits;
241: } __attribute__ ((packed));
242:
243:
244: #define USB_CDC_PACKET_TYPE_PROMISCUOUS (1 << 0)
245: #define USB_CDC_PACKET_TYPE_ALL_MULTICAST (1 << 1)
246: #define USB_CDC_PACKET_TYPE_DIRECTED (1 << 2)
247: #define USB_CDC_PACKET_TYPE_BROADCAST (1 << 3)
248: #define USB_CDC_PACKET_TYPE_MULTICAST (1 << 4)
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261: #define USB_CDC_NOTIFY_NETWORK_CONNECTION 0x00
262: #define USB_CDC_NOTIFY_RESPONSE_AVAILABLE 0x01
263: #define USB_CDC_NOTIFY_SERIAL_STATE 0x20
264: #define USB_CDC_NOTIFY_SPEED_CHANGE 0x2a
265:
266: struct usb_cdc_notification {
267: __u8 bmRequestType;
268: __u8 bNotificationType;
269: __le16 wValue;
270: __le16 wIndex;
271: __le16 wLength;
272: } __attribute__ ((packed));
273:
274: struct usb_cdc_speed_change {
275: __le32 DLBitRRate;
276: __le32 ULBitRate;
277: } __attribute__ ((packed));
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288: struct usb_cdc_ncm_ntb_parameters {
289: __le16 wLength;
290: __le16 bmNtbFormatsSupported;
291: __le32 dwNtbInMaxSize;
292: __le16 wNdpInDivisor;
293: __le16 wNdpInPayloadRemainder;
294: __le16 wNdpInAlignment;
295: __le16 wPadding1;
296: __le32 dwNtbOutMaxSize;
297: __le16 wNdpOutDivisor;
298: __le16 wNdpOutPayloadRemainder;
299: __le16 wNdpOutAlignment;
300: __le16 wNtbOutMaxDatagrams;
301: } __attribute__ ((packed));
302:
303:
304:
305:
306:
307: #define USB_CDC_NCM_NTH16_SIGN 0x484D434E
308: #define USB_CDC_NCM_NTH32_SIGN 0x686D636E
309:
310: struct usb_cdc_ncm_nth16 {
311: __le32 dwSignature;
312: __le16 wHeaderLength;
313: __le16 wSequence;
314: __le16 wBlockLength;
315: __le16 wNdpIndex;
316: } __attribute__ ((packed));
317:
318: struct usb_cdc_ncm_nth32 {
319: __le32 dwSignature;
320: __le16 wHeaderLength;
321: __le16 wSequence;
322: __le32 dwBlockLength;
323: __le32 dwNdpIndex;
324: } __attribute__ ((packed));
325:
326:
327:
328:
329:
330: #define USB_CDC_NCM_NDP16_CRC_SIGN 0x314D434E
331: #define USB_CDC_NCM_NDP16_NOCRC_SIGN 0x304D434E
332: #define USB_CDC_NCM_NDP32_CRC_SIGN 0x316D636E
333: #define USB_CDC_NCM_NDP32_NOCRC_SIGN 0x306D636E
334:
335:
336: struct usb_cdc_ncm_dpe16 {
337: __le16 wDatagramIndex;
338: __le16 wDatagramLength;
339: } __attribute__((__packed__));
340:
341:
342: struct usb_cdc_ncm_ndp16 {
343: __le32 dwSignature;
344: __le16 wLength;
345: __le16 wNextNdpIndex;
346: struct usb_cdc_ncm_dpe16 dpe16[0];
347: } __attribute__ ((packed));
348:
349:
350: struct usb_cdc_ncm_dpe32 {
351: __le32 dwDatagramIndex;
352: __le32 dwDatagramLength;
353: } __attribute__((__packed__));
354:
355:
356: struct usb_cdc_ncm_ndp32 {
357: __le32 dwSignature;
358: __le16 wLength;
359: __le16 wReserved6;
360: __le32 dwNextNdpIndex;
361: __le32 dwReserved12;
362: struct usb_cdc_ncm_dpe32 dpe32[0];
363: } __attribute__ ((packed));
364:
365:
366: #define USB_CDC_NCM_NDP16_INDEX_MIN 0x000C
367: #define USB_CDC_NCM_NDP32_INDEX_MIN 0x0010
368:
369:
370: #define USB_CDC_NCM_DATAGRAM_FORMAT_CRC 0x30
371: #define USB_CDC_NCM_DATAGRAM_FORMAT_NOCRC 0X31
372:
373:
374: #define USB_CDC_NCM_PROTO_CODE_NO_ENCAP_COMMANDS 0x00
375: #define USB_CDC_NCM_PROTO_CODE_EXTERN_PROTO 0xFE
376:
377:
378: #define USB_CDC_NCM_NCAP_ETH_FILTER (1 << 0)
379: #define USB_CDC_NCM_NCAP_NET_ADDRESS (1 << 1)
380: #define USB_CDC_NCM_NCAP_ENCAP_COMMAND (1 << 2)
381: #define USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE (1 << 3)
382: #define USB_CDC_NCM_NCAP_CRC_MODE (1 << 4)
383: #define USB_CDC_NCM_NCAP_NTB_INPUT_SIZE (1 << 5)
384:
385:
386: #define USB_CDC_NCM_NTB16_SUPPORTED (1 << 0)
387: #define USB_CDC_NCM_NTB32_SUPPORTED (1 << 1)
388:
389:
390: #define USB_CDC_NCM_NDP_ALIGN_MIN_SIZE 0x04
391: #define USB_CDC_NCM_NTB_MAX_LENGTH 0x1C
392:
393:
394: #define USB_CDC_NCM_NTB16_FORMAT 0x00
395: #define USB_CDC_NCM_NTB32_FORMAT 0x01
396:
397:
398: #define USB_CDC_NCM_NTB_MIN_IN_SIZE 2048
399: #define USB_CDC_NCM_NTB_MIN_OUT_SIZE 2048
400:
401:
402: struct usb_cdc_ncm_ndp_input_size {
403: __le32 dwNtbInMaxSize;
404: __le16 wNtbInMaxDatagrams;
405: __le16 wReserved;
406: } __attribute__ ((packed));
407:
408:
409: #define USB_CDC_NCM_CRC_NOT_APPENDED 0x00
410: #define USB_CDC_NCM_CRC_APPENDED 0x01
411:
412: #endif
413:
© Andrew Scott 2006 -
2025,
All Rights Reserved