root/dev/ic/rt2661var.h

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

INCLUDED FROM


    1 /*      $OpenBSD: rt2661var.h,v 1.9 2006/10/22 12:14:44 damien Exp $    */
    2 
    3 /*-
    4  * Copyright (c) 2006
    5  *      Damien Bergamini <damien.bergamini@free.fr>
    6  *
    7  * Permission to use, copy, modify, and distribute this software for any
    8  * purpose with or without fee is hereby granted, provided that the above
    9  * copyright notice and this permission notice appear in all copies.
   10  *
   11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   18  */
   19 
   20 struct rt2661_rx_radiotap_header {
   21         struct ieee80211_radiotap_header wr_ihdr;
   22         uint64_t        wr_tsf;
   23         uint8_t         wr_flags;
   24         uint8_t         wr_rate;
   25         uint16_t        wr_chan_freq;
   26         uint16_t        wr_chan_flags;
   27         uint8_t         wr_antsignal;
   28 } __packed;
   29 
   30 #define RT2661_RX_RADIOTAP_PRESENT                                      \
   31         ((1 << IEEE80211_RADIOTAP_TSFT) |                               \
   32          (1 << IEEE80211_RADIOTAP_FLAGS) |                              \
   33          (1 << IEEE80211_RADIOTAP_RATE) |                               \
   34          (1 << IEEE80211_RADIOTAP_CHANNEL) |                            \
   35          (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
   36 
   37 struct rt2661_tx_radiotap_header {
   38         struct ieee80211_radiotap_header wt_ihdr;
   39         uint8_t         wt_flags;
   40         uint8_t         wt_rate;
   41         uint16_t        wt_chan_freq;
   42         uint16_t        wt_chan_flags;
   43 } __packed;
   44 
   45 #define RT2661_TX_RADIOTAP_PRESENT                                      \
   46         ((1 << IEEE80211_RADIOTAP_FLAGS) |                              \
   47          (1 << IEEE80211_RADIOTAP_RATE) |                               \
   48          (1 << IEEE80211_RADIOTAP_CHANNEL))
   49 
   50 struct rt2661_tx_data {
   51         bus_dmamap_t                    map;
   52         struct mbuf                     *m;
   53         struct ieee80211_node           *ni;
   54 };
   55 
   56 struct rt2661_tx_ring {
   57         bus_dmamap_t            map;
   58         bus_dma_segment_t       seg;
   59         bus_addr_t              physaddr;
   60         struct rt2661_tx_desc   *desc;
   61         struct rt2661_tx_data   *data;
   62         int                     count;
   63         int                     queued;
   64         int                     cur;
   65         int                     next;
   66         int                     stat;
   67 };
   68 
   69 struct rt2661_rx_data {
   70         bus_dmamap_t    map;
   71         struct mbuf     *m;
   72 };
   73 
   74 struct rt2661_rx_ring {
   75         bus_dmamap_t            map;
   76         bus_dma_segment_t       seg;
   77         bus_addr_t              physaddr;
   78         struct rt2661_rx_desc   *desc;
   79         struct rt2661_rx_data   *data;
   80         int                     count;
   81         int                     cur;
   82         int                     next;
   83 };
   84 
   85 struct rt2661_node {
   86         struct ieee80211_node           ni;
   87         struct ieee80211_amrr_node      amn;
   88 };
   89 
   90 struct rt2661_softc {
   91         struct device                   sc_dev;
   92 
   93         struct ieee80211com             sc_ic;
   94         int                             (*sc_newstate)(struct ieee80211com *,
   95                                             enum ieee80211_state, int);
   96         struct ieee80211_amrr           amrr;
   97 
   98         int                             (*sc_enable)(struct rt2661_softc *);
   99         void                            (*sc_disable)(struct rt2661_softc *);
  100         void                            (*sc_power)(struct rt2661_softc *, int);
  101 
  102         bus_dma_tag_t                   sc_dmat;
  103         bus_space_tag_t                 sc_st;
  104         bus_space_handle_t              sc_sh;
  105 
  106         struct timeout                  scan_to;
  107         struct timeout                  amrr_to;
  108 
  109         int                             sc_id;
  110         int                             sc_flags;
  111 #define RT2661_ENABLED          (1 << 0)
  112 #define RT2661_FWLOADED         (1 << 1)
  113 #define RT2661_UPDATE_SLOT      (1 << 2)
  114 #define RT2661_SET_SLOTTIME     (1 << 3)
  115 
  116         int                             sc_tx_timer;
  117 
  118         struct ieee80211_channel        *sc_curchan;
  119 
  120         uint8_t                         rf_rev;
  121 
  122         uint8_t                         rfprog;
  123         uint8_t                         rffreq;
  124 
  125         struct rt2661_tx_ring           txq[5];
  126         struct rt2661_tx_ring           mgtq;
  127         struct rt2661_rx_ring           rxq;
  128 
  129         uint32_t                        rf_regs[4];
  130         int8_t                          txpow[38];
  131 
  132         struct {
  133                 uint8_t reg;
  134                 uint8_t val;
  135         }                               bbp_prom[16];
  136 
  137         int                             hw_radio;
  138         int                             rx_ant;
  139         int                             tx_ant;
  140         int                             nb_ant;
  141         int                             ext_2ghz_lna;
  142         int                             ext_5ghz_lna;
  143         int                             rssi_2ghz_corr;
  144         int                             rssi_5ghz_corr;
  145 
  146         int                             ncalls;
  147         int                             avg_rssi;
  148         int                             sifs;
  149 
  150         uint32_t                        erp_csr;
  151 
  152         uint8_t                         bbp18;
  153         uint8_t                         bbp21;
  154         uint8_t                         bbp22;
  155         uint8_t                         bbp16;
  156         uint8_t                         bbp17;
  157         uint8_t                         bbp64;
  158 
  159 #if NBPFILTER > 0
  160         caddr_t                         sc_drvbpf;
  161 
  162         union {
  163                 struct rt2661_rx_radiotap_header th;
  164                 uint8_t pad[64];
  165         }                               sc_rxtapu;
  166 #define sc_rxtap                        sc_rxtapu.th
  167         int                             sc_rxtap_len;
  168 
  169         union {
  170                 struct rt2661_tx_radiotap_header th;
  171                 uint8_t pad[64];
  172         }                               sc_txtapu;
  173 #define sc_txtap                        sc_txtapu.th
  174         int                             sc_txtap_len;
  175 #endif
  176         void                            *sc_sdhook;
  177         void                            *sc_powerhook;
  178 };
  179 
  180 int     rt2661_attach(void *, int);
  181 int     rt2661_detach(void *);
  182 int     rt2661_intr(void *);
  183 void    rt2661_shutdown(void *);

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