Add linux-next specific files for 20110831
[linux-2.6/next.git] / drivers / net / wireless / b43legacy / main.h
blobb74a058d7bac064ab04bbfd5d978152c1e5f0a87
1 /*
3 Broadcom B43legacy wireless driver
5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
6 Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it>
7 Copyright (c) 2005, 2006 Michael Buesch <m@bues.ch>
8 Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
9 Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
10 Copyright (c) 2007 Larry Finger <Larry.Finger@lwfinger.net>
12 Some parts of the code in this file are derived from the ipw2200
13 driver Copyright(c) 2003 - 2004 Intel Corporation.
15 This program is free software; you can redistribute it and/or modify
16 it under the terms of the GNU General Public License as published by
17 the Free Software Foundation; either version 2 of the License, or
18 (at your option) any later version.
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
25 You should have received a copy of the GNU General Public License
26 along with this program; see the file COPYING. If not, write to
27 the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
28 Boston, MA 02110-1301, USA.
32 #ifndef B43legacy_MAIN_H_
33 #define B43legacy_MAIN_H_
35 #include "b43legacy.h"
38 #define P4D_BYT3S(magic, nr_bytes) u8 __p4dding##magic[nr_bytes]
39 #define P4D_BYTES(line, nr_bytes) P4D_BYT3S(line, nr_bytes)
40 /* Magic helper macro to pad structures. Ignore those above. It's magic. */
41 #define PAD_BYTES(nr_bytes) P4D_BYTES(__LINE__ , (nr_bytes))
44 /* Lightweight function to convert a frequency (in Mhz) to a channel number. */
45 static inline
46 u8 b43legacy_freq_to_channel_bg(int freq)
48 u8 channel;
50 if (freq == 2484)
51 channel = 14;
52 else
53 channel = (freq - 2407) / 5;
55 return channel;
57 static inline
58 u8 b43legacy_freq_to_channel(struct b43legacy_wldev *dev,
59 int freq)
61 return b43legacy_freq_to_channel_bg(freq);
64 /* Lightweight function to convert a channel number to a frequency (in Mhz). */
65 static inline
66 int b43legacy_channel_to_freq_bg(u8 channel)
68 int freq;
70 if (channel == 14)
71 freq = 2484;
72 else
73 freq = 2407 + (5 * channel);
75 return freq;
78 static inline
79 int b43legacy_channel_to_freq(struct b43legacy_wldev *dev,
80 u8 channel)
82 return b43legacy_channel_to_freq_bg(channel);
85 static inline
86 int b43legacy_is_cck_rate(int rate)
88 return (rate == B43legacy_CCK_RATE_1MB ||
89 rate == B43legacy_CCK_RATE_2MB ||
90 rate == B43legacy_CCK_RATE_5MB ||
91 rate == B43legacy_CCK_RATE_11MB);
94 static inline
95 int b43legacy_is_ofdm_rate(int rate)
97 return !b43legacy_is_cck_rate(rate);
100 void b43legacy_tsf_read(struct b43legacy_wldev *dev, u64 *tsf);
101 void b43legacy_tsf_write(struct b43legacy_wldev *dev, u64 tsf);
103 u32 b43legacy_shm_read32(struct b43legacy_wldev *dev,
104 u16 routing, u16 offset);
105 u16 b43legacy_shm_read16(struct b43legacy_wldev *dev,
106 u16 routing, u16 offset);
107 void b43legacy_shm_write32(struct b43legacy_wldev *dev,
108 u16 routing, u16 offset,
109 u32 value);
110 void b43legacy_shm_write16(struct b43legacy_wldev *dev,
111 u16 routing, u16 offset,
112 u16 value);
114 u32 b43legacy_hf_read(struct b43legacy_wldev *dev);
115 void b43legacy_hf_write(struct b43legacy_wldev *dev, u32 value);
117 void b43legacy_dummy_transmission(struct b43legacy_wldev *dev);
119 void b43legacy_wireless_core_reset(struct b43legacy_wldev *dev, u32 flags);
121 void b43legacy_mac_suspend(struct b43legacy_wldev *dev);
122 void b43legacy_mac_enable(struct b43legacy_wldev *dev);
124 void b43legacy_controller_restart(struct b43legacy_wldev *dev,
125 const char *reason);
127 #endif /* B43legacy_MAIN_H_ */