if_uralvar.h revision 1.2 1 /* $NetBSD: if_uralvar.h,v 1.2 2005/07/04 17:46:31 drochner Exp $ */
2 /* $OpenBSD: if_ralvar.h,v 1.2 2005/05/13 18:42:50 damien Exp $ */
3
4 /*-
5 * Copyright (c) 2005
6 * Damien Bergamini <damien.bergamini (at) free.fr>
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 RAL_RX_LIST_COUNT 1
22 #define RAL_TX_LIST_COUNT 1
23
24 struct ural_rx_radiotap_header {
25 struct ieee80211_radiotap_header wr_ihdr;
26 uint8_t wr_flags;
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 RAL_RX_RADIOTAP_PRESENT \
34 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
35 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
36 (1 << IEEE80211_RADIOTAP_ANTENNA) | \
37 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
38
39 struct ural_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 RAL_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 ural_softc;
55
56 struct ural_tx_data {
57 struct ural_softc *sc;
58 usbd_xfer_handle xfer;
59 uint8_t *buf;
60 struct mbuf *m;
61 struct ieee80211_node *ni;
62 };
63
64 struct ural_rx_data {
65 struct ural_softc *sc;
66 usbd_xfer_handle xfer;
67 uint8_t *buf;
68 struct mbuf *m;
69 };
70
71 struct ural_softc {
72 USBBASEDEVICE sc_dev;
73 struct ethercom sc_ec;
74 #define sc_if sc_ec.ec_if
75 struct ieee80211com sc_ic;
76 int (*sc_newstate)(struct ieee80211com *,
77 enum ieee80211_state, int);
78
79 usbd_device_handle sc_udev;
80 usbd_interface_handle sc_iface;
81
82 int sc_rx_no;
83 int sc_tx_no;
84
85 uint32_t asic_rev;
86 uint8_t rf_rev;
87
88 usbd_pipe_handle sc_rx_pipeh;
89 usbd_pipe_handle sc_tx_pipeh;
90
91 enum ieee80211_state sc_state;
92 struct usb_task sc_task;
93
94 struct ural_rx_data rx_data[RAL_RX_LIST_COUNT];
95 struct ural_tx_data tx_data[RAL_TX_LIST_COUNT];
96 int tx_queued;
97
98 struct ieee80211_beacon_offsets sc_bo;
99
100 struct callout scan_ch;
101
102 int sc_tx_timer;
103
104 uint32_t rf_regs[4];
105 uint8_t txpow[14];
106
107 struct {
108 uint8_t val;
109 uint8_t reg;
110 } __packed bbp_prom[16];
111
112 int led_mode;
113 int hw_radio;
114 int rx_ant;
115 int tx_ant;
116 int nb_ant;
117
118 #if NBPFILTER > 0
119 caddr_t sc_drvbpf;
120
121 union {
122 struct ural_rx_radiotap_header th;
123 uint8_t pad[64];
124 } sc_rxtapu;
125 #define sc_rxtap sc_rxtapu.th
126 int sc_rxtap_len;
127
128 union {
129 struct ural_tx_radiotap_header th;
130 uint8_t pad[64];
131 } sc_txtapu;
132 #define sc_txtap sc_txtapu.th
133 int sc_txtap_len;
134 #endif
135 };
136