The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/bwi/bwirf.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * SPDX-License-Identifier: BSD-3-Clause
    3  *
    4  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
    5  * 
    6  * This code is derived from software contributed to The DragonFly Project
    7  * by Sepherosa Ziehau <sepherosa@gmail.com>
    8  * 
    9  * Redistribution and use in source and binary forms, with or without
   10  * modification, are permitted provided that the following conditions
   11  * are met:
   12  * 
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in
   17  *    the documentation and/or other materials provided with the
   18  *    distribution.
   19  * 3. Neither the name of The DragonFly Project nor the names of its
   20  *    contributors may be used to endorse or promote products derived
   21  *    from this software without specific, prior written permission.
   22  * 
   23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   24  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
   27  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   28  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
   29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
   31  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   32  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   33  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   34  * SUCH DAMAGE.
   35  * 
   36  * $DragonFly: src/sys/dev/netif/bwi/bwirf.h,v 1.3 2007/10/03 04:53:19 sephe Exp $
   37  * $FreeBSD$
   38  */
   39 
   40 #ifndef _BWI_RF_H
   41 #define _BWI_RF_H
   42 
   43 int             bwi_rf_attach(struct bwi_mac *);
   44 void            bwi_rf_clear_state(struct bwi_rf *);
   45 
   46 int             bwi_rf_map_txpower(struct bwi_mac *);
   47 void            bwi_rf_lo_adjust(struct bwi_mac *, const struct bwi_tpctl *);
   48 void            bwi_rf_set_chan(struct bwi_mac *, u_int, int);
   49 void            bwi_rf_get_gains(struct bwi_mac *);
   50 void            bwi_rf_init(struct bwi_mac *);
   51 void            bwi_rf_init_bcm2050(struct bwi_mac *);
   52 void            bwi_rf_init_hw_nrssi_table(struct bwi_mac *, uint16_t);
   53 void            bwi_rf_set_ant_mode(struct bwi_mac *, int);
   54 
   55 void            bwi_rf_clear_tssi(struct bwi_mac *);
   56 int             bwi_rf_get_latest_tssi(struct bwi_mac *, int8_t[], uint16_t);
   57 int             bwi_rf_tssi2dbm(struct bwi_mac *, int8_t, int8_t *);
   58 
   59 void            bwi_rf_write(struct bwi_mac *, uint16_t, uint16_t);
   60 uint16_t        bwi_rf_read(struct bwi_mac *, uint16_t);
   61 
   62 static __inline void
   63 bwi_rf_off(struct bwi_mac *_mac)
   64 {
   65         _mac->mac_rf.rf_off(_mac);
   66         /* TODO:LED */
   67 
   68         _mac->mac_rf.rf_flags &= ~BWI_RF_F_ON;
   69 }
   70 
   71 static __inline void
   72 bwi_rf_on(struct bwi_mac *_mac)
   73 {
   74         if (_mac->mac_rf.rf_flags & BWI_RF_F_ON)
   75                 return;
   76 
   77         _mac->mac_rf.rf_on(_mac);
   78         /* TODO: LED */
   79 
   80         _mac->mac_rf.rf_flags |= BWI_RF_F_ON;
   81 }
   82 
   83 static __inline void
   84 bwi_rf_calc_nrssi_slope(struct bwi_mac *_mac)
   85 {
   86         _mac->mac_rf.rf_calc_nrssi_slope(_mac);
   87 }
   88 
   89 static __inline void
   90 bwi_rf_set_nrssi_thr(struct bwi_mac *_mac)
   91 {
   92         _mac->mac_rf.rf_set_nrssi_thr(_mac);
   93 }
   94 
   95 static __inline int
   96 bwi_rf_calc_rssi(struct bwi_mac *_mac, const struct bwi_rxbuf_hdr *_hdr)
   97 {
   98         return _mac->mac_rf.rf_calc_rssi(_mac, _hdr);
   99 }
  100 
  101 static __inline int
  102 bwi_rf_calc_noise(struct bwi_mac *_mac)
  103 {
  104         return _mac->mac_rf.rf_calc_noise(_mac);
  105 }
  106 
  107 static __inline void
  108 bwi_rf_lo_update(struct bwi_mac *_mac)
  109 {
  110         return _mac->mac_rf.rf_lo_update(_mac);
  111 }
  112 
  113 #define RF_WRITE(mac, ofs, val)         bwi_rf_write((mac), (ofs), (val))
  114 #define RF_READ(mac, ofs)               bwi_rf_read((mac), (ofs))
  115 
  116 #define RF_SETBITS(mac, ofs, bits)              \
  117         RF_WRITE((mac), (ofs), RF_READ((mac), (ofs)) | (bits))
  118 #define RF_CLRBITS(mac, ofs, bits)              \
  119         RF_WRITE((mac), (ofs), RF_READ((mac), (ofs)) & ~(bits))
  120 #define RF_FILT_SETBITS(mac, ofs, filt, bits)   \
  121         RF_WRITE((mac), (ofs), (RF_READ((mac), (ofs)) & (filt)) | (bits))
  122 
  123 #define BWI_RFR_ATTEN                   0x43
  124 
  125 #define BWI_RFR_TXPWR                   0x52
  126 #define BWI_RFR_TXPWR1_MASK             __BITS(6, 4)
  127 
  128 #define BWI_RFR_BBP_ATTEN               0x60
  129 #define BWI_RFR_BBP_ATTEN_CALIB_BIT     __BIT(0)
  130 #define BWI_RFR_BBP_ATTEN_CALIB_IDX     __BITS(4, 1)
  131 
  132 /*
  133  * TSSI -- TX power maps
  134  */
  135 /*
  136  * http://bcm-specs.sipsolutions.net/TSSI_to_DBM_Table
  137  * B PHY
  138  */
  139 #define BWI_TXPOWER_MAP_11B \
  140         0x4d,   0x4c,   0x4b,   0x4a,   0x4a,   0x49,   0x48,   0x47,   \
  141         0x47,   0x46,   0x45,   0x45,   0x44,   0x43,   0x42,   0x42,   \
  142         0x41,   0x40,   0x3f,   0x3e,   0x3d,   0x3c,   0x3b,   0x3a,   \
  143         0x39,   0x38,   0x37,   0x36,   0x35,   0x34,   0x32,   0x31,   \
  144         0x30,   0x2f,   0x2d,   0x2c,   0x2b,   0x29,   0x28,   0x26,   \
  145         0x25,   0x23,   0x21,   0x1f,   0x1d,   0x1a,   0x17,   0x14,   \
  146         0x10,   0x0c,   0x06,   0x00,   -7,     -7,     -7,     -7,     \
  147         -7,     -7,     -7,     -7,     -7,     -7,     -7,     -7
  148 /*
  149  * http://bcm-specs.sipsolutions.net/TSSI_to_DBM_Table
  150  * G PHY
  151  */
  152 #define BWI_TXPOWER_MAP_11G \
  153         77,     77,     77,     76,     76,     76,     75,     75,     \
  154         74,     74,     73,     73,     73,     72,     72,     71,     \
  155         71,     70,     70,     69,     68,     68,     67,     67,     \
  156         66,     65,     65,     64,     63,     63,     62,     61,     \
  157         60,     59,     58,     57,     56,     55,     54,     53,     \
  158         52,     50,     49,     47,     45,     43,     40,     37,     \
  159         33,     28,     22,     14,     5,      -7,     -20,    -20,    \
  160         -20,    -20,    -20,    -20,    -20,    -20,    -20,    -20
  161 
  162 #endif  /* !_BWI_RF_H */

Cache object: ead13d3651e4ded46329af010fff1b88


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.