Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003 
0004   Broadcom B43legacy wireless driver
0005 
0006   Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
0007   Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it>
0008   Copyright (c) 2005, 2006 Michael Buesch <m@bues.ch>
0009   Copyright (c) 2005  Danny van Dyk <kugelfang@gentoo.org>
0010   Copyright (c) 2005  Andreas Jaggi <andreas.jaggi@waterwave.ch>
0011   Copyright (c) 2007  Larry Finger <Larry.Finger@lwfinger.net>
0012 
0013   Some parts of the code in this file are derived from the ipw2200
0014   driver  Copyright(c) 2003 - 2004 Intel Corporation.
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 /* Magic helper macro to pad structures. Ignore those above. It's magic. */
0028 #define PAD_BYTES(nr_bytes)     P4D_BYTES(__LINE__ , (nr_bytes))
0029 
0030 
0031 /* Lightweight function to convert a frequency (in Mhz) to a channel number. */
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 /* Lightweight function to convert a channel number to a frequency (in Mhz). */
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 /* B43legacy_MAIN_H_ */