association.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * Wireless USB - Cable Based Association
  3. *
  4. * Copyright (C) 2006 Intel Corporation
  5. * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License version
  9. * 2 as published by the Free Software Foundation.
  10. *
  11. */
  12. #ifndef __LINUX_USB_ASSOCIATION_H
  13. #define __LINUX_USB_ASSOCIATION_H
  14. /*
  15. * Association attributes
  16. *
  17. * Association Models Supplement to WUSB 1.0 T[3-1]
  18. *
  19. * Each field in the structures has it's ID, it's length and then the
  20. * value. This is the actual definition of the field's ID and its
  21. * length.
  22. */
  23. struct wusb_am_attr {
  24. __u8 id;
  25. __u8 len;
  26. };
  27. /* Different fields defined by the spec */
  28. #define WUSB_AR_AssociationTypeId { .id = cpu_to_le16(0x0000), .len = cpu_to_le16(2) }
  29. #define WUSB_AR_AssociationSubTypeId { .id = cpu_to_le16(0x0001), .len = cpu_to_le16(2) }
  30. #define WUSB_AR_Length { .id = cpu_to_le16(0x0002), .len = cpu_to_le16(4) }
  31. #define WUSB_AR_AssociationStatus { .id = cpu_to_le16(0x0004), .len = cpu_to_le16(4) }
  32. #define WUSB_AR_LangID { .id = cpu_to_le16(0x0008), .len = cpu_to_le16(2) }
  33. #define WUSB_AR_DeviceFriendlyName { .id = cpu_to_le16(0x000b), .len = cpu_to_le16(64) } /* max */
  34. #define WUSB_AR_HostFriendlyName { .id = cpu_to_le16(0x000c), .len = cpu_to_le16(64) } /* max */
  35. #define WUSB_AR_CHID { .id = cpu_to_le16(0x1000), .len = cpu_to_le16(16) }
  36. #define WUSB_AR_CDID { .id = cpu_to_le16(0x1001), .len = cpu_to_le16(16) }
  37. #define WUSB_AR_ConnectionContext { .id = cpu_to_le16(0x1002), .len = cpu_to_le16(48) }
  38. #define WUSB_AR_BandGroups { .id = cpu_to_le16(0x1004), .len = cpu_to_le16(2) }
  39. /* CBAF Control Requests (AMS1.0[T4-1] */
  40. enum {
  41. CBAF_REQ_GET_ASSOCIATION_INFORMATION = 0x01,
  42. CBAF_REQ_GET_ASSOCIATION_REQUEST,
  43. CBAF_REQ_SET_ASSOCIATION_RESPONSE
  44. };
  45. /*
  46. * CBAF USB-interface defitions
  47. *
  48. * No altsettings, one optional interrupt endpoint.
  49. */
  50. enum {
  51. CBAF_IFACECLASS = 0xef,
  52. CBAF_IFACESUBCLASS = 0x03,
  53. CBAF_IFACEPROTOCOL = 0x01,
  54. };
  55. /* Association Information (AMS1.0[T4-3]) */
  56. struct wusb_cbaf_assoc_info {
  57. __le16 Length;
  58. __u8 NumAssociationRequests;
  59. __le16 Flags;
  60. __u8 AssociationRequestsArray[];
  61. } __attribute__((packed));
  62. /* Association Request (AMS1.0[T4-4]) */
  63. struct wusb_cbaf_assoc_request {
  64. __u8 AssociationDataIndex;
  65. __u8 Reserved;
  66. __le16 AssociationTypeId;
  67. __le16 AssociationSubTypeId;
  68. __le32 AssociationTypeInfoSize;
  69. } __attribute__((packed));
  70. enum {
  71. AR_TYPE_WUSB = 0x0001,
  72. AR_TYPE_WUSB_RETRIEVE_HOST_INFO = 0x0000,
  73. AR_TYPE_WUSB_ASSOCIATE = 0x0001,
  74. };
  75. /* Association Attribute header (AMS1.0[3.8]) */
  76. struct wusb_cbaf_attr_hdr {
  77. __le16 id;
  78. __le16 len;
  79. } __attribute__((packed));
  80. /* Host Info (AMS1.0[T4-7]) (yeah, more headers and fields...) */
  81. struct wusb_cbaf_host_info {
  82. struct wusb_cbaf_attr_hdr AssociationTypeId_hdr;
  83. __le16 AssociationTypeId;
  84. struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr;
  85. __le16 AssociationSubTypeId;
  86. struct wusb_cbaf_attr_hdr CHID_hdr;
  87. struct wusb_ckhdid CHID;
  88. struct wusb_cbaf_attr_hdr LangID_hdr;
  89. __le16 LangID;
  90. struct wusb_cbaf_attr_hdr HostFriendlyName_hdr;
  91. __u8 HostFriendlyName[];
  92. } __attribute__((packed));
  93. /* Device Info (AMS1.0[T4-8])
  94. *
  95. * I still don't get this tag'n'header stuff for each goddamn
  96. * field...
  97. */
  98. struct wusb_cbaf_device_info {
  99. struct wusb_cbaf_attr_hdr Length_hdr;
  100. __le32 Length;
  101. struct wusb_cbaf_attr_hdr CDID_hdr;
  102. struct wusb_ckhdid CDID;
  103. struct wusb_cbaf_attr_hdr BandGroups_hdr;
  104. __le16 BandGroups;
  105. struct wusb_cbaf_attr_hdr LangID_hdr;
  106. __le16 LangID;
  107. struct wusb_cbaf_attr_hdr DeviceFriendlyName_hdr;
  108. __u8 DeviceFriendlyName[];
  109. } __attribute__((packed));
  110. /* Connection Context; CC_DATA - Success case (AMS1.0[T4-9]) */
  111. struct wusb_cbaf_cc_data {
  112. struct wusb_cbaf_attr_hdr AssociationTypeId_hdr;
  113. __le16 AssociationTypeId;
  114. struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr;
  115. __le16 AssociationSubTypeId;
  116. struct wusb_cbaf_attr_hdr Length_hdr;
  117. __le32 Length;
  118. struct wusb_cbaf_attr_hdr ConnectionContext_hdr;
  119. struct wusb_ckhdid CHID;
  120. struct wusb_ckhdid CDID;
  121. struct wusb_ckhdid CK;
  122. struct wusb_cbaf_attr_hdr BandGroups_hdr;
  123. __le16 BandGroups;
  124. } __attribute__((packed));
  125. /* CC_DATA - Failure case (AMS1.0[T4-10]) */
  126. struct wusb_cbaf_cc_data_fail {
  127. struct wusb_cbaf_attr_hdr AssociationTypeId_hdr;
  128. __le16 AssociationTypeId;
  129. struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr;
  130. __le16 AssociationSubTypeId;
  131. struct wusb_cbaf_attr_hdr Length_hdr;
  132. __le16 Length;
  133. struct wusb_cbaf_attr_hdr AssociationStatus_hdr;
  134. __u32 AssociationStatus;
  135. } __attribute__((packed));
  136. #endif /* __LINUX_USB_ASSOCIATION_H */