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