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