Nuke device_ptr_t, USBBASEDEVICE, USBDEVNAME(), USBDEVUNIT(), USBGETSOFTC(),
[dragonfly/vkernel-mp.git] / sys / dev / netif / rum / if_rumvar.h
blob9b9a0a4d6c9ee8bfbe6de628b74c3dc73911ee10
1 /* $OpenBSD: if_rumvar.h,v 1.6 2006/08/18 15:11:12 damien Exp $ */
2 /* $DragonFly: src/sys/dev/netif/rum/if_rumvar.h,v 1.5 2007/06/28 06:32:32 hasso Exp $ */
4 /*-
5 * Copyright (c) 2005, 2006 Damien Bergamini <damien.bergamini@free.fr>
6 * Copyright (c) 2006 Niall O'Higgins <niallo@openbsd.org>
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.
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.
21 #define RT2573_RX_LIST_COUNT 1
22 #define RT2573_TX_LIST_COUNT 1
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;
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))
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;
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))
56 struct rum_softc;
58 struct rum_tx_data {
59 struct rum_softc *sc;
60 usbd_xfer_handle xfer;
61 uint8_t *buf;
62 struct mbuf *m;
63 struct ieee80211_node *ni;
66 struct rum_rx_data {
67 struct rum_softc *sc;
68 usbd_xfer_handle xfer;
69 uint8_t *buf;
70 struct mbuf *m;
73 struct rum_softc {
74 device_t sc_dev;
75 struct ieee80211com sc_ic;
76 int (*sc_newstate)(struct ieee80211com *,
77 enum ieee80211_state, int);
79 int sc_stopped;
81 usbd_device_handle sc_udev;
82 usbd_interface_handle sc_iface;
84 struct ieee80211_channel *sc_curchan;
86 int sc_rx_no;
87 int sc_tx_no;
89 uint16_t macbbp_rev;
90 uint8_t rf_rev;
91 uint8_t rffreq;
93 usbd_xfer_handle stats_xfer;
95 usbd_pipe_handle sc_rx_pipeh;
96 usbd_pipe_handle sc_tx_pipeh;
98 enum ieee80211_state sc_state;
99 int sc_arg;
100 int sc_sifs;
101 struct usb_task sc_task;
103 struct ieee80211_ratectl_stats sc_stats;
105 struct rum_rx_data rx_data[RT2573_RX_LIST_COUNT];
106 struct rum_tx_data tx_data[RT2573_TX_LIST_COUNT];
107 int tx_queued;
109 struct callout scan_ch;
110 struct callout stats_ch;
112 int sc_tx_timer;
114 uint32_t sta[6];
115 uint32_t rf_regs[4];
116 uint8_t txpow[44];
118 struct {
119 uint8_t val;
120 uint8_t reg;
121 } __packed bbp_prom[16];
123 int hw_radio;
124 int rx_ant;
125 int tx_ant;
126 int nb_ant;
127 int ext_2ghz_lna;
128 int ext_5ghz_lna;
129 int rssi_2ghz_corr;
130 int rssi_5ghz_corr;
131 uint8_t bbp17;
133 struct bpf_if *sc_drvbpf;
135 union {
136 struct rum_rx_radiotap_header th;
137 uint8_t pad[64];
138 } sc_rxtapu;
139 #define sc_rxtap sc_rxtapu.th
140 int sc_rxtap_len;
142 union {
143 struct rum_tx_radiotap_header th;
144 uint8_t pad[64];
145 } sc_txtapu;
146 #define sc_txtap sc_txtapu.th
147 int sc_txtap_len;
150 /* See the comment take from rt73 near RT2573_TX_LONG_RETRY */
151 #define RUM_TX_SHORT_RETRY_MAX 7
152 #define RUM_TX_LONG_RETRY_MAX 4
154 #define RUM_TX_PKT_NO_RETRY(sc) (le32toh((sc)->sta[4]) & 0xffff)
155 #define RUM_TX_PKT_ONE_RETRY(sc) (le32toh((sc)->sta[4]) >> 16)
156 #define RUM_TX_PKT_MULTI_RETRY(sc) (le32toh((sc)->sta[5]) & 0xffff)
157 #define RUM_TX_PKT_FAIL(sc) (le32toh((sc)->sta[5]) >> 16)