0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef B43legacy_MAIN_H_
0020 #define B43legacy_MAIN_H_
0021
0022 #include "b43legacy.h"
0023
0024
0025 #define P4D_BYT3S(magic, nr_bytes) u8 __p4dding##magic[nr_bytes]
0026 #define P4D_BYTES(line, nr_bytes) P4D_BYT3S(line, nr_bytes)
0027
0028 #define PAD_BYTES(nr_bytes) P4D_BYTES(__LINE__ , (nr_bytes))
0029
0030
0031
0032 static inline
0033 u8 b43legacy_freq_to_channel_bg(int freq)
0034 {
0035 u8 channel;
0036
0037 if (freq == 2484)
0038 channel = 14;
0039 else
0040 channel = (freq - 2407) / 5;
0041
0042 return channel;
0043 }
0044 static inline
0045 u8 b43legacy_freq_to_channel(struct b43legacy_wldev *dev,
0046 int freq)
0047 {
0048 return b43legacy_freq_to_channel_bg(freq);
0049 }
0050
0051
0052 static inline
0053 int b43legacy_channel_to_freq_bg(u8 channel)
0054 {
0055 int freq;
0056
0057 if (channel == 14)
0058 freq = 2484;
0059 else
0060 freq = 2407 + (5 * channel);
0061
0062 return freq;
0063 }
0064
0065 static inline
0066 int b43legacy_channel_to_freq(struct b43legacy_wldev *dev,
0067 u8 channel)
0068 {
0069 return b43legacy_channel_to_freq_bg(channel);
0070 }
0071
0072 static inline
0073 int b43legacy_is_cck_rate(int rate)
0074 {
0075 return (rate == B43legacy_CCK_RATE_1MB ||
0076 rate == B43legacy_CCK_RATE_2MB ||
0077 rate == B43legacy_CCK_RATE_5MB ||
0078 rate == B43legacy_CCK_RATE_11MB);
0079 }
0080
0081 static inline
0082 int b43legacy_is_ofdm_rate(int rate)
0083 {
0084 return !b43legacy_is_cck_rate(rate);
0085 }
0086
0087 void b43legacy_tsf_read(struct b43legacy_wldev *dev, u64 *tsf);
0088 void b43legacy_tsf_write(struct b43legacy_wldev *dev, u64 tsf);
0089
0090 u32 b43legacy_shm_read32(struct b43legacy_wldev *dev,
0091 u16 routing, u16 offset);
0092 u16 b43legacy_shm_read16(struct b43legacy_wldev *dev,
0093 u16 routing, u16 offset);
0094 void b43legacy_shm_write32(struct b43legacy_wldev *dev,
0095 u16 routing, u16 offset,
0096 u32 value);
0097 void b43legacy_shm_write16(struct b43legacy_wldev *dev,
0098 u16 routing, u16 offset,
0099 u16 value);
0100
0101 u32 b43legacy_hf_read(struct b43legacy_wldev *dev);
0102 void b43legacy_hf_write(struct b43legacy_wldev *dev, u32 value);
0103
0104 void b43legacy_dummy_transmission(struct b43legacy_wldev *dev);
0105
0106 void b43legacy_wireless_core_reset(struct b43legacy_wldev *dev, u32 flags);
0107
0108 void b43legacy_mac_suspend(struct b43legacy_wldev *dev);
0109 void b43legacy_mac_enable(struct b43legacy_wldev *dev);
0110
0111 void b43legacy_controller_restart(struct b43legacy_wldev *dev,
0112 const char *reason);
0113
0114 #endif