if_uralvar.h revision 1.6.10.2 1 /* $NetBSD: if_uralvar.h,v 1.6.10.2 2007/06/17 00:59:01 itohy 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 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 RAL_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 ural_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 RAL_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 ural_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
67 int sc_rx_no;
68 int sc_tx_no;
69
70 uint32_t asic_rev;
71 uint8_t rf_rev;
72
73 usbd_xfer_handle amrr_xfer;
74
75 usbd_pipe_handle sc_rx_pipeh;
76 usbd_pipe_handle sc_tx_pipeh;
77
78 enum ieee80211_state sc_state;
79 struct usb_task sc_task;
80
81 struct ieee80211_amrr amrr;
82 struct ieee80211_amrr_node amn;
83
84 struct ue_chain rx_data[RAL_RX_LIST_COUNT];
85 struct ue_chain tx_data[RAL_TX_LIST_COUNT];
86 struct ieee80211_node *tx_ni[RAL_TX_LIST_COUNT];
87 int tx_queued;
88
89 struct ieee80211_beacon_offsets sc_bo;
90
91 struct callout scan_ch;
92 struct callout amrr_ch;
93
94 int sc_tx_timer;
95
96 int16_t sta[11];
97 uint32_t rf_regs[4];
98 uint8_t txpow[14];
99
100 struct {
101 uint8_t val;
102 uint8_t reg;
103 } __packed bbp_prom[16];
104
105 int led_mode;
106 int hw_radio;
107 int rx_ant;
108 int tx_ant;
109 int nb_ant;
110
111 #if NBPFILTER > 0
112 void *sc_drvbpf;
113
114 union {
115 struct ural_rx_radiotap_header th;
116 uint8_t pad[64];
117 } sc_rxtapu;
118 #define sc_rxtap sc_rxtapu.th
119 int sc_rxtap_len;
120
121 union {
122 struct ural_tx_radiotap_header th;
123 uint8_t pad[64];
124 } sc_txtapu;
125 #define sc_txtap sc_txtapu.th
126 int sc_txtap_len;
127 #endif
128 };
129