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/rtwn/rtl8192c/r92c_rf.c

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 /*      $OpenBSD: if_urtwn.c,v 1.16 2011/02/10 17:26:40 jakemsr Exp $   */
    2 
    3 /*-
    4  * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
    5  * Copyright (c) 2014 Kevin Lo <kevlo@FreeBSD.org>
    6  * Copyright (c) 2015-2016 Andriy Voskoboinyk <avos@FreeBSD.org>
    7  *
    8  * Permission to use, copy, modify, and distribute this software for any
    9  * purpose with or without fee is hereby granted, provided that the above
   10  * copyright notice and this permission notice appear in all copies.
   11  *
   12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   13  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   14  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   15  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   16  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   17  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   18  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   19  */
   20 
   21 #include <sys/cdefs.h>
   22 __FBSDID("$FreeBSD$");
   23 
   24 #include "opt_wlan.h"
   25 
   26 #include <sys/param.h>
   27 #include <sys/lock.h>
   28 #include <sys/mutex.h>
   29 #include <sys/mbuf.h>
   30 #include <sys/kernel.h>
   31 #include <sys/socket.h>
   32 #include <sys/systm.h>
   33 #include <sys/malloc.h>
   34 #include <sys/queue.h>
   35 #include <sys/taskqueue.h>
   36 #include <sys/bus.h>
   37 #include <sys/endian.h>
   38 #include <sys/linker.h>
   39 
   40 #include <net/if.h>
   41 #include <net/ethernet.h>
   42 #include <net/if_media.h>
   43 
   44 #include <net80211/ieee80211_var.h>
   45 #include <net80211/ieee80211_radiotap.h>
   46 
   47 #include <dev/rtwn/if_rtwnreg.h>
   48 #include <dev/rtwn/if_rtwnvar.h>
   49 
   50 #include <dev/rtwn/rtl8192c/r92c.h>
   51 #include <dev/rtwn/rtl8192c/r92c_reg.h>
   52 #include <dev/rtwn/rtl8192c/r92c_var.h>
   53 #include <dev/rtwn/rtl8192c/r92c_rom_defs.h>
   54 
   55 uint32_t
   56 r92c_rf_read(struct rtwn_softc *sc, int chain, uint8_t addr)
   57 {
   58         struct r92c_softc *rs = sc->sc_priv;
   59         uint32_t reg[R92C_MAX_CHAINS], val;
   60 
   61         reg[0] = rtwn_bb_read(sc, R92C_HSSI_PARAM2(0));
   62         if (chain != 0)
   63                 reg[chain] = rtwn_bb_read(sc, R92C_HSSI_PARAM2(chain));
   64 
   65         rtwn_bb_write(sc, R92C_HSSI_PARAM2(0),
   66             reg[0] & ~R92C_HSSI_PARAM2_READ_EDGE);
   67         rtwn_delay(sc, rs->rf_read_delay[0]);
   68 
   69         rtwn_bb_write(sc, R92C_HSSI_PARAM2(chain),
   70             RW(reg[chain], R92C_HSSI_PARAM2_READ_ADDR, addr) |
   71             R92C_HSSI_PARAM2_READ_EDGE);
   72         rtwn_delay(sc, rs->rf_read_delay[1]);
   73 
   74         rtwn_bb_write(sc, R92C_HSSI_PARAM2(0),
   75             reg[0] | R92C_HSSI_PARAM2_READ_EDGE);
   76         rtwn_delay(sc, rs->rf_read_delay[2]);
   77 
   78         if (rtwn_bb_read(sc, R92C_HSSI_PARAM1(chain)) & R92C_HSSI_PARAM1_PI)
   79                 val = rtwn_bb_read(sc, R92C_HSPI_READBACK(chain));
   80         else
   81                 val = rtwn_bb_read(sc, R92C_LSSI_READBACK(chain));
   82         return (MS(val, R92C_LSSI_READBACK_DATA));
   83 }
   84 
   85 void
   86 r92c_rf_write(struct rtwn_softc *sc, int chain, uint8_t addr,
   87     uint32_t val)
   88 {
   89         rtwn_bb_write(sc, R92C_LSSI_PARAM(chain),
   90             SM(R92C_LSSI_PARAM_ADDR, addr) |
   91             SM(R92C_LSSI_PARAM_DATA, val));
   92 }

Cache object: 3178b830b9e5c90ebd96ea82abd11ca4


[ 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.