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