wusb-wa.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. /*
  2. * Wireless USB Wire Adapter constants and structures.
  3. *
  4. * Copyright (C) 2005-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. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19. * 02110-1301, USA.
  20. *
  21. *
  22. * FIXME: docs
  23. * FIXME: organize properly, group logically
  24. *
  25. * All the event structures are defined in uwb/spec.h, as they are
  26. * common to the WHCI and WUSB radio control interfaces.
  27. *
  28. * References:
  29. * [WUSB] Wireless Universal Serial Bus Specification, revision 1.0, ch8
  30. */
  31. #ifndef __LINUX_USB_WUSB_WA_H
  32. #define __LINUX_USB_WUSB_WA_H
  33. /**
  34. * Radio Command Request for the Radio Control Interface
  35. *
  36. * Radio Control Interface command and event codes are the same as
  37. * WHCI, and listed in include/linux/uwb.h:UWB_RC_{CMD,EVT}_*
  38. */
  39. enum {
  40. WA_EXEC_RC_CMD = 40, /* Radio Control command Request */
  41. };
  42. /* Wireless Adapter Requests ([WUSB] table 8-51) */
  43. enum {
  44. WUSB_REQ_ADD_MMC_IE = 20,
  45. WUSB_REQ_REMOVE_MMC_IE = 21,
  46. WUSB_REQ_SET_NUM_DNTS = 22,
  47. WUSB_REQ_SET_CLUSTER_ID = 23,
  48. WUSB_REQ_SET_DEV_INFO = 24,
  49. WUSB_REQ_GET_TIME = 25,
  50. WUSB_REQ_SET_STREAM_IDX = 26,
  51. WUSB_REQ_SET_WUSB_MAS = 27,
  52. };
  53. /* Wireless Adapter WUSB Channel Time types ([WUSB] table 8-52) */
  54. enum {
  55. WUSB_TIME_ADJ = 0,
  56. WUSB_TIME_BPST = 1,
  57. WUSB_TIME_WUSB = 2,
  58. };
  59. enum {
  60. WA_ENABLE = 0x01,
  61. WA_RESET = 0x02,
  62. RPIPE_PAUSE = 0x1,
  63. };
  64. /* Responses from Get Status request ([WUSB] section 8.3.1.6) */
  65. enum {
  66. WA_STATUS_ENABLED = 0x01,
  67. WA_STATUS_RESETTING = 0x02
  68. };
  69. enum rpipe_crs {
  70. RPIPE_CRS_CTL = 0x01,
  71. RPIPE_CRS_ISO = 0x02,
  72. RPIPE_CRS_BULK = 0x04,
  73. RPIPE_CRS_INTR = 0x08
  74. };
  75. /**
  76. * RPipe descriptor ([WUSB] section 8.5.2.11)
  77. *
  78. * FIXME: explain rpipes
  79. */
  80. struct usb_rpipe_descriptor {
  81. u8 bLength;
  82. u8 bDescriptorType;
  83. __le16 wRPipeIndex;
  84. __le16 wRequests;
  85. __le16 wBlocks; /* rw if 0 */
  86. __le16 wMaxPacketSize; /* rw? */
  87. u8 bHSHubAddress; /* reserved: 0 */
  88. u8 bHSHubPort; /* ??? FIXME ??? */
  89. u8 bSpeed; /* rw: xfer rate 'enum uwb_phy_rate' */
  90. u8 bDeviceAddress; /* rw: Target device address */
  91. u8 bEndpointAddress; /* rw: Target EP address */
  92. u8 bDataSequence; /* ro: Current Data sequence */
  93. __le32 dwCurrentWindow; /* ro */
  94. u8 bMaxDataSequence; /* ro?: max supported seq */
  95. u8 bInterval; /* rw: */
  96. u8 bOverTheAirInterval; /* rw: */
  97. u8 bmAttribute; /* ro? */
  98. u8 bmCharacteristics; /* ro? enum rpipe_attr, supported xsactions */
  99. u8 bmRetryOptions; /* rw? */
  100. __le16 wNumTransactionErrors; /* rw */
  101. } __attribute__ ((packed));
  102. /**
  103. * Wire Adapter Notification types ([WUSB] sections 8.4.5 & 8.5.4)
  104. *
  105. * These are the notifications coming on the notification endpoint of
  106. * an HWA and a DWA.
  107. */
  108. enum wa_notif_type {
  109. DWA_NOTIF_RWAKE = 0x91,
  110. DWA_NOTIF_PORTSTATUS = 0x92,
  111. WA_NOTIF_TRANSFER = 0x93,
  112. HWA_NOTIF_BPST_ADJ = 0x94,
  113. HWA_NOTIF_DN = 0x95,
  114. };
  115. /**
  116. * Wire Adapter notification header
  117. *
  118. * Notifications coming from a wire adapter use a common header
  119. * defined in [WUSB] sections 8.4.5 & 8.5.4.
  120. */
  121. struct wa_notif_hdr {
  122. u8 bLength;
  123. u8 bNotifyType; /* enum wa_notif_type */
  124. } __attribute__((packed));
  125. /**
  126. * HWA DN Received notification [(WUSB] section 8.5.4.2)
  127. *
  128. * The DNData is specified in WUSB1.0[7.6]. For each device
  129. * notification we received, we just need to dispatch it.
  130. *
  131. * @dndata: this is really an array of notifications, but all start
  132. * with the same header.
  133. */
  134. struct hwa_notif_dn {
  135. struct wa_notif_hdr hdr;
  136. u8 bSourceDeviceAddr; /* from errata 2005/07 */
  137. u8 bmAttributes;
  138. struct wusb_dn_hdr dndata[];
  139. } __attribute__((packed));
  140. /* [WUSB] section 8.3.3 */
  141. enum wa_xfer_type {
  142. WA_XFER_TYPE_CTL = 0x80,
  143. WA_XFER_TYPE_BI = 0x81, /* bulk/interrupt */
  144. WA_XFER_TYPE_ISO = 0x82,
  145. WA_XFER_RESULT = 0x83,
  146. WA_XFER_ABORT = 0x84,
  147. };
  148. /* [WUSB] section 8.3.3 */
  149. struct wa_xfer_hdr {
  150. u8 bLength; /* 0x18 */
  151. u8 bRequestType; /* 0x80 WA_REQUEST_TYPE_CTL */
  152. __le16 wRPipe; /* RPipe index */
  153. __le32 dwTransferID; /* Host-assigned ID */
  154. __le32 dwTransferLength; /* Length of data to xfer */
  155. u8 bTransferSegment;
  156. } __attribute__((packed));
  157. struct wa_xfer_ctl {
  158. struct wa_xfer_hdr hdr;
  159. u8 bmAttribute;
  160. __le16 wReserved;
  161. struct usb_ctrlrequest baSetupData;
  162. } __attribute__((packed));
  163. struct wa_xfer_bi {
  164. struct wa_xfer_hdr hdr;
  165. u8 bReserved;
  166. __le16 wReserved;
  167. } __attribute__((packed));
  168. struct wa_xfer_hwaiso {
  169. struct wa_xfer_hdr hdr;
  170. u8 bReserved;
  171. __le16 wPresentationTime;
  172. __le32 dwNumOfPackets;
  173. /* FIXME: u8 pktdata[]? */
  174. } __attribute__((packed));
  175. /* [WUSB] section 8.3.3.5 */
  176. struct wa_xfer_abort {
  177. u8 bLength;
  178. u8 bRequestType;
  179. __le16 wRPipe; /* RPipe index */
  180. __le32 dwTransferID; /* Host-assigned ID */
  181. } __attribute__((packed));
  182. /**
  183. * WA Transfer Complete notification ([WUSB] section 8.3.3.3)
  184. *
  185. */
  186. struct wa_notif_xfer {
  187. struct wa_notif_hdr hdr;
  188. u8 bEndpoint;
  189. u8 Reserved;
  190. } __attribute__((packed));
  191. /** Transfer result basic codes [WUSB] table 8-15 */
  192. enum {
  193. WA_XFER_STATUS_SUCCESS,
  194. WA_XFER_STATUS_HALTED,
  195. WA_XFER_STATUS_DATA_BUFFER_ERROR,
  196. WA_XFER_STATUS_BABBLE,
  197. WA_XFER_RESERVED,
  198. WA_XFER_STATUS_NOT_FOUND,
  199. WA_XFER_STATUS_INSUFFICIENT_RESOURCE,
  200. WA_XFER_STATUS_TRANSACTION_ERROR,
  201. WA_XFER_STATUS_ABORTED,
  202. WA_XFER_STATUS_RPIPE_NOT_READY,
  203. WA_XFER_INVALID_FORMAT,
  204. WA_XFER_UNEXPECTED_SEGMENT_NUMBER,
  205. WA_XFER_STATUS_RPIPE_TYPE_MISMATCH,
  206. };
  207. /** [WUSB] section 8.3.3.4 */
  208. struct wa_xfer_result {
  209. struct wa_notif_hdr hdr;
  210. __le32 dwTransferID;
  211. __le32 dwTransferLength;
  212. u8 bTransferSegment;
  213. u8 bTransferStatus;
  214. __le32 dwNumOfPackets;
  215. } __attribute__((packed));
  216. /**
  217. * Wire Adapter Class Descriptor ([WUSB] section 8.5.2.7).
  218. *
  219. * NOTE: u16 fields are read Little Endian from the hardware.
  220. *
  221. * @bNumPorts is the original max number of devices that the host can
  222. * connect; we might chop this so the stack can handle
  223. * it. In case you need to access it, use wusbhc->ports_max
  224. * if it is a Wireless USB WA.
  225. */
  226. struct usb_wa_descriptor {
  227. u8 bLength;
  228. u8 bDescriptorType;
  229. u16 bcdWAVersion;
  230. u8 bNumPorts; /* don't use!! */
  231. u8 bmAttributes; /* Reserved == 0 */
  232. u16 wNumRPipes;
  233. u16 wRPipeMaxBlock;
  234. u8 bRPipeBlockSize;
  235. u8 bPwrOn2PwrGood;
  236. u8 bNumMMCIEs;
  237. u8 DeviceRemovable; /* FIXME: in DWA this is up to 16 bytes */
  238. } __attribute__((packed));
  239. /**
  240. * HWA Device Information Buffer (WUSB1.0[T8.54])
  241. */
  242. struct hwa_dev_info {
  243. u8 bmDeviceAvailability[32]; /* FIXME: ignored for now */
  244. u8 bDeviceAddress;
  245. __le16 wPHYRates;
  246. u8 bmDeviceAttribute;
  247. } __attribute__((packed));
  248. #endif /* #ifndef __LINUX_USB_WUSB_WA_H */