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