Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of wl1271 |
| 3 | * |
| 4 | * Copyright (C) 1998-2009 Texas Instruments. All rights reserved. |
| 5 | * Copyright (C) 2009 Nokia Corporation |
| 6 | * |
| 7 | * Contact: Luciano Coelho <luciano.coelho@nokia.com> |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License |
| 11 | * version 2 as published by the Free Software Foundation. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, but |
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 21 | * 02110-1301 USA |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #ifndef __WL1271_CMD_H__ |
| 26 | #define __WL1271_CMD_H__ |
| 27 | |
| 28 | #include "wl1271.h" |
| 29 | |
| 30 | struct acx_header; |
| 31 | |
Juuso Oikarinen | fa867e7 | 2009-11-02 20:22:13 +0200 | [diff] [blame] | 32 | int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len, |
| 33 | size_t res_len); |
Luciano Coelho | 98b5dd5 | 2009-11-23 23:22:17 +0200 | [diff] [blame] | 34 | int wl1271_cmd_general_parms(struct wl1271 *wl); |
| 35 | int wl1271_cmd_radio_parms(struct wl1271 *wl); |
Juuso Oikarinen | 1530549 | 2010-02-22 08:38:32 +0200 | [diff] [blame] | 36 | int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 37 | int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer); |
| 38 | int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len); |
| 39 | int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len); |
Luciano Coelho | 9421089 | 2009-12-11 15:40:55 +0200 | [diff] [blame] | 40 | int wl1271_cmd_data_path(struct wl1271 *wl, bool enable); |
Juuso Oikarinen | d8c42c0 | 2010-02-18 13:25:36 +0200 | [diff] [blame] | 41 | int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, bool send); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 42 | int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer, |
| 43 | size_t len); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 44 | int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id, |
Juuso Oikarinen | 606c148 | 2010-04-01 11:38:21 +0300 | [diff] [blame] | 45 | void *buf, size_t buf_len, int index, u32 rates); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 46 | int wl1271_cmd_build_null_data(struct wl1271 *wl); |
| 47 | int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid); |
Kalle Valo | 818e306 | 2010-03-18 12:26:35 +0200 | [diff] [blame] | 48 | int wl1271_cmd_build_probe_req(struct wl1271 *wl, |
| 49 | const u8 *ssid, size_t ssid_len, |
| 50 | const u8 *ie, size_t ie_len, u8 band); |
Kalle Valo | 023e082 | 2010-03-18 12:26:36 +0200 | [diff] [blame] | 51 | int wl1271_build_qos_null_data(struct wl1271 *wl); |
Juuso Oikarinen | bfb24c9 | 2010-03-26 12:53:31 +0200 | [diff] [blame] | 52 | int wl1271_cmd_build_klv_null_data(struct wl1271 *wl); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 53 | int wl1271_cmd_set_default_wep_key(struct wl1271 *wl, u8 id); |
| 54 | int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type, |
Juuso Oikarinen | ac4e4ce | 2009-10-08 21:56:19 +0300 | [diff] [blame] | 55 | u8 key_size, const u8 *key, const u8 *addr, |
| 56 | u32 tx_seq_32, u16 tx_seq_16); |
Luciano Coelho | 25a7dc6 | 2009-10-12 15:08:42 +0300 | [diff] [blame] | 57 | int wl1271_cmd_disconnect(struct wl1271 *wl); |
Juuso Oikarinen | be86cbe | 2010-05-27 12:53:01 +0300 | [diff] [blame^] | 58 | int wl1271_cmd_set_sta_state(struct wl1271 *wl); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 59 | |
| 60 | enum wl1271_commands { |
| 61 | CMD_INTERROGATE = 1, /*use this to read information elements*/ |
| 62 | CMD_CONFIGURE = 2, /*use this to write information elements*/ |
| 63 | CMD_ENABLE_RX = 3, |
| 64 | CMD_ENABLE_TX = 4, |
| 65 | CMD_DISABLE_RX = 5, |
| 66 | CMD_DISABLE_TX = 6, |
| 67 | CMD_SCAN = 8, |
| 68 | CMD_STOP_SCAN = 9, |
| 69 | CMD_START_JOIN = 11, |
| 70 | CMD_SET_KEYS = 12, |
| 71 | CMD_READ_MEMORY = 13, |
| 72 | CMD_WRITE_MEMORY = 14, |
| 73 | CMD_SET_TEMPLATE = 19, |
| 74 | CMD_TEST = 23, |
| 75 | CMD_NOISE_HIST = 28, |
| 76 | CMD_LNA_CONTROL = 32, |
| 77 | CMD_SET_BCN_MODE = 33, |
| 78 | CMD_MEASUREMENT = 34, |
| 79 | CMD_STOP_MEASUREMENT = 35, |
| 80 | CMD_DISCONNECT = 36, |
| 81 | CMD_SET_PS_MODE = 37, |
| 82 | CMD_CHANNEL_SWITCH = 38, |
| 83 | CMD_STOP_CHANNEL_SWICTH = 39, |
| 84 | CMD_AP_DISCOVERY = 40, |
| 85 | CMD_STOP_AP_DISCOVERY = 41, |
| 86 | CMD_SPS_SCAN = 42, |
| 87 | CMD_STOP_SPS_SCAN = 43, |
| 88 | CMD_HEALTH_CHECK = 45, |
| 89 | CMD_DEBUG = 46, |
| 90 | CMD_TRIGGER_SCAN_TO = 47, |
| 91 | CMD_CONNECTION_SCAN_CFG = 48, |
| 92 | CMD_CONNECTION_SCAN_SSID_CFG = 49, |
| 93 | CMD_START_PERIODIC_SCAN = 50, |
| 94 | CMD_STOP_PERIODIC_SCAN = 51, |
| 95 | CMD_SET_STA_STATE = 52, |
| 96 | |
| 97 | NUM_COMMANDS, |
| 98 | MAX_COMMAND_ID = 0xFFFF, |
| 99 | }; |
| 100 | |
| 101 | #define MAX_CMD_PARAMS 572 |
| 102 | |
Juuso Oikarinen | bfb24c9 | 2010-03-26 12:53:31 +0200 | [diff] [blame] | 103 | enum { |
| 104 | CMD_TEMPL_KLV_IDX_NULL_DATA = 0, |
| 105 | CMD_TEMPL_KLV_IDX_MAX = 4 |
| 106 | }; |
| 107 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 108 | enum cmd_templ { |
| 109 | CMD_TEMPL_NULL_DATA = 0, |
| 110 | CMD_TEMPL_BEACON, |
| 111 | CMD_TEMPL_CFG_PROBE_REQ_2_4, |
| 112 | CMD_TEMPL_CFG_PROBE_REQ_5, |
| 113 | CMD_TEMPL_PROBE_RESPONSE, |
| 114 | CMD_TEMPL_QOS_NULL_DATA, |
| 115 | CMD_TEMPL_PS_POLL, |
| 116 | CMD_TEMPL_KLV, |
| 117 | CMD_TEMPL_DISCONNECT, |
| 118 | CMD_TEMPL_PROBE_REQ_2_4, /* for firmware internal use only */ |
| 119 | CMD_TEMPL_PROBE_REQ_5, /* for firmware internal use only */ |
| 120 | CMD_TEMPL_BAR, /* for firmware internal use only */ |
| 121 | CMD_TEMPL_CTS, /* |
| 122 | * For CTS-to-self (FastCTS) mechanism |
| 123 | * for BT/WLAN coexistence (SoftGemini). */ |
| 124 | CMD_TEMPL_MAX = 0xff |
| 125 | }; |
| 126 | |
| 127 | /* unit ms */ |
| 128 | #define WL1271_COMMAND_TIMEOUT 2000 |
| 129 | #define WL1271_CMD_TEMPL_MAX_SIZE 252 |
Teemu Paasikivi | 0cbb103 | 2010-05-07 11:39:01 +0300 | [diff] [blame] | 130 | #define WL1271_EVENT_TIMEOUT 750 |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 131 | |
| 132 | struct wl1271_cmd_header { |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 133 | __le16 id; |
| 134 | __le16 status; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 135 | /* payload */ |
| 136 | u8 data[0]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 137 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 138 | |
| 139 | #define WL1271_CMD_MAX_PARAMS 572 |
| 140 | |
| 141 | struct wl1271_command { |
| 142 | struct wl1271_cmd_header header; |
| 143 | u8 parameters[WL1271_CMD_MAX_PARAMS]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 144 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 145 | |
| 146 | enum { |
| 147 | CMD_MAILBOX_IDLE = 0, |
| 148 | CMD_STATUS_SUCCESS = 1, |
| 149 | CMD_STATUS_UNKNOWN_CMD = 2, |
| 150 | CMD_STATUS_UNKNOWN_IE = 3, |
| 151 | CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11, |
| 152 | CMD_STATUS_RX_BUSY = 13, |
| 153 | CMD_STATUS_INVALID_PARAM = 14, |
| 154 | CMD_STATUS_TEMPLATE_TOO_LARGE = 15, |
| 155 | CMD_STATUS_OUT_OF_MEMORY = 16, |
| 156 | CMD_STATUS_STA_TABLE_FULL = 17, |
| 157 | CMD_STATUS_RADIO_ERROR = 18, |
| 158 | CMD_STATUS_WRONG_NESTING = 19, |
| 159 | CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/ |
| 160 | CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/ |
| 161 | MAX_COMMAND_STATUS = 0xff |
| 162 | }; |
| 163 | |
| 164 | |
| 165 | /* |
| 166 | * CMD_READ_MEMORY |
| 167 | * |
| 168 | * The host issues this command to read the WiLink device memory/registers. |
| 169 | * |
| 170 | * Note: The Base Band address has special handling (16 bits registers and |
| 171 | * addresses). For more information, see the hardware specification. |
| 172 | */ |
| 173 | /* |
| 174 | * CMD_WRITE_MEMORY |
| 175 | * |
| 176 | * The host issues this command to write the WiLink device memory/registers. |
| 177 | * |
| 178 | * The Base Band address has special handling (16 bits registers and |
| 179 | * addresses). For more information, see the hardware specification. |
| 180 | */ |
| 181 | #define MAX_READ_SIZE 256 |
| 182 | |
| 183 | struct cmd_read_write_memory { |
| 184 | struct wl1271_cmd_header header; |
| 185 | |
| 186 | /* The address of the memory to read from or write to.*/ |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 187 | __le32 addr; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 188 | |
| 189 | /* The amount of data in bytes to read from or write to the WiLink |
| 190 | * device.*/ |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 191 | __le32 size; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 192 | |
| 193 | /* The actual value read from or written to the Wilink. The source |
| 194 | of this field is the Host in WRITE command or the Wilink in READ |
| 195 | command. */ |
| 196 | u8 value[MAX_READ_SIZE]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 197 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 198 | |
| 199 | #define CMDMBOX_HEADER_LEN 4 |
| 200 | #define CMDMBOX_INFO_ELEM_HEADER_LEN 4 |
| 201 | |
| 202 | enum { |
| 203 | BSS_TYPE_IBSS = 0, |
| 204 | BSS_TYPE_STA_BSS = 2, |
| 205 | BSS_TYPE_AP_BSS = 3, |
| 206 | MAX_BSS_TYPE = 0xFF |
| 207 | }; |
| 208 | |
| 209 | #define WL1271_JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */ |
| 210 | #define WL1271_JOIN_CMD_TX_SESSION_OFFSET 1 |
Teemu Paasikivi | a410264 | 2009-10-13 12:47:51 +0300 | [diff] [blame] | 211 | #define WL1271_JOIN_CMD_BSS_TYPE_5GHZ 0x10 |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 212 | |
| 213 | struct wl1271_cmd_join { |
| 214 | struct wl1271_cmd_header header; |
| 215 | |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 216 | __le32 bssid_lsb; |
| 217 | __le16 bssid_msb; |
| 218 | __le16 beacon_interval; /* in TBTTs */ |
| 219 | __le32 rx_config_options; |
| 220 | __le32 rx_filter_options; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 221 | |
| 222 | /* |
| 223 | * The target uses this field to determine the rate at |
| 224 | * which to transmit control frame responses (such as |
| 225 | * ACK or CTS frames). |
| 226 | */ |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 227 | __le32 basic_rate_set; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 228 | u8 dtim_interval; |
| 229 | /* |
| 230 | * bits 0-2: This bitwise field specifies the type |
| 231 | * of BSS to start or join (BSS_TYPE_*). |
| 232 | * bit 4: Band - The radio band in which to join |
| 233 | * or start. |
| 234 | * 0 - 2.4GHz band |
| 235 | * 1 - 5GHz band |
| 236 | * bits 3, 5-7: Reserved |
| 237 | */ |
| 238 | u8 bss_type; |
| 239 | u8 channel; |
| 240 | u8 ssid_len; |
| 241 | u8 ssid[IW_ESSID_MAX_SIZE]; |
| 242 | u8 ctrl; /* JOIN_CMD_CTRL_* */ |
| 243 | u8 reserved[3]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 244 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 245 | |
| 246 | struct cmd_enabledisable_path { |
| 247 | struct wl1271_cmd_header header; |
| 248 | |
| 249 | u8 channel; |
| 250 | u8 padding[3]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 251 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 252 | |
Juuso Oikarinen | 606c148 | 2010-04-01 11:38:21 +0300 | [diff] [blame] | 253 | #define WL1271_RATE_AUTOMATIC 0 |
| 254 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 255 | struct wl1271_cmd_template_set { |
| 256 | struct wl1271_cmd_header header; |
| 257 | |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 258 | __le16 len; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 259 | u8 template_type; |
| 260 | u8 index; /* relevant only for KLV_TEMPLATE type */ |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 261 | __le32 enabled_rates; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 262 | u8 short_retry_limit; |
| 263 | u8 long_retry_limit; |
| 264 | u8 aflags; |
| 265 | u8 reserved; |
| 266 | u8 template_data[WL1271_CMD_TEMPL_MAX_SIZE]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 267 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 268 | |
| 269 | #define TIM_ELE_ID 5 |
| 270 | #define PARTIAL_VBM_MAX 251 |
| 271 | |
| 272 | struct wl1271_tim { |
| 273 | u8 identity; |
| 274 | u8 length; |
| 275 | u8 dtim_count; |
| 276 | u8 dtim_period; |
| 277 | u8 bitmap_ctrl; |
| 278 | u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */ |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 279 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 280 | |
| 281 | enum wl1271_cmd_ps_mode { |
| 282 | STATION_ACTIVE_MODE, |
| 283 | STATION_POWER_SAVE_MODE |
| 284 | }; |
| 285 | |
| 286 | struct wl1271_cmd_ps_params { |
| 287 | struct wl1271_cmd_header header; |
| 288 | |
| 289 | u8 ps_mode; /* STATION_* */ |
| 290 | u8 send_null_data; /* Do we have to send NULL data packet ? */ |
| 291 | u8 retries; /* Number of retires for the initial NULL data packet */ |
| 292 | |
| 293 | /* |
| 294 | * TUs during which the target stays awake after switching |
| 295 | * to power save mode. |
| 296 | */ |
| 297 | u8 hang_over_period; |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 298 | __le32 null_data_rate; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 299 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 300 | |
| 301 | /* HW encryption keys */ |
| 302 | #define NUM_ACCESS_CATEGORIES_COPY 4 |
| 303 | #define MAX_KEY_SIZE 32 |
| 304 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 305 | enum wl1271_cmd_key_action { |
| 306 | KEY_ADD_OR_REPLACE = 1, |
| 307 | KEY_REMOVE = 2, |
| 308 | KEY_SET_ID = 3, |
| 309 | MAX_KEY_ACTION = 0xffff, |
| 310 | }; |
| 311 | |
| 312 | enum wl1271_cmd_key_type { |
| 313 | KEY_NONE = 0, |
| 314 | KEY_WEP = 1, |
| 315 | KEY_TKIP = 2, |
| 316 | KEY_AES = 3, |
| 317 | KEY_GEM = 4 |
| 318 | }; |
| 319 | |
| 320 | /* FIXME: Add description for key-types */ |
| 321 | |
| 322 | struct wl1271_cmd_set_keys { |
| 323 | struct wl1271_cmd_header header; |
| 324 | |
| 325 | /* Ignored for default WEP key */ |
| 326 | u8 addr[ETH_ALEN]; |
| 327 | |
| 328 | /* key_action_e */ |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 329 | __le16 key_action; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 330 | |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 331 | __le16 reserved_1; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 332 | |
| 333 | /* key size in bytes */ |
| 334 | u8 key_size; |
| 335 | |
| 336 | /* key_type_e */ |
| 337 | u8 key_type; |
| 338 | u8 ssid_profile; |
| 339 | |
| 340 | /* |
| 341 | * TKIP, AES: frame's key id field. |
| 342 | * For WEP default key: key id; |
| 343 | */ |
| 344 | u8 id; |
| 345 | u8 reserved_2[6]; |
| 346 | u8 key[MAX_KEY_SIZE]; |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 347 | __le16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY]; |
| 348 | __le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 349 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 350 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 351 | struct wl1271_cmd_test_header { |
| 352 | u8 id; |
| 353 | u8 padding[3]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 354 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 355 | |
| 356 | enum wl1271_channel_tune_bands { |
| 357 | WL1271_CHANNEL_TUNE_BAND_2_4, |
| 358 | WL1271_CHANNEL_TUNE_BAND_5, |
| 359 | WL1271_CHANNEL_TUNE_BAND_4_9 |
| 360 | }; |
| 361 | |
| 362 | #define WL1271_PD_REFERENCE_POINT_BAND_B_G 0 |
| 363 | |
| 364 | #define TEST_CMD_P2G_CAL 0x02 |
| 365 | #define TEST_CMD_CHANNEL_TUNE 0x0d |
| 366 | #define TEST_CMD_UPDATE_PD_REFERENCE_POINT 0x1d |
Luciano Coelho | 98b5dd5 | 2009-11-23 23:22:17 +0200 | [diff] [blame] | 367 | #define TEST_CMD_INI_FILE_RADIO_PARAM 0x19 |
| 368 | #define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E |
| 369 | |
| 370 | struct wl1271_general_parms_cmd { |
| 371 | struct wl1271_cmd_header header; |
| 372 | |
| 373 | struct wl1271_cmd_test_header test; |
| 374 | |
Juuso Oikarinen | eb70eb7 | 2010-05-14 10:46:22 +0300 | [diff] [blame] | 375 | struct wl1271_ini_general_params general_params; |
Luciano Coelho | 98b5dd5 | 2009-11-23 23:22:17 +0200 | [diff] [blame] | 376 | |
Juuso Oikarinen | eb70eb7 | 2010-05-14 10:46:22 +0300 | [diff] [blame] | 377 | u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM]; |
| 378 | u8 sr_sen_n_p; |
| 379 | u8 sr_sen_n_p_gain; |
| 380 | u8 sr_sen_nrn; |
| 381 | u8 sr_sen_prn; |
| 382 | u8 padding[3]; |
David S. Miller | 14599f1 | 2010-06-11 11:34:06 -0700 | [diff] [blame] | 383 | } __packed; |
Juuso Oikarinen | 152ee6e | 2010-02-18 13:25:42 +0200 | [diff] [blame] | 384 | |
Luciano Coelho | 98b5dd5 | 2009-11-23 23:22:17 +0200 | [diff] [blame] | 385 | struct wl1271_radio_parms_cmd { |
| 386 | struct wl1271_cmd_header header; |
| 387 | |
| 388 | struct wl1271_cmd_test_header test; |
| 389 | |
Juuso Oikarinen | eb70eb7 | 2010-05-14 10:46:22 +0300 | [diff] [blame] | 390 | /* Static radio parameters */ |
| 391 | struct wl1271_ini_band_params_2 static_params_2; |
| 392 | struct wl1271_ini_band_params_5 static_params_5; |
Luciano Coelho | 98b5dd5 | 2009-11-23 23:22:17 +0200 | [diff] [blame] | 393 | |
Juuso Oikarinen | eb70eb7 | 2010-05-14 10:46:22 +0300 | [diff] [blame] | 394 | /* Dynamic radio parameters */ |
| 395 | struct wl1271_ini_fem_params_2 dyn_params_2; |
| 396 | u8 padding2; |
| 397 | struct wl1271_ini_fem_params_5 dyn_params_5; |
| 398 | u8 padding3[2]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 399 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 400 | |
| 401 | struct wl1271_cmd_cal_channel_tune { |
| 402 | struct wl1271_cmd_header header; |
| 403 | |
| 404 | struct wl1271_cmd_test_header test; |
| 405 | |
| 406 | u8 band; |
| 407 | u8 channel; |
| 408 | |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 409 | __le16 radio_status; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 410 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 411 | |
| 412 | struct wl1271_cmd_cal_update_ref_point { |
| 413 | struct wl1271_cmd_header header; |
| 414 | |
| 415 | struct wl1271_cmd_test_header test; |
| 416 | |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 417 | __le32 ref_power; |
| 418 | __le32 ref_detector; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 419 | u8 sub_band; |
| 420 | u8 padding[3]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 421 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 422 | |
| 423 | #define MAX_TLV_LENGTH 400 |
| 424 | #define MAX_NVS_VERSION_LENGTH 12 |
| 425 | |
| 426 | #define WL1271_CAL_P2G_BAND_B_G BIT(0) |
| 427 | |
| 428 | struct wl1271_cmd_cal_p2g { |
| 429 | struct wl1271_cmd_header header; |
| 430 | |
| 431 | struct wl1271_cmd_test_header test; |
| 432 | |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 433 | __le16 len; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 434 | u8 buf[MAX_TLV_LENGTH]; |
| 435 | u8 type; |
| 436 | u8 padding; |
| 437 | |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 438 | __le16 radio_status; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 439 | u8 nvs_version[MAX_NVS_VERSION_LENGTH]; |
| 440 | |
| 441 | u8 sub_band_mask; |
| 442 | u8 padding2; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 443 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 444 | |
Luciano Coelho | 25a7dc6 | 2009-10-12 15:08:42 +0300 | [diff] [blame] | 445 | |
| 446 | /* |
| 447 | * There are three types of disconnections: |
| 448 | * |
| 449 | * DISCONNECT_IMMEDIATE: the fw doesn't send any frames |
| 450 | * DISCONNECT_DEAUTH: the fw generates a DEAUTH request with the reason |
| 451 | * we have passed |
| 452 | * DISCONNECT_DISASSOC: the fw generates a DESASSOC request with the reason |
| 453 | * we have passed |
| 454 | */ |
| 455 | enum wl1271_disconnect_type { |
| 456 | DISCONNECT_IMMEDIATE, |
| 457 | DISCONNECT_DEAUTH, |
| 458 | DISCONNECT_DISASSOC |
| 459 | }; |
| 460 | |
| 461 | struct wl1271_cmd_disconnect { |
Luciano Coelho | 1ed9538 | 2010-04-01 11:38:18 +0300 | [diff] [blame] | 462 | struct wl1271_cmd_header header; |
| 463 | |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 464 | __le32 rx_config_options; |
| 465 | __le32 rx_filter_options; |
Luciano Coelho | 25a7dc6 | 2009-10-12 15:08:42 +0300 | [diff] [blame] | 466 | |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 467 | __le16 reason; |
Luciano Coelho | 25a7dc6 | 2009-10-12 15:08:42 +0300 | [diff] [blame] | 468 | u8 type; |
| 469 | |
| 470 | u8 padding; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 471 | } __packed; |
Luciano Coelho | 25a7dc6 | 2009-10-12 15:08:42 +0300 | [diff] [blame] | 472 | |
Juuso Oikarinen | be86cbe | 2010-05-27 12:53:01 +0300 | [diff] [blame^] | 473 | #define WL1271_CMD_STA_STATE_CONNECTED 1 |
| 474 | |
| 475 | struct wl1271_cmd_set_sta_state { |
| 476 | struct wl1271_cmd_header header; |
| 477 | |
| 478 | u8 state; |
| 479 | u8 padding[3]; |
| 480 | } __attribute__ ((packed)); |
| 481 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 482 | #endif /* __WL1271_CMD_H__ */ |