brintos

brintos / linux-shallow public Read only

0
0
Text · 2.9 KiB · 85edbc8 Raw
115 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2/*3 4  Broadcom B43legacy wireless driver5 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>12 13  Some parts of the code in this file are derived from the ipw220014  driver  Copyright(c) 2003 - 2004 Intel Corporation.15 16 17*/18 19#ifndef B43legacy_MAIN_H_20#define B43legacy_MAIN_H_21 22#include "b43legacy.h"23 24 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))29 30 31/* Lightweight function to convert a frequency (in Mhz) to a channel number. */32static inline33u8 b43legacy_freq_to_channel_bg(int freq)34{35	u8 channel;36 37	if (freq == 2484)38		channel = 14;39	else40		channel = (freq - 2407) / 5;41 42	return channel;43}44static inline45u8 b43legacy_freq_to_channel(struct b43legacy_wldev *dev,46			     int freq)47{48	return b43legacy_freq_to_channel_bg(freq);49}50 51/* Lightweight function to convert a channel number to a frequency (in Mhz). */52static inline53int b43legacy_channel_to_freq_bg(u8 channel)54{55	int freq;56 57	if (channel == 14)58		freq = 2484;59	else60		freq = 2407 + (5 * channel);61 62	return freq;63}64 65static inline66int b43legacy_channel_to_freq(struct b43legacy_wldev *dev,67			      u8 channel)68{69	return b43legacy_channel_to_freq_bg(channel);70}71 72static inline73int b43legacy_is_cck_rate(int rate)74{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);79}80 81static inline82int b43legacy_is_ofdm_rate(int rate)83{84	return !b43legacy_is_cck_rate(rate);85}86 87void b43legacy_tsf_read(struct b43legacy_wldev *dev, u64 *tsf);88void b43legacy_tsf_write(struct b43legacy_wldev *dev, u64 tsf);89 90u32 b43legacy_shm_read32(struct b43legacy_wldev *dev,91			 u16 routing, u16 offset);92u16 b43legacy_shm_read16(struct b43legacy_wldev *dev,93			 u16 routing, u16 offset);94void b43legacy_shm_write32(struct b43legacy_wldev *dev,95			 u16 routing, u16 offset,96			 u32 value);97void b43legacy_shm_write16(struct b43legacy_wldev *dev,98			 u16 routing, u16 offset,99			 u16 value);100 101u32 b43legacy_hf_read(struct b43legacy_wldev *dev);102void b43legacy_hf_write(struct b43legacy_wldev *dev, u32 value);103 104void b43legacy_dummy_transmission(struct b43legacy_wldev *dev);105 106void b43legacy_wireless_core_reset(struct b43legacy_wldev *dev, u32 flags);107 108void b43legacy_mac_suspend(struct b43legacy_wldev *dev);109void b43legacy_mac_enable(struct b43legacy_wldev *dev);110 111void b43legacy_controller_restart(struct b43legacy_wldev *dev,112				  const char *reason);113 114#endif /* B43legacy_MAIN_H_ */115