iwlwifi: mark more functions/variables static
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / net / wireless / iwlwifi / iwl-channel.h
blob023c3f240cea6f5212e886607ed7e400a4b81ac7
1 /******************************************************************************
3 * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
21 * Contact Information:
22 * James P. Ketrenos <ipw2100-admin@linux.intel.com>
23 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25 *****************************************************************************/
26 #ifndef __iwl_channel_h__
27 #define __iwl_channel_h__
29 #define IWL_NUM_SCAN_RATES (2)
31 struct iwl_channel_tgd_info {
32 u8 type;
33 s8 max_power;
36 struct iwl_channel_tgh_info {
37 s64 last_radar_time;
40 /* current Tx power values to use, one for each rate for each channel.
41 * requested power is limited by:
42 * -- regulatory EEPROM limits for this channel
43 * -- hardware capabilities (clip-powers)
44 * -- spectrum management
45 * -- user preference (e.g. iwconfig)
46 * when requested power is set, base power index must also be set. */
47 struct iwl_channel_power_info {
48 struct iwl_tx_power tpc; /* actual radio and DSP gain settings */
49 s8 power_table_index; /* actual (compenst'd) index into gain table */
50 s8 base_power_index; /* gain index for power at factory temp. */
51 s8 requested_power; /* power (dBm) requested for this chnl/rate */
54 /* current scan Tx power values to use, one for each scan rate for each
55 * channel. */
56 struct iwl_scan_power_info {
57 struct iwl_tx_power tpc; /* actual radio and DSP gain settings */
58 s8 power_table_index; /* actual (compenst'd) index into gain table */
59 s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */
62 /* Channel unlock period is 15 seconds. If no beacon or probe response
63 * has been received within 15 seconds on a locked channel then the channel
64 * remains locked. */
65 #define TX_UNLOCK_PERIOD 15
67 /* CSA lock period is 15 seconds. If a CSA has been received on a channel in
68 * the last 15 seconds, the channel is locked */
69 #define CSA_LOCK_PERIOD 15
71 * One for each channel, holds all channel setup data
72 * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant
73 * with one another!
75 #define IWL4965_MAX_RATE (33)
77 struct iwl_channel_info {
78 struct iwl_channel_tgd_info tgd;
79 struct iwl_channel_tgh_info tgh;
80 struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */
81 struct iwl_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for
82 * FAT channel */
84 u8 channel; /* channel number */
85 u8 flags; /* flags copied from EEPROM */
86 s8 max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */
87 s8 curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) */
88 s8 min_power; /* always 0 */
89 s8 scan_power; /* (dBm) regul. eeprom, direct scans, any rate */
91 u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */
92 u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */
93 u8 phymode; /* MODE_IEEE80211{A,B,G} */
95 /* Radio/DSP gain settings for each "normal" data Tx rate.
96 * These include, in addition to RF and DSP gain, a few fields for
97 * remembering/modifying gain settings (indexes). */
98 struct iwl_channel_power_info power_info[IWL4965_MAX_RATE];
100 #if IWL == 4965
101 /* FAT channel info */
102 s8 fat_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */
103 s8 fat_curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) */
104 s8 fat_min_power; /* always 0 */
105 s8 fat_scan_power; /* (dBm) eeprom, direct scans, any rate */
106 u8 fat_flags; /* flags copied from EEPROM */
107 u8 fat_extension_channel;
108 #endif
110 /* Radio/DSP gain settings for each scan rate, for directed scans. */
111 struct iwl_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES];
114 struct iwl_clip_group {
115 /* maximum power level to prevent clipping for each rate, derived by
116 * us from this band's saturation power in EEPROM */
117 const s8 clip_powers[IWL_MAX_RATES];
120 static inline int is_channel_valid(const struct iwl_channel_info *ch_info)
122 if (ch_info == NULL)
123 return 0;
124 return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0;
127 static inline int is_channel_narrow(const struct iwl_channel_info *ch_info)
129 return (ch_info->flags & EEPROM_CHANNEL_NARROW) ? 1 : 0;
132 static inline int is_channel_radar(const struct iwl_channel_info *ch_info)
134 return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0;
137 static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info)
139 return ch_info->phymode == MODE_IEEE80211A;
142 static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info)
144 return ((ch_info->phymode == MODE_IEEE80211B) ||
145 (ch_info->phymode == MODE_IEEE80211G));
148 static inline int is_channel_passive(const struct iwl_channel_info *ch)
150 return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
153 static inline int is_channel_ibss(const struct iwl_channel_info *ch)
155 return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
158 extern const struct iwl_channel_info *iwl_get_channel_info(
159 const struct iwl_priv *priv, int phymode, u16 channel);
161 #endif