root/dev/ic/rt2560var.h

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

INCLUDED FROM


    1 /*      $OpenBSD: rt2560var.h,v 1.5 2006/10/22 12:14:44 damien Exp $  */
    2 
    3 /*-
    4  * Copyright (c) 2005, 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 rt2560_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_antenna;
   28         uint8_t         wr_antsignal;
   29 } __packed;
   30 
   31 #define RT2560_RX_RADIOTAP_PRESENT                                      \
   32         ((1 << IEEE80211_RADIOTAP_TSFT) |                               \
   33          (1 << IEEE80211_RADIOTAP_FLAGS) |                              \
   34          (1 << IEEE80211_RADIOTAP_RATE) |                               \
   35          (1 << IEEE80211_RADIOTAP_CHANNEL) |                            \
   36          (1 << IEEE80211_RADIOTAP_ANTENNA) |                            \
   37          (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
   38 
   39 struct rt2560_tx_radiotap_header {
   40         struct ieee80211_radiotap_header wt_ihdr;
   41         uint8_t         wt_flags;
   42         uint8_t         wt_rate;
   43         uint16_t        wt_chan_freq;
   44         uint16_t        wt_chan_flags;
   45         uint8_t         wt_antenna;
   46 } __packed;
   47 
   48 #define RT2560_TX_RADIOTAP_PRESENT                                      \
   49         ((1 << IEEE80211_RADIOTAP_FLAGS) |                              \
   50          (1 << IEEE80211_RADIOTAP_RATE) |                               \
   51          (1 << IEEE80211_RADIOTAP_CHANNEL) |                            \
   52          (1 << IEEE80211_RADIOTAP_ANTENNA))
   53 
   54 struct rt2560_tx_data {
   55         bus_dmamap_t                    map;
   56         struct mbuf                     *m;
   57         struct ieee80211_node           *ni;
   58 };
   59 
   60 struct rt2560_tx_ring {
   61         bus_dmamap_t            map;
   62         bus_dma_segment_t       seg;
   63         bus_addr_t              physaddr;
   64         struct rt2560_tx_desc   *desc;
   65         struct rt2560_tx_data   *data;
   66         int                     count;
   67         int                     queued;
   68         int                     cur;
   69         int                     next;
   70         int                     cur_encrypt;
   71         int                     next_encrypt;
   72 };
   73 
   74 struct rt2560_rx_data {
   75         bus_dmamap_t    map;
   76         struct mbuf     *m;
   77         int             drop;
   78 };
   79 
   80 struct rt2560_rx_ring {
   81         bus_dmamap_t            map;
   82         bus_dma_segment_t       seg;
   83         bus_addr_t              physaddr;
   84         struct rt2560_rx_desc   *desc;
   85         struct rt2560_rx_data   *data;
   86         int                     count;
   87         int                     cur;
   88         int                     next;
   89         int                     cur_decrypt;
   90 };
   91 
   92 struct rt2560_node {
   93         struct ieee80211_node           ni;
   94         struct ieee80211_amrr_node      amn;
   95 };
   96 
   97 struct rt2560_softc {
   98         struct device           sc_dev;
   99 
  100         struct ieee80211com     sc_ic;
  101         int                     (*sc_newstate)(struct ieee80211com *,
  102                                     enum ieee80211_state, int);
  103         struct ieee80211_amrr   amrr;
  104 
  105         int                     (*sc_enable)(struct rt2560_softc *);
  106         void                    (*sc_disable)(struct rt2560_softc *);
  107         void                    (*sc_power)(struct rt2560_softc *, int);
  108 
  109         bus_dma_tag_t           sc_dmat;
  110         bus_space_tag_t         sc_st;
  111         bus_space_handle_t      sc_sh;
  112 
  113         struct timeout          scan_to;
  114         struct timeout          amrr_to;
  115 
  116         int                     sc_flags;
  117 #define RT2560_ENABLED          (1 << 0)
  118 #define RT2560_UPDATE_SLOT      (1 << 1)
  119 #define RT2560_SET_SLOTTIME     (1 << 2)
  120 
  121         int                     sc_tx_timer;
  122 
  123         uint32_t                asic_rev;
  124         uint8_t                 rf_rev;
  125 
  126         struct rt2560_tx_ring   txq;
  127         struct rt2560_tx_ring   prioq;
  128         struct rt2560_tx_ring   atimq;
  129         struct rt2560_tx_ring   bcnq;
  130         struct rt2560_rx_ring   rxq;
  131 
  132         uint32_t                rf_regs[4];
  133         uint8_t                 txpow[14];
  134 
  135         struct {
  136                 uint8_t reg;
  137                 uint8_t val;
  138         }                       bbp_prom[16];
  139 
  140         int                     led_mode;
  141         int                     hw_radio;
  142         int                     rx_ant;
  143         int                     tx_ant;
  144         int                     nb_ant;
  145 
  146         uint8_t                 *erp;
  147 
  148 #if NBPFILTER > 0
  149         caddr_t                 sc_drvbpf;
  150 
  151         union {
  152                 struct rt2560_rx_radiotap_header th;
  153                 uint8_t pad[64];
  154         }                       sc_rxtapu;
  155 #define sc_rxtap                sc_rxtapu.th
  156         int                     sc_rxtap_len;
  157 
  158         union {
  159                 struct rt2560_tx_radiotap_header th;
  160                 uint8_t pad[64];
  161         }                       sc_txtapu;
  162 #define sc_txtap                sc_txtapu.th
  163         int                     sc_txtap_len;
  164 #endif
  165         void                    *sc_sdhook;     /* shutdown hook */
  166         void                    *sc_powerhook;  /* power management hook */
  167 };
  168 
  169 int     rt2560_attach(void *, int);
  170 int     rt2560_detach(void *);
  171 int     rt2560_intr(void *);
  172 void    rt2560_shutdown(void *);

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