wusb-wa.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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. WUSB_REQ_CHAN_STOP = 28,
  53. };
  54. /* Wireless Adapter WUSB Channel Time types ([WUSB] table 8-52) */
  55. enum {
  56. WUSB_TIME_ADJ = 0,
  57. WUSB_TIME_BPST = 1,
  58. WUSB_TIME_WUSB = 2,
  59. };
  60. enum {
  61. WA_ENABLE = 0x01,
  62. WA_RESET = 0x02,
  63. RPIPE_PAUSE = 0x1,
  64. RPIPE_STALL = 0x2,
  65. };
  66. /* Responses from Get Status request ([WUSB] section 8.3.1.6) */
  67. enum {
  68. WA_STATUS_ENABLED = 0x01,
  69. WA_STATUS_RESETTING = 0x02
  70. };
  71. enum rpipe_crs {
  72. RPIPE_CRS_CTL = 0x01,
  73. RPIPE_CRS_ISO = 0x02,
  74. RPIPE_CRS_BULK = 0x04,
  75. RPIPE_CRS_INTR = 0x08
  76. };
  77. /**
  78. * RPipe descriptor ([WUSB] section 8.5.2.11)
  79. *
  80. * FIXME: explain rpipes
  81. */
  82. struct usb_rpipe_descriptor {
  83. u8 bLength;
  84. u8 bDescriptorType;
  85. __le16 wRPipeIndex;
  86. __le16 wRequests;
  87. __le16 wBlocks; /* rw if 0 */
  88. __le16 wMaxPacketSize; /* rw */
  89. union {
  90. u8 dwa_bHSHubAddress; /* rw: DWA. */
  91. u8 hwa_bMaxBurst; /* rw: HWA. */
  92. };
  93. union {
  94. u8 dwa_bHSHubPort; /* rw: DWA. */
  95. u8 hwa_bDeviceInfoIndex; /* rw: HWA. */
  96. };
  97. u8 bSpeed; /* rw: xfer rate 'enum uwb_phy_rate' */
  98. union {
  99. u8 dwa_bDeviceAddress; /* rw: DWA Target device address. */
  100. u8 hwa_reserved; /* rw: HWA. */
  101. };
  102. u8 bEndpointAddress; /* rw: Target EP address */
  103. u8 bDataSequence; /* ro: Current Data sequence */
  104. __le32 dwCurrentWindow; /* ro */
  105. u8 bMaxDataSequence; /* ro?: max supported seq */
  106. u8 bInterval; /* rw: */
  107. u8 bOverTheAirInterval; /* rw: */
  108. u8 bmAttribute; /* ro? */
  109. u8 bmCharacteristics; /* ro? enum rpipe_attr, supported xsactions */
  110. u8 bmRetryOptions; /* rw? */
  111. __le16 wNumTransactionErrors; /* rw */
  112. } __attribute__ ((packed));
  113. /**
  114. * Wire Adapter Notification types ([WUSB] sections 8.4.5 & 8.5.4)
  115. *
  116. * These are the notifications coming on the notification endpoint of
  117. * an HWA and a DWA.
  118. */
  119. enum wa_notif_type {
  120. DWA_NOTIF_RWAKE = 0x91,
  121. DWA_NOTIF_PORTSTATUS = 0x92,
  122. WA_NOTIF_TRANSFER = 0x93,
  123. HWA_NOTIF_BPST_ADJ = 0x94,
  124. HWA_NOTIF_DN = 0x95,
  125. };
  126. /**
  127. * Wire Adapter notification header
  128. *
  129. * Notifications coming from a wire adapter use a common header
  130. * defined in [WUSB] sections 8.4.5 & 8.5.4.
  131. */
  132. struct wa_notif_hdr {
  133. u8 bLength;
  134. u8 bNotifyType; /* enum wa_notif_type */
  135. } __packed;
  136. /**
  137. * HWA DN Received notification [(WUSB] section 8.5.4.2)
  138. *
  139. * The DNData is specified in WUSB1.0[7.6]. For each device
  140. * notification we received, we just need to dispatch it.
  141. *
  142. * @dndata: this is really an array of notifications, but all start
  143. * with the same header.
  144. */
  145. struct hwa_notif_dn {
  146. struct wa_notif_hdr hdr;
  147. u8 bSourceDeviceAddr; /* from errata 2005/07 */
  148. u8 bmAttributes;
  149. struct wusb_dn_hdr dndata[];
  150. } __packed;
  151. /* [WUSB] section 8.3.3 */
  152. enum wa_xfer_type {
  153. WA_XFER_TYPE_CTL = 0x80,
  154. WA_XFER_TYPE_BI = 0x81, /* bulk/interrupt */
  155. WA_XFER_TYPE_ISO = 0x82,
  156. WA_XFER_RESULT = 0x83,
  157. WA_XFER_ABORT = 0x84,
  158. WA_XFER_ISO_PACKET_INFO = 0xA0,
  159. WA_XFER_ISO_PACKET_STATUS = 0xA1,
  160. };
  161. /* [WUSB] section 8.3.3 */
  162. struct wa_xfer_hdr {
  163. u8 bLength; /* 0x18 */
  164. u8 bRequestType; /* 0x80 WA_REQUEST_TYPE_CTL */
  165. __le16 wRPipe; /* RPipe index */
  166. __le32 dwTransferID; /* Host-assigned ID */
  167. __le32 dwTransferLength; /* Length of data to xfer */
  168. u8 bTransferSegment;
  169. } __packed;
  170. struct wa_xfer_ctl {
  171. struct wa_xfer_hdr hdr;
  172. u8 bmAttribute;
  173. __le16 wReserved;
  174. struct usb_ctrlrequest baSetupData;
  175. } __packed;
  176. struct wa_xfer_bi {
  177. struct wa_xfer_hdr hdr;
  178. u8 bReserved;
  179. __le16 wReserved;
  180. } __packed;
  181. /* [WUSB] section 8.5.5 */
  182. struct wa_xfer_hwaiso {
  183. struct wa_xfer_hdr hdr;
  184. u8 bReserved;
  185. __le16 wPresentationTime;
  186. __le32 dwNumOfPackets;
  187. } __packed;
  188. struct wa_xfer_packet_info_hwaiso {
  189. __le16 wLength;
  190. u8 bPacketType;
  191. u8 bReserved;
  192. __le16 PacketLength[0];
  193. } __packed;
  194. struct wa_xfer_packet_status_len_hwaiso {
  195. __le16 PacketLength;
  196. __le16 PacketStatus;
  197. } __packed;
  198. struct wa_xfer_packet_status_hwaiso {
  199. __le16 wLength;
  200. u8 bPacketType;
  201. u8 bReserved;
  202. struct wa_xfer_packet_status_len_hwaiso PacketStatus[0];
  203. } __packed;
  204. /* [WUSB] section 8.3.3.5 */
  205. struct wa_xfer_abort {
  206. u8 bLength;
  207. u8 bRequestType;
  208. __le16 wRPipe; /* RPipe index */
  209. __le32 dwTransferID; /* Host-assigned ID */
  210. } __packed;
  211. /**
  212. * WA Transfer Complete notification ([WUSB] section 8.3.3.3)
  213. *
  214. */
  215. struct wa_notif_xfer {
  216. struct wa_notif_hdr hdr;
  217. u8 bEndpoint;
  218. u8 Reserved;
  219. } __packed;
  220. /** Transfer result basic codes [WUSB] table 8-15 */
  221. enum {
  222. WA_XFER_STATUS_SUCCESS,
  223. WA_XFER_STATUS_HALTED,
  224. WA_XFER_STATUS_DATA_BUFFER_ERROR,
  225. WA_XFER_STATUS_BABBLE,
  226. WA_XFER_RESERVED,
  227. WA_XFER_STATUS_NOT_FOUND,
  228. WA_XFER_STATUS_INSUFFICIENT_RESOURCE,
  229. WA_XFER_STATUS_TRANSACTION_ERROR,
  230. WA_XFER_STATUS_ABORTED,
  231. WA_XFER_STATUS_RPIPE_NOT_READY,
  232. WA_XFER_INVALID_FORMAT,
  233. WA_XFER_UNEXPECTED_SEGMENT_NUMBER,
  234. WA_XFER_STATUS_RPIPE_TYPE_MISMATCH,
  235. };
  236. /** [WUSB] section 8.3.3.4 */
  237. struct wa_xfer_result {
  238. struct wa_notif_hdr hdr;
  239. __le32 dwTransferID;
  240. __le32 dwTransferLength;
  241. u8 bTransferSegment;
  242. u8 bTransferStatus;
  243. __le32 dwNumOfPackets;
  244. } __packed;
  245. /**
  246. * Wire Adapter Class Descriptor ([WUSB] section 8.5.2.7).
  247. *
  248. * NOTE: u16 fields are read Little Endian from the hardware.
  249. *
  250. * @bNumPorts is the original max number of devices that the host can
  251. * connect; we might chop this so the stack can handle
  252. * it. In case you need to access it, use wusbhc->ports_max
  253. * if it is a Wireless USB WA.
  254. */
  255. struct usb_wa_descriptor {
  256. u8 bLength;
  257. u8 bDescriptorType;
  258. __le16 bcdWAVersion;
  259. u8 bNumPorts; /* don't use!! */
  260. u8 bmAttributes; /* Reserved == 0 */
  261. __le16 wNumRPipes;
  262. __le16 wRPipeMaxBlock;
  263. u8 bRPipeBlockSize;
  264. u8 bPwrOn2PwrGood;
  265. u8 bNumMMCIEs;
  266. u8 DeviceRemovable; /* FIXME: in DWA this is up to 16 bytes */
  267. } __packed;
  268. /**
  269. * HWA Device Information Buffer (WUSB1.0[T8.54])
  270. */
  271. struct hwa_dev_info {
  272. u8 bmDeviceAvailability[32]; /* FIXME: ignored for now */
  273. u8 bDeviceAddress;
  274. __le16 wPHYRates;
  275. u8 bmDeviceAttribute;
  276. } __packed;
  277. #endif /* #ifndef __LINUX_USB_WUSB_WA_H */