Home | History | Annotate | Line # | Download | only in usb
if_rumvar.h revision 1.4
      1 /*	$OpenBSD: if_rumvar.h,v 1.7 2006/11/13 20:06:38 damien Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2005, 2006 Damien Bergamini <damien.bergamini (at) free.fr>
      5  * Copyright (c) 2006 Niall O'Higgins <niallo (at) openbsd.org>
      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 #define RUM_RX_LIST_COUNT	1
     21 #define RUM_TX_LIST_COUNT	1
     22 
     23 struct rum_rx_radiotap_header {
     24 	struct ieee80211_radiotap_header wr_ihdr;
     25 	uint8_t		wr_flags;
     26 	uint8_t		wr_rate;
     27 	uint16_t	wr_chan_freq;
     28 	uint16_t	wr_chan_flags;
     29 	uint8_t		wr_antenna;
     30 	uint8_t		wr_antsignal;
     31 } __packed;
     32 
     33 #define RT2573_RX_RADIOTAP_PRESENT					\
     34 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
     35 	 (1 << IEEE80211_RADIOTAP_RATE) |				\
     36 	 (1 << IEEE80211_RADIOTAP_CHANNEL) |				\
     37 	 (1 << IEEE80211_RADIOTAP_ANTENNA) |				\
     38 	 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
     39 
     40 struct rum_tx_radiotap_header {
     41 	struct ieee80211_radiotap_header wt_ihdr;
     42 	uint8_t		wt_flags;
     43 	uint8_t		wt_rate;
     44 	uint16_t	wt_chan_freq;
     45 	uint16_t	wt_chan_flags;
     46 	uint8_t		wt_antenna;
     47 } __packed;
     48 
     49 #define RT2573_TX_RADIOTAP_PRESENT						\
     50 	((1 << IEEE80211_RADIOTAP_FLAGS) |				\
     51 	 (1 << IEEE80211_RADIOTAP_RATE) |				\
     52 	 (1 << IEEE80211_RADIOTAP_CHANNEL) |				\
     53 	 (1 << IEEE80211_RADIOTAP_ANTENNA))
     54 
     55 struct rum_softc;
     56 
     57 struct rum_tx_data {
     58 	struct rum_softc	*sc;
     59 	usbd_xfer_handle	xfer;
     60 	uint8_t			*buf;
     61 	struct mbuf		*m;
     62 	struct ieee80211_node	*ni;
     63 };
     64 
     65 struct rum_rx_data {
     66 	struct rum_softc	*sc;
     67 	usbd_xfer_handle	xfer;
     68 	uint8_t			*buf;
     69 	struct mbuf		*m;
     70 };
     71 
     72 struct rum_softc {
     73 	USBBASEDEVICE			sc_dev;
     74 	struct ethercom			sc_ec;
     75 #define sc_if	sc_ec.ec_if
     76 	struct ieee80211com		sc_ic;
     77 	int				(*sc_newstate)(struct ieee80211com *,
     78 					    enum ieee80211_state, int);
     79 
     80 	usbd_device_handle		sc_udev;
     81 	usbd_interface_handle		sc_iface;
     82 	int				sc_flags;
     83 #define	RT2573_FWLOADED	(1 << 0)
     84 
     85 	struct ieee80211_channel	*sc_curchan;
     86 
     87 	int				sc_rx_no;
     88 	int				sc_tx_no;
     89 
     90 	uint16_t			macbbp_rev;
     91 	uint8_t				rf_rev;
     92 	uint8_t				rffreq;
     93 
     94 	usbd_xfer_handle		amrr_xfer;
     95 
     96 	usbd_pipe_handle		sc_rx_pipeh;
     97 	usbd_pipe_handle		sc_tx_pipeh;
     98 
     99 	enum ieee80211_state		sc_state;
    100 	struct usb_task			sc_task;
    101 
    102 	struct ieee80211_amrr		amrr;
    103 	struct ieee80211_amrr_node	amn;
    104 
    105 	struct rum_rx_data		rx_data[RUM_RX_LIST_COUNT];
    106 	struct rum_tx_data		tx_data[RUM_TX_LIST_COUNT];
    107 	int				tx_queued;
    108 
    109 	struct ieee80211_beacon_offsets	sc_bo;
    110 
    111 	usb_callout_t			sc_scan_ch;
    112 	usb_callout_t			sc_amrr_ch;
    113 
    114 	int				sc_tx_timer;
    115 
    116 	uint32_t			sta[6];
    117 	uint32_t			rf_regs[4];
    118 	uint8_t				txpow[44];
    119 
    120 	struct {
    121 		uint8_t	val;
    122 		uint8_t	reg;
    123 	} __packed			bbp_prom[16];
    124 
    125 	int				hw_radio;
    126 	int				rx_ant;
    127 	int				tx_ant;
    128 	int				nb_ant;
    129 	int				ext_2ghz_lna;
    130 	int				ext_5ghz_lna;
    131 	int				rssi_2ghz_corr;
    132 	int				rssi_5ghz_corr;
    133 	int				sifs;
    134 	uint8_t				bbp17;
    135 
    136 #if NBPFILTER > 0
    137 	void *				sc_drvbpf;
    138 
    139 	union {
    140 		struct rum_rx_radiotap_header th;
    141 		uint8_t	pad[64];
    142 	}				sc_rxtapu;
    143 #define sc_rxtap	sc_rxtapu.th
    144 	int				sc_rxtap_len;
    145 
    146 	union {
    147 		struct rum_tx_radiotap_header th;
    148 		uint8_t	pad[64];
    149 	}				sc_txtapu;
    150 #define sc_txtap	sc_txtapu.th
    151 	int				sc_txtap_len;
    152 #endif
    153 };
    154