if_uralvar.h revision 1.4 1 /* $NetBSD: if_uralvar.h,v 1.4 2005/12/11 12:24:01 christos 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 uint8_t _pad;
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 RAL_RX_RADIOTAP_PRESENT \
35 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
36 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
37 (1 << IEEE80211_RADIOTAP_ANTENNA) | \
38 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
39
40 struct ural_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 RAL_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 ural_softc;
56
57 struct ural_tx_data {
58 struct ural_softc *sc;
59 usbd_xfer_handle xfer;
60 uint8_t *buf;
61 struct mbuf *m;
62 struct ieee80211_node *ni;
63 };
64
65 struct ural_rx_data {
66 struct ural_softc *sc;
67 usbd_xfer_handle xfer;
68 uint8_t *buf;
69 struct mbuf *m;
70 };
71
72 struct ural_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
83 int sc_rx_no;
84 int sc_tx_no;
85
86 uint32_t asic_rev;
87 uint8_t rf_rev;
88
89 usbd_pipe_handle sc_rx_pipeh;
90 usbd_pipe_handle sc_tx_pipeh;
91
92 enum ieee80211_state sc_state;
93 struct usb_task sc_task;
94
95 struct ural_rx_data rx_data[RAL_RX_LIST_COUNT];
96 struct ural_tx_data tx_data[RAL_TX_LIST_COUNT];
97 int tx_queued;
98
99 struct ieee80211_beacon_offsets sc_bo;
100
101 struct callout scan_ch;
102
103 int sc_tx_timer;
104
105 uint32_t rf_regs[4];
106 uint8_t txpow[14];
107
108 struct {
109 uint8_t val;
110 uint8_t reg;
111 } __packed bbp_prom[16];
112
113 int led_mode;
114 int hw_radio;
115 int rx_ant;
116 int tx_ant;
117 int nb_ant;
118
119 #if NBPFILTER > 0
120 caddr_t sc_drvbpf;
121
122 union {
123 struct ural_rx_radiotap_header th;
124 uint8_t pad[64];
125 } sc_rxtapu;
126 #define sc_rxtap sc_rxtapu.th
127 int sc_rxtap_len;
128
129 union {
130 struct ural_tx_radiotap_header th;
131 uint8_t pad[64];
132 } sc_txtapu;
133 #define sc_txtap sc_txtapu.th
134 int sc_txtap_len;
135 #endif
136 };
137