No empty .Rs/.Re
[netbsd-mini2440.git] / sys / dev / ic / rt2560var.h
blobc7df4298445ca39ee2f82edc87f5b01602d90421
1 /* $NetBSD: rt2560var.h,v 1.5 2007/03/04 06:02:00 christos Exp $ */
2 /* $OpenBSD: rt2560var.h,v 1.2 2006/01/14 12:43:27 damien Exp $ */
4 /*-
5 * Copyright (c) 2005, 2006
6 * Damien Bergamini <damien.bergamini@free.fr>
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.
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.
21 struct rt2560_rx_radiotap_header {
22 struct ieee80211_radiotap_header wr_ihdr;
23 uint64_t wr_tsf;
24 uint8_t wr_flags;
25 uint8_t wr_rate;
26 uint16_t wr_chan_freq;
27 uint16_t wr_chan_flags;
28 uint8_t wr_antenna;
29 uint8_t wr_antsignal;
30 } __packed;
32 #define RT2560_RX_RADIOTAP_PRESENT \
33 ((1 << IEEE80211_RADIOTAP_TSFT) | \
34 (1 << IEEE80211_RADIOTAP_FLAGS) | \
35 (1 << IEEE80211_RADIOTAP_RATE) | \
36 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
37 (1 << IEEE80211_RADIOTAP_ANTENNA) | \
38 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
40 struct rt2560_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;
49 #define RT2560_TX_RADIOTAP_PRESENT \
50 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
51 (1 << IEEE80211_RADIOTAP_RATE) | \
52 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
53 (1 << IEEE80211_RADIOTAP_ANTENNA))
55 struct rt2560_tx_data {
56 bus_dmamap_t map;
57 struct mbuf *m;
58 struct ieee80211_node *ni;
59 struct ieee80211_rssdesc id;
62 struct rt2560_tx_ring {
63 bus_dmamap_t map;
64 bus_dma_segment_t seg;
65 bus_addr_t physaddr;
66 struct rt2560_tx_desc *desc;
67 struct rt2560_tx_data *data;
68 int count;
69 int queued;
70 int cur;
71 int next;
72 int cur_encrypt;
73 int next_encrypt;
76 struct rt2560_rx_data {
77 bus_dmamap_t map;
78 struct mbuf *m;
79 int drop;
82 struct rt2560_rx_ring {
83 bus_dmamap_t map;
84 bus_dma_segment_t seg;
85 bus_addr_t physaddr;
86 struct rt2560_rx_desc *desc;
87 struct rt2560_rx_data *data;
88 int count;
89 int cur;
90 int next;
91 int cur_decrypt;
94 struct rt2560_node {
95 struct ieee80211_node ni;
96 struct ieee80211_rssadapt rssadapt;
99 struct rt2560_softc {
100 struct device sc_dev;
102 struct ieee80211com sc_ic;
103 int (*sc_newstate)(struct ieee80211com *,
104 enum ieee80211_state, int);
106 int (*sc_enable)(struct rt2560_softc *);
107 void (*sc_disable)(struct rt2560_softc *);
109 bus_dma_tag_t sc_dmat;
110 bus_space_tag_t sc_st;
111 bus_space_handle_t sc_sh;
113 struct sysctllog *sc_sysctllog;
115 struct ethercom sc_ec;
117 struct callout scan_ch;
118 struct callout rssadapt_ch;
120 int sc_flags;
121 #define RT2560_ENABLED (1 << 0)
123 int sc_tx_timer;
125 uint32_t asic_rev;
126 uint8_t rf_rev;
128 struct rt2560_tx_ring txq;
129 struct rt2560_tx_ring prioq;
130 struct rt2560_tx_ring atimq;
131 struct rt2560_tx_ring bcnq;
132 struct rt2560_rx_ring rxq;
134 struct ieee80211_beacon_offsets sc_bo;
136 uint32_t rf_regs[4];
137 uint8_t txpow[14];
139 struct {
140 uint8_t reg;
141 uint8_t val;
142 } bbp_prom[16];
144 int led_mode;
145 int hw_radio;
146 int rx_ant;
147 int tx_ant;
148 int nb_ant;
150 int dwelltime;
152 #if NBPFILTER > 0
153 void * sc_drvbpf;
155 union {
156 struct rt2560_rx_radiotap_header th;
157 uint8_t pad[64];
158 } sc_rxtapu;
159 #define sc_rxtap sc_rxtapu.th
160 int sc_rxtap_len;
162 union {
163 struct rt2560_tx_radiotap_header th;
164 uint8_t pad[64];
165 } sc_txtapu;
166 #define sc_txtap sc_txtapu.th
167 int sc_txtap_len;
168 #endif
171 #define sc_if sc_ec.ec_if
173 int rt2560_attach(void *, int);
174 int rt2560_detach(void *);
175 int rt2560_intr(void *);