diff options
Diffstat (limited to 'include/linux/usb/cdc.h')
-rw-r--r-- | include/linux/usb/cdc.h | 79 |
1 files changed, 67 insertions, 12 deletions
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h index c117a68d04a7..5e86dc771da4 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 | /* |
@@ -274,13 +276,13 @@ struct usb_cdc_notification { | |||
274 | /* | 276 | /* |
275 | * Class Specific structures and constants | 277 | * Class Specific structures and constants |
276 | * | 278 | * |
277 | * CDC NCM parameter structure, CDC NCM subclass 6.2.1 | 279 | * CDC NCM NTB parameters structure, CDC NCM subclass 6.2.1 |
278 | * | 280 | * |
279 | */ | 281 | */ |
280 | 282 | ||
281 | struct usb_cdc_ncm_ntb_parameter { | 283 | struct usb_cdc_ncm_ntb_parameters { |
282 | __le16 wLength; | 284 | __le16 wLength; |
283 | __le16 bmNtbFormatSupported; | 285 | __le16 bmNtbFormatsSupported; |
284 | __le32 dwNtbInMaxSize; | 286 | __le32 dwNtbInMaxSize; |
285 | __le16 wNdpInDivisor; | 287 | __le16 wNdpInDivisor; |
286 | __le16 wNdpInPayloadRemainder; | 288 | __le16 wNdpInPayloadRemainder; |
@@ -297,8 +299,8 @@ struct usb_cdc_ncm_ntb_parameter { | |||
297 | * CDC NCM transfer headers, CDC NCM subclass 3.2 | 299 | * CDC NCM transfer headers, CDC NCM subclass 3.2 |
298 | */ | 300 | */ |
299 | 301 | ||
300 | #define NCM_NTH16_SIGN 0x484D434E /* NCMH */ | 302 | #define USB_CDC_NCM_NTH16_SIGN 0x484D434E /* NCMH */ |
301 | #define NCM_NTH32_SIGN 0x686D636E /* ncmh */ | 303 | #define USB_CDC_NCM_NTH32_SIGN 0x686D636E /* ncmh */ |
302 | 304 | ||
303 | struct usb_cdc_ncm_nth16 { | 305 | struct usb_cdc_ncm_nth16 { |
304 | __le32 dwSignature; | 306 | __le32 dwSignature; |
@@ -320,25 +322,78 @@ struct usb_cdc_ncm_nth32 { | |||
320 | * CDC NCM datagram pointers, CDC NCM subclass 3.3 | 322 | * CDC NCM datagram pointers, CDC NCM subclass 3.3 |
321 | */ | 323 | */ |
322 | 324 | ||
323 | #define NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */ | 325 | #define USB_CDC_NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */ |
324 | #define NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */ | 326 | #define USB_CDC_NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */ |
325 | #define NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */ | 327 | #define USB_CDC_NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */ |
326 | #define NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */ | 328 | #define USB_CDC_NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */ |
329 | |||
330 | /* 16-bit NCM Datagram Pointer Entry */ | ||
331 | struct usb_cdc_ncm_dpe16 { | ||
332 | __le16 wDatagramIndex; | ||
333 | __le16 wDatagramLength; | ||
334 | } __attribute__((__packed__)); | ||
327 | 335 | ||
336 | /* 16-bit NCM Datagram Pointer Table */ | ||
328 | struct usb_cdc_ncm_ndp16 { | 337 | struct usb_cdc_ncm_ndp16 { |
329 | __le32 dwSignature; | 338 | __le32 dwSignature; |
330 | __le16 wLength; | 339 | __le16 wLength; |
331 | __le16 wNextFpIndex; | 340 | __le16 wNextFpIndex; |
332 | __u8 data[0]; | 341 | struct usb_cdc_ncm_dpe16 dpe16[0]; |
333 | } __attribute__ ((packed)); | 342 | } __attribute__ ((packed)); |
334 | 343 | ||
344 | /* 32-bit NCM Datagram Pointer Entry */ | ||
345 | struct usb_cdc_ncm_dpe32 { | ||
346 | __le32 dwDatagramIndex; | ||
347 | __le32 dwDatagramLength; | ||
348 | } __attribute__((__packed__)); | ||
349 | |||
350 | /* 32-bit NCM Datagram Pointer Table */ | ||
335 | struct usb_cdc_ncm_ndp32 { | 351 | struct usb_cdc_ncm_ndp32 { |
336 | __le32 dwSignature; | 352 | __le32 dwSignature; |
337 | __le16 wLength; | 353 | __le16 wLength; |
338 | __le16 wReserved6; | 354 | __le16 wReserved6; |
339 | __le32 dwNextFpIndex; | 355 | __le32 dwNextNdpIndex; |
340 | __le32 dwReserved12; | 356 | __le32 dwReserved12; |
341 | __u8 data[0]; | 357 | struct usb_cdc_ncm_dpe32 dpe32[0]; |
342 | } __attribute__ ((packed)); | 358 | } __attribute__ ((packed)); |
343 | 359 | ||
360 | /* CDC NCM subclass 3.2.1 and 3.2.2 */ | ||
361 | #define USB_CDC_NCM_NDP16_INDEX_MIN 0x000C | ||
362 | #define USB_CDC_NCM_NDP32_INDEX_MIN 0x0010 | ||
363 | |||
364 | /* CDC NCM subclass 3.3.3 Datagram Formatting */ | ||
365 | #define USB_CDC_NCM_DATAGRAM_FORMAT_CRC 0x30 | ||
366 | #define USB_CDC_NCM_DATAGRAM_FORMAT_NOCRC 0X31 | ||
367 | |||
368 | /* CDC NCM subclass 4.2 NCM Communications Interface Protocol Code */ | ||
369 | #define USB_CDC_NCM_PROTO_CODE_NO_ENCAP_COMMANDS 0x00 | ||
370 | #define USB_CDC_NCM_PROTO_CODE_EXTERN_PROTO 0xFE | ||
371 | |||
372 | /* CDC NCM subclass 5.2.1 NCM Functional Descriptor, bmNetworkCapabilities */ | ||
373 | #define USB_CDC_NCM_NCAP_ETH_FILTER (1 << 0) | ||
374 | #define USB_CDC_NCM_NCAP_NET_ADDRESS (1 << 1) | ||
375 | #define USB_CDC_NCM_NCAP_ENCAP_COMMAND (1 << 2) | ||
376 | #define USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE (1 << 3) | ||
377 | #define USB_CDC_NCM_NCAP_CRC_MODE (1 << 4) | ||
378 | |||
379 | /* CDC NCM subclass Table 6-3: NTB Parameter Structure */ | ||
380 | #define USB_CDC_NCM_NTB16_SUPPORTED (1 << 0) | ||
381 | #define USB_CDC_NCM_NTB32_SUPPORTED (1 << 1) | ||
382 | |||
383 | /* CDC NCM subclass Table 6-3: NTB Parameter Structure */ | ||
384 | #define USB_CDC_NCM_NDP_ALIGN_MIN_SIZE 0x04 | ||
385 | #define USB_CDC_NCM_NTB_MAX_LENGTH 0x1C | ||
386 | |||
387 | /* CDC NCM subclass 6.2.5 SetNtbFormat */ | ||
388 | #define USB_CDC_NCM_NTB16_FORMAT 0x00 | ||
389 | #define USB_CDC_NCM_NTB32_FORMAT 0x01 | ||
390 | |||
391 | /* CDC NCM subclass 6.2.7 SetNtbInputSize */ | ||
392 | #define USB_CDC_NCM_NTB_MIN_IN_SIZE 2048 | ||
393 | #define USB_CDC_NCM_NTB_MIN_OUT_SIZE 2048 | ||
394 | |||
395 | /* CDC NCM subclass 6.2.11 SetCrcMode */ | ||
396 | #define USB_CDC_NCM_CRC_NOT_APPENDED 0x00 | ||
397 | #define USB_CDC_NCM_CRC_APPENDED 0x01 | ||
398 | |||
344 | #endif /* __LINUX_USB_CDC_H */ | 399 | #endif /* __LINUX_USB_CDC_H */ |