aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYauheni Kaliuta <yauheni.kaliuta@nokia.com>2010-09-20 08:40:28 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 13:21:47 -0400
commite5dcd531ac7a040f1b4d35f58914a36ad6174e84 (patch)
tree774cc8d6370e83190d0f7d1a8d46a78303e10ec0 /include
parent7fc09170cedc329ad274433b4f1a653e603600b5 (diff)
USB: cdc.h: ncm: add missed constants and structures
Make a dedicated structure for datagram pointer entry. There is no explicit declaration in the spec, but it's used by the host implementation and makes the structure more clear. Add some missed constants from the spec Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/usb/cdc.h57
1 files changed, 55 insertions, 2 deletions
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 583264abca0c..2d5b6f296aa3 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/*
@@ -325,14 +327,26 @@ struct usb_cdc_ncm_nth32 {
325#define USB_CDC_NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */ 327#define USB_CDC_NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */
326#define USB_CDC_NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */ 328#define USB_CDC_NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */
327 329
330/* 16-bit NCM Datagram Pointer Entry */
331struct usb_cdc_ncm_dpe16 {
332 __le16 wDatagramIndex;
333 __le16 wDatagramLength;
334} __attribute__((__packed__));
335
328/* 16-bit NCM Datagram Pointer Table */ 336/* 16-bit NCM Datagram Pointer Table */
329struct usb_cdc_ncm_ndp16 { 337struct usb_cdc_ncm_ndp16 {
330 __le32 dwSignature; 338 __le32 dwSignature;
331 __le16 wLength; 339 __le16 wLength;
332 __le16 wNextFpIndex; 340 __le16 wNextFpIndex;
333 __u8 data[0]; 341 struct usb_cdc_ncm_dpe16 dpe16[0];
334} __attribute__ ((packed)); 342} __attribute__ ((packed));
335 343
344/* 32-bit NCM Datagram Pointer Entry */
345struct usb_cdc_ncm_dpe32 {
346 __le32 wDatagramIndex;
347 __le32 wDatagramLength;
348} __attribute__((__packed__));
349
336/* 32-bit NCM Datagram Pointer Table */ 350/* 32-bit NCM Datagram Pointer Table */
337struct usb_cdc_ncm_ndp32 { 351struct usb_cdc_ncm_ndp32 {
338 __le32 dwSignature; 352 __le32 dwSignature;
@@ -340,7 +354,46 @@ struct usb_cdc_ncm_ndp32 {
340 __le16 wReserved6; 354 __le16 wReserved6;
341 __le32 dwNextNdpIndex; 355 __le32 dwNextNdpIndex;
342 __le32 dwReserved12; 356 __le32 dwReserved12;
343 __u8 data[0]; 357 struct usb_cdc_ncm_dpe32 dpe32[0];
344} __attribute__ ((packed)); 358} __attribute__ ((packed));
345 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
346#endif /* __LINUX_USB_CDC_H */ 399#endif /* __LINUX_USB_CDC_H */