root/drivers/net/wireless/broadcom/b43legacy/main.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. b43legacy_freq_to_channel_bg
  2. b43legacy_freq_to_channel
  3. b43legacy_channel_to_freq_bg
  4. b43legacy_channel_to_freq
  5. b43legacy_is_cck_rate
  6. b43legacy_is_ofdm_rate

   1 /* SPDX-License-Identifier: GPL-2.0-or-later */
   2 /*
   3 
   4   Broadcom B43legacy wireless driver
   5 
   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 ipw2200
  14   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. */
  32 static inline
  33 u8 b43legacy_freq_to_channel_bg(int freq)
  34 {
  35         u8 channel;
  36 
  37         if (freq == 2484)
  38                 channel = 14;
  39         else
  40                 channel = (freq - 2407) / 5;
  41 
  42         return channel;
  43 }
  44 static inline
  45 u8 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). */
  52 static inline
  53 int b43legacy_channel_to_freq_bg(u8 channel)
  54 {
  55         int freq;
  56 
  57         if (channel == 14)
  58                 freq = 2484;
  59         else
  60                 freq = 2407 + (5 * channel);
  61 
  62         return freq;
  63 }
  64 
  65 static inline
  66 int b43legacy_channel_to_freq(struct b43legacy_wldev *dev,
  67                               u8 channel)
  68 {
  69         return b43legacy_channel_to_freq_bg(channel);
  70 }
  71 
  72 static inline
  73 int 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 
  81 static inline
  82 int b43legacy_is_ofdm_rate(int rate)
  83 {
  84         return !b43legacy_is_cck_rate(rate);
  85 }
  86 
  87 void b43legacy_tsf_read(struct b43legacy_wldev *dev, u64 *tsf);
  88 void b43legacy_tsf_write(struct b43legacy_wldev *dev, u64 tsf);
  89 
  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,
  96                          u32 value);
  97 void b43legacy_shm_write16(struct b43legacy_wldev *dev,
  98                          u16 routing, u16 offset,
  99                          u16 value);
 100 
 101 u32 b43legacy_hf_read(struct b43legacy_wldev *dev);
 102 void b43legacy_hf_write(struct b43legacy_wldev *dev, u32 value);
 103 
 104 void b43legacy_dummy_transmission(struct b43legacy_wldev *dev);
 105 
 106 void b43legacy_wireless_core_reset(struct b43legacy_wldev *dev, u32 flags);
 107 
 108 void b43legacy_mac_suspend(struct b43legacy_wldev *dev);
 109 void b43legacy_mac_enable(struct b43legacy_wldev *dev);
 110 
 111 void b43legacy_controller_restart(struct b43legacy_wldev *dev,
 112                                   const char *reason);
 113 
 114 #endif /* B43legacy_MAIN_H_ */

/* [<][>][^][v][top][bottom][index][help] */