wusb-wa.h 7.0 KB

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