2 * This file is part of wl12xx
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 __WL12XX_CMD_H__
26 #define __WL12XX_CMD_H__
30 int wl12xx_cmd_send(struct wl12xx *wl, u16 type, void *buf, size_t buf_len);
31 int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer);
32 int wl12xx_cmd_interrogate(struct wl12xx *wl, u16 ie_id, u16 ie_len,
34 int wl12xx_cmd_configure(struct wl12xx *wl, void *ie, int ie_len);
35 int wl12xx_cmd_vbm(struct wl12xx *wl, u8 identity,
36 void *bitmap, u16 bitmap_len, u8 bitmap_control);
37 int wl12xx_cmd_data_path(struct wl12xx *wl, u8 channel, u8 enable);
38 int wl12xx_cmd_join(struct wl12xx *wl, u8 bss_type, u8 dtim_interval,
39 u16 beacon_interval, u8 wait);
40 int wl12xx_cmd_ps_mode(struct wl12xx *wl, u8 ps_mode);
41 int wl12xx_cmd_read_memory(struct wl12xx *wl, u32 addr, u32 len, void *answer);
42 int wl12xx_cmd_template_set(struct wl12xx *wl, u16 cmd_id,
43 void *buf, size_t buf_len);
46 #define WL12XX_COMMAND_TIMEOUT 2000
48 #define WL12XX_MAX_TEMPLATE_SIZE 300
50 struct wl12xx_cmd_packet_template {
52 u8 template[WL12XX_MAX_TEMPLATE_SIZE];
53 } __attribute__ ((packed));
55 enum wl12xx_commands {
57 CMD_INTERROGATE = 1, /*use this to read information elements*/
58 CMD_CONFIGURE = 2, /*use this to write information elements*/
69 CMD_WRITE_MEMORY = 14,
75 CMD_RADIO_CALIBRATE = 25, /* OBSOLETE */
76 CMD_ENABLE_RX_PATH = 27, /* OBSOLETE */
80 CMD_QOS_NULL_DATA = 31,
82 CMD_SET_BCN_MODE = 33,
84 CMD_STOP_MEASUREMENT = 35,
87 CMD_CHANNEL_SWITCH = 38,
88 CMD_STOP_CHANNEL_SWICTH = 39,
89 CMD_AP_DISCOVERY = 40,
90 CMD_STOP_AP_DISCOVERY = 41,
92 CMD_STOP_SPS_SCAN = 43,
93 CMD_HEALTH_CHECK = 45,
95 CMD_TRIGGER_SCAN_TO = 47,
98 MAX_COMMAND_ID = 0xFFFF,
101 #define MAX_CMD_PARAMS 572
103 struct wl12xx_command {
106 u8 parameters[MAX_CMD_PARAMS];
110 CMD_MAILBOX_IDLE = 0,
111 CMD_STATUS_SUCCESS = 1,
112 CMD_STATUS_UNKNOWN_CMD = 2,
113 CMD_STATUS_UNKNOWN_IE = 3,
114 CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11,
115 CMD_STATUS_RX_BUSY = 13,
116 CMD_STATUS_INVALID_PARAM = 14,
117 CMD_STATUS_TEMPLATE_TOO_LARGE = 15,
118 CMD_STATUS_OUT_OF_MEMORY = 16,
119 CMD_STATUS_STA_TABLE_FULL = 17,
120 CMD_STATUS_RADIO_ERROR = 18,
121 CMD_STATUS_WRONG_NESTING = 19,
122 CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/
123 CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/
124 MAX_COMMAND_STATUS = 0xff
131 * The host issues this command to read the WiLink device memory/registers.
133 * Note: The Base Band address has special handling (16 bits registers and
134 * addresses). For more information, see the hardware specification.
139 * The host issues this command to write the WiLink device memory/registers.
141 * The Base Band address has special handling (16 bits registers and
142 * addresses). For more information, see the hardware specification.
144 #define MAX_READ_SIZE 256
146 struct cmd_read_write_memory {
147 /* The address of the memory to read from or write to.*/
150 /* The amount of data in bytes to read from or write to the WiLink
154 /* The actual value read from or written to the Wilink. The source
155 of this field is the Host in WRITE command or the Wilink in READ
157 u8 value[MAX_READ_SIZE];
160 #define CMDMBOX_HEADER_LEN 4
161 #define CMDMBOX_INFO_ELEM_HEADER_LEN 4
164 struct basic_scan_parameters {
165 u32 rx_config_options;
166 u32 rx_filter_options;
170 * bit 0: When this bit is set, passive scan.
171 * bit 1: Band, when this bit is set we scan
173 * bit 2: voice mode, 0 for normal scan.
174 * bit 3: scan priority, 1 for high priority.
178 /* Number of channels to scan */
181 /* Number opf probe requests to send, per channel */
182 u8 num_probe_requests;
184 /* Rate and modulation for probe requests */
191 } __attribute__ ((packed));
193 struct basic_scan_channel_parameters {
194 u32 min_duration; /* in TU */
195 u32 max_duration; /* in TU */
200 * bits 0-3: Early termination count.
201 * bits 4-5: Early termination condition.
203 u8 early_termination;
208 } __attribute__ ((packed));
210 /* SCAN parameters */
211 #define SCAN_MAX_NUM_OF_CHANNELS 16
214 struct basic_scan_parameters params;
215 struct basic_scan_channel_parameters channels[SCAN_MAX_NUM_OF_CHANNELS];
216 } __attribute__ ((packed));
220 BSS_TYPE_STA_BSS = 2,
225 #define JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
226 #define JOIN_CMD_CTRL_EARLY_WAKEUP_ENABLE 0x01 /* Early wakeup time */
232 u16 beacon_interval; /* in TBTTs */
233 u32 rx_config_options;
234 u32 rx_filter_options;
237 * The target uses this field to determine the rate at
238 * which to transmit control frame responses (such as
239 * ACK or CTS frames).
243 u8 tx_ctrl_frame_rate; /* OBSOLETE */
244 u8 tx_ctrl_frame_mod; /* OBSOLETE */
246 * bits 0-2: This bitwise field specifies the type
247 * of BSS to start or join (BSS_TYPE_*).
248 * bit 4: Band - The radio band in which to join
252 * bits 3, 5-7: Reserved
257 u8 ssid[IW_ESSID_MAX_SIZE];
258 u8 ctrl; /* JOIN_CMD_CTRL_* */
259 u8 tx_mgt_frame_rate; /* OBSOLETE */
260 u8 tx_mgt_frame_mod; /* OBSOLETE */
262 } __attribute__ ((packed));
265 #endif /* __WL12XX_CMD_H__ */