blob: 16e0a877bf5743fe8f437ed92deac67110cae440 [file] [log] [blame]
Luciano Coelhof5fc0f82009-08-06 16:25:28 +03001/*
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
Shahar Levi00d20102010-11-08 11:20:10 +000025#ifndef __CMD_H__
26#define __CMD_H__
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030027
Shahar Levi00d20102010-11-08 11:20:10 +000028#include "wl12xx.h"
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030029
30struct acx_header;
31
Juuso Oikarinenfa867e72009-11-02 20:22:13 +020032int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len,
33 size_t res_len);
Luciano Coelho98b5dd52009-11-23 23:22:17 +020034int wl1271_cmd_general_parms(struct wl1271 *wl);
Shahar Levi49d750ca2011-03-06 16:32:09 +020035int wl128x_cmd_general_parms(struct wl1271 *wl);
Luciano Coelho98b5dd52009-11-23 23:22:17 +020036int wl1271_cmd_radio_parms(struct wl1271 *wl);
Shahar Levi49d750ca2011-03-06 16:32:09 +020037int wl128x_cmd_radio_parms(struct wl1271 *wl);
Juuso Oikarinen644a4862010-10-05 13:11:56 +020038int wl1271_cmd_ext_radio_parms(struct wl1271 *wl);
Eliad Pellerc690ec82011-08-14 13:17:07 +030039int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 role_type, u8 *role_id);
40int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id);
41int wl12xx_cmd_role_start_dev(struct wl1271 *wl);
42int wl12xx_cmd_role_stop_dev(struct wl1271 *wl);
43int wl12xx_cmd_role_start_sta(struct wl1271 *wl);
44int wl12xx_cmd_role_stop_sta(struct wl1271 *wl);
45int wl12xx_cmd_role_start_ap(struct wl1271 *wl);
46int wl12xx_cmd_role_stop_ap(struct wl1271 *wl);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030047int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer);
48int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len);
49int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len);
Luciano Coelho94210892009-12-11 15:40:55 +020050int wl1271_cmd_data_path(struct wl1271 *wl, bool enable);
Eliad Pellerc8bde242011-02-02 09:59:35 +020051int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode);
Juuso Oikarinen65cddbf2010-08-24 06:28:03 +030052int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer,
53 size_t len);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030054int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
Juuso Oikarinen606c1482010-04-01 11:38:21 +030055 void *buf, size_t buf_len, int index, u32 rates);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030056int wl1271_cmd_build_null_data(struct wl1271 *wl);
57int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid);
Kalle Valo818e3062010-03-18 12:26:35 +020058int wl1271_cmd_build_probe_req(struct wl1271 *wl,
59 const u8 *ssid, size_t ssid_len,
60 const u8 *ie, size_t ie_len, u8 band);
Juuso Oikarinen2f6724b2010-11-24 08:16:57 +020061struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl,
62 struct sk_buff *skb);
Eliad Pellerc5312772010-12-09 11:31:27 +020063int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, __be32 ip_addr);
Kalle Valo023e0822010-03-18 12:26:36 +020064int wl1271_build_qos_null_data(struct wl1271 *wl);
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +020065int wl1271_cmd_build_klv_null_data(struct wl1271 *wl);
Eliad Pellerc690ec82011-08-14 13:17:07 +030066int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid);
Arik Nemtsov98bdaab2010-10-16 18:08:58 +020067int wl1271_cmd_set_sta_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
68 u8 key_size, const u8 *key, const u8 *addr,
69 u32 tx_seq_32, u16 tx_seq_16);
70int wl1271_cmd_set_ap_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
71 u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32,
72 u16 tx_seq_16);
Eliad Pellerc690ec82011-08-14 13:17:07 +030073int wl12xx_cmd_set_peer_state(struct wl1271 *wl);
74int wl12xx_cmd_add_peer(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid);
75int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid);
Ido Yariv95dac04f2011-06-06 14:57:06 +030076int wl12xx_cmd_config_fwlog(struct wl1271 *wl);
77int wl12xx_cmd_start_fwlog(struct wl1271 *wl);
78int wl12xx_cmd_stop_fwlog(struct wl1271 *wl);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030079
80enum wl1271_commands {
81 CMD_INTERROGATE = 1, /*use this to read information elements*/
82 CMD_CONFIGURE = 2, /*use this to write information elements*/
83 CMD_ENABLE_RX = 3,
84 CMD_ENABLE_TX = 4,
85 CMD_DISABLE_RX = 5,
86 CMD_DISABLE_TX = 6,
87 CMD_SCAN = 8,
88 CMD_STOP_SCAN = 9,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030089 CMD_SET_KEYS = 12,
90 CMD_READ_MEMORY = 13,
91 CMD_WRITE_MEMORY = 14,
92 CMD_SET_TEMPLATE = 19,
93 CMD_TEST = 23,
94 CMD_NOISE_HIST = 28,
Eliad Pellerc690ec82011-08-14 13:17:07 +030095 CMD_QUIET_ELEMENT_SET_STATE = 29,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030096 CMD_SET_BCN_MODE = 33,
97 CMD_MEASUREMENT = 34,
98 CMD_STOP_MEASUREMENT = 35,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030099 CMD_SET_PS_MODE = 37,
100 CMD_CHANNEL_SWITCH = 38,
101 CMD_STOP_CHANNEL_SWICTH = 39,
102 CMD_AP_DISCOVERY = 40,
103 CMD_STOP_AP_DISCOVERY = 41,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300104 CMD_HEALTH_CHECK = 45,
105 CMD_DEBUG = 46,
106 CMD_TRIGGER_SCAN_TO = 47,
107 CMD_CONNECTION_SCAN_CFG = 48,
108 CMD_CONNECTION_SCAN_SSID_CFG = 49,
109 CMD_START_PERIODIC_SCAN = 50,
110 CMD_STOP_PERIODIC_SCAN = 51,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300111 CMD_SET_PEER_STATE = 52,
112 CMD_REMAIN_ON_CHANNEL = 53,
113 CMD_CANCEL_REMAIN_ON_CHANNEL = 54,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300114
Eliad Pellerc690ec82011-08-14 13:17:07 +0300115 CMD_CONFIG_FWLOGGER = 55,
116 CMD_START_FWLOGGER = 56,
117 CMD_STOP_FWLOGGER = 57,
118
119 /* AP commands */
120 CMD_ADD_PEER = 62,
121 CMD_REMOVE_PEER = 63,
122
123 /* Role API */
124 CMD_ROLE_ENABLE = 70,
125 CMD_ROLE_DISABLE = 71,
126 CMD_ROLE_START = 72,
127 CMD_ROLE_STOP = 73,
128
129 /* WIFI Direct */
130 CMD_WFD_START_DISCOVERY = 80,
131 CMD_WFD_STOP_DISCOVERY = 81,
132 CMD_WFD_ATTRIBUTE_CONFIG = 82,
133
134 CMD_NOP = 100,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200135
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300136 NUM_COMMANDS,
137 MAX_COMMAND_ID = 0xFFFF,
138};
139
140#define MAX_CMD_PARAMS 572
141
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +0200142enum {
143 CMD_TEMPL_KLV_IDX_NULL_DATA = 0,
144 CMD_TEMPL_KLV_IDX_MAX = 4
145};
146
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300147enum cmd_templ {
148 CMD_TEMPL_NULL_DATA = 0,
149 CMD_TEMPL_BEACON,
150 CMD_TEMPL_CFG_PROBE_REQ_2_4,
151 CMD_TEMPL_CFG_PROBE_REQ_5,
152 CMD_TEMPL_PROBE_RESPONSE,
153 CMD_TEMPL_QOS_NULL_DATA,
154 CMD_TEMPL_PS_POLL,
155 CMD_TEMPL_KLV,
156 CMD_TEMPL_DISCONNECT,
157 CMD_TEMPL_PROBE_REQ_2_4, /* for firmware internal use only */
158 CMD_TEMPL_PROBE_REQ_5, /* for firmware internal use only */
159 CMD_TEMPL_BAR, /* for firmware internal use only */
160 CMD_TEMPL_CTS, /*
161 * For CTS-to-self (FastCTS) mechanism
162 * for BT/WLAN coexistence (SoftGemini). */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300163 CMD_TEMPL_AP_BEACON,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200164 CMD_TEMPL_AP_PROBE_RESPONSE,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300165 CMD_TEMPL_ARP_RSP,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200166 CMD_TEMPL_DEAUTH_AP,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300167 CMD_TEMPL_TEMPORARY,
168 CMD_TEMPL_LINK_MEASUREMENT_REPORT,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200169
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300170 CMD_TEMPL_MAX = 0xff
171};
172
173/* unit ms */
174#define WL1271_COMMAND_TIMEOUT 2000
175#define WL1271_CMD_TEMPL_MAX_SIZE 252
Teemu Paasikivi0cbb1032010-05-07 11:39:01 +0300176#define WL1271_EVENT_TIMEOUT 750
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300177
178struct wl1271_cmd_header {
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300179 __le16 id;
180 __le16 status;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300181 /* payload */
182 u8 data[0];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000183} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300184
185#define WL1271_CMD_MAX_PARAMS 572
186
187struct wl1271_command {
188 struct wl1271_cmd_header header;
189 u8 parameters[WL1271_CMD_MAX_PARAMS];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000190} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300191
192enum {
193 CMD_MAILBOX_IDLE = 0,
194 CMD_STATUS_SUCCESS = 1,
195 CMD_STATUS_UNKNOWN_CMD = 2,
196 CMD_STATUS_UNKNOWN_IE = 3,
197 CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11,
198 CMD_STATUS_RX_BUSY = 13,
199 CMD_STATUS_INVALID_PARAM = 14,
200 CMD_STATUS_TEMPLATE_TOO_LARGE = 15,
201 CMD_STATUS_OUT_OF_MEMORY = 16,
202 CMD_STATUS_STA_TABLE_FULL = 17,
203 CMD_STATUS_RADIO_ERROR = 18,
204 CMD_STATUS_WRONG_NESTING = 19,
205 CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/
206 CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/
Eliad Pellerc690ec82011-08-14 13:17:07 +0300207 CMD_STATUS_TEMPLATE_OOM = 23,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300208 MAX_COMMAND_STATUS = 0xff
209};
210
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300211#define CMDMBOX_HEADER_LEN 4
212#define CMDMBOX_INFO_ELEM_HEADER_LEN 4
213
214enum {
215 BSS_TYPE_IBSS = 0,
216 BSS_TYPE_STA_BSS = 2,
217 BSS_TYPE_AP_BSS = 3,
218 MAX_BSS_TYPE = 0xFF
219};
220
221#define WL1271_JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
222#define WL1271_JOIN_CMD_TX_SESSION_OFFSET 1
Teemu Paasikivia4102642009-10-13 12:47:51 +0300223#define WL1271_JOIN_CMD_BSS_TYPE_5GHZ 0x10
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300224
Eliad Pellerc690ec82011-08-14 13:17:07 +0300225struct wl12xx_cmd_role_enable {
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300226 struct wl1271_cmd_header header;
227
Eliad Pellerc690ec82011-08-14 13:17:07 +0300228 u8 role_id;
229 u8 role_type;
230 u8 mac_address[ETH_ALEN];
231} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300232
Eliad Pellerc690ec82011-08-14 13:17:07 +0300233struct wl12xx_cmd_role_disable {
234 struct wl1271_cmd_header header;
235
236 u8 role_id;
237 u8 padding[3];
238} __packed;
239
240enum wl12xx_band {
241 WL12XX_BAND_2_4GHZ = 0,
242 WL12XX_BAND_5GHZ = 1,
243 WL12XX_BAND_JAPAN_4_9_GHZ = 2,
244 WL12XX_BAND_DEFAULT = WL12XX_BAND_2_4GHZ,
245 WL12XX_BAND_INVALID = 0x7E,
246 WL12XX_BAND_MAX_RADIO = 0x7F,
247};
248
249struct wl12xx_cmd_role_start {
250 struct wl1271_cmd_header header;
251
252 u8 role_id;
253 u8 band;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300254 u8 channel;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300255 u8 padding;
256
257 union {
258 struct {
259 u8 hlid;
260 u8 session;
261 u8 padding_1[54];
262 } __packed device;
263 /* sta & p2p_cli use the same struct */
264 struct {
265 u8 bssid[ETH_ALEN];
266 u8 hlid; /* data hlid */
267 u8 session;
268 __le32 remote_rates; /* remote supported rates */
269
270 /*
271 * The target uses this field to determine the rate at
272 * which to transmit control frame responses (such as
273 * ACK or CTS frames).
274 */
275 __le32 basic_rate_set;
276 __le32 local_rates; /* local supported rates */
277
278 u8 ssid_type;
279 u8 ssid_len;
280 u8 ssid[IEEE80211_MAX_SSID_LEN];
281
282 __le16 beacon_interval; /* in TBTTs */
283 } __packed sta;
284 struct {
285 u8 bssid[ETH_ALEN];
286 u8 hlid; /* data hlid */
287 u8 dtim_interval;
288 __le32 remote_rates; /* remote supported rates */
289
290 __le32 basic_rate_set;
291 __le32 local_rates; /* local supported rates */
292
293 u8 ssid_type;
294 u8 ssid_len;
295 u8 ssid[IEEE80211_MAX_SSID_LEN];
296
297 __le16 beacon_interval; /* in TBTTs */
298
299 u8 padding_1[4];
300 } __packed ibss;
301 /* ap & p2p_go use the same struct */
302 struct {
303 __le16 aging_period; /* in secs */
304 u8 beacon_expiry; /* in ms */
305 u8 bss_index;
306 /* The host link id for the AP's global queue */
307 u8 global_hlid;
308 /* The host link id for the AP's broadcast queue */
309 u8 broadcast_hlid;
310
311 __le16 beacon_interval; /* in TBTTs */
312
313 __le32 basic_rate_set;
314 __le32 local_rates; /* local supported rates */
315
316 u8 dtim_interval;
317
318 u8 ssid_type;
319 u8 ssid_len;
320 u8 ssid[IEEE80211_MAX_SSID_LEN];
321
322 u8 padding_1[5];
323 } __packed ap;
324 };
325} __packed;
326
327struct wl12xx_cmd_role_stop {
328 struct wl1271_cmd_header header;
329
330 u8 role_id;
331 u8 disc_type; /* only STA and P2P_CLI */
332 __le16 reason; /* only STA and P2P_CLI */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000333} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300334
335struct cmd_enabledisable_path {
336 struct wl1271_cmd_header header;
337
338 u8 channel;
339 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000340} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300341
Juuso Oikarinen606c1482010-04-01 11:38:21 +0300342#define WL1271_RATE_AUTOMATIC 0
343
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300344struct wl1271_cmd_template_set {
345 struct wl1271_cmd_header header;
346
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300347 __le16 len;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300348 u8 template_type;
349 u8 index; /* relevant only for KLV_TEMPLATE type */
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300350 __le32 enabled_rates;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300351 u8 short_retry_limit;
352 u8 long_retry_limit;
353 u8 aflags;
354 u8 reserved;
355 u8 template_data[WL1271_CMD_TEMPL_MAX_SIZE];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000356} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300357
358#define TIM_ELE_ID 5
359#define PARTIAL_VBM_MAX 251
360
361struct wl1271_tim {
362 u8 identity;
363 u8 length;
364 u8 dtim_count;
365 u8 dtim_period;
366 u8 bitmap_ctrl;
367 u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000368} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300369
370enum wl1271_cmd_ps_mode {
371 STATION_ACTIVE_MODE,
372 STATION_POWER_SAVE_MODE
373};
374
375struct wl1271_cmd_ps_params {
376 struct wl1271_cmd_header header;
377
Eliad Pellerc690ec82011-08-14 13:17:07 +0300378 u8 role_id;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300379 u8 ps_mode; /* STATION_* */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300380 u8 padding[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000381} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300382
383/* HW encryption keys */
384#define NUM_ACCESS_CATEGORIES_COPY 4
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300385
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300386enum wl1271_cmd_key_action {
387 KEY_ADD_OR_REPLACE = 1,
388 KEY_REMOVE = 2,
389 KEY_SET_ID = 3,
390 MAX_KEY_ACTION = 0xffff,
391};
392
Eliad Pellerc690ec82011-08-14 13:17:07 +0300393enum wl1271_cmd_lid_key_type {
394 UNICAST_LID_TYPE = 0,
395 BROADCAST_LID_TYPE = 1,
396 WEP_DEFAULT_LID_TYPE = 2
397};
398
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300399enum wl1271_cmd_key_type {
400 KEY_NONE = 0,
401 KEY_WEP = 1,
402 KEY_TKIP = 2,
403 KEY_AES = 3,
Juuso Oikarinen7a557242010-09-27 12:42:07 +0200404 KEY_GEM = 4,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300405};
406
Eliad Pellerc690ec82011-08-14 13:17:07 +0300407struct wl1271_cmd_set_keys {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200408 struct wl1271_cmd_header header;
409
410 /*
411 * Indicates whether the HLID is a unicast key set
412 * or broadcast key set. A special value 0xFF is
413 * used to indicate that the HLID is on WEP-default
414 * (multi-hlids). of type wl1271_cmd_lid_key_type.
415 */
416 u8 hlid;
417
418 /*
419 * In WEP-default network (hlid == 0xFF) used to
420 * indicate which network STA/IBSS/AP role should be
421 * changed
422 */
423 u8 lid_key_type;
424
425 /*
426 * Key ID - For TKIP and AES key types, this field
427 * indicates the value that should be inserted into
428 * the KeyID field of frames transmitted using this
429 * key entry. For broadcast keys the index use as a
430 * marker for TX/RX key.
431 * For WEP default network (HLID=0xFF), this field
432 * indicates the ID of the key to add or remove.
433 */
434 u8 key_id;
435 u8 reserved_1;
436
437 /* key_action_e */
438 __le16 key_action;
439
440 /* key size in bytes */
441 u8 key_size;
442
443 /* key_type_e */
444 u8 key_type;
445
446 /* This field holds the security key data to add to the STA table */
447 u8 key[MAX_KEY_SIZE];
448 __le16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
449 __le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
450} __packed;
451
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300452struct wl1271_cmd_test_header {
453 u8 id;
454 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000455} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300456
457enum wl1271_channel_tune_bands {
458 WL1271_CHANNEL_TUNE_BAND_2_4,
459 WL1271_CHANNEL_TUNE_BAND_5,
460 WL1271_CHANNEL_TUNE_BAND_4_9
461};
462
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200463#define WL1271_PD_REFERENCE_POINT_BAND_B_G 0
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300464
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200465#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
466#define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E
467#define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200468
469struct wl1271_general_parms_cmd {
470 struct wl1271_cmd_header header;
471
472 struct wl1271_cmd_test_header test;
473
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300474 struct wl1271_ini_general_params general_params;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200475
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300476 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
477 u8 sr_sen_n_p;
478 u8 sr_sen_n_p_gain;
479 u8 sr_sen_nrn;
480 u8 sr_sen_prn;
481 u8 padding[3];
David S. Miller14599f12010-06-11 11:34:06 -0700482} __packed;
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200483
Shahar Levi49d750ca2011-03-06 16:32:09 +0200484struct wl128x_general_parms_cmd {
485 struct wl1271_cmd_header header;
486
487 struct wl1271_cmd_test_header test;
488
489 struct wl128x_ini_general_params general_params;
490
491 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
492 u8 sr_sen_n_p;
493 u8 sr_sen_n_p_gain;
494 u8 sr_sen_nrn;
495 u8 sr_sen_prn;
496 u8 padding[3];
497} __packed;
498
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200499struct wl1271_radio_parms_cmd {
500 struct wl1271_cmd_header header;
501
502 struct wl1271_cmd_test_header test;
503
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300504 /* Static radio parameters */
505 struct wl1271_ini_band_params_2 static_params_2;
506 struct wl1271_ini_band_params_5 static_params_5;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200507
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300508 /* Dynamic radio parameters */
509 struct wl1271_ini_fem_params_2 dyn_params_2;
510 u8 padding2;
511 struct wl1271_ini_fem_params_5 dyn_params_5;
512 u8 padding3[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000513} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300514
Shahar Levi49d750ca2011-03-06 16:32:09 +0200515struct wl128x_radio_parms_cmd {
516 struct wl1271_cmd_header header;
517
518 struct wl1271_cmd_test_header test;
519
520 /* Static radio parameters */
521 struct wl128x_ini_band_params_2 static_params_2;
522 struct wl128x_ini_band_params_5 static_params_5;
523
524 u8 fem_vendor_and_options;
525
526 /* Dynamic radio parameters */
527 struct wl128x_ini_fem_params_2 dyn_params_2;
528 u8 padding2;
529 struct wl128x_ini_fem_params_5 dyn_params_5;
530} __packed;
531
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200532struct wl1271_ext_radio_parms_cmd {
533 struct wl1271_cmd_header header;
534
535 struct wl1271_cmd_test_header test;
536
537 u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2];
538 u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5];
539 u8 padding[3];
540} __packed;
541
Luciano Coelho25a7dc62009-10-12 15:08:42 +0300542/*
543 * There are three types of disconnections:
544 *
545 * DISCONNECT_IMMEDIATE: the fw doesn't send any frames
546 * DISCONNECT_DEAUTH: the fw generates a DEAUTH request with the reason
547 * we have passed
548 * DISCONNECT_DISASSOC: the fw generates a DESASSOC request with the reason
549 * we have passed
550 */
551enum wl1271_disconnect_type {
552 DISCONNECT_IMMEDIATE,
553 DISCONNECT_DEAUTH,
554 DISCONNECT_DISASSOC
555};
556
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300557#define WL1271_CMD_STA_STATE_CONNECTED 1
558
Eliad Pellerc690ec82011-08-14 13:17:07 +0300559struct wl12xx_cmd_set_peer_state {
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300560 struct wl1271_cmd_header header;
561
Eliad Pellerc690ec82011-08-14 13:17:07 +0300562 u8 hlid;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300563 u8 state;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300564 u8 padding[2];
Luciano Coelho5082b822010-10-05 14:58:49 +0300565} __packed;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300566
Eliad Pellerc690ec82011-08-14 13:17:07 +0300567enum wl12xx_ssid_type {
568 WL12XX_SSID_TYPE_PUBLIC = 0,
569 WL12XX_SSID_TYPE_HIDDEN = 1,
570 WL12XX_SSID_TYPE_ANY = 2,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200571};
572
Eliad Pellerc690ec82011-08-14 13:17:07 +0300573struct wl12xx_cmd_add_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200574 struct wl1271_cmd_header header;
575
576 u8 addr[ETH_ALEN];
577 u8 hlid;
578 u8 aid;
579 u8 psd_type[NUM_ACCESS_CATEGORIES_COPY];
580 __le32 supported_rates;
581 u8 bss_index;
582 u8 sp_len;
583 u8 wmm;
584 u8 padding1;
585} __packed;
586
Eliad Pellerc690ec82011-08-14 13:17:07 +0300587struct wl12xx_cmd_remove_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200588 struct wl1271_cmd_header header;
589
590 u8 hlid;
591 u8 reason_opcode;
592 u8 send_deauth_flag;
593 u8 padding1;
594} __packed;
595
Ido Yariv95dac04f2011-06-06 14:57:06 +0300596/*
597 * Continuous mode - packets are transferred to the host periodically
598 * via the data path.
599 * On demand - Log messages are stored in a cyclic buffer in the
600 * firmware, and only transferred to the host when explicitly requested
601 */
602enum wl12xx_fwlogger_log_mode {
603 WL12XX_FWLOG_CONTINUOUS,
604 WL12XX_FWLOG_ON_DEMAND
605};
606
607/* Include/exclude timestamps from the log messages */
608enum wl12xx_fwlogger_timestamp {
609 WL12XX_FWLOG_TIMESTAMP_DISABLED,
610 WL12XX_FWLOG_TIMESTAMP_ENABLED
611};
612
613/*
614 * Logs can be routed to the debug pinouts (where available), to the host bus
615 * (SDIO/SPI), or dropped
616 */
617enum wl12xx_fwlogger_output {
618 WL12XX_FWLOG_OUTPUT_NONE,
619 WL12XX_FWLOG_OUTPUT_DBG_PINS,
620 WL12XX_FWLOG_OUTPUT_HOST,
621};
622
623struct wl12xx_cmd_config_fwlog {
624 struct wl1271_cmd_header header;
625
626 /* See enum wl12xx_fwlogger_log_mode */
627 u8 logger_mode;
628
629 /* Minimum log level threshold */
630 u8 log_severity;
631
632 /* Include/exclude timestamps from the log messages */
633 u8 timestamp;
634
635 /* See enum wl1271_fwlogger_output */
636 u8 output;
637
638 /* Regulates the frequency of log messages */
639 u8 threshold;
640
641 u8 padding[3];
642} __packed;
643
644struct wl12xx_cmd_start_fwlog {
645 struct wl1271_cmd_header header;
646} __packed;
647
648struct wl12xx_cmd_stop_fwlog {
649 struct wl1271_cmd_header header;
650} __packed;
651
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300652#endif /* __WL1271_CMD_H__ */