1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#ifndef __WL1251_CMD_H__
24#define __WL1251_CMD_H__
25
26#include "wl1251.h"
27
28#include <net/cfg80211.h>
29
30struct acx_header;
31
32int wl1251_cmd_send(struct wl1251 *wl, u16 type, void *buf, size_t buf_len);
33int wl1251_cmd_test(struct wl1251 *wl, void *buf, size_t buf_len, u8 answer);
34int wl1251_cmd_interrogate(struct wl1251 *wl, u16 id, void *buf, size_t len);
35int wl1251_cmd_configure(struct wl1251 *wl, u16 id, void *buf, size_t len);
36int wl1251_cmd_vbm(struct wl1251 *wl, u8 identity,
37 void *bitmap, u16 bitmap_len, u8 bitmap_control);
38int wl1251_cmd_data_path_rx(struct wl1251 *wl, u8 channel, bool enable);
39int wl1251_cmd_data_path_tx(struct wl1251 *wl, u8 channel, bool enable);
40int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel,
41 u16 beacon_interval, u8 dtim_interval);
42int wl1251_cmd_ps_mode(struct wl1251 *wl, u8 ps_mode);
43int wl1251_cmd_read_memory(struct wl1251 *wl, u32 addr, void *answer,
44 size_t len);
45int wl1251_cmd_template_set(struct wl1251 *wl, u16 cmd_id,
46 void *buf, size_t buf_len);
47int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len,
48 struct ieee80211_channel *channels[],
49 unsigned int n_channels, unsigned int n_probes);
50int wl1251_cmd_trigger_scan_to(struct wl1251 *wl, u32 timeout);
51
52
53#define WL1251_COMMAND_TIMEOUT 2000
54
55enum wl1251_commands {
56 CMD_RESET = 0,
57 CMD_INTERROGATE = 1,
58 CMD_CONFIGURE = 2,
59 CMD_ENABLE_RX = 3,
60 CMD_ENABLE_TX = 4,
61 CMD_DISABLE_RX = 5,
62 CMD_DISABLE_TX = 6,
63 CMD_SCAN = 8,
64 CMD_STOP_SCAN = 9,
65 CMD_VBM = 10,
66 CMD_START_JOIN = 11,
67 CMD_SET_KEYS = 12,
68 CMD_READ_MEMORY = 13,
69 CMD_WRITE_MEMORY = 14,
70 CMD_BEACON = 19,
71 CMD_PROBE_RESP = 20,
72 CMD_NULL_DATA = 21,
73 CMD_PROBE_REQ = 22,
74 CMD_TEST = 23,
75 CMD_RADIO_CALIBRATE = 25,
76 CMD_ENABLE_RX_PATH = 27,
77 CMD_NOISE_HIST = 28,
78 CMD_RX_RESET = 29,
79 CMD_PS_POLL = 30,
80 CMD_QOS_NULL_DATA = 31,
81 CMD_LNA_CONTROL = 32,
82 CMD_SET_BCN_MODE = 33,
83 CMD_MEASUREMENT = 34,
84 CMD_STOP_MEASUREMENT = 35,
85 CMD_DISCONNECT = 36,
86 CMD_SET_PS_MODE = 37,
87 CMD_CHANNEL_SWITCH = 38,
88 CMD_STOP_CHANNEL_SWICTH = 39,
89 CMD_AP_DISCOVERY = 40,
90 CMD_STOP_AP_DISCOVERY = 41,
91 CMD_SPS_SCAN = 42,
92 CMD_STOP_SPS_SCAN = 43,
93 CMD_HEALTH_CHECK = 45,
94 CMD_DEBUG = 46,
95 CMD_TRIGGER_SCAN_TO = 47,
96
97 NUM_COMMANDS,
98 MAX_COMMAND_ID = 0xFFFF,
99};
100
101#define MAX_CMD_PARAMS 572
102
103struct wl1251_cmd_header {
104 u16 id;
105 u16 status;
106
107 u8 data[0];
108} __packed;
109
110struct wl1251_command {
111 struct wl1251_cmd_header header;
112 u8 parameters[MAX_CMD_PARAMS];
113} __packed;
114
115enum {
116 CMD_MAILBOX_IDLE = 0,
117 CMD_STATUS_SUCCESS = 1,
118 CMD_STATUS_UNKNOWN_CMD = 2,
119 CMD_STATUS_UNKNOWN_IE = 3,
120 CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11,
121 CMD_STATUS_RX_BUSY = 13,
122 CMD_STATUS_INVALID_PARAM = 14,
123 CMD_STATUS_TEMPLATE_TOO_LARGE = 15,
124 CMD_STATUS_OUT_OF_MEMORY = 16,
125 CMD_STATUS_STA_TABLE_FULL = 17,
126 CMD_STATUS_RADIO_ERROR = 18,
127 CMD_STATUS_WRONG_NESTING = 19,
128 CMD_STATUS_TIMEOUT = 21,
129 CMD_STATUS_FW_RESET = 22,
130 MAX_COMMAND_STATUS = 0xff
131};
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150#define MAX_READ_SIZE 256
151
152struct cmd_read_write_memory {
153 struct wl1251_cmd_header header;
154
155
156 u32 addr;
157
158
159
160 u32 size;
161
162
163
164
165 u8 value[MAX_READ_SIZE];
166} __packed;
167
168#define CMDMBOX_HEADER_LEN 4
169#define CMDMBOX_INFO_ELEM_HEADER_LEN 4
170
171#define WL1251_SCAN_OPT_PASSIVE 1
172#define WL1251_SCAN_OPT_5GHZ_BAND 2
173#define WL1251_SCAN_OPT_TRIGGERD_SCAN 4
174#define WL1251_SCAN_OPT_PRIORITY_HIGH 8
175
176#define WL1251_SCAN_MIN_DURATION 30000
177#define WL1251_SCAN_MAX_DURATION 60000
178
179#define WL1251_SCAN_NUM_PROBES 3
180
181struct wl1251_scan_parameters {
182 __le32 rx_config_options;
183 __le32 rx_filter_options;
184
185
186
187
188
189
190
191
192
193 __le16 scan_options;
194
195
196 u8 num_channels;
197
198
199 u8 num_probe_requests;
200
201
202 __le16 tx_rate;
203
204 u8 tid_trigger;
205 u8 ssid_len;
206 u8 ssid[32];
207
208} __packed;
209
210struct wl1251_scan_ch_parameters {
211 __le32 min_duration;
212 __le32 max_duration;
213 u32 bssid_lsb;
214 u16 bssid_msb;
215
216
217
218
219
220 u8 early_termination;
221
222 u8 tx_power_att;
223 u8 channel;
224 u8 pad[3];
225} __packed;
226
227
228#define SCAN_MAX_NUM_OF_CHANNELS 16
229
230struct wl1251_cmd_scan {
231 struct wl1251_cmd_header header;
232
233 struct wl1251_scan_parameters params;
234 struct wl1251_scan_ch_parameters channels[SCAN_MAX_NUM_OF_CHANNELS];
235} __packed;
236
237enum {
238 BSS_TYPE_IBSS = 0,
239 BSS_TYPE_STA_BSS = 2,
240 BSS_TYPE_AP_BSS = 3,
241 MAX_BSS_TYPE = 0xFF
242};
243
244#define JOIN_CMD_CTRL_TX_FLUSH 0x80
245#define JOIN_CMD_CTRL_EARLY_WAKEUP_ENABLE 0x01
246
247
248struct cmd_join {
249 struct wl1251_cmd_header header;
250
251 u32 bssid_lsb;
252 u16 bssid_msb;
253 u16 beacon_interval;
254 u32 rx_config_options;
255 u32 rx_filter_options;
256
257
258
259
260
261
262 u16 basic_rate_set;
263 u8 dtim_interval;
264 u8 tx_ctrl_frame_rate;
265 u8 tx_ctrl_frame_mod;
266
267
268
269
270
271
272
273
274
275 u8 bss_type;
276 u8 channel;
277 u8 ssid_len;
278 u8 ssid[IEEE80211_MAX_SSID_LEN];
279 u8 ctrl;
280 u8 tx_mgt_frame_rate;
281 u8 tx_mgt_frame_mod;
282 u8 reserved;
283} __packed;
284
285struct cmd_enabledisable_path {
286 struct wl1251_cmd_header header;
287
288 u8 channel;
289 u8 padding[3];
290} __packed;
291
292#define WL1251_MAX_TEMPLATE_SIZE 300
293
294struct wl1251_cmd_packet_template {
295 struct wl1251_cmd_header header;
296
297 __le16 size;
298 u8 data[0];
299} __packed;
300
301#define TIM_ELE_ID 5
302#define PARTIAL_VBM_MAX 251
303
304struct wl1251_tim {
305 u8 identity;
306 u8 length;
307 u8 dtim_count;
308 u8 dtim_period;
309 u8 bitmap_ctrl;
310 u8 pvb_field[PARTIAL_VBM_MAX];
311} __packed;
312
313
314struct wl1251_cmd_vbm_update {
315 struct wl1251_cmd_header header;
316 __le16 len;
317 u8 padding[2];
318 struct wl1251_tim tim;
319} __packed;
320
321enum wl1251_cmd_ps_mode {
322 CHIP_ACTIVE_MODE,
323 CHIP_POWER_SAVE_MODE
324};
325
326struct wl1251_cmd_ps_params {
327 struct wl1251_cmd_header header;
328
329 u8 ps_mode;
330 u8 send_null_data;
331 u8 retries;
332
333
334
335
336
337 u8 hang_over_period;
338 u16 null_data_rate;
339 u8 pad[2];
340} __packed;
341
342struct wl1251_cmd_trigger_scan_to {
343 struct wl1251_cmd_header header;
344
345 u32 timeout;
346} __packed;
347
348
349#define NUM_ACCESS_CATEGORIES_COPY 4
350#define MAX_KEY_SIZE 32
351
352
353#define DF_ENCRYPTION_DISABLE 0x01
354
355#define DF_SNIFF_MODE_ENABLE 0x80
356
357enum wl1251_cmd_key_action {
358 KEY_ADD_OR_REPLACE = 1,
359 KEY_REMOVE = 2,
360 KEY_SET_ID = 3,
361 MAX_KEY_ACTION = 0xffff,
362};
363
364enum wl1251_cmd_key_type {
365 KEY_WEP_DEFAULT = 0,
366 KEY_WEP_ADDR = 1,
367 KEY_AES_GROUP = 4,
368 KEY_AES_PAIRWISE = 5,
369 KEY_WEP_GROUP = 6,
370 KEY_TKIP_MIC_GROUP = 10,
371 KEY_TKIP_MIC_PAIRWISE = 11,
372};
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391struct wl1251_cmd_set_keys {
392 struct wl1251_cmd_header header;
393
394
395 u8 addr[ETH_ALEN];
396
397
398 u16 key_action;
399
400 u16 reserved_1;
401
402
403 u8 key_size;
404
405
406 u8 key_type;
407 u8 ssid_profile;
408
409
410
411
412
413 u8 id;
414 u8 reserved_2[6];
415 u8 key[MAX_KEY_SIZE];
416 u16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
417 u32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
418} __packed;
419
420
421#endif
422