rtwvar.h revision 1.2 1 1.2 dyoung /* $NetBSD: rtwvar.h,v 1.2 2004/12/12 06:37:59 dyoung Exp $ */
2 1.1 dyoung /*-
3 1.1 dyoung * Copyright (c) 2004, 2005 David Young. All rights reserved.
4 1.1 dyoung *
5 1.1 dyoung * Driver for the Realtek RTL8180 802.11 MAC/BBP by David Young.
6 1.1 dyoung *
7 1.1 dyoung * Redistribution and use in source and binary forms, with or without
8 1.1 dyoung * modification, are permitted provided that the following conditions
9 1.1 dyoung * are met:
10 1.1 dyoung * 1. Redistributions of source code must retain the above copyright
11 1.1 dyoung * notice, this list of conditions and the following disclaimer.
12 1.1 dyoung * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 dyoung * notice, this list of conditions and the following disclaimer in the
14 1.1 dyoung * documentation and/or other materials provided with the distribution.
15 1.1 dyoung * 3. The name of David Young may not be used to endorse or promote
16 1.1 dyoung * products derived from this software without specific prior
17 1.1 dyoung * written permission.
18 1.1 dyoung *
19 1.1 dyoung * THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY
20 1.1 dyoung * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 1.1 dyoung * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22 1.1 dyoung * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David
23 1.1 dyoung * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 1.1 dyoung * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 1.1 dyoung * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.1 dyoung * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 1.1 dyoung * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 1.1 dyoung * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 1.1 dyoung * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
30 1.1 dyoung * OF SUCH DAMAGE.
31 1.1 dyoung */
32 1.1 dyoung
33 1.1 dyoung #ifndef _DEV_IC_RTWVAR_H_
34 1.1 dyoung #define _DEV_IC_RTWVAR_H_
35 1.1 dyoung
36 1.1 dyoung #include <sys/queue.h>
37 1.1 dyoung #include <sys/callout.h>
38 1.1 dyoung
39 1.1 dyoung #ifdef RTW_DEBUG
40 1.1 dyoung extern int rtw_debug;
41 1.1 dyoung #define RTW_DPRINTF(x) if (rtw_debug > 0) printf x
42 1.1 dyoung #define RTW_DPRINTF2(x) if (rtw_debug > 1) printf x
43 1.1 dyoung #define RTW_DPRINTF3(x) if (rtw_debug > 2) printf x
44 1.1 dyoung #define DPRINTF(sc, x) if ((sc)->sc_ic.ic_if.if_flags & IFF_DEBUG) printf x
45 1.1 dyoung #define DPRINTF2(sc, x) if ((sc)->sc_ic.ic_if.if_flags & IFF_DEBUG) RTW_DPRINTF2(x)
46 1.1 dyoung #define DPRINTF3(sc, x) if ((sc)->sc_ic.ic_if.if_flags & IFF_DEBUG) RTW_DPRINTF3(x)
47 1.1 dyoung #else /* RTW_DEBUG */
48 1.1 dyoung #define RTW_DPRINTF(x)
49 1.1 dyoung #define RTW_DPRINTF2(x)
50 1.1 dyoung #define RTW_DPRINTF3(x)
51 1.1 dyoung #define DPRINTF(sc, x)
52 1.1 dyoung #define DPRINTF2(sc, x)
53 1.1 dyoung #define DPRINTF3(sc, x)
54 1.1 dyoung #endif /* RTW_DEBUG */
55 1.1 dyoung
56 1.1 dyoung #if 0
57 1.1 dyoung enum rtw_rftype {
58 1.1 dyoung RTW_RFTYPE_INTERSIL = 0,
59 1.1 dyoung RTW_RFTYPE_RFMD,
60 1.1 dyoung RTW_RFTYPE_PHILIPS,
61 1.1 dyoung RTW_RFTYPE_MAXIM
62 1.1 dyoung };
63 1.1 dyoung #endif
64 1.1 dyoung
65 1.1 dyoung enum rtw_locale {
66 1.1 dyoung RTW_LOCALE_USA = 0,
67 1.1 dyoung RTW_LOCALE_EUROPE,
68 1.1 dyoung RTW_LOCALE_JAPAN,
69 1.1 dyoung RTW_LOCALE_UNKNOWN
70 1.1 dyoung };
71 1.1 dyoung
72 1.1 dyoung enum rtw_rfchipid {
73 1.1 dyoung RTW_RFCHIPID_RESERVED = 0,
74 1.1 dyoung RTW_RFCHIPID_INTERSIL = 1,
75 1.1 dyoung RTW_RFCHIPID_RFMD = 2,
76 1.1 dyoung RTW_RFCHIPID_PHILIPS = 3,
77 1.1 dyoung RTW_RFCHIPID_MAXIM = 4,
78 1.1 dyoung RTW_RFCHIPID_GCT = 5
79 1.1 dyoung };
80 1.1 dyoung
81 1.1 dyoung /* sc_flags */
82 1.1 dyoung #define RTW_F_ENABLED 0x00000001 /* chip is enabled */
83 1.1 dyoung #define RTW_F_DIGPHY 0x00000002 /* digital PHY */
84 1.1 dyoung #define RTW_F_DFLANTB 0x00000004 /* B antenna is default */
85 1.1 dyoung #define RTW_F_ANTDIV 0x00000010 /* h/w antenna diversity */
86 1.1 dyoung #define RTW_F_9356SROM 0x00000020 /* 93c56 SROM */
87 1.2 dyoung #define RTW_F_SLEEP 0x00000040 /* chip is asleep */
88 1.2 dyoung #define RTW_F_INVALID 0x00000080 /* chip is absent */
89 1.1 dyoung /* all PHY flags */
90 1.1 dyoung #define RTW_F_ALLPHY (RTW_F_DIGPHY|RTW_F_DFLANTB|RTW_F_ANTDIV)
91 1.1 dyoung
92 1.1 dyoung struct rtw_regs {
93 1.1 dyoung bus_space_tag_t r_bt;
94 1.1 dyoung bus_space_handle_t r_bh;
95 1.1 dyoung };
96 1.1 dyoung
97 1.1 dyoung #define RTW_SR_GET(sr, ofs) \
98 1.1 dyoung (((sr)->sr_content[(ofs)/2] >> (((ofs) % 2 == 0) ? 0 : 8)) & 0xff)
99 1.1 dyoung
100 1.1 dyoung #define RTW_SR_GET16(sr, ofs) \
101 1.1 dyoung (RTW_SR_GET((sr), (ofs)) | (RTW_SR_GET((sr), (ofs) + 1) << 8))
102 1.1 dyoung
103 1.1 dyoung struct rtw_srom {
104 1.1 dyoung u_int16_t *sr_content;
105 1.1 dyoung u_int16_t sr_size;
106 1.1 dyoung };
107 1.1 dyoung
108 1.1 dyoung struct rtw_rxctl {
109 1.1 dyoung struct mbuf *srx_mbuf;
110 1.1 dyoung bus_dmamap_t srx_dmamap;
111 1.1 dyoung };
112 1.1 dyoung
113 1.1 dyoung struct rtw_txctl {
114 1.1 dyoung SIMPLEQ_ENTRY(rtw_txctl) stx_q;
115 1.1 dyoung struct mbuf *stx_mbuf;
116 1.1 dyoung bus_dmamap_t stx_dmamap;
117 1.1 dyoung struct ieee80211_node *stx_ni; /* destination node */
118 1.1 dyoung u_int stx_first; /* 1st hw descriptor */
119 1.1 dyoung u_int stx_last; /* last hw descriptor */
120 1.1 dyoung };
121 1.1 dyoung
122 1.1 dyoung #define RTW_NTXPRI 4 /* number of Tx priorities */
123 1.1 dyoung #define RTW_TXPRILO 0
124 1.1 dyoung #define RTW_TXPRIMD 1
125 1.1 dyoung #define RTW_TXPRIHI 2
126 1.1 dyoung #define RTW_TXPRIBCN 3 /* beacon priority */
127 1.1 dyoung
128 1.1 dyoung #define RTW_MAXPKTSEGS 32 /* max 32 segments per Tx packet */
129 1.1 dyoung
130 1.1 dyoung #define CASSERT(cond, complaint) complaint[(cond) ? 0 : -1] = complaint[(cond) ? 0 : -1]
131 1.1 dyoung
132 1.1 dyoung #define RTW_NTXDESC_ROUNDUP(n) \
133 1.1 dyoung roundup(n, RTW_DESC_ALIGNMENT / sizeof(struct rtw_txdesc))
134 1.1 dyoung
135 1.1 dyoung #define RTW_TXQLEN_ROUNDUP(n) \
136 1.1 dyoung (RTW_NTXDESC_ROUNDUP(n * RTW_MAXPKTSEGS) / RTW_MAXPKTSEGS)
137 1.1 dyoung
138 1.1 dyoung #define RTW_RXQLEN_ROUNDUP(n) \
139 1.1 dyoung roundup(n, RTW_DESC_ALIGNMENT / sizeof(struct rtw_rxctl))
140 1.1 dyoung
141 1.1 dyoung /* The descriptor rings must begin on RTW_DESC_ALIGNMENT boundaries.
142 1.1 dyoung * I allocate them consecutively from one buffer, so just round up.
143 1.1 dyoung */
144 1.1 dyoung #define RTW_TXQLENLO RTW_TXQLEN_ROUNDUP(64) /* high-priority queue length */
145 1.1 dyoung #define RTW_TXQLENMD RTW_TXQLEN_ROUNDUP(32) /* medium-priority */
146 1.1 dyoung #define RTW_TXQLENHI RTW_TXQLEN_ROUNDUP(16) /* high-priority */
147 1.1 dyoung #define RTW_TXQLENBCN 1 /* beacon */
148 1.1 dyoung
149 1.1 dyoung #define RTW_NTXDESCLO (RTW_TXQLENLO * RTW_MAXPKTSEGS)
150 1.1 dyoung #define RTW_NTXDESCMD (RTW_TXQLENMD * RTW_MAXPKTSEGS)
151 1.1 dyoung #define RTW_NTXDESCHI (RTW_TXQLENHI * RTW_MAXPKTSEGS)
152 1.1 dyoung #define RTW_NTXDESCBCN (RTW_TXQLENBCN * RTW_MAXPKTSEGS)
153 1.1 dyoung
154 1.1 dyoung #define RTW_NTXDESCTOTAL (RTW_NTXDESCLO + RTW_NTXDESCMD + \
155 1.1 dyoung RTW_NTXDESCHI + RTW_NTXDESCBCN)
156 1.1 dyoung
157 1.1 dyoung #define RTW_RXQLEN RTW_RXQLEN_ROUNDUP(32)
158 1.1 dyoung #define RTW_NRXDESC RTW_RXQLEN
159 1.1 dyoung
160 1.1 dyoung struct rtw_txdesc_blk {
161 1.1 dyoung u_int htc_ndesc;
162 1.1 dyoung u_int htc_next;
163 1.1 dyoung u_int htc_nfree;
164 1.1 dyoung bus_addr_t htc_physbase;
165 1.1 dyoung bus_addr_t htc_ofs;
166 1.1 dyoung struct rtw_txdesc *htc_desc;
167 1.1 dyoung };
168 1.1 dyoung
169 1.1 dyoung #define RTW_NEXT_DESC(htc, idx) \
170 1.1 dyoung (htc->htc_physbase + \
171 1.1 dyoung sizeof(struct rtw_txdesc) * ((idx + 1) % htc->htc_ndesc))
172 1.1 dyoung
173 1.1 dyoung SIMPLEQ_HEAD(rtw_txq, rtw_txctl);
174 1.1 dyoung
175 1.1 dyoung struct rtw_txctl_blk {
176 1.1 dyoung /* dirty/free s/w descriptors */
177 1.1 dyoung struct rtw_txq stc_dirtyq;
178 1.1 dyoung struct rtw_txq stc_freeq;
179 1.1 dyoung u_int stc_ndesc;
180 1.1 dyoung struct rtw_txctl *stc_desc;
181 1.1 dyoung };
182 1.1 dyoung
183 1.1 dyoung struct rtw_descs {
184 1.1 dyoung struct rtw_txdesc hd_txlo[RTW_NTXDESCLO];
185 1.1 dyoung struct rtw_txdesc hd_txmd[RTW_NTXDESCMD];
186 1.1 dyoung struct rtw_txdesc hd_txhi[RTW_NTXDESCMD];
187 1.1 dyoung struct rtw_rxdesc hd_rx[RTW_NRXDESC];
188 1.1 dyoung struct rtw_txdesc hd_bcn[RTW_NTXDESCBCN];
189 1.1 dyoung };
190 1.1 dyoung #define RTW_DESC_OFFSET(ring, i) offsetof(struct rtw_descs, ring[i])
191 1.1 dyoung #define RTW_RING_OFFSET(ring) RTW_DESC_OFFSET(ring, 0)
192 1.1 dyoung #define RTW_RING_BASE(sc, ring) ((sc)->sc_desc_physaddr + \
193 1.1 dyoung RTW_RING_OFFSET(ring))
194 1.1 dyoung
195 1.1 dyoung /* Radio capture format for RTL8180. */
196 1.1 dyoung
197 1.1 dyoung #define RTW_RX_RADIOTAP_PRESENT \
198 1.1 dyoung ((1 << IEEE80211_RADIOTAP_FLAGS) | (1 << IEEE80211_RADIOTAP_RATE) | \
199 1.1 dyoung (1 << IEEE80211_RADIOTAP_CHANNEL) | \
200 1.1 dyoung (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
201 1.1 dyoung
202 1.1 dyoung struct rtw_rx_radiotap_header {
203 1.1 dyoung struct ieee80211_radiotap_header rr_ihdr;
204 1.1 dyoung u_int8_t rr_flags;
205 1.1 dyoung u_int8_t rr_rate;
206 1.1 dyoung u_int16_t rr_chan_freq;
207 1.1 dyoung u_int16_t rr_chan_flags;
208 1.1 dyoung u_int8_t rr_antsignal;
209 1.1 dyoung } __attribute__((__packed__));
210 1.1 dyoung
211 1.1 dyoung #define RTW_TX_RADIOTAP_PRESENT ((1 << IEEE80211_RADIOTAP_FLAGS) | \
212 1.1 dyoung (1 << IEEE80211_RADIOTAP_RATE) | \
213 1.1 dyoung (1 << IEEE80211_RADIOTAP_CHANNEL))
214 1.1 dyoung
215 1.1 dyoung struct rtw_tx_radiotap_header {
216 1.1 dyoung struct ieee80211_radiotap_header rt_ihdr;
217 1.1 dyoung u_int8_t rt_flags;
218 1.1 dyoung u_int8_t rt_rate;
219 1.1 dyoung u_int16_t rt_chan_freq;
220 1.1 dyoung u_int16_t rt_chan_flags;
221 1.1 dyoung } __attribute__((__packed__));
222 1.1 dyoung
223 1.1 dyoung enum rtw_attach_state {FINISHED, FINISH_DESCMAP_LOAD, FINISH_DESCMAP_CREATE,
224 1.1 dyoung FINISH_DESC_MAP, FINISH_DESC_ALLOC, FINISH_RXMAPS_CREATE,
225 1.1 dyoung FINISH_TXMAPS_CREATE, FINISH_RESET, FINISH_READ_SROM, FINISH_PARSE_SROM,
226 1.1 dyoung FINISH_RF_ATTACH, FINISH_ID_STA, FINISH_TXDESCBLK_SETUP,
227 1.1 dyoung FINISH_TXCTLBLK_SETUP, DETACHED};
228 1.1 dyoung
229 1.1 dyoung struct rtw_hooks {
230 1.1 dyoung void *rh_shutdown; /* shutdown hook */
231 1.1 dyoung void *rh_power; /* power management hook */
232 1.1 dyoung };
233 1.1 dyoung
234 1.1 dyoung struct rtw_mtbl {
235 1.1 dyoung int (*mt_newstate)(struct ieee80211com *,
236 1.1 dyoung enum ieee80211_state, int);
237 1.1 dyoung void (*mt_recv_mgmt)(struct ieee80211com *,
238 1.1 dyoung struct mbuf *, struct ieee80211_node *,
239 1.1 dyoung int, int, u_int32_t);
240 1.1 dyoung struct ieee80211_node *(*mt_node_alloc)(struct ieee80211com *);
241 1.1 dyoung void (*mt_node_free)(struct ieee80211com *,
242 1.1 dyoung struct ieee80211_node *);
243 1.1 dyoung };
244 1.1 dyoung
245 1.1 dyoung enum rtw_pwrstate { RTW_OFF = 0, RTW_SLEEP, RTW_ON };
246 1.1 dyoung
247 1.1 dyoung typedef void (*rtw_continuous_tx_cb_t)(void *arg, int);
248 1.1 dyoung
249 1.1 dyoung struct rtw_phy {
250 1.1 dyoung struct rtw_rf *p_rf;
251 1.1 dyoung struct rtw_regs *p_regs;
252 1.1 dyoung };
253 1.1 dyoung
254 1.1 dyoung struct rtw_bbpset {
255 1.1 dyoung u_int bb_antatten;
256 1.1 dyoung u_int bb_chestlim;
257 1.1 dyoung u_int bb_chsqlim;
258 1.1 dyoung u_int bb_ifagcdet;
259 1.1 dyoung u_int bb_ifagcini;
260 1.1 dyoung u_int bb_ifagclimit;
261 1.1 dyoung u_int bb_lnadet;
262 1.1 dyoung u_int bb_sys1;
263 1.1 dyoung u_int bb_sys2;
264 1.1 dyoung u_int bb_sys3;
265 1.1 dyoung u_int bb_trl;
266 1.1 dyoung u_int bb_txagc;
267 1.1 dyoung };
268 1.1 dyoung
269 1.1 dyoung struct rtw_rf {
270 1.1 dyoung void (*rf_destroy)(struct rtw_rf *);
271 1.1 dyoung /* args: frequency, txpower, power state */
272 1.1 dyoung int (*rf_init)(struct rtw_rf *, u_int, u_int8_t,
273 1.1 dyoung enum rtw_pwrstate);
274 1.1 dyoung /* arg: power state */
275 1.1 dyoung int (*rf_pwrstate)(struct rtw_rf *, enum rtw_pwrstate);
276 1.1 dyoung /* arg: frequency */
277 1.1 dyoung int (*rf_tune)(struct rtw_rf *, u_int);
278 1.1 dyoung /* arg: txpower */
279 1.1 dyoung int (*rf_txpower)(struct rtw_rf *, u_int8_t);
280 1.1 dyoung rtw_continuous_tx_cb_t rf_continuous_tx_cb;
281 1.1 dyoung void *rf_continuous_tx_arg;
282 1.1 dyoung struct rtw_bbpset rf_bbpset;
283 1.1 dyoung };
284 1.1 dyoung
285 1.1 dyoung static __inline void
286 1.1 dyoung rtw_rf_destroy(struct rtw_rf *rf)
287 1.1 dyoung {
288 1.1 dyoung (*rf->rf_destroy)(rf);
289 1.1 dyoung }
290 1.1 dyoung
291 1.1 dyoung static __inline int
292 1.1 dyoung rtw_rf_init(struct rtw_rf *rf, u_int freq, u_int8_t opaque_txpower,
293 1.1 dyoung enum rtw_pwrstate power)
294 1.1 dyoung {
295 1.1 dyoung return (*rf->rf_init)(rf, freq, opaque_txpower, power);
296 1.1 dyoung }
297 1.1 dyoung
298 1.1 dyoung static __inline int
299 1.1 dyoung rtw_rf_pwrstate(struct rtw_rf *rf, enum rtw_pwrstate power)
300 1.1 dyoung {
301 1.1 dyoung return (*rf->rf_pwrstate)(rf, power);
302 1.1 dyoung }
303 1.1 dyoung
304 1.1 dyoung static __inline int
305 1.1 dyoung rtw_rf_tune(struct rtw_rf *rf, u_int freq)
306 1.1 dyoung {
307 1.1 dyoung return (*rf->rf_tune)(rf, freq);
308 1.1 dyoung }
309 1.1 dyoung
310 1.1 dyoung static __inline int
311 1.1 dyoung rtw_rf_txpower(struct rtw_rf *rf, u_int8_t opaque_txpower)
312 1.1 dyoung {
313 1.1 dyoung return (*rf->rf_txpower)(rf, opaque_txpower);
314 1.1 dyoung }
315 1.1 dyoung
316 1.1 dyoung typedef int (*rtw_rf_write_t)(struct rtw_regs *, enum rtw_rfchipid, u_int,
317 1.1 dyoung u_int32_t);
318 1.1 dyoung
319 1.1 dyoung struct rtw_rfbus {
320 1.1 dyoung struct rtw_regs *b_regs;
321 1.1 dyoung rtw_rf_write_t b_write;
322 1.1 dyoung };
323 1.1 dyoung
324 1.1 dyoung static __inline int
325 1.1 dyoung rtw_rfbus_write(struct rtw_rfbus *bus, enum rtw_rfchipid rfchipid, u_int addr,
326 1.1 dyoung u_int32_t val)
327 1.1 dyoung {
328 1.1 dyoung return (*bus->b_write)(bus->b_regs, rfchipid, addr, val);
329 1.1 dyoung }
330 1.1 dyoung
331 1.1 dyoung struct rtw_max2820 {
332 1.1 dyoung struct rtw_rf mx_rf;
333 1.1 dyoung struct rtw_rfbus mx_bus;
334 1.1 dyoung int mx_is_a; /* 1: MAX2820A/MAX2821A */
335 1.1 dyoung };
336 1.1 dyoung
337 1.1 dyoung struct rtw_sa2400 {
338 1.1 dyoung struct rtw_rf sa_rf;
339 1.1 dyoung struct rtw_rfbus sa_bus;
340 1.1 dyoung int sa_digphy; /* 1: digital PHY */
341 1.1 dyoung };
342 1.1 dyoung
343 1.1 dyoung typedef void (*rtw_pwrstate_t)(struct rtw_regs *, enum rtw_pwrstate, int);
344 1.1 dyoung
345 1.2 dyoung enum rtw_access {RTW_ACCESS_NONE = 0,
346 1.2 dyoung RTW_ACCESS_CONFIG = 1,
347 1.2 dyoung RTW_ACCESS_ANAPARM = 2};
348 1.2 dyoung
349 1.1 dyoung struct rtw_softc {
350 1.1 dyoung struct device sc_dev;
351 1.1 dyoung struct ieee80211com sc_ic;
352 1.1 dyoung struct rtw_regs sc_regs;
353 1.1 dyoung bus_dma_tag_t sc_dmat;
354 1.1 dyoung u_int32_t sc_flags;
355 1.1 dyoung
356 1.1 dyoung #if 0
357 1.1 dyoung enum rtw_rftype sc_rftype;
358 1.1 dyoung #endif
359 1.1 dyoung enum rtw_attach_state sc_attach_state;
360 1.1 dyoung enum rtw_rfchipid sc_rfchipid;
361 1.1 dyoung enum rtw_locale sc_locale;
362 1.1 dyoung u_int8_t sc_phydelay;
363 1.1 dyoung
364 1.1 dyoung /* s/w Tx/Rx descriptors */
365 1.1 dyoung struct rtw_txctl_blk sc_txctl_blk[RTW_NTXPRI];
366 1.1 dyoung struct rtw_rxctl sc_rxctl[RTW_RXQLEN];
367 1.1 dyoung u_int sc_txq;
368 1.1 dyoung u_int sc_txnext;
369 1.1 dyoung
370 1.1 dyoung struct rtw_txdesc_blk sc_txdesc_blk[RTW_NTXPRI];
371 1.1 dyoung struct rtw_rxdesc *sc_rxdesc;
372 1.1 dyoung u_int sc_rxnext;
373 1.1 dyoung
374 1.1 dyoung struct rtw_descs *sc_descs;
375 1.1 dyoung
376 1.1 dyoung bus_dma_segment_t sc_desc_segs;
377 1.1 dyoung int sc_desc_nsegs;
378 1.1 dyoung bus_dmamap_t sc_desc_dmamap;
379 1.1 dyoung #define sc_desc_physaddr sc_desc_dmamap->dm_segs[0].ds_addr
380 1.1 dyoung
381 1.1 dyoung struct rtw_srom sc_srom;
382 1.1 dyoung
383 1.1 dyoung enum rtw_pwrstate sc_pwrstate;
384 1.1 dyoung
385 1.1 dyoung rtw_pwrstate_t sc_pwrstate_cb;
386 1.1 dyoung
387 1.1 dyoung struct rtw_rf *sc_rf;
388 1.1 dyoung
389 1.1 dyoung u_int16_t sc_inten;
390 1.1 dyoung
391 1.1 dyoung /* interrupt acknowledge hook */
392 1.1 dyoung void (*sc_intr_ack) __P((struct rtw_regs *));
393 1.1 dyoung
394 1.1 dyoung int (*sc_enable)(struct rtw_softc *);
395 1.1 dyoung void (*sc_disable)(struct rtw_softc *);
396 1.1 dyoung void (*sc_power)(struct rtw_softc *, int);
397 1.1 dyoung struct rtw_mtbl sc_mtbl;
398 1.1 dyoung struct rtw_hooks sc_hooks;
399 1.1 dyoung
400 1.1 dyoung caddr_t sc_radiobpf;
401 1.1 dyoung
402 1.1 dyoung struct callout sc_scan_ch;
403 1.1 dyoung u_int sc_cur_chan;
404 1.1 dyoung
405 1.1 dyoung u_int32_t sc_tsfth; /* most significant TSFT bits */
406 1.1 dyoung u_int32_t sc_rcr; /* RTW_RCR */
407 1.1 dyoung u_int8_t sc_csthr; /* carrier-sense threshold */
408 1.1 dyoung
409 1.1 dyoung int sc_do_tick; /* indicate 1s ticks */
410 1.1 dyoung struct timeval sc_tick0; /* first tick */
411 1.1 dyoung
412 1.1 dyoung uint8_t sc_rev; /* PCI/Cardbus revision */
413 1.1 dyoung
414 1.1 dyoung union {
415 1.1 dyoung struct rtw_rx_radiotap_header tap;
416 1.1 dyoung u_int8_t pad[64];
417 1.1 dyoung } sc_rxtapu;
418 1.1 dyoung union {
419 1.1 dyoung struct rtw_tx_radiotap_header tap;
420 1.1 dyoung u_int8_t pad[64];
421 1.1 dyoung } sc_txtapu;
422 1.2 dyoung enum rtw_access sc_access;
423 1.1 dyoung };
424 1.1 dyoung
425 1.1 dyoung #define sc_if sc_ic.ic_if
426 1.1 dyoung #define sc_rxtap sc_rxtapu.tap
427 1.1 dyoung #define sc_txtap sc_txtapu.tap
428 1.1 dyoung
429 1.1 dyoung void rtw_txdac_enable(struct rtw_regs *, int);
430 1.1 dyoung void rtw_anaparm_enable(struct rtw_regs *, int);
431 1.1 dyoung void rtw_config0123_enable(struct rtw_regs *, int);
432 1.2 dyoung void rtw_continuous_tx_enable(struct rtw_softc *, int);
433 1.2 dyoung void rtw_set_access(struct rtw_softc *, enum rtw_access);
434 1.1 dyoung
435 1.1 dyoung void rtw_attach(struct rtw_softc *);
436 1.1 dyoung int rtw_detach(struct rtw_softc *);
437 1.1 dyoung int rtw_intr(void *);
438 1.1 dyoung
439 1.1 dyoung void rtw_disable(struct rtw_softc *);
440 1.1 dyoung int rtw_enable(struct rtw_softc *);
441 1.1 dyoung
442 1.1 dyoung int rtw_activate(struct device *, enum devact);
443 1.1 dyoung void rtw_power(int, void *);
444 1.1 dyoung void rtw_shutdown(void *);
445 1.1 dyoung
446 1.1 dyoung const char *rtw_pwrstate_string(enum rtw_pwrstate);
447 1.1 dyoung
448 1.1 dyoung #endif /* _DEV_IC_RTWVAR_H_ */
449