18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci  Broadcom B43 wireless driver
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci  Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
78c2ecf20Sopenharmony_ci                     Stefano Brivio <stefano.brivio@polimi.it>
88c2ecf20Sopenharmony_ci                     Michael Buesch <m@bues.ch>
98c2ecf20Sopenharmony_ci                     Danny van Dyk <kugelfang@gentoo.org>
108c2ecf20Sopenharmony_ci                     Andreas Jaggi <andreas.jaggi@waterwave.ch>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci  Some parts of the code in this file are derived from the ipw2200
138c2ecf20Sopenharmony_ci  driver  Copyright(c) 2003 - 2004 Intel Corporation.
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci*/
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#ifndef B43_MAIN_H_
198c2ecf20Sopenharmony_ci#define B43_MAIN_H_
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#include "b43.h"
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#define P4D_BYT3S(magic, nr_bytes)	u8 __p4dding##magic[nr_bytes]
248c2ecf20Sopenharmony_ci#define P4D_BYTES(line, nr_bytes)	P4D_BYT3S(line, nr_bytes)
258c2ecf20Sopenharmony_ci/* Magic helper macro to pad structures. Ignore those above. It's magic. */
268c2ecf20Sopenharmony_ci#define PAD_BYTES(nr_bytes)		P4D_BYTES( __LINE__ , (nr_bytes))
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciextern int b43_modparam_verbose;
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* Logmessage verbosity levels. Update the b43_modparam_verbose helptext, if
328c2ecf20Sopenharmony_ci * you add or remove levels. */
338c2ecf20Sopenharmony_cienum b43_verbosity {
348c2ecf20Sopenharmony_ci	B43_VERBOSITY_ERROR,
358c2ecf20Sopenharmony_ci	B43_VERBOSITY_WARN,
368c2ecf20Sopenharmony_ci	B43_VERBOSITY_INFO,
378c2ecf20Sopenharmony_ci	B43_VERBOSITY_DEBUG,
388c2ecf20Sopenharmony_ci	__B43_VERBOSITY_AFTERLAST, /* keep last */
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	B43_VERBOSITY_MAX = __B43_VERBOSITY_AFTERLAST - 1,
418c2ecf20Sopenharmony_ci#if B43_DEBUG
428c2ecf20Sopenharmony_ci	B43_VERBOSITY_DEFAULT = B43_VERBOSITY_DEBUG,
438c2ecf20Sopenharmony_ci#else
448c2ecf20Sopenharmony_ci	B43_VERBOSITY_DEFAULT = B43_VERBOSITY_INFO,
458c2ecf20Sopenharmony_ci#endif
468c2ecf20Sopenharmony_ci};
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cistatic inline int b43_is_cck_rate(int rate)
498c2ecf20Sopenharmony_ci{
508c2ecf20Sopenharmony_ci	return (rate == B43_CCK_RATE_1MB ||
518c2ecf20Sopenharmony_ci		rate == B43_CCK_RATE_2MB ||
528c2ecf20Sopenharmony_ci		rate == B43_CCK_RATE_5MB || rate == B43_CCK_RATE_11MB);
538c2ecf20Sopenharmony_ci}
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_cistatic inline int b43_is_ofdm_rate(int rate)
568c2ecf20Sopenharmony_ci{
578c2ecf20Sopenharmony_ci	return !b43_is_cck_rate(rate);
588c2ecf20Sopenharmony_ci}
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciu8 b43_ieee80211_antenna_sanitize(struct b43_wldev *dev,
618c2ecf20Sopenharmony_ci				  u8 antenna_nr);
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_civoid b43_tsf_read(struct b43_wldev *dev, u64 * tsf);
648c2ecf20Sopenharmony_civoid b43_tsf_write(struct b43_wldev *dev, u64 tsf);
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ciu32 b43_shm_read32(struct b43_wldev *dev, u16 routing, u16 offset);
678c2ecf20Sopenharmony_ciu16 b43_shm_read16(struct b43_wldev *dev, u16 routing, u16 offset);
688c2ecf20Sopenharmony_civoid b43_shm_write32(struct b43_wldev *dev, u16 routing, u16 offset, u32 value);
698c2ecf20Sopenharmony_civoid b43_shm_write16(struct b43_wldev *dev, u16 routing, u16 offset, u16 value);
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ciu64 b43_hf_read(struct b43_wldev *dev);
728c2ecf20Sopenharmony_civoid b43_hf_write(struct b43_wldev *dev, u64 value);
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_civoid b43_dummy_transmission(struct b43_wldev *dev, bool ofdm, bool pa_on);
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_civoid b43_wireless_core_reset(struct b43_wldev *dev, bool gmode);
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_civoid b43_controller_restart(struct b43_wldev *dev, const char *reason);
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci#define B43_PS_ENABLED	(1 << 0)	/* Force enable hardware power saving */
818c2ecf20Sopenharmony_ci#define B43_PS_DISABLED	(1 << 1)	/* Force disable hardware power saving */
828c2ecf20Sopenharmony_ci#define B43_PS_AWAKE	(1 << 2)	/* Force device awake */
838c2ecf20Sopenharmony_ci#define B43_PS_ASLEEP	(1 << 3)	/* Force device asleep */
848c2ecf20Sopenharmony_civoid b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags);
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_civoid b43_wireless_core_phy_pll_reset(struct b43_wldev *dev);
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_civoid b43_mac_suspend(struct b43_wldev *dev);
898c2ecf20Sopenharmony_civoid b43_mac_enable(struct b43_wldev *dev);
908c2ecf20Sopenharmony_civoid b43_mac_phy_clock_set(struct b43_wldev *dev, bool on);
918c2ecf20Sopenharmony_civoid b43_mac_switch_freq(struct b43_wldev *dev, u8 spurmode);
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_cistruct b43_request_fw_context;
958c2ecf20Sopenharmony_ciint b43_do_request_fw(struct b43_request_fw_context *ctx, const char *name,
968c2ecf20Sopenharmony_ci		      struct b43_firmware_file *fw, bool async);
978c2ecf20Sopenharmony_civoid b43_do_release_fw(struct b43_firmware_file *fw);
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci#endif /* B43_MAIN_H_ */
100