2 * This file is part of wl1251
4 * Copyright (c) 1998-2007 Texas Instruments Incorporated
5 * Copyright (C) 2008 Nokia Corporation
7 * Contact: Kalle Valo <kalle.valo@nokia.com>
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.
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.
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
25 #ifndef __WL1251_CMD_H__
26 #define __WL1251_CMD_H__
30 #include <net/cfg80211.h>
34 int wl1251_cmd_send(struct wl1251 *wl, u16 type, void *buf, size_t buf_len);
35 int wl1251_cmd_test(struct wl1251 *wl, void *buf, size_t buf_len, u8 answer);
36 int wl1251_cmd_interrogate(struct wl1251 *wl, u16 id, void *buf, size_t len);
37 int wl1251_cmd_configure(struct wl1251 *wl, u16 id, void *buf, size_t len);
38 int wl1251_cmd_vbm(struct wl1251 *wl, u8 identity,
39 void *bitmap, u16 bitmap_len, u8 bitmap_control);
40 int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, bool enable);
41 int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel,
42 u16 beacon_interval, u8 dtim_interval);
43 int wl1251_cmd_ps_mode(struct wl1251 *wl, u8 ps_mode);
44 int wl1251_cmd_read_memory(struct wl1251 *wl, u32 addr, void *answer,
46 int wl1251_cmd_template_set(struct wl1251 *wl, u16 cmd_id,
47 void *buf, size_t buf_len);
48 int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len,
49 struct ieee80211_channel *channels[],
50 unsigned int n_channels, unsigned int n_probes);
51 int wl1251_cmd_trigger_scan_to(struct wl1251 *wl, u32 timeout);
54 #define WL1251_COMMAND_TIMEOUT 2000
56 enum wl1251_commands {
58 CMD_INTERROGATE = 1, /*use this to read information elements*/
59 CMD_CONFIGURE = 2, /*use this to write information elements*/
70 CMD_WRITE_MEMORY = 14,
76 CMD_RADIO_CALIBRATE = 25, /* OBSOLETE */
77 CMD_ENABLE_RX_PATH = 27, /* OBSOLETE */
81 CMD_QOS_NULL_DATA = 31,
83 CMD_SET_BCN_MODE = 33,
85 CMD_STOP_MEASUREMENT = 35,
88 CMD_CHANNEL_SWITCH = 38,
89 CMD_STOP_CHANNEL_SWICTH = 39,
90 CMD_AP_DISCOVERY = 40,
91 CMD_STOP_AP_DISCOVERY = 41,
93 CMD_STOP_SPS_SCAN = 43,
94 CMD_HEALTH_CHECK = 45,
96 CMD_TRIGGER_SCAN_TO = 47,
99 MAX_COMMAND_ID = 0xFFFF,
102 #define MAX_CMD_PARAMS 572
104 struct wl1251_cmd_header {
109 } __attribute__ ((packed));
111 struct wl1251_command {
112 struct wl1251_cmd_header header;
113 u8 parameters[MAX_CMD_PARAMS];
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
138 * The host issues this command to read the WiLink device memory/registers.
140 * Note: The Base Band address has special handling (16 bits registers and
141 * addresses). For more information, see the hardware specification.
146 * The host issues this command to write the WiLink device memory/registers.
148 * The Base Band address has special handling (16 bits registers and
149 * addresses). For more information, see the hardware specification.
151 #define MAX_READ_SIZE 256
153 struct cmd_read_write_memory {
154 struct wl1251_cmd_header header;
156 /* The address of the memory to read from or write to.*/
159 /* The amount of data in bytes to read from or write to the WiLink
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
166 u8 value[MAX_READ_SIZE];
169 #define CMDMBOX_HEADER_LEN 4
170 #define CMDMBOX_INFO_ELEM_HEADER_LEN 4
172 #define WL1251_SCAN_MIN_DURATION 30000
173 #define WL1251_SCAN_MAX_DURATION 60000
175 #define WL1251_SCAN_NUM_PROBES 3
177 struct wl1251_scan_parameters {
178 u32 rx_config_options;
179 u32 rx_filter_options;
183 * bit 0: When this bit is set, passive scan.
184 * bit 1: Band, when this bit is set we scan
186 * bit 2: voice mode, 0 for normal scan.
187 * bit 3: scan priority, 1 for high priority.
191 /* Number of channels to scan */
194 /* Number opf probe requests to send, per channel */
195 u8 num_probe_requests;
197 /* Rate and modulation for probe requests */
204 } __attribute__ ((packed));
206 struct wl1251_scan_ch_parameters {
207 u32 min_duration; /* in TU */
208 u32 max_duration; /* in TU */
213 * bits 0-3: Early termination count.
214 * bits 4-5: Early termination condition.
216 u8 early_termination;
221 } __attribute__ ((packed));
223 /* SCAN parameters */
224 #define SCAN_MAX_NUM_OF_CHANNELS 16
226 struct wl1251_cmd_scan {
227 struct wl1251_cmd_header header;
229 struct wl1251_scan_parameters params;
230 struct wl1251_scan_ch_parameters channels[SCAN_MAX_NUM_OF_CHANNELS];
231 } __attribute__ ((packed));
235 BSS_TYPE_STA_BSS = 2,
240 #define JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
241 #define JOIN_CMD_CTRL_EARLY_WAKEUP_ENABLE 0x01 /* Early wakeup time */
245 struct wl1251_cmd_header header;
249 u16 beacon_interval; /* in TBTTs */
250 u32 rx_config_options;
251 u32 rx_filter_options;
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).
260 u8 tx_ctrl_frame_rate; /* OBSOLETE */
261 u8 tx_ctrl_frame_mod; /* OBSOLETE */
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
269 * bits 3, 5-7: Reserved
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 */
279 } __attribute__ ((packed));
281 struct cmd_enabledisable_path {
282 struct wl1251_cmd_header header;
286 } __attribute__ ((packed));
288 #define WL1251_MAX_TEMPLATE_SIZE 300
290 struct wl1251_cmd_packet_template {
291 struct wl1251_cmd_header header;
295 } __attribute__ ((packed));
298 #define PARTIAL_VBM_MAX 251
306 u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
307 } __attribute__ ((packed));
309 /* Virtual Bit Map update */
310 struct wl1251_cmd_vbm_update {
311 struct wl1251_cmd_header header;
314 struct wl1251_tim tim;
315 } __attribute__ ((packed));
317 enum wl1251_cmd_ps_mode {
319 STATION_POWER_SAVE_MODE
322 struct wl1251_cmd_ps_params {
323 struct wl1251_cmd_header header;
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 */
330 * TUs during which the target stays awake after switching
331 * to power save mode.
336 } __attribute__ ((packed));
338 struct wl1251_cmd_trigger_scan_to {
339 struct wl1251_cmd_header header;
344 /* HW encryption keys */
345 #define NUM_ACCESS_CATEGORIES_COPY 4
346 #define MAX_KEY_SIZE 32
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
353 enum wl1251_cmd_key_action {
354 KEY_ADD_OR_REPLACE = 1,
357 MAX_KEY_ACTION = 0xffff,
360 enum wl1251_cmd_key_type {
364 KEY_AES_PAIRWISE = 5,
366 KEY_TKIP_MIC_GROUP = 10,
367 KEY_TKIP_MIC_PAIRWISE = 11,
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
387 struct wl1251_cmd_set_keys {
388 struct wl1251_cmd_header header;
390 /* Ignored for default WEP key */
398 /* key size in bytes */
406 * TKIP, AES: frame's key id field.
407 * For WEP default key: key id;
411 u8 key[MAX_KEY_SIZE];
412 u16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
413 u32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
414 } __attribute__ ((packed));
417 #endif /* __WL1251_CMD_H__ */