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/ral/rt2860var.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  * Copyright (c) 2007 Damien Bergamini <damien.bergamini@free.fr>
    3  * Copyright (c) 2012 Bernhard Schmidt <bschmidt@FreeBSD.org>
    4  *
    5  * Permission to use, copy, modify, and distribute this software for any
    6  * purpose with or without fee is hereby granted, provided that the above
    7  * copyright notice and this permission notice appear in all copies.
    8  *
    9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   16  *
   17  * $OpenBSD: rt2860var.h,v 1.20 2010/09/07 16:21:42 deraadt Exp $
   18  * $FreeBSD$
   19  */
   20 
   21 #define RT2860_TX_RING_COUNT    64
   22 #define RT2860_RX_RING_COUNT    128
   23 #define RT2860_TX_POOL_COUNT    (RT2860_TX_RING_COUNT * 2)
   24 
   25 #define RT2860_MAX_SCATTER      ((RT2860_TX_RING_COUNT * 2) - 1)
   26 
   27 /* HW supports up to 255 STAs */
   28 #define RT2860_WCID_MAX         254
   29 #define RT2860_AID2WCID(aid)    ((aid) & 0xff)
   30 
   31 struct rt2860_rx_radiotap_header {
   32         struct ieee80211_radiotap_header wr_ihdr;
   33         uint64_t        wr_tsf;
   34         uint8_t         wr_flags;
   35         uint8_t         wr_rate;
   36         uint16_t        wr_chan_freq;
   37         uint16_t        wr_chan_flags;
   38         uint8_t         wr_antenna;
   39         int8_t          wr_antsignal;
   40         int8_t          wr_antnoise;
   41 } __packed __aligned(8);
   42 
   43 #define RT2860_RX_RADIOTAP_PRESENT                                      \
   44         ((1 << IEEE80211_RADIOTAP_TSFT) |                               \
   45          (1 << IEEE80211_RADIOTAP_FLAGS) |                              \
   46          (1 << IEEE80211_RADIOTAP_RATE) |                               \
   47          (1 << IEEE80211_RADIOTAP_CHANNEL) |                            \
   48          (1 << IEEE80211_RADIOTAP_ANTENNA) |                            \
   49          (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |                      \
   50          (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE))
   51 
   52 struct rt2860_tx_radiotap_header {
   53         struct ieee80211_radiotap_header wt_ihdr;
   54         uint8_t         wt_flags;
   55         uint8_t         wt_rate;
   56         uint16_t        wt_chan_freq;
   57         uint16_t        wt_chan_flags;
   58 } __packed;
   59 
   60 #define RT2860_TX_RADIOTAP_PRESENT                                      \
   61         ((1 << IEEE80211_RADIOTAP_FLAGS) |                              \
   62          (1 << IEEE80211_RADIOTAP_RATE) |                               \
   63          (1 << IEEE80211_RADIOTAP_CHANNEL))
   64 
   65 struct rt2860_tx_data {
   66         struct rt2860_txwi              *txwi;
   67         struct mbuf                     *m;
   68         struct ieee80211_node           *ni;
   69         bus_dmamap_t                    map;
   70         bus_addr_t                      paddr;
   71         SLIST_ENTRY(rt2860_tx_data)     next;
   72 };
   73 
   74 struct rt2860_tx_ring {
   75         struct rt2860_txd       *txd;
   76         bus_addr_t              paddr;
   77         bus_dma_tag_t           desc_dmat;
   78         bus_dmamap_t            desc_map;
   79         bus_dma_segment_t       seg;
   80         struct rt2860_tx_data   *data[RT2860_TX_RING_COUNT];
   81         int                     cur;
   82         int                     next;
   83         int                     queued;
   84 };
   85 
   86 struct rt2860_rx_data {
   87         struct mbuf     *m;
   88         bus_dmamap_t    map;
   89 };
   90 
   91 struct rt2860_rx_ring {
   92         struct rt2860_rxd       *rxd;
   93         bus_addr_t              paddr;
   94         bus_dma_tag_t           desc_dmat;
   95         bus_dmamap_t            desc_map;
   96         bus_dma_tag_t           data_dmat;
   97         bus_dma_segment_t       seg;
   98         unsigned int            cur;    /* must be unsigned */
   99         struct rt2860_rx_data   data[RT2860_RX_RING_COUNT];
  100 };
  101 
  102 struct rt2860_node {
  103         struct ieee80211_node   ni;
  104         uint8_t                 wcid;
  105         uint8_t                 ridx[IEEE80211_RATE_MAXSIZE];
  106         uint8_t                 ctl_ridx[IEEE80211_RATE_MAXSIZE];
  107 };
  108 
  109 struct rt2860_vap {
  110         struct ieee80211vap     ral_vap;
  111 
  112         int                     (*ral_newstate)(struct ieee80211vap *,
  113                                     enum ieee80211_state, int);
  114 };
  115 #define RT2860_VAP(vap)         ((struct rt2860_vap *)(vap))
  116 
  117 struct rt2860_softc {
  118         struct ieee80211com             sc_ic;
  119         struct ieee80211_ratectl_tx_status sc_txs;
  120         struct mbufq                    sc_snd;
  121         struct mtx                      sc_mtx;
  122         device_t                        sc_dev;
  123         bus_space_tag_t                 sc_st;
  124         bus_space_handle_t              sc_sh;
  125 
  126         struct callout                  watchdog_ch;
  127 
  128         int                             sc_invalid;
  129         int                             sc_debug;
  130 /*
  131  * The same in both up to here
  132  * ------------------------------------------------
  133  */
  134 
  135         uint16_t                        (*sc_srom_read)(struct rt2860_softc *,
  136                                             uint16_t);
  137         void                            (*sc_node_free)(struct ieee80211_node *);
  138 
  139         int                             sc_flags;
  140 #define RT2860_ENABLED          (1 << 0)
  141 #define RT2860_ADVANCED_PS      (1 << 1)
  142 #define RT2860_PCIE             (1 << 2)
  143 #define RT2860_RUNNING          (1 << 3)
  144 
  145         struct ieee80211_node           *wcid2ni[RT2860_WCID_MAX + 1];
  146 
  147         struct rt2860_tx_ring           txq[6];
  148         struct rt2860_rx_ring           rxq;
  149 
  150         SLIST_HEAD(, rt2860_tx_data)    data_pool;
  151         struct rt2860_tx_data           data[RT2860_TX_POOL_COUNT];
  152         bus_dma_tag_t                   txwi_dmat;
  153         bus_dmamap_t                    txwi_map;
  154         bus_dma_segment_t               txwi_seg;
  155         caddr_t                         txwi_vaddr;
  156 
  157         int                             sc_tx_timer;
  158         int                             mgtqid;
  159         uint8_t                         qfullmsk;
  160 
  161         uint16_t                        mac_ver;
  162         uint16_t                        mac_rev;
  163         uint16_t                        rf_rev;
  164         uint8_t                         freq;
  165         uint8_t                         ntxchains;
  166         uint8_t                         nrxchains;
  167         uint8_t                         pslevel;
  168         int8_t                          txpow1[54];
  169         int8_t                          txpow2[54];
  170         int8_t                          rssi_2ghz[3];
  171         int8_t                          rssi_5ghz[3];
  172         uint8_t                         lna[4];
  173         uint8_t                         rf24_20mhz;
  174         uint8_t                         rf24_40mhz;
  175         uint8_t                         patch_dac;
  176         uint8_t                         rfswitch;
  177         uint8_t                         ext_2ghz_lna;
  178         uint8_t                         ext_5ghz_lna;
  179         uint8_t                         calib_2ghz;
  180         uint8_t                         calib_5ghz;
  181         uint8_t                         txmixgain_2ghz;
  182         uint8_t                         txmixgain_5ghz;
  183         uint8_t                         tssi_2ghz[9];
  184         uint8_t                         tssi_5ghz[9];
  185         uint8_t                         step_2ghz;
  186         uint8_t                         step_5ghz;
  187         struct {
  188                 uint8_t reg;
  189                 uint8_t val;
  190         }                               bbp[8], rf[10];
  191         uint8_t                         leds;
  192         uint16_t                        led[3];
  193         uint32_t                        txpow20mhz[5];
  194         uint32_t                        txpow40mhz_2ghz[5];
  195         uint32_t                        txpow40mhz_5ghz[5];
  196 
  197         struct rt2860_rx_radiotap_header sc_rxtap;
  198         struct rt2860_tx_radiotap_header sc_txtap;
  199 };
  200 
  201 int     rt2860_attach(device_t, int);
  202 int     rt2860_detach(void *);
  203 void    rt2860_shutdown(void *);
  204 void    rt2860_suspend(void *);
  205 void    rt2860_resume(void *);
  206 void    rt2860_intr(void *);
  207 
  208 #define RAL_LOCK(sc)            mtx_lock(&(sc)->sc_mtx)
  209 #define RAL_LOCK_ASSERT(sc)     mtx_assert(&(sc)->sc_mtx, MA_OWNED)
  210 #define RAL_UNLOCK(sc)          mtx_unlock(&(sc)->sc_mtx)

Cache object: b9efeed77e2792b47d89881b61690190


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