drivers/net: use __packed annotation
[deliverable/linux.git] / drivers / net / wireless / wl12xx / wl1251_cmd.h
CommitLineData
2f01a1f5 1/*
80301cdc 2 * This file is part of wl1251
2f01a1f5
KV
3 *
4 * Copyright (c) 1998-2007 Texas Instruments Incorporated
5 * Copyright (C) 2008 Nokia Corporation
6 *
7 * Contact: Kalle Valo <kalle.valo@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
80301cdc
KV
25#ifndef __WL1251_CMD_H__
26#define __WL1251_CMD_H__
2f01a1f5 27
13674118 28#include "wl1251.h"
2f01a1f5 29
dc52f0a8
KV
30#include <net/cfg80211.h>
31
ff25839b
KV
32struct acx_header;
33
80301cdc
KV
34int wl1251_cmd_send(struct wl1251 *wl, u16 type, void *buf, size_t buf_len);
35int wl1251_cmd_test(struct wl1251 *wl, void *buf, size_t buf_len, u8 answer);
36int wl1251_cmd_interrogate(struct wl1251 *wl, u16 id, void *buf, size_t len);
37int wl1251_cmd_configure(struct wl1251 *wl, u16 id, void *buf, size_t len);
38int wl1251_cmd_vbm(struct wl1251 *wl, u8 identity,
2f01a1f5 39 void *bitmap, u16 bitmap_len, u8 bitmap_control);
80301cdc 40int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, bool enable);
c88f8754
KV
41int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel,
42 u16 beacon_interval, u8 dtim_interval);
80301cdc
KV
43int wl1251_cmd_ps_mode(struct wl1251 *wl, u8 ps_mode);
44int wl1251_cmd_read_memory(struct wl1251 *wl, u32 addr, void *answer,
ff25839b 45 size_t len);
80301cdc 46int wl1251_cmd_template_set(struct wl1251 *wl, u16 cmd_id,
2f01a1f5 47 void *buf, size_t buf_len);
3a98c30f 48int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len,
dc52f0a8 49 struct ieee80211_channel *channels[],
3a98c30f
KV
50 unsigned int n_channels, unsigned int n_probes);
51int wl1251_cmd_trigger_scan_to(struct wl1251 *wl, u32 timeout);
2f01a1f5
KV
52
53/* unit ms */
80301cdc 54#define WL1251_COMMAND_TIMEOUT 2000
2f01a1f5 55
80301cdc 56enum wl1251_commands {
2f01a1f5
KV
57 CMD_RESET = 0,
58 CMD_INTERROGATE = 1, /*use this to read information elements*/
59 CMD_CONFIGURE = 2, /*use this to write information elements*/
60 CMD_ENABLE_RX = 3,
61 CMD_ENABLE_TX = 4,
62 CMD_DISABLE_RX = 5,
63 CMD_DISABLE_TX = 6,
64 CMD_SCAN = 8,
65 CMD_STOP_SCAN = 9,
66 CMD_VBM = 10,
67 CMD_START_JOIN = 11,
68 CMD_SET_KEYS = 12,
69 CMD_READ_MEMORY = 13,
70 CMD_WRITE_MEMORY = 14,
71 CMD_BEACON = 19,
72 CMD_PROBE_RESP = 20,
73 CMD_NULL_DATA = 21,
74 CMD_PROBE_REQ = 22,
75 CMD_TEST = 23,
76 CMD_RADIO_CALIBRATE = 25, /* OBSOLETE */
77 CMD_ENABLE_RX_PATH = 27, /* OBSOLETE */
78 CMD_NOISE_HIST = 28,
79 CMD_RX_RESET = 29,
80 CMD_PS_POLL = 30,
81 CMD_QOS_NULL_DATA = 31,
82 CMD_LNA_CONTROL = 32,
83 CMD_SET_BCN_MODE = 33,
84 CMD_MEASUREMENT = 34,
85 CMD_STOP_MEASUREMENT = 35,
86 CMD_DISCONNECT = 36,
87 CMD_SET_PS_MODE = 37,
88 CMD_CHANNEL_SWITCH = 38,
89 CMD_STOP_CHANNEL_SWICTH = 39,
90 CMD_AP_DISCOVERY = 40,
91 CMD_STOP_AP_DISCOVERY = 41,
92 CMD_SPS_SCAN = 42,
93 CMD_STOP_SPS_SCAN = 43,
94 CMD_HEALTH_CHECK = 45,
95 CMD_DEBUG = 46,
96 CMD_TRIGGER_SCAN_TO = 47,
97
98 NUM_COMMANDS,
99 MAX_COMMAND_ID = 0xFFFF,
100};
101
102#define MAX_CMD_PARAMS 572
103
80301cdc 104struct wl1251_cmd_header {
2f01a1f5
KV
105 u16 id;
106 u16 status;
ff25839b
KV
107 /* payload */
108 u8 data[0];
ba2d3587 109} __packed;
ff25839b 110
80301cdc
KV
111struct wl1251_command {
112 struct wl1251_cmd_header header;
2f01a1f5
KV
113 u8 parameters[MAX_CMD_PARAMS];
114};
115
116enum {
117 CMD_MAILBOX_IDLE = 0,
118 CMD_STATUS_SUCCESS = 1,
119 CMD_STATUS_UNKNOWN_CMD = 2,
120 CMD_STATUS_UNKNOWN_IE = 3,
121 CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11,
122 CMD_STATUS_RX_BUSY = 13,
123 CMD_STATUS_INVALID_PARAM = 14,
124 CMD_STATUS_TEMPLATE_TOO_LARGE = 15,
125 CMD_STATUS_OUT_OF_MEMORY = 16,
126 CMD_STATUS_STA_TABLE_FULL = 17,
127 CMD_STATUS_RADIO_ERROR = 18,
128 CMD_STATUS_WRONG_NESTING = 19,
129 CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/
130 CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/
131 MAX_COMMAND_STATUS = 0xff
132};
133
134
135/*
136 * CMD_READ_MEMORY
137 *
138 * The host issues this command to read the WiLink device memory/registers.
139 *
140 * Note: The Base Band address has special handling (16 bits registers and
141 * addresses). For more information, see the hardware specification.
142 */
143/*
144 * CMD_WRITE_MEMORY
145 *
146 * The host issues this command to write the WiLink device memory/registers.
147 *
148 * The Base Band address has special handling (16 bits registers and
149 * addresses). For more information, see the hardware specification.
150 */
151#define MAX_READ_SIZE 256
152
153struct cmd_read_write_memory {
80301cdc 154 struct wl1251_cmd_header header;
ff25839b 155
2f01a1f5
KV
156 /* The address of the memory to read from or write to.*/
157 u32 addr;
158
159 /* The amount of data in bytes to read from or write to the WiLink
160 * device.*/
161 u32 size;
162
163 /* The actual value read from or written to the Wilink. The source
164 of this field is the Host in WRITE command or the Wilink in READ
165 command. */
166 u8 value[MAX_READ_SIZE];
167};
168
169#define CMDMBOX_HEADER_LEN 4
170#define CMDMBOX_INFO_ELEM_HEADER_LEN 4
171
3a98c30f
KV
172#define WL1251_SCAN_MIN_DURATION 30000
173#define WL1251_SCAN_MAX_DURATION 60000
2f01a1f5 174
dc52f0a8
KV
175#define WL1251_SCAN_NUM_PROBES 3
176
3a98c30f 177struct wl1251_scan_parameters {
2f01a1f5
KV
178 u32 rx_config_options;
179 u32 rx_filter_options;
180
181 /*
182 * Scan options:
183 * bit 0: When this bit is set, passive scan.
184 * bit 1: Band, when this bit is set we scan
185 * in the 5Ghz band.
186 * bit 2: voice mode, 0 for normal scan.
187 * bit 3: scan priority, 1 for high priority.
188 */
189 u16 scan_options;
190
191 /* Number of channels to scan */
192 u8 num_channels;
193
194 /* Number opf probe requests to send, per channel */
195 u8 num_probe_requests;
196
197 /* Rate and modulation for probe requests */
198 u16 tx_rate;
199
200 u8 tid_trigger;
201 u8 ssid_len;
3a98c30f 202 u8 ssid[32];
2f01a1f5 203
ba2d3587 204} __packed;
2f01a1f5 205
3a98c30f 206struct wl1251_scan_ch_parameters {
2f01a1f5
KV
207 u32 min_duration; /* in TU */
208 u32 max_duration; /* in TU */
209 u32 bssid_lsb;
210 u16 bssid_msb;
211
212 /*
213 * bits 0-3: Early termination count.
214 * bits 4-5: Early termination condition.
215 */
216 u8 early_termination;
217
218 u8 tx_power_att;
219 u8 channel;
220 u8 pad[3];
ba2d3587 221} __packed;
2f01a1f5
KV
222
223/* SCAN parameters */
224#define SCAN_MAX_NUM_OF_CHANNELS 16
225
3a98c30f 226struct wl1251_cmd_scan {
80301cdc 227 struct wl1251_cmd_header header;
ff25839b 228
3a98c30f
KV
229 struct wl1251_scan_parameters params;
230 struct wl1251_scan_ch_parameters channels[SCAN_MAX_NUM_OF_CHANNELS];
ba2d3587 231} __packed;
2f01a1f5
KV
232
233enum {
234 BSS_TYPE_IBSS = 0,
235 BSS_TYPE_STA_BSS = 2,
236 BSS_TYPE_AP_BSS = 3,
237 MAX_BSS_TYPE = 0xFF
238};
239
240#define JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
241#define JOIN_CMD_CTRL_EARLY_WAKEUP_ENABLE 0x01 /* Early wakeup time */
242
243
244struct cmd_join {
80301cdc 245 struct wl1251_cmd_header header;
ff25839b 246
2f01a1f5
KV
247 u32 bssid_lsb;
248 u16 bssid_msb;
249 u16 beacon_interval; /* in TBTTs */
250 u32 rx_config_options;
251 u32 rx_filter_options;
252
253 /*
254 * The target uses this field to determine the rate at
255 * which to transmit control frame responses (such as
256 * ACK or CTS frames).
257 */
258 u16 basic_rate_set;
259 u8 dtim_interval;
260 u8 tx_ctrl_frame_rate; /* OBSOLETE */
261 u8 tx_ctrl_frame_mod; /* OBSOLETE */
262 /*
263 * bits 0-2: This bitwise field specifies the type
264 * of BSS to start or join (BSS_TYPE_*).
265 * bit 4: Band - The radio band in which to join
266 * or start.
267 * 0 - 2.4GHz band
268 * 1 - 5GHz band
269 * bits 3, 5-7: Reserved
270 */
271 u8 bss_type;
272 u8 channel;
273 u8 ssid_len;
274 u8 ssid[IW_ESSID_MAX_SIZE];
275 u8 ctrl; /* JOIN_CMD_CTRL_* */
276 u8 tx_mgt_frame_rate; /* OBSOLETE */
277 u8 tx_mgt_frame_mod; /* OBSOLETE */
278 u8 reserved;
ba2d3587 279} __packed;
2f01a1f5 280
ff25839b 281struct cmd_enabledisable_path {
80301cdc 282 struct wl1251_cmd_header header;
ff25839b
KV
283
284 u8 channel;
285 u8 padding[3];
ba2d3587 286} __packed;
ff25839b 287
80301cdc 288#define WL1251_MAX_TEMPLATE_SIZE 300
ff25839b 289
80301cdc
KV
290struct wl1251_cmd_packet_template {
291 struct wl1251_cmd_header header;
ff25839b
KV
292
293 __le16 size;
294 u8 data[0];
ba2d3587 295} __packed;
ff25839b
KV
296
297#define TIM_ELE_ID 5
298#define PARTIAL_VBM_MAX 251
299
80301cdc 300struct wl1251_tim {
ff25839b
KV
301 u8 identity;
302 u8 length;
303 u8 dtim_count;
304 u8 dtim_period;
305 u8 bitmap_ctrl;
306 u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
ba2d3587 307} __packed;
ff25839b
KV
308
309/* Virtual Bit Map update */
80301cdc
KV
310struct wl1251_cmd_vbm_update {
311 struct wl1251_cmd_header header;
ff25839b
KV
312 __le16 len;
313 u8 padding[2];
80301cdc 314 struct wl1251_tim tim;
ba2d3587 315} __packed;
ff25839b 316
80301cdc 317enum wl1251_cmd_ps_mode {
ff25839b
KV
318 STATION_ACTIVE_MODE,
319 STATION_POWER_SAVE_MODE
320};
321
80301cdc
KV
322struct wl1251_cmd_ps_params {
323 struct wl1251_cmd_header header;
ff25839b
KV
324
325 u8 ps_mode; /* STATION_* */
326 u8 send_null_data; /* Do we have to send NULL data packet ? */
327 u8 retries; /* Number of retires for the initial NULL data packet */
328
329 /*
330 * TUs during which the target stays awake after switching
331 * to power save mode.
332 */
333 u8 hang_over_period;
334 u16 null_data_rate;
335 u8 pad[2];
ba2d3587 336} __packed;
ff25839b 337
80301cdc
KV
338struct wl1251_cmd_trigger_scan_to {
339 struct wl1251_cmd_header header;
ff25839b
KV
340
341 u32 timeout;
342};
343
344/* HW encryption keys */
345#define NUM_ACCESS_CATEGORIES_COPY 4
346#define MAX_KEY_SIZE 32
347
348/* When set, disable HW encryption */
349#define DF_ENCRYPTION_DISABLE 0x01
350/* When set, disable HW decryption */
351#define DF_SNIFF_MODE_ENABLE 0x80
352
80301cdc 353enum wl1251_cmd_key_action {
ff25839b
KV
354 KEY_ADD_OR_REPLACE = 1,
355 KEY_REMOVE = 2,
356 KEY_SET_ID = 3,
357 MAX_KEY_ACTION = 0xffff,
358};
359
80301cdc 360enum wl1251_cmd_key_type {
ff25839b
KV
361 KEY_WEP_DEFAULT = 0,
362 KEY_WEP_ADDR = 1,
363 KEY_AES_GROUP = 4,
364 KEY_AES_PAIRWISE = 5,
365 KEY_WEP_GROUP = 6,
366 KEY_TKIP_MIC_GROUP = 10,
367 KEY_TKIP_MIC_PAIRWISE = 11,
368};
369
370/*
371 *
372 * key_type_e key size key format
373 * ---------- --------- ----------
374 * 0x00 5, 13, 29 Key data
375 * 0x01 5, 13, 29 Key data
376 * 0x04 16 16 bytes of key data
377 * 0x05 16 16 bytes of key data
378 * 0x0a 32 16 bytes of TKIP key data
379 * 8 bytes of RX MIC key data
380 * 8 bytes of TX MIC key data
381 * 0x0b 32 16 bytes of TKIP key data
382 * 8 bytes of RX MIC key data
383 * 8 bytes of TX MIC key data
384 *
385 */
386
80301cdc
KV
387struct wl1251_cmd_set_keys {
388 struct wl1251_cmd_header header;
ff25839b
KV
389
390 /* Ignored for default WEP key */
391 u8 addr[ETH_ALEN];
392
393 /* key_action_e */
394 u16 key_action;
395
396 u16 reserved_1;
397
398 /* key size in bytes */
399 u8 key_size;
400
401 /* key_type_e */
402 u8 key_type;
403 u8 ssid_profile;
404
405 /*
406 * TKIP, AES: frame's key id field.
407 * For WEP default key: key id;
408 */
409 u8 id;
410 u8 reserved_2[6];
411 u8 key[MAX_KEY_SIZE];
412 u16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
413 u32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
ba2d3587 414} __packed;
ff25839b 415
2f01a1f5 416
80301cdc 417#endif /* __WL1251_CMD_H__ */
This page took 0.263548 seconds and 5 git commands to generate.