1 /* $FreeBSD: releng/6.0/sys/dev/ral/if_ralvar.h 147256 2005-06-10 16:49:24Z brooks $ */
2
3 /*-
4 * Copyright (c) 2005
5 * Damien Bergamini <damien.bergamini@free.fr>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 struct ral_rx_radiotap_header {
21 struct ieee80211_radiotap_header wr_ihdr;
22 uint64_t wr_tsf;
23 uint8_t wr_flags;
24 uint16_t wr_chan_freq;
25 uint16_t wr_chan_flags;
26 uint8_t wr_antenna;
27 uint8_t wr_antsignal;
28 };
29
30 #define RAL_RX_RADIOTAP_PRESENT \
31 ((1 << IEEE80211_RADIOTAP_TSFT) | \
32 (1 << IEEE80211_RADIOTAP_FLAGS) | \
33 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
34 (1 << IEEE80211_RADIOTAP_ANTENNA) | \
35 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
36
37 struct ral_tx_radiotap_header {
38 struct ieee80211_radiotap_header wt_ihdr;
39 uint8_t wt_flags;
40 uint8_t wt_rate;
41 uint16_t wt_chan_freq;
42 uint16_t wt_chan_flags;
43 uint8_t wt_antenna;
44 };
45
46 #define RAL_TX_RADIOTAP_PRESENT \
47 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
48 (1 << IEEE80211_RADIOTAP_RATE) | \
49 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
50 (1 << IEEE80211_RADIOTAP_ANTENNA))
51
52 struct ral_tx_data {
53 bus_dmamap_t map;
54 struct mbuf *m;
55 struct ieee80211_node *ni;
56 struct ral_rssdesc id;
57 };
58
59 struct ral_tx_ring {
60 bus_dma_tag_t desc_dmat;
61 bus_dma_tag_t data_dmat;
62 bus_dmamap_t desc_map;
63 bus_addr_t physaddr;
64 struct ral_tx_desc *desc;
65 struct ral_tx_data *data;
66 int count;
67 int queued;
68 int cur;
69 int next;
70 int cur_encrypt;
71 int next_encrypt;
72 };
73
74 struct ral_rx_data {
75 bus_dmamap_t map;
76 struct mbuf *m;
77 int drop;
78 };
79
80 struct ral_rx_ring {
81 bus_dma_tag_t desc_dmat;
82 bus_dma_tag_t data_dmat;
83 bus_dmamap_t desc_map;
84 bus_addr_t physaddr;
85 struct ral_rx_desc *desc;
86 struct ral_rx_data *data;
87 int count;
88 int cur;
89 int next;
90 int cur_decrypt;
91 };
92
93 struct ral_node {
94 struct ieee80211_node ni;
95 struct ral_rssadapt rssadapt;
96 };
97
98 struct ral_softc {
99 struct ifnet *sc_ifp;
100 struct ieee80211com sc_ic;
101 int (*sc_newstate)(struct ieee80211com *,
102 enum ieee80211_state, int);
103 device_t sc_dev;
104
105 struct mtx sc_mtx;
106
107 struct callout scan_ch;
108 struct callout rssadapt_ch;
109
110 int irq_rid;
111 int mem_rid;
112 struct resource *irq;
113 struct resource *mem;
114 bus_space_tag_t sc_st;
115 bus_space_handle_t sc_sh;
116 void *sc_ih;
117
118 int sc_tx_timer;
119
120 uint32_t asic_rev;
121 uint32_t eeprom_rev;
122 uint8_t rf_rev;
123
124 struct ral_tx_ring txq;
125 struct ral_tx_ring prioq;
126 struct ral_tx_ring atimq;
127 struct ral_tx_ring bcnq;
128 struct ral_rx_ring rxq;
129
130 struct ieee80211_beacon_offsets sc_bo;
131
132 uint32_t rf_regs[4];
133 uint8_t txpow[14];
134
135 struct {
136 uint8_t reg;
137 uint8_t val;
138 } bbp_prom[16];
139
140 int led_mode;
141 int hw_radio;
142 int rx_ant;
143 int tx_ant;
144 int nb_ant;
145
146 int dwelltime;
147
148 struct bpf_if *sc_drvbpf;
149
150 union {
151 struct ral_rx_radiotap_header th;
152 uint8_t pad[64];
153 } sc_rxtapu;
154 #define sc_rxtap sc_rxtapu.th
155 int sc_rxtap_len;
156
157 union {
158 struct ral_tx_radiotap_header th;
159 uint8_t pad[64];
160 } sc_txtapu;
161 #define sc_txtap sc_txtapu.th
162 int sc_txtap_len;
163 };
164
165 extern devclass_t ral_devclass;
166
167 int ral_attach(device_t);
168 int ral_detach(device_t);
169 void ral_shutdown(device_t);
170 int ral_alloc(device_t, int);
171 void ral_free(device_t);
172 void ral_stop(void *);
173
174 #define RAL_LOCK(sc) mtx_lock(&(sc)->sc_mtx)
175 #define RAL_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
Cache object: c8155f29bdf377e17de7595117197376
|