1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 Broadcom B43legacy wireless driver
6 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
7 Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it>
8 Copyright (c) 2005, 2006 Michael Buesch <m@bues.ch>
9 Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
10 Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
11 Copyright (c) 2007 Larry Finger <Larry.Finger@lwfinger.net>
13 Some parts of the code in this file are derived from the ipw2200
14 driver Copyright(c) 2003 - 2004 Intel Corporation.
19 #ifndef B43legacy_MAIN_H_
20 #define B43legacy_MAIN_H_
22 #include "b43legacy.h"
25 #define P4D_BYT3S(magic, nr_bytes) u8 __p4dding##magic[nr_bytes]
26 #define P4D_BYTES(line, nr_bytes) P4D_BYT3S(line, nr_bytes)
27 /* Magic helper macro to pad structures. Ignore those above. It's magic. */
28 #define PAD_BYTES(nr_bytes) P4D_BYTES(__LINE__ , (nr_bytes))
31 /* Lightweight function to convert a frequency (in Mhz) to a channel number. */
33 u8
b43legacy_freq_to_channel_bg(int freq
)
40 channel
= (freq
- 2407) / 5;
45 u8
b43legacy_freq_to_channel(struct b43legacy_wldev
*dev
,
48 return b43legacy_freq_to_channel_bg(freq
);
51 /* Lightweight function to convert a channel number to a frequency (in Mhz). */
53 int b43legacy_channel_to_freq_bg(u8 channel
)
60 freq
= 2407 + (5 * channel
);
66 int b43legacy_channel_to_freq(struct b43legacy_wldev
*dev
,
69 return b43legacy_channel_to_freq_bg(channel
);
73 int b43legacy_is_cck_rate(int rate
)
75 return (rate
== B43legacy_CCK_RATE_1MB
||
76 rate
== B43legacy_CCK_RATE_2MB
||
77 rate
== B43legacy_CCK_RATE_5MB
||
78 rate
== B43legacy_CCK_RATE_11MB
);
82 int b43legacy_is_ofdm_rate(int rate
)
84 return !b43legacy_is_cck_rate(rate
);
87 void b43legacy_tsf_read(struct b43legacy_wldev
*dev
, u64
*tsf
);
88 void b43legacy_tsf_write(struct b43legacy_wldev
*dev
, u64 tsf
);
90 u32
b43legacy_shm_read32(struct b43legacy_wldev
*dev
,
91 u16 routing
, u16 offset
);
92 u16
b43legacy_shm_read16(struct b43legacy_wldev
*dev
,
93 u16 routing
, u16 offset
);
94 void b43legacy_shm_write32(struct b43legacy_wldev
*dev
,
95 u16 routing
, u16 offset
,
97 void b43legacy_shm_write16(struct b43legacy_wldev
*dev
,
98 u16 routing
, u16 offset
,
101 u32
b43legacy_hf_read(struct b43legacy_wldev
*dev
);
102 void b43legacy_hf_write(struct b43legacy_wldev
*dev
, u32 value
);
104 void b43legacy_dummy_transmission(struct b43legacy_wldev
*dev
);
106 void b43legacy_wireless_core_reset(struct b43legacy_wldev
*dev
, u32 flags
);
108 void b43legacy_mac_suspend(struct b43legacy_wldev
*dev
);
109 void b43legacy_mac_enable(struct b43legacy_wldev
*dev
);
111 void b43legacy_controller_restart(struct b43legacy_wldev
*dev
,
114 #endif /* B43legacy_MAIN_H_ */