aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb/cdc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/usb/cdc.h')
-rw-r--r--include/linux/usb/cdc.h102
1 files changed, 85 insertions, 17 deletions
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index c117a68d04a7..81a927930bfd 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -32,6 +32,8 @@
32 32
33#define USB_CDC_PROTO_EEM 7 33#define USB_CDC_PROTO_EEM 7
34 34
35#define USB_CDC_NCM_PROTO_NTB 1
36
35/*-------------------------------------------------------------------------*/ 37/*-------------------------------------------------------------------------*/
36 38
37/* 39/*
@@ -87,7 +89,7 @@ struct usb_cdc_acm_descriptor {
87 89
88#define USB_CDC_COMM_FEATURE 0x01 90#define USB_CDC_COMM_FEATURE 0x01
89#define USB_CDC_CAP_LINE 0x02 91#define USB_CDC_CAP_LINE 0x02
90#define USB_CDC_CAP_BRK 0x04 92#define USB_CDC_CAP_BRK 0x04
91#define USB_CDC_CAP_NOTIFY 0x08 93#define USB_CDC_CAP_NOTIFY 0x08
92 94
93/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */ 95/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */
@@ -269,18 +271,23 @@ struct usb_cdc_notification {
269 __le16 wLength; 271 __le16 wLength;
270} __attribute__ ((packed)); 272} __attribute__ ((packed));
271 273
274struct usb_cdc_speed_change {
275 __le32 DLBitRRate; /* contains the downlink bit rate (IN pipe) */
276 __le32 ULBitRate; /* contains the uplink bit rate (OUT pipe) */
277} __attribute__ ((packed));
278
272/*-------------------------------------------------------------------------*/ 279/*-------------------------------------------------------------------------*/
273 280
274/* 281/*
275 * Class Specific structures and constants 282 * Class Specific structures and constants
276 * 283 *
277 * CDC NCM parameter structure, CDC NCM subclass 6.2.1 284 * CDC NCM NTB parameters structure, CDC NCM subclass 6.2.1
278 * 285 *
279 */ 286 */
280 287
281struct usb_cdc_ncm_ntb_parameter { 288struct usb_cdc_ncm_ntb_parameters {
282 __le16 wLength; 289 __le16 wLength;
283 __le16 bmNtbFormatSupported; 290 __le16 bmNtbFormatsSupported;
284 __le32 dwNtbInMaxSize; 291 __le32 dwNtbInMaxSize;
285 __le16 wNdpInDivisor; 292 __le16 wNdpInDivisor;
286 __le16 wNdpInPayloadRemainder; 293 __le16 wNdpInPayloadRemainder;
@@ -290,22 +297,22 @@ struct usb_cdc_ncm_ntb_parameter {
290 __le16 wNdpOutDivisor; 297 __le16 wNdpOutDivisor;
291 __le16 wNdpOutPayloadRemainder; 298 __le16 wNdpOutPayloadRemainder;
292 __le16 wNdpOutAlignment; 299 __le16 wNdpOutAlignment;
293 __le16 wPadding2; 300 __le16 wNtbOutMaxDatagrams;
294} __attribute__ ((packed)); 301} __attribute__ ((packed));
295 302
296/* 303/*
297 * CDC NCM transfer headers, CDC NCM subclass 3.2 304 * CDC NCM transfer headers, CDC NCM subclass 3.2
298 */ 305 */
299 306
300#define NCM_NTH16_SIGN 0x484D434E /* NCMH */ 307#define USB_CDC_NCM_NTH16_SIGN 0x484D434E /* NCMH */
301#define NCM_NTH32_SIGN 0x686D636E /* ncmh */ 308#define USB_CDC_NCM_NTH32_SIGN 0x686D636E /* ncmh */
302 309
303struct usb_cdc_ncm_nth16 { 310struct usb_cdc_ncm_nth16 {
304 __le32 dwSignature; 311 __le32 dwSignature;
305 __le16 wHeaderLength; 312 __le16 wHeaderLength;
306 __le16 wSequence; 313 __le16 wSequence;
307 __le16 wBlockLength; 314 __le16 wBlockLength;
308 __le16 wFpIndex; 315 __le16 wNdpIndex;
309} __attribute__ ((packed)); 316} __attribute__ ((packed));
310 317
311struct usb_cdc_ncm_nth32 { 318struct usb_cdc_ncm_nth32 {
@@ -313,32 +320,93 @@ struct usb_cdc_ncm_nth32 {
313 __le16 wHeaderLength; 320 __le16 wHeaderLength;
314 __le16 wSequence; 321 __le16 wSequence;
315 __le32 dwBlockLength; 322 __le32 dwBlockLength;
316 __le32 dwFpIndex; 323 __le32 dwNdpIndex;
317} __attribute__ ((packed)); 324} __attribute__ ((packed));
318 325
319/* 326/*
320 * CDC NCM datagram pointers, CDC NCM subclass 3.3 327 * CDC NCM datagram pointers, CDC NCM subclass 3.3
321 */ 328 */
322 329
323#define NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */ 330#define USB_CDC_NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */
324#define NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */ 331#define USB_CDC_NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */
325#define NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */ 332#define USB_CDC_NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */
326#define NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */ 333#define USB_CDC_NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */
327 334
335/* 16-bit NCM Datagram Pointer Entry */
336struct usb_cdc_ncm_dpe16 {
337 __le16 wDatagramIndex;
338 __le16 wDatagramLength;
339} __attribute__((__packed__));
340
341/* 16-bit NCM Datagram Pointer Table */
328struct usb_cdc_ncm_ndp16 { 342struct usb_cdc_ncm_ndp16 {
329 __le32 dwSignature; 343 __le32 dwSignature;
330 __le16 wLength; 344 __le16 wLength;
331 __le16 wNextFpIndex; 345 __le16 wNextNdpIndex;
332 __u8 data[0]; 346 struct usb_cdc_ncm_dpe16 dpe16[0];
333} __attribute__ ((packed)); 347} __attribute__ ((packed));
334 348
349/* 32-bit NCM Datagram Pointer Entry */
350struct usb_cdc_ncm_dpe32 {
351 __le32 dwDatagramIndex;
352 __le32 dwDatagramLength;
353} __attribute__((__packed__));
354
355/* 32-bit NCM Datagram Pointer Table */
335struct usb_cdc_ncm_ndp32 { 356struct usb_cdc_ncm_ndp32 {
336 __le32 dwSignature; 357 __le32 dwSignature;
337 __le16 wLength; 358 __le16 wLength;
338 __le16 wReserved6; 359 __le16 wReserved6;
339 __le32 dwNextFpIndex; 360 __le32 dwNextNdpIndex;
340 __le32 dwReserved12; 361 __le32 dwReserved12;
341 __u8 data[0]; 362 struct usb_cdc_ncm_dpe32 dpe32[0];
342} __attribute__ ((packed)); 363} __attribute__ ((packed));
343 364
365/* CDC NCM subclass 3.2.1 and 3.2.2 */
366#define USB_CDC_NCM_NDP16_INDEX_MIN 0x000C
367#define USB_CDC_NCM_NDP32_INDEX_MIN 0x0010
368
369/* CDC NCM subclass 3.3.3 Datagram Formatting */
370#define USB_CDC_NCM_DATAGRAM_FORMAT_CRC 0x30
371#define USB_CDC_NCM_DATAGRAM_FORMAT_NOCRC 0X31
372
373/* CDC NCM subclass 4.2 NCM Communications Interface Protocol Code */
374#define USB_CDC_NCM_PROTO_CODE_NO_ENCAP_COMMANDS 0x00
375#define USB_CDC_NCM_PROTO_CODE_EXTERN_PROTO 0xFE
376
377/* CDC NCM subclass 5.2.1 NCM Functional Descriptor, bmNetworkCapabilities */
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/* CDC NCM subclass Table 6-3: NTB Parameter Structure */
386#define USB_CDC_NCM_NTB16_SUPPORTED (1 << 0)
387#define USB_CDC_NCM_NTB32_SUPPORTED (1 << 1)
388
389/* CDC NCM subclass Table 6-3: NTB Parameter Structure */
390#define USB_CDC_NCM_NDP_ALIGN_MIN_SIZE 0x04
391#define USB_CDC_NCM_NTB_MAX_LENGTH 0x1C
392
393/* CDC NCM subclass 6.2.5 SetNtbFormat */
394#define USB_CDC_NCM_NTB16_FORMAT 0x00
395#define USB_CDC_NCM_NTB32_FORMAT 0x01
396
397/* CDC NCM subclass 6.2.7 SetNtbInputSize */
398#define USB_CDC_NCM_NTB_MIN_IN_SIZE 2048
399#define USB_CDC_NCM_NTB_MIN_OUT_SIZE 2048
400
401/* NTB Input Size Structure */
402struct usb_cdc_ncm_ndp_input_size {
403 __le32 dwNtbInMaxSize;
404 __le16 wNtbInMaxDatagrams;
405 __le16 wReserved;
406} __attribute__ ((packed));
407
408/* CDC NCM subclass 6.2.11 SetCrcMode */
409#define USB_CDC_NCM_CRC_NOT_APPENDED 0x00
410#define USB_CDC_NCM_CRC_APPENDED 0x01
411
344#endif /* __LINUX_USB_CDC_H */ 412#endif /* __LINUX_USB_CDC_H */