Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-3945-commands.h
1 /******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
8 * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
22 * USA
23 *
24 * The full GNU General Public License is included in this distribution
25 * in the file called LICENSE.GPL.
26 *
27 * Contact Information:
28 * James P. Ketrenos <ipw2100-admin@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30 *
31 * BSD LICENSE
32 *
33 * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
34 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 *
40 * * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
45 * distribution.
46 * * Neither the name Intel Corporation nor the names of its
47 * contributors may be used to endorse or promote products derived
48 * from this software without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *
62 *****************************************************************************/
63 /*
64 * Please use this file (iwl-3945-commands.h) only for uCode API definitions.
65 * Please use iwl-3945-hw.h for hardware-related definitions.
66 * Please use iwl-3945.h for driver implementation definitions.
67 */
68
69 #ifndef __iwl_3945_commands_h__
70 #define __iwl_3945_commands_h__
71
72 enum {
73 REPLY_ALIVE = 0x1,
74 REPLY_ERROR = 0x2,
75
76 /* RXON and QOS commands */
77 REPLY_RXON = 0x10,
78 REPLY_RXON_ASSOC = 0x11,
79 REPLY_QOS_PARAM = 0x13,
80 REPLY_RXON_TIMING = 0x14,
81
82 /* Multi-Station support */
83 REPLY_ADD_STA = 0x18,
84 REPLY_REMOVE_STA = 0x19, /* not used */
85 REPLY_REMOVE_ALL_STA = 0x1a, /* not used */
86
87 /* RX, TX, LEDs */
88 REPLY_3945_RX = 0x1b, /* 3945 only */
89 REPLY_TX = 0x1c,
90 REPLY_RATE_SCALE = 0x47, /* 3945 only */
91 REPLY_LEDS_CMD = 0x48,
92 REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */
93
94 /* 802.11h related */
95 RADAR_NOTIFICATION = 0x70, /* not used */
96 REPLY_QUIET_CMD = 0x71, /* not used */
97 REPLY_CHANNEL_SWITCH = 0x72,
98 CHANNEL_SWITCH_NOTIFICATION = 0x73,
99 REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74,
100 SPECTRUM_MEASURE_NOTIFICATION = 0x75,
101
102 /* Power Management */
103 POWER_TABLE_CMD = 0x77,
104 PM_SLEEP_NOTIFICATION = 0x7A,
105 PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,
106
107 /* Scan commands and notifications */
108 REPLY_SCAN_CMD = 0x80,
109 REPLY_SCAN_ABORT_CMD = 0x81,
110 SCAN_START_NOTIFICATION = 0x82,
111 SCAN_RESULTS_NOTIFICATION = 0x83,
112 SCAN_COMPLETE_NOTIFICATION = 0x84,
113
114 /* IBSS/AP commands */
115 BEACON_NOTIFICATION = 0x90,
116 REPLY_TX_BEACON = 0x91,
117 WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */
118
119 /* Miscellaneous commands */
120 QUIET_NOTIFICATION = 0x96, /* not used */
121 REPLY_TX_PWR_TABLE_CMD = 0x97,
122 MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */
123
124 /* Bluetooth device coexistance config command */
125 REPLY_BT_CONFIG = 0x9b,
126
127 /* Statistics */
128 REPLY_STATISTICS_CMD = 0x9c,
129 STATISTICS_NOTIFICATION = 0x9d,
130
131 /* RF-KILL commands and notifications */
132 REPLY_CARD_STATE_CMD = 0xa0,
133 CARD_STATE_NOTIFICATION = 0xa1,
134
135 /* Missed beacons notification */
136 MISSED_BEACONS_NOTIFICATION = 0xa2,
137
138 REPLY_MAX = 0xff
139 };
140
141 /******************************************************************************
142 * (0)
143 * Commonly used structures and definitions:
144 * Command header, txpower
145 *
146 *****************************************************************************/
147
148 /* iwl3945_cmd_header flags value */
149 #define IWL_CMD_FAILED_MSK 0x40
150
151 /**
152 * struct iwl3945_cmd_header
153 *
154 * This header format appears in the beginning of each command sent from the
155 * driver, and each response/notification received from uCode.
156 */
157 struct iwl3945_cmd_header {
158 u8 cmd; /* Command ID: REPLY_RXON, etc. */
159 u8 flags; /* IWL_CMD_* */
160 /*
161 * The driver sets up the sequence number to values of its chosing.
162 * uCode does not use this value, but passes it back to the driver
163 * when sending the response to each driver-originated command, so
164 * the driver can match the response to the command. Since the values
165 * don't get used by uCode, the driver may set up an arbitrary format.
166 *
167 * There is one exception: uCode sets bit 15 when it originates
168 * the response/notification, i.e. when the response/notification
169 * is not a direct response to a command sent by the driver. For
170 * example, uCode issues REPLY_3945_RX when it sends a received frame
171 * to the driver; it is not a direct response to any driver command.
172 *
173 * The Linux driver uses the following format:
174 *
175 * 0:7 index/position within Tx queue
176 * 8:13 Tx queue selection
177 * 14:14 driver sets this to indicate command is in the 'huge'
178 * storage at the end of the command buffers, i.e. scan cmd
179 * 15:15 uCode sets this in uCode-originated response/notification
180 */
181 __le16 sequence;
182
183 /* command or response/notification data follows immediately */
184 u8 data[0];
185 } __attribute__ ((packed));
186
187 /**
188 * struct iwl3945_tx_power
189 *
190 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
191 *
192 * Each entry contains two values:
193 * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
194 * linear value that multiplies the output of the digital signal processor,
195 * before being sent to the analog radio.
196 * 2) Radio gain. This sets the analog gain of the radio Tx path.
197 * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
198 *
199 * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
200 */
201 struct iwl3945_tx_power {
202 u8 tx_gain; /* gain for analog radio */
203 u8 dsp_atten; /* gain for DSP */
204 } __attribute__ ((packed));
205
206 /**
207 * struct iwl3945_power_per_rate
208 *
209 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
210 */
211 struct iwl3945_power_per_rate {
212 u8 rate; /* plcp */
213 struct iwl3945_tx_power tpc;
214 u8 reserved;
215 } __attribute__ ((packed));
216
217 /******************************************************************************
218 * (0a)
219 * Alive and Error Commands & Responses:
220 *
221 *****************************************************************************/
222
223 #define UCODE_VALID_OK __constant_cpu_to_le32(0x1)
224 #define INITIALIZE_SUBTYPE (9)
225
226 /*
227 * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
228 *
229 * uCode issues this "initialize alive" notification once the initialization
230 * uCode image has completed its work, and is ready to load the runtime image.
231 * This is the *first* "alive" notification that the driver will receive after
232 * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
233 *
234 * See comments documenting "BSM" (bootstrap state machine).
235 */
236 struct iwl3945_init_alive_resp {
237 u8 ucode_minor;
238 u8 ucode_major;
239 __le16 reserved1;
240 u8 sw_rev[8];
241 u8 ver_type;
242 u8 ver_subtype; /* "9" for initialize alive */
243 __le16 reserved2;
244 __le32 log_event_table_ptr;
245 __le32 error_event_table_ptr;
246 __le32 timestamp;
247 __le32 is_valid;
248 } __attribute__ ((packed));
249
250
251 /**
252 * REPLY_ALIVE = 0x1 (response only, not a command)
253 *
254 * uCode issues this "alive" notification once the runtime image is ready
255 * to receive commands from the driver. This is the *second* "alive"
256 * notification that the driver will receive after rebooting uCode;
257 * this "alive" is indicated by subtype field != 9.
258 *
259 * See comments documenting "BSM" (bootstrap state machine).
260 *
261 * This response includes two pointers to structures within the device's
262 * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
263 *
264 * 1) log_event_table_ptr indicates base of the event log. This traces
265 * a 256-entry history of uCode execution within a circular buffer.
266 *
267 * 2) error_event_table_ptr indicates base of the error log. This contains
268 * information about any uCode error that occurs.
269 *
270 * The Linux driver can print both logs to the system log when a uCode error
271 * occurs.
272 */
273 struct iwl3945_alive_resp {
274 u8 ucode_minor;
275 u8 ucode_major;
276 __le16 reserved1;
277 u8 sw_rev[8];
278 u8 ver_type;
279 u8 ver_subtype; /* not "9" for runtime alive */
280 __le16 reserved2;
281 __le32 log_event_table_ptr; /* SRAM address for event log */
282 __le32 error_event_table_ptr; /* SRAM address for error log */
283 __le32 timestamp;
284 __le32 is_valid;
285 } __attribute__ ((packed));
286
287 union tsf {
288 u8 byte[8];
289 __le16 word[4];
290 __le32 dw[2];
291 };
292
293 /*
294 * REPLY_ERROR = 0x2 (response only, not a command)
295 */
296 struct iwl3945_error_resp {
297 __le32 error_type;
298 u8 cmd_id;
299 u8 reserved1;
300 __le16 bad_cmd_seq_num;
301 __le16 reserved2;
302 __le32 error_info;
303 union tsf timestamp;
304 } __attribute__ ((packed));
305
306 /******************************************************************************
307 * (1)
308 * RXON Commands & Responses:
309 *
310 *****************************************************************************/
311
312 /*
313 * Rx config defines & structure
314 */
315 /* rx_config device types */
316 enum {
317 RXON_DEV_TYPE_AP = 1,
318 RXON_DEV_TYPE_ESS = 3,
319 RXON_DEV_TYPE_IBSS = 4,
320 RXON_DEV_TYPE_SNIFFER = 6,
321 };
322
323 /* rx_config flags */
324 /* band & modulation selection */
325 #define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0)
326 #define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1)
327 /* auto detection enable */
328 #define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2)
329 /* TGg protection when tx */
330 #define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3)
331 /* cck short slot & preamble */
332 #define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4)
333 #define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5)
334 /* antenna selection */
335 #define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7)
336 #define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00)
337 #define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
338 #define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
339 /* radar detection enable */
340 #define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12)
341 #define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13)
342 /* rx response to host with 8-byte TSF
343 * (according to ON_AIR deassertion) */
344 #define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15)
345
346 /* rx_config filter flags */
347 /* accept all data frames */
348 #define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0)
349 /* pass control & management to host */
350 #define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1)
351 /* accept multi-cast */
352 #define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2)
353 /* don't decrypt uni-cast frames */
354 #define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3)
355 /* don't decrypt multi-cast frames */
356 #define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4)
357 /* STA is associated */
358 #define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5)
359 /* transfer to host non bssid beacons in associated state */
360 #define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6)
361
362 /**
363 * REPLY_RXON = 0x10 (command, has simple generic response)
364 *
365 * RXON tunes the radio tuner to a service channel, and sets up a number
366 * of parameters that are used primarily for Rx, but also for Tx operations.
367 *
368 * NOTE: When tuning to a new channel, driver must set the
369 * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent
370 * info within the device, including the station tables, tx retry
371 * rate tables, and txpower tables. Driver must build a new station
372 * table and txpower table before transmitting anything on the RXON
373 * channel.
374 *
375 * NOTE: All RXONs wipe clean the internal txpower table. Driver must
376 * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
377 * regardless of whether RXON_FILTER_ASSOC_MSK is set.
378 */
379 struct iwl3945_rxon_cmd {
380 u8 node_addr[6];
381 __le16 reserved1;
382 u8 bssid_addr[6];
383 __le16 reserved2;
384 u8 wlap_bssid_addr[6];
385 __le16 reserved3;
386 u8 dev_type;
387 u8 air_propagation;
388 __le16 reserved4;
389 u8 ofdm_basic_rates;
390 u8 cck_basic_rates;
391 __le16 assoc_id;
392 __le32 flags;
393 __le32 filter_flags;
394 __le16 channel;
395 __le16 reserved5;
396 } __attribute__ ((packed));
397
398 /*
399 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
400 */
401 struct iwl3945_rxon_assoc_cmd {
402 __le32 flags;
403 __le32 filter_flags;
404 u8 ofdm_basic_rates;
405 u8 cck_basic_rates;
406 __le16 reserved;
407 } __attribute__ ((packed));
408
409 /*
410 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
411 */
412 struct iwl3945_rxon_time_cmd {
413 union tsf timestamp;
414 __le16 beacon_interval;
415 __le16 atim_window;
416 __le32 beacon_init_val;
417 __le16 listen_interval;
418 __le16 reserved;
419 } __attribute__ ((packed));
420
421 /*
422 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
423 */
424 struct iwl3945_channel_switch_cmd {
425 u8 band;
426 u8 expect_beacon;
427 __le16 channel;
428 __le32 rxon_flags;
429 __le32 rxon_filter_flags;
430 __le32 switch_time;
431 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
432 } __attribute__ ((packed));
433
434 /*
435 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
436 */
437 struct iwl3945_csa_notification {
438 __le16 band;
439 __le16 channel;
440 __le32 status; /* 0 - OK, 1 - fail */
441 } __attribute__ ((packed));
442
443 /******************************************************************************
444 * (2)
445 * Quality-of-Service (QOS) Commands & Responses:
446 *
447 *****************************************************************************/
448
449 /**
450 * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM
451 * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd
452 *
453 * @cw_min: Contention window, start value in numbers of slots.
454 * Should be a power-of-2, minus 1. Device's default is 0x0f.
455 * @cw_max: Contention window, max value in numbers of slots.
456 * Should be a power-of-2, minus 1. Device's default is 0x3f.
457 * @aifsn: Number of slots in Arbitration Interframe Space (before
458 * performing random backoff timing prior to Tx). Device default 1.
459 * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0.
460 *
461 * Device will automatically increase contention window by (2*CW) + 1 for each
462 * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW
463 * value, to cap the CW value.
464 */
465 struct iwl3945_ac_qos {
466 __le16 cw_min;
467 __le16 cw_max;
468 u8 aifsn;
469 u8 reserved1;
470 __le16 edca_txop;
471 } __attribute__ ((packed));
472
473 /* QoS flags defines */
474 #define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01)
475 #define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02)
476 #define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10)
477
478 /* Number of Access Categories (AC) (EDCA), queues 0..3 */
479 #define AC_NUM 4
480
481 /*
482 * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
483 *
484 * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
485 * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
486 */
487 struct iwl3945_qosparam_cmd {
488 __le32 qos_flags;
489 struct iwl3945_ac_qos ac[AC_NUM];
490 } __attribute__ ((packed));
491
492 /******************************************************************************
493 * (3)
494 * Add/Modify Stations Commands & Responses:
495 *
496 *****************************************************************************/
497 /*
498 * Multi station support
499 */
500
501 /* Special, dedicated locations within device's station table */
502 #define IWL_AP_ID 0
503 #define IWL_MULTICAST_ID 1
504 #define IWL_STA_ID 2
505 #define IWL3945_BROADCAST_ID 24
506 #define IWL3945_STATION_COUNT 25
507
508 #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
509 #define IWL_INVALID_STATION 255
510
511 #define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1 << 2);
512 #define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1 << 8);
513
514 /* Use in mode field. 1: modify existing entry, 0: add new station entry */
515 #define STA_CONTROL_MODIFY_MSK 0x01
516
517 /* key flags __le16*/
518 #define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x0007)
519 #define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0000)
520 #define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x0001)
521 #define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x0002)
522 #define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x0003)
523
524 #define STA_KEY_FLG_KEYID_POS 8
525 #define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800)
526 /* wep key is either from global key (0) or from station info array (1) */
527 #define STA_KEY_FLG_WEP_KEY_MAP_MSK __constant_cpu_to_le16(0x0008)
528
529 /* wep key in STA: 5-bytes (0) or 13-bytes (1) */
530 #define STA_KEY_FLG_KEY_SIZE_MSK __constant_cpu_to_le16(0x1000)
531 #define STA_KEY_MULTICAST_MSK __constant_cpu_to_le16(0x4000)
532
533 /* Flags indicate whether to modify vs. don't change various station params */
534 #define STA_MODIFY_KEY_MASK 0x01
535 #define STA_MODIFY_TID_DISABLE_TX 0x02
536 #define STA_MODIFY_TX_RATE_MSK 0x04
537
538 /*
539 * Antenna masks:
540 * bit14:15 01 B inactive, A active
541 * 10 B active, A inactive
542 * 11 Both active
543 */
544 #define RATE_MCS_ANT_A_POS 14
545 #define RATE_MCS_ANT_B_POS 15
546 #define RATE_MCS_ANT_A_MSK 0x4000
547 #define RATE_MCS_ANT_B_MSK 0x8000
548 #define RATE_MCS_ANT_AB_MSK 0xc000
549
550 struct iwl3945_keyinfo {
551 __le16 key_flags;
552 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
553 u8 reserved1;
554 __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
555 u8 key_offset;
556 u8 reserved2;
557 u8 key[16]; /* 16-byte unicast decryption key */
558 } __attribute__ ((packed));
559
560 /**
561 * struct sta_id_modify
562 * @addr[ETH_ALEN]: station's MAC address
563 * @sta_id: index of station in uCode's station table
564 * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change
565 *
566 * Driver selects unused table index when adding new station,
567 * or the index to a pre-existing station entry when modifying that station.
568 * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP).
569 *
570 * modify_mask flags select which parameters to modify vs. leave alone.
571 */
572 struct sta_id_modify {
573 u8 addr[ETH_ALEN];
574 __le16 reserved1;
575 u8 sta_id;
576 u8 modify_mask;
577 __le16 reserved2;
578 } __attribute__ ((packed));
579
580 /*
581 * REPLY_ADD_STA = 0x18 (command)
582 *
583 * The device contains an internal table of per-station information,
584 * with info on security keys, aggregation parameters, and Tx rates for
585 * initial Tx attempt and any retries (4965 uses REPLY_TX_LINK_QUALITY_CMD,
586 * 3945 uses REPLY_RATE_SCALE to set up rate tables).
587 *
588 * REPLY_ADD_STA sets up the table entry for one station, either creating
589 * a new entry, or modifying a pre-existing one.
590 *
591 * NOTE: RXON command (without "associated" bit set) wipes the station table
592 * clean. Moving into RF_KILL state does this also. Driver must set up
593 * new station table before transmitting anything on the RXON channel
594 * (except active scans or active measurements; those commands carry
595 * their own txpower/rate setup data).
596 *
597 * When getting started on a new channel, driver must set up the
598 * IWL_BROADCAST_ID entry (last entry in the table). For a client
599 * station in a BSS, once an AP is selected, driver sets up the AP STA
600 * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP
601 * are all that are needed for a BSS client station. If the device is
602 * used as AP, or in an IBSS network, driver must set up station table
603 * entries for all STAs in network, starting with index IWL_STA_ID.
604 */
605 struct iwl3945_addsta_cmd {
606 u8 mode; /* 1: modify existing, 0: add new station */
607 u8 reserved[3];
608 struct sta_id_modify sta;
609 struct iwl3945_keyinfo key;
610 __le32 station_flags; /* STA_FLG_* */
611 __le32 station_flags_msk; /* STA_FLG_* */
612
613 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
614 * corresponding to bit (e.g. bit 5 controls TID 5).
615 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
616 __le16 tid_disable_tx;
617
618 __le16 rate_n_flags;
619
620 /* TID for which to add block-ack support.
621 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
622 u8 add_immediate_ba_tid;
623
624 /* TID for which to remove block-ack support.
625 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
626 u8 remove_immediate_ba_tid;
627
628 /* Starting Sequence Number for added block-ack support.
629 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
630 __le16 add_immediate_ba_ssn;
631 } __attribute__ ((packed));
632
633 #define ADD_STA_SUCCESS_MSK 0x1
634 #define ADD_STA_NO_ROOM_IN_TABLE 0x2
635 #define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4
636 /*
637 * REPLY_ADD_STA = 0x18 (response)
638 */
639 struct iwl3945_add_sta_resp {
640 u8 status; /* ADD_STA_* */
641 } __attribute__ ((packed));
642
643
644 /******************************************************************************
645 * (4)
646 * Rx Responses:
647 *
648 *****************************************************************************/
649
650 struct iwl3945_rx_frame_stats {
651 u8 phy_count;
652 u8 id;
653 u8 rssi;
654 u8 agc;
655 __le16 sig_avg;
656 __le16 noise_diff;
657 u8 payload[0];
658 } __attribute__ ((packed));
659
660 struct iwl3945_rx_frame_hdr {
661 __le16 channel;
662 __le16 phy_flags;
663 u8 reserved1;
664 u8 rate;
665 __le16 len;
666 u8 payload[0];
667 } __attribute__ ((packed));
668
669 #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0)
670 #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1)
671
672 #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0)
673 #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1)
674 #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2)
675 #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3)
676 #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0)
677
678 #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
679 #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
680 #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
681 #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
682 #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
683
684 #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
685 #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
686 #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
687 #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
688 #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
689
690 struct iwl3945_rx_frame_end {
691 __le32 status;
692 __le64 timestamp;
693 __le32 beacon_timestamp;
694 } __attribute__ ((packed));
695
696 /*
697 * REPLY_3945_RX = 0x1b (response only, not a command)
698 *
699 * NOTE: DO NOT dereference from casts to this structure
700 * It is provided only for calculating minimum data set size.
701 * The actual offsets of the hdr and end are dynamic based on
702 * stats.phy_count
703 */
704 struct iwl3945_rx_frame {
705 struct iwl3945_rx_frame_stats stats;
706 struct iwl3945_rx_frame_hdr hdr;
707 struct iwl3945_rx_frame_end end;
708 } __attribute__ ((packed));
709
710 /* Fixed (non-configurable) rx data from phy */
711 #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
712 #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
713 #define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
714 #define IWL_AGC_DB_POS (7)
715 struct iwl4965_rx_non_cfg_phy {
716 __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
717 __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
718 u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
719 u8 pad[0];
720 } __attribute__ ((packed));
721
722 /*
723 * REPLY_4965_RX = 0xc3 (response only, not a command)
724 * Used only for legacy (non 11n) frames.
725 */
726 #define RX_RES_PHY_CNT 14
727 struct iwl4965_rx_phy_res {
728 u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
729 u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
730 u8 stat_id; /* configurable DSP phy data set ID */
731 u8 reserved1;
732 __le64 timestamp; /* TSF at on air rise */
733 __le32 beacon_time_stamp; /* beacon at on-air rise */
734 __le16 phy_flags; /* general phy flags: band, modulation, ... */
735 __le16 channel; /* channel number */
736 __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */
737 __le32 reserved2;
738 __le32 rate_n_flags;
739 __le16 byte_count; /* frame's byte-count */
740 __le16 reserved3;
741 } __attribute__ ((packed));
742
743 struct iwl4965_rx_mpdu_res_start {
744 __le16 byte_count;
745 __le16 reserved;
746 } __attribute__ ((packed));
747
748
749 /******************************************************************************
750 * (5)
751 * Tx Commands & Responses:
752 *
753 * Driver must place each REPLY_TX command into one of the prioritized Tx
754 * queues in host DRAM, shared between driver and device. When the device's
755 * Tx scheduler and uCode are preparing to transmit, the device pulls the
756 * Tx command over the PCI bus via one of the device's Tx DMA channels,
757 * to fill an internal FIFO from which data will be transmitted.
758 *
759 * uCode handles all timing and protocol related to control frames
760 * (RTS/CTS/ACK), based on flags in the Tx command.
761 *
762 * uCode handles retrying Tx when an ACK is expected but not received.
763 * This includes trying lower data rates than the one requested in the Tx
764 * command, as set up by the REPLY_RATE_SCALE (for 3945) or
765 * REPLY_TX_LINK_QUALITY_CMD (4965).
766 *
767 * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
768 * This command must be executed after every RXON command, before Tx can occur.
769 *****************************************************************************/
770
771 /* REPLY_TX Tx flags field */
772
773 /* 1: Use Request-To-Send protocol before this frame.
774 * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */
775 #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1)
776
777 /* 1: Transmit Clear-To-Send to self before this frame.
778 * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
779 * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */
780 #define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2)
781
782 /* 1: Expect ACK from receiving station
783 * 0: Don't expect ACK (MAC header's duration field s/b 0)
784 * Set this for unicast frames, but not broadcast/multicast. */
785 #define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3)
786
787 /* 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD).
788 * Tx command's initial_rate_index indicates first rate to try;
789 * uCode walks through table for additional Tx attempts.
790 * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
791 * This rate will be used for all Tx attempts; it will not be scaled. */
792 #define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4)
793
794 /* 1: Expect immediate block-ack.
795 * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
796 #define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6)
797
798 /* 1: Frame requires full Tx-Op protection.
799 * Set this if either RTS or CTS Tx Flag gets set. */
800 #define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7)
801
802 /* Tx antenna selection field; used only for 3945, reserved (0) for 4965.
803 * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
804 #define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00)
805 #define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
806 #define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
807
808 /* 1: Ignore Bluetooth priority for this frame.
809 * 0: Delay Tx until Bluetooth device is done (normal usage). */
810 #define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12)
811
812 /* 1: uCode overrides sequence control field in MAC header.
813 * 0: Driver provides sequence control field in MAC header.
814 * Set this for management frames, non-QOS data frames, non-unicast frames,
815 * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */
816 #define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13)
817
818 /* 1: This frame is non-last MPDU; more fragments are coming.
819 * 0: Last fragment, or not using fragmentation. */
820 #define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14)
821
822 /* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
823 * 0: No TSF required in outgoing frame.
824 * Set this for transmitting beacons and probe responses. */
825 #define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16)
826
827 /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
828 * alignment of frame's payload data field.
829 * 0: No pad
830 * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
831 * field (but not both). Driver must align frame data (i.e. data following
832 * MAC header) to DWORD boundary. */
833 #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
834
835 /* HCCA-AP - disable duration overwriting. */
836 #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
837
838 /*
839 * TX command security control
840 */
841 #define TX_CMD_SEC_WEP 0x01
842 #define TX_CMD_SEC_CCM 0x02
843 #define TX_CMD_SEC_TKIP 0x03
844 #define TX_CMD_SEC_MSK 0x03
845 #define TX_CMD_SEC_SHIFT 6
846 #define TX_CMD_SEC_KEY128 0x08
847
848 /*
849 * REPLY_TX = 0x1c (command)
850 */
851 struct iwl3945_tx_cmd {
852 /*
853 * MPDU byte count:
854 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
855 * + 8 byte IV for CCM or TKIP (not used for WEP)
856 * + Data payload
857 * + 8-byte MIC (not used for CCM/WEP)
858 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
859 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
860 * Range: 14-2342 bytes.
861 */
862 __le16 len;
863
864 /*
865 * MPDU or MSDU byte count for next frame.
866 * Used for fragmentation and bursting, but not 11n aggregation.
867 * Same as "len", but for next frame. Set to 0 if not applicable.
868 */
869 __le16 next_frame_len;
870
871 __le32 tx_flags; /* TX_CMD_FLG_* */
872
873 u8 rate;
874
875 /* Index of recipient station in uCode's station table */
876 u8 sta_id;
877 u8 tid_tspec;
878 u8 sec_ctl;
879 u8 key[16];
880 union {
881 u8 byte[8];
882 __le16 word[4];
883 __le32 dw[2];
884 } tkip_mic;
885 __le32 next_frame_info;
886 union {
887 __le32 life_time;
888 __le32 attempt;
889 } stop_time;
890 u8 supp_rates[2];
891 u8 rts_retry_limit; /*byte 50 */
892 u8 data_retry_limit; /*byte 51 */
893 union {
894 __le16 pm_frame_timeout;
895 __le16 attempt_duration;
896 } timeout;
897
898 /*
899 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
900 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
901 */
902 __le16 driver_txop;
903
904 /*
905 * MAC header goes here, followed by 2 bytes padding if MAC header
906 * length is 26 or 30 bytes, followed by payload data
907 */
908 u8 payload[0];
909 struct ieee80211_hdr hdr[0];
910 } __attribute__ ((packed));
911
912 /* TX command response is sent after *all* transmission attempts.
913 *
914 * NOTES:
915 *
916 * TX_STATUS_FAIL_NEXT_FRAG
917 *
918 * If the fragment flag in the MAC header for the frame being transmitted
919 * is set and there is insufficient time to transmit the next frame, the
920 * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
921 *
922 * TX_STATUS_FIFO_UNDERRUN
923 *
924 * Indicates the host did not provide bytes to the FIFO fast enough while
925 * a TX was in progress.
926 *
927 * TX_STATUS_FAIL_MGMNT_ABORT
928 *
929 * This status is only possible if the ABORT ON MGMT RX parameter was
930 * set to true with the TX command.
931 *
932 * If the MSB of the status parameter is set then an abort sequence is
933 * required. This sequence consists of the host activating the TX Abort
934 * control line, and then waiting for the TX Abort command response. This
935 * indicates that a the device is no longer in a transmit state, and that the
936 * command FIFO has been cleared. The host must then deactivate the TX Abort
937 * control line. Receiving is still allowed in this case.
938 */
939 enum {
940 TX_STATUS_SUCCESS = 0x01,
941 TX_STATUS_DIRECT_DONE = 0x02,
942 TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
943 TX_STATUS_FAIL_LONG_LIMIT = 0x83,
944 TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
945 TX_STATUS_FAIL_MGMNT_ABORT = 0x85,
946 TX_STATUS_FAIL_NEXT_FRAG = 0x86,
947 TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
948 TX_STATUS_FAIL_DEST_PS = 0x88,
949 TX_STATUS_FAIL_ABORTED = 0x89,
950 TX_STATUS_FAIL_BT_RETRY = 0x8a,
951 TX_STATUS_FAIL_STA_INVALID = 0x8b,
952 TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
953 TX_STATUS_FAIL_TID_DISABLE = 0x8d,
954 TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
955 TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
956 TX_STATUS_FAIL_TX_LOCKED = 0x90,
957 TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
958 };
959
960 #define TX_PACKET_MODE_REGULAR 0x0000
961 #define TX_PACKET_MODE_BURST_SEQ 0x0100
962 #define TX_PACKET_MODE_BURST_FIRST 0x0200
963
964 enum {
965 TX_POWER_PA_NOT_ACTIVE = 0x0,
966 };
967
968 enum {
969 TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
970 TX_STATUS_DELAY_MSK = 0x00000040,
971 TX_STATUS_ABORT_MSK = 0x00000080,
972 TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
973 TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
974 TX_RESERVED = 0x00780000, /* bits 19:22 */
975 TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
976 TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
977 };
978
979 /*
980 * REPLY_TX = 0x1c (response)
981 */
982 struct iwl3945_tx_resp {
983 u8 failure_rts;
984 u8 failure_frame;
985 u8 bt_kill_count;
986 u8 rate;
987 __le32 wireless_media_time;
988 __le32 status; /* TX status */
989 } __attribute__ ((packed));
990
991 /*
992 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
993 */
994 struct iwl3945_txpowertable_cmd {
995 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
996 u8 reserved;
997 __le16 channel;
998 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
999 } __attribute__ ((packed));
1000
1001 struct iwl3945_rate_scaling_info {
1002 __le16 rate_n_flags;
1003 u8 try_cnt;
1004 u8 next_rate_index;
1005 } __attribute__ ((packed));
1006
1007 /**
1008 * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
1009 *
1010 * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
1011 *
1012 * NOTE: The table of rates passed to the uCode via the
1013 * RATE_SCALE command sets up the corresponding order of
1014 * rates used for all related commands, including rate
1015 * masks, etc.
1016 *
1017 * For example, if you set 9MB (PLCP 0x0f) as the first
1018 * rate in the rate table, the bit mask for that rate
1019 * when passed through ofdm_basic_rates on the REPLY_RXON
1020 * command would be bit 0 (1 << 0)
1021 */
1022 struct iwl3945_rate_scaling_cmd {
1023 u8 table_id;
1024 u8 reserved[3];
1025 struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
1026 } __attribute__ ((packed));
1027
1028 /*
1029 * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
1030 *
1031 * 3945 and 4965 support hardware handshake with Bluetooth device on
1032 * same platform. Bluetooth device alerts wireless device when it will Tx;
1033 * wireless device can delay or kill its own Tx to accomodate.
1034 */
1035 struct iwl3945_bt_cmd {
1036 u8 flags;
1037 u8 lead_time;
1038 u8 max_kill;
1039 u8 reserved;
1040 __le32 kill_ack_mask;
1041 __le32 kill_cts_mask;
1042 } __attribute__ ((packed));
1043
1044 /******************************************************************************
1045 * (6)
1046 * Spectrum Management (802.11h) Commands, Responses, Notifications:
1047 *
1048 *****************************************************************************/
1049
1050 /*
1051 * Spectrum Management
1052 */
1053 #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
1054 RXON_FILTER_CTL2HOST_MSK | \
1055 RXON_FILTER_ACCEPT_GRP_MSK | \
1056 RXON_FILTER_DIS_DECRYPT_MSK | \
1057 RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
1058 RXON_FILTER_ASSOC_MSK | \
1059 RXON_FILTER_BCON_AWARE_MSK)
1060
1061 struct iwl3945_measure_channel {
1062 __le32 duration; /* measurement duration in extended beacon
1063 * format */
1064 u8 channel; /* channel to measure */
1065 u8 type; /* see enum iwl3945_measure_type */
1066 __le16 reserved;
1067 } __attribute__ ((packed));
1068
1069 /*
1070 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
1071 */
1072 struct iwl3945_spectrum_cmd {
1073 __le16 len; /* number of bytes starting from token */
1074 u8 token; /* token id */
1075 u8 id; /* measurement id -- 0 or 1 */
1076 u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
1077 u8 periodic; /* 1 = periodic */
1078 __le16 path_loss_timeout;
1079 __le32 start_time; /* start time in extended beacon format */
1080 __le32 reserved2;
1081 __le32 flags; /* rxon flags */
1082 __le32 filter_flags; /* rxon filter flags */
1083 __le16 channel_count; /* minimum 1, maximum 10 */
1084 __le16 reserved3;
1085 struct iwl3945_measure_channel channels[10];
1086 } __attribute__ ((packed));
1087
1088 /*
1089 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
1090 */
1091 struct iwl3945_spectrum_resp {
1092 u8 token;
1093 u8 id; /* id of the prior command replaced, or 0xff */
1094 __le16 status; /* 0 - command will be handled
1095 * 1 - cannot handle (conflicts with another
1096 * measurement) */
1097 } __attribute__ ((packed));
1098
1099 enum iwl3945_measurement_state {
1100 IWL_MEASUREMENT_START = 0,
1101 IWL_MEASUREMENT_STOP = 1,
1102 };
1103
1104 enum iwl3945_measurement_status {
1105 IWL_MEASUREMENT_OK = 0,
1106 IWL_MEASUREMENT_CONCURRENT = 1,
1107 IWL_MEASUREMENT_CSA_CONFLICT = 2,
1108 IWL_MEASUREMENT_TGH_CONFLICT = 3,
1109 /* 4-5 reserved */
1110 IWL_MEASUREMENT_STOPPED = 6,
1111 IWL_MEASUREMENT_TIMEOUT = 7,
1112 IWL_MEASUREMENT_PERIODIC_FAILED = 8,
1113 };
1114
1115 #define NUM_ELEMENTS_IN_HISTOGRAM 8
1116
1117 struct iwl3945_measurement_histogram {
1118 __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
1119 __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
1120 } __attribute__ ((packed));
1121
1122 /* clear channel availability counters */
1123 struct iwl3945_measurement_cca_counters {
1124 __le32 ofdm;
1125 __le32 cck;
1126 } __attribute__ ((packed));
1127
1128 enum iwl3945_measure_type {
1129 IWL_MEASURE_BASIC = (1 << 0),
1130 IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
1131 IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
1132 IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
1133 IWL_MEASURE_FRAME = (1 << 4),
1134 /* bits 5:6 are reserved */
1135 IWL_MEASURE_IDLE = (1 << 7),
1136 };
1137
1138 /*
1139 * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
1140 */
1141 struct iwl3945_spectrum_notification {
1142 u8 id; /* measurement id -- 0 or 1 */
1143 u8 token;
1144 u8 channel_index; /* index in measurement channel list */
1145 u8 state; /* 0 - start, 1 - stop */
1146 __le32 start_time; /* lower 32-bits of TSF */
1147 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
1148 u8 channel;
1149 u8 type; /* see enum iwl3945_measurement_type */
1150 u8 reserved1;
1151 /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
1152 * valid if applicable for measurement type requested. */
1153 __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
1154 __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
1155 __le32 cca_time; /* channel load time in usecs */
1156 u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
1157 * unidentified */
1158 u8 reserved2[3];
1159 struct iwl3945_measurement_histogram histogram;
1160 __le32 stop_time; /* lower 32-bits of TSF */
1161 __le32 status; /* see iwl3945_measurement_status */
1162 } __attribute__ ((packed));
1163
1164 /******************************************************************************
1165 * (7)
1166 * Power Management Commands, Responses, Notifications:
1167 *
1168 *****************************************************************************/
1169
1170 /**
1171 * struct iwl3945_powertable_cmd - Power Table Command
1172 * @flags: See below:
1173 *
1174 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
1175 *
1176 * PM allow:
1177 * bit 0 - '0' Driver not allow power management
1178 * '1' Driver allow PM (use rest of parameters)
1179 * uCode send sleep notifications:
1180 * bit 1 - '0' Don't send sleep notification
1181 * '1' send sleep notification (SEND_PM_NOTIFICATION)
1182 * Sleep over DTIM
1183 * bit 2 - '0' PM have to walk up every DTIM
1184 * '1' PM could sleep over DTIM till listen Interval.
1185 * PCI power managed
1186 * bit 3 - '0' (PCI_LINK_CTRL & 0x1)
1187 * '1' !(PCI_LINK_CTRL & 0x1)
1188 * Force sleep Modes
1189 * bit 31/30- '00' use both mac/xtal sleeps
1190 * '01' force Mac sleep
1191 * '10' force xtal sleep
1192 * '11' Illegal set
1193 *
1194 * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
1195 * ucode assume sleep over DTIM is allowed and we don't need to wakeup
1196 * for every DTIM.
1197 */
1198 #define IWL_POWER_VEC_SIZE 5
1199
1200 #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1 << 0)
1201 #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1 << 2)
1202 #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1 << 3)
1203 struct iwl3945_powertable_cmd {
1204 __le32 flags;
1205 __le32 rx_data_timeout;
1206 __le32 tx_data_timeout;
1207 __le32 sleep_interval[IWL_POWER_VEC_SIZE];
1208 } __attribute__((packed));
1209
1210 /*
1211 * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
1212 * 3945 and 4965 identical.
1213 */
1214 struct iwl3945_sleep_notification {
1215 u8 pm_sleep_mode;
1216 u8 pm_wakeup_src;
1217 __le16 reserved;
1218 __le32 sleep_time;
1219 __le32 tsf_low;
1220 __le32 bcon_timer;
1221 } __attribute__ ((packed));
1222
1223 /* Sleep states. 3945 and 4965 identical. */
1224 enum {
1225 IWL_PM_NO_SLEEP = 0,
1226 IWL_PM_SLP_MAC = 1,
1227 IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
1228 IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
1229 IWL_PM_SLP_PHY = 4,
1230 IWL_PM_SLP_REPENT = 5,
1231 IWL_PM_WAKEUP_BY_TIMER = 6,
1232 IWL_PM_WAKEUP_BY_DRIVER = 7,
1233 IWL_PM_WAKEUP_BY_RFKILL = 8,
1234 /* 3 reserved */
1235 IWL_PM_NUM_OF_MODES = 12,
1236 };
1237
1238 /*
1239 * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
1240 */
1241 #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */
1242 #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */
1243 #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */
1244 struct iwl3945_card_state_cmd {
1245 __le32 status; /* CARD_STATE_CMD_* request new power state */
1246 } __attribute__ ((packed));
1247
1248 /*
1249 * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
1250 */
1251 struct iwl3945_card_state_notif {
1252 __le32 flags;
1253 } __attribute__ ((packed));
1254
1255 #define HW_CARD_DISABLED 0x01
1256 #define SW_CARD_DISABLED 0x02
1257 #define RF_CARD_DISABLED 0x04
1258 #define RXON_CARD_DISABLED 0x10
1259
1260 struct iwl3945_ct_kill_config {
1261 __le32 reserved;
1262 __le32 critical_temperature_M;
1263 __le32 critical_temperature_R;
1264 } __attribute__ ((packed));
1265
1266 /******************************************************************************
1267 * (8)
1268 * Scan Commands, Responses, Notifications:
1269 *
1270 *****************************************************************************/
1271
1272 /**
1273 * struct iwl3945_scan_channel - entry in REPLY_SCAN_CMD channel table
1274 *
1275 * One for each channel in the scan list.
1276 * Each channel can independently select:
1277 * 1) SSID for directed active scans
1278 * 2) Txpower setting (for rate specified within Tx command)
1279 * 3) How long to stay on-channel (behavior may be modified by quiet_time,
1280 * quiet_plcp_th, good_CRC_th)
1281 *
1282 * To avoid uCode errors, make sure the following are true (see comments
1283 * under struct iwl3945_scan_cmd about max_out_time and quiet_time):
1284 * 1) If using passive_dwell (i.e. passive_dwell != 0):
1285 * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
1286 * 2) quiet_time <= active_dwell
1287 * 3) If restricting off-channel time (i.e. max_out_time !=0):
1288 * passive_dwell < max_out_time
1289 * active_dwell < max_out_time
1290 */
1291 struct iwl3945_scan_channel {
1292 /*
1293 * type is defined as:
1294 * 0:0 1 = active, 0 = passive
1295 * 1:4 SSID direct bit map; if a bit is set, then corresponding
1296 * SSID IE is transmitted in probe request.
1297 * 5:7 reserved
1298 */
1299 u8 type;
1300 u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */
1301 struct iwl3945_tx_power tpc;
1302 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
1303 __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
1304 } __attribute__ ((packed));
1305
1306 /**
1307 * struct iwl3945_ssid_ie - directed scan network information element
1308 *
1309 * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field
1310 * in struct iwl3945_scan_channel; each channel may select different ssids from
1311 * among the 4 entries. SSID IEs get transmitted in reverse order of entry.
1312 */
1313 struct iwl3945_ssid_ie {
1314 u8 id;
1315 u8 len;
1316 u8 ssid[32];
1317 } __attribute__ ((packed));
1318
1319 #define PROBE_OPTION_MAX 0x4
1320 #define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF)
1321 #define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1)
1322 #define IWL_MAX_SCAN_SIZE 1024
1323
1324 /*
1325 * REPLY_SCAN_CMD = 0x80 (command)
1326 *
1327 * The hardware scan command is very powerful; the driver can set it up to
1328 * maintain (relatively) normal network traffic while doing a scan in the
1329 * background. The max_out_time and suspend_time control the ratio of how
1330 * long the device stays on an associated network channel ("service channel")
1331 * vs. how long it's away from the service channel, tuned to other channels
1332 * for scanning.
1333 *
1334 * max_out_time is the max time off-channel (in usec), and suspend_time
1335 * is how long (in "extended beacon" format) that the scan is "suspended"
1336 * after returning to the service channel. That is, suspend_time is the
1337 * time that we stay on the service channel, doing normal work, between
1338 * scan segments. The driver may set these parameters differently to support
1339 * scanning when associated vs. not associated, and light vs. heavy traffic
1340 * loads when associated.
1341 *
1342 * After receiving this command, the device's scan engine does the following;
1343 *
1344 * 1) Sends SCAN_START notification to driver
1345 * 2) Checks to see if it has time to do scan for one channel
1346 * 3) Sends NULL packet, with power-save (PS) bit set to 1,
1347 * to tell AP that we're going off-channel
1348 * 4) Tunes to first channel in scan list, does active or passive scan
1349 * 5) Sends SCAN_RESULT notification to driver
1350 * 6) Checks to see if it has time to do scan on *next* channel in list
1351 * 7) Repeats 4-6 until it no longer has time to scan the next channel
1352 * before max_out_time expires
1353 * 8) Returns to service channel
1354 * 9) Sends NULL packet with PS=0 to tell AP that we're back
1355 * 10) Stays on service channel until suspend_time expires
1356 * 11) Repeats entire process 2-10 until list is complete
1357 * 12) Sends SCAN_COMPLETE notification
1358 *
1359 * For fast, efficient scans, the scan command also has support for staying on
1360 * a channel for just a short time, if doing active scanning and getting no
1361 * responses to the transmitted probe request. This time is controlled by
1362 * quiet_time, and the number of received packets below which a channel is
1363 * considered "quiet" is controlled by quiet_plcp_threshold.
1364 *
1365 * For active scanning on channels that have regulatory restrictions against
1366 * blindly transmitting, the scan can listen before transmitting, to make sure
1367 * that there is already legitimate activity on the channel. If enough
1368 * packets are cleanly received on the channel (controlled by good_CRC_th,
1369 * typical value 1), the scan engine starts transmitting probe requests.
1370 *
1371 * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
1372 *
1373 * To avoid uCode errors, see timing restrictions described under
1374 * struct iwl3945_scan_channel.
1375 */
1376 struct iwl3945_scan_cmd {
1377 __le16 len;
1378 u8 reserved0;
1379 u8 channel_count; /* # channels in channel list */
1380 __le16 quiet_time; /* dwell only this # millisecs on quiet channel
1381 * (only for active scan) */
1382 __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
1383 __le16 good_CRC_th; /* passive -> active promotion threshold */
1384 __le16 reserved1;
1385 __le32 max_out_time; /* max usec to be away from associated (service)
1386 * channel */
1387 __le32 suspend_time; /* pause scan this long (in "extended beacon
1388 * format") when returning to service channel:
1389 * 3945; 31:24 # beacons, 19:0 additional usec,
1390 * 4965; 31:22 # beacons, 21:0 additional usec.
1391 */
1392 __le32 flags; /* RXON_FLG_* */
1393 __le32 filter_flags; /* RXON_FILTER_* */
1394
1395 /* For active scans (set to all-0s for passive scans).
1396 * Does not include payload. Must specify Tx rate; no rate scaling. */
1397 struct iwl3945_tx_cmd tx_cmd;
1398
1399 /* For directed active scans (set to all-0s otherwise) */
1400 struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX];
1401
1402 /*
1403 * Probe request frame, followed by channel list.
1404 *
1405 * Size of probe request frame is specified by byte count in tx_cmd.
1406 * Channel list follows immediately after probe request frame.
1407 * Number of channels in list is specified by channel_count.
1408 * Each channel in list is of type:
1409 *
1410 * struct iwl3945_scan_channel channels[0];
1411 *
1412 * NOTE: Only one band of channels can be scanned per pass. You
1413 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
1414 * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
1415 * before requesting another scan.
1416 */
1417 u8 data[0];
1418 } __attribute__ ((packed));
1419
1420 /* Can abort will notify by complete notification with abort status. */
1421 #define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1)
1422 /* complete notification statuses */
1423 #define ABORT_STATUS 0x2
1424
1425 /*
1426 * REPLY_SCAN_CMD = 0x80 (response)
1427 */
1428 struct iwl3945_scanreq_notification {
1429 __le32 status; /* 1: okay, 2: cannot fulfill request */
1430 } __attribute__ ((packed));
1431
1432 /*
1433 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
1434 */
1435 struct iwl3945_scanstart_notification {
1436 __le32 tsf_low;
1437 __le32 tsf_high;
1438 __le32 beacon_timer;
1439 u8 channel;
1440 u8 band;
1441 u8 reserved[2];
1442 __le32 status;
1443 } __attribute__ ((packed));
1444
1445 #define SCAN_OWNER_STATUS 0x1;
1446 #define MEASURE_OWNER_STATUS 0x2;
1447
1448 #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
1449 /*
1450 * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
1451 */
1452 struct iwl3945_scanresults_notification {
1453 u8 channel;
1454 u8 band;
1455 u8 reserved[2];
1456 __le32 tsf_low;
1457 __le32 tsf_high;
1458 __le32 statistics[NUMBER_OF_STATISTICS];
1459 } __attribute__ ((packed));
1460
1461 /*
1462 * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
1463 */
1464 struct iwl3945_scancomplete_notification {
1465 u8 scanned_channels;
1466 u8 status;
1467 u8 reserved;
1468 u8 last_channel;
1469 __le32 tsf_low;
1470 __le32 tsf_high;
1471 } __attribute__ ((packed));
1472
1473
1474 /******************************************************************************
1475 * (9)
1476 * IBSS/AP Commands and Notifications:
1477 *
1478 *****************************************************************************/
1479
1480 /*
1481 * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
1482 */
1483 struct iwl3945_beacon_notif {
1484 struct iwl3945_tx_resp beacon_notify_hdr;
1485 __le32 low_tsf;
1486 __le32 high_tsf;
1487 __le32 ibss_mgr_status;
1488 } __attribute__ ((packed));
1489
1490 /*
1491 * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
1492 */
1493 struct iwl3945_tx_beacon_cmd {
1494 struct iwl3945_tx_cmd tx;
1495 __le16 tim_idx;
1496 u8 tim_size;
1497 u8 reserved1;
1498 struct ieee80211_hdr frame[0]; /* beacon frame */
1499 } __attribute__ ((packed));
1500
1501 /******************************************************************************
1502 * (10)
1503 * Statistics Commands and Notifications:
1504 *
1505 *****************************************************************************/
1506
1507 #define IWL_TEMP_CONVERT 260
1508
1509 #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
1510 #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
1511 #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
1512
1513 /* Used for passing to driver number of successes and failures per rate */
1514 struct rate_histogram {
1515 union {
1516 __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
1517 __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
1518 __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
1519 } success;
1520 union {
1521 __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
1522 __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
1523 __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
1524 } failed;
1525 } __attribute__ ((packed));
1526
1527 /* statistics command response */
1528
1529 struct statistics_rx_phy {
1530 __le32 ina_cnt;
1531 __le32 fina_cnt;
1532 __le32 plcp_err;
1533 __le32 crc32_err;
1534 __le32 overrun_err;
1535 __le32 early_overrun_err;
1536 __le32 crc32_good;
1537 __le32 false_alarm_cnt;
1538 __le32 fina_sync_err_cnt;
1539 __le32 sfd_timeout;
1540 __le32 fina_timeout;
1541 __le32 unresponded_rts;
1542 __le32 rxe_frame_limit_overrun;
1543 __le32 sent_ack_cnt;
1544 __le32 sent_cts_cnt;
1545 } __attribute__ ((packed));
1546
1547 struct statistics_rx_non_phy {
1548 __le32 bogus_cts; /* CTS received when not expecting CTS */
1549 __le32 bogus_ack; /* ACK received when not expecting ACK */
1550 __le32 non_bssid_frames; /* number of frames with BSSID that
1551 * doesn't belong to the STA BSSID */
1552 __le32 filtered_frames; /* count frames that were dumped in the
1553 * filtering process */
1554 __le32 non_channel_beacons; /* beacons with our bss id but not on
1555 * our serving channel */
1556 } __attribute__ ((packed));
1557
1558 struct statistics_rx {
1559 struct statistics_rx_phy ofdm;
1560 struct statistics_rx_phy cck;
1561 struct statistics_rx_non_phy general;
1562 } __attribute__ ((packed));
1563
1564 struct statistics_tx {
1565 __le32 preamble_cnt;
1566 __le32 rx_detected_cnt;
1567 __le32 bt_prio_defer_cnt;
1568 __le32 bt_prio_kill_cnt;
1569 __le32 few_bytes_cnt;
1570 __le32 cts_timeout;
1571 __le32 ack_timeout;
1572 __le32 expected_ack_cnt;
1573 __le32 actual_ack_cnt;
1574 } __attribute__ ((packed));
1575
1576 struct statistics_dbg {
1577 __le32 burst_check;
1578 __le32 burst_count;
1579 __le32 reserved[4];
1580 } __attribute__ ((packed));
1581
1582 struct statistics_div {
1583 __le32 tx_on_a;
1584 __le32 tx_on_b;
1585 __le32 exec_time;
1586 __le32 probe_time;
1587 } __attribute__ ((packed));
1588
1589 struct statistics_general {
1590 __le32 temperature;
1591 struct statistics_dbg dbg;
1592 __le32 sleep_time;
1593 __le32 slots_out;
1594 __le32 slots_idle;
1595 __le32 ttl_timestamp;
1596 struct statistics_div div;
1597 } __attribute__ ((packed));
1598
1599 /*
1600 * REPLY_STATISTICS_CMD = 0x9c,
1601 * 3945 and 4965 identical.
1602 *
1603 * This command triggers an immediate response containing uCode statistics.
1604 * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
1605 *
1606 * If the CLEAR_STATS configuration flag is set, uCode will clear its
1607 * internal copy of the statistics (counters) after issuing the response.
1608 * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
1609 *
1610 * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
1611 * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
1612 * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
1613 */
1614 #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
1615 #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
1616 struct iwl3945_statistics_cmd {
1617 __le32 configuration_flags; /* IWL_STATS_CONF_* */
1618 } __attribute__ ((packed));
1619
1620 /*
1621 * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
1622 *
1623 * By default, uCode issues this notification after receiving a beacon
1624 * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
1625 * REPLY_STATISTICS_CMD 0x9c, above.
1626 *
1627 * Statistics counters continue to increment beacon after beacon, but are
1628 * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
1629 * 0x9c with CLEAR_STATS bit set (see above).
1630 *
1631 * uCode also issues this notification during scans. uCode clears statistics
1632 * appropriately so that each notification contains statistics for only the
1633 * one channel that has just been scanned.
1634 */
1635 #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2)
1636 #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)
1637 struct iwl3945_notif_statistics {
1638 __le32 flag;
1639 struct statistics_rx rx;
1640 struct statistics_tx tx;
1641 struct statistics_general general;
1642 } __attribute__ ((packed));
1643
1644
1645 /*
1646 * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
1647 */
1648 /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row,
1649 * then this notification will be sent. */
1650 #define CONSECUTIVE_MISSED_BCONS_TH 20
1651
1652 struct iwl3945_missed_beacon_notif {
1653 __le32 consequtive_missed_beacons;
1654 __le32 total_missed_becons;
1655 __le32 num_expected_beacons;
1656 __le32 num_recvd_beacons;
1657 } __attribute__ ((packed));
1658
1659 /******************************************************************************
1660 * (11)
1661 * Rx Calibration Commands:
1662 *
1663 *****************************************************************************/
1664
1665 #define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
1666 #define HD_TABLE_SIZE (11)
1667
1668 struct iwl3945_sensitivity_cmd {
1669 __le16 control;
1670 __le16 table[HD_TABLE_SIZE];
1671 } __attribute__ ((packed));
1672
1673 struct iwl3945_calibration_cmd {
1674 u8 opCode;
1675 u8 flags;
1676 __le16 reserved;
1677 s8 diff_gain_a;
1678 s8 diff_gain_b;
1679 s8 diff_gain_c;
1680 u8 reserved1;
1681 } __attribute__ ((packed));
1682
1683 /******************************************************************************
1684 * (12)
1685 * Miscellaneous Commands:
1686 *
1687 *****************************************************************************/
1688
1689 /*
1690 * LEDs Command & Response
1691 * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
1692 *
1693 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
1694 * this command turns it on or off, or sets up a periodic blinking cycle.
1695 */
1696 struct iwl3945_led_cmd {
1697 __le32 interval; /* "interval" in uSec */
1698 u8 id; /* 1: Activity, 2: Link, 3: Tech */
1699 u8 off; /* # intervals off while blinking;
1700 * "0", with >0 "on" value, turns LED on */
1701 u8 on; /* # intervals on while blinking;
1702 * "0", regardless of "off", turns LED off */
1703 u8 reserved;
1704 } __attribute__ ((packed));
1705
1706 /******************************************************************************
1707 * (13)
1708 * Union of all expected notifications/responses:
1709 *
1710 *****************************************************************************/
1711
1712 struct iwl3945_rx_packet {
1713 __le32 len;
1714 struct iwl3945_cmd_header hdr;
1715 union {
1716 struct iwl3945_alive_resp alive_frame;
1717 struct iwl3945_rx_frame rx_frame;
1718 struct iwl3945_tx_resp tx_resp;
1719 struct iwl3945_spectrum_notification spectrum_notif;
1720 struct iwl3945_csa_notification csa_notif;
1721 struct iwl3945_error_resp err_resp;
1722 struct iwl3945_card_state_notif card_state_notif;
1723 struct iwl3945_beacon_notif beacon_status;
1724 struct iwl3945_add_sta_resp add_sta;
1725 struct iwl3945_sleep_notification sleep_notif;
1726 struct iwl3945_spectrum_resp spectrum;
1727 struct iwl3945_notif_statistics stats;
1728 __le32 status;
1729 u8 raw[0];
1730 } u;
1731 } __attribute__ ((packed));
1732
1733 #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
1734
1735 #endif /* __iwl3945_3945_commands_h__ */
This page took 0.072157 seconds and 6 git commands to generate.