rt2560var.h revision 1.3.4.2 1 1.3.4.2 chap /* $NetBSD: rt2560var.h,v 1.3.4.2 2006/06/19 03:58:14 chap Exp $ */
2 1.3.4.2 chap /* $OpenBSD: rt2560var.h,v 1.2 2006/01/14 12:43:27 damien Exp $ */
3 1.3.4.2 chap
4 1.3.4.2 chap /*-
5 1.3.4.2 chap * Copyright (c) 2005, 2006
6 1.3.4.2 chap * Damien Bergamini <damien.bergamini (at) free.fr>
7 1.3.4.2 chap *
8 1.3.4.2 chap * Permission to use, copy, modify, and distribute this software for any
9 1.3.4.2 chap * purpose with or without fee is hereby granted, provided that the above
10 1.3.4.2 chap * copyright notice and this permission notice appear in all copies.
11 1.3.4.2 chap *
12 1.3.4.2 chap * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 1.3.4.2 chap * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 1.3.4.2 chap * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 1.3.4.2 chap * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 1.3.4.2 chap * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 1.3.4.2 chap * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 1.3.4.2 chap * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 1.3.4.2 chap */
20 1.3.4.2 chap
21 1.3.4.2 chap struct rt2560_rx_radiotap_header {
22 1.3.4.2 chap struct ieee80211_radiotap_header wr_ihdr;
23 1.3.4.2 chap uint64_t wr_tsf;
24 1.3.4.2 chap uint8_t wr_flags;
25 1.3.4.2 chap uint8_t wr_rate;
26 1.3.4.2 chap uint16_t wr_chan_freq;
27 1.3.4.2 chap uint16_t wr_chan_flags;
28 1.3.4.2 chap uint8_t wr_antenna;
29 1.3.4.2 chap uint8_t wr_antsignal;
30 1.3.4.2 chap } __packed;
31 1.3.4.2 chap
32 1.3.4.2 chap #define RT2560_RX_RADIOTAP_PRESENT \
33 1.3.4.2 chap ((1 << IEEE80211_RADIOTAP_TSFT) | \
34 1.3.4.2 chap (1 << IEEE80211_RADIOTAP_FLAGS) | \
35 1.3.4.2 chap (1 << IEEE80211_RADIOTAP_RATE) | \
36 1.3.4.2 chap (1 << IEEE80211_RADIOTAP_CHANNEL) | \
37 1.3.4.2 chap (1 << IEEE80211_RADIOTAP_ANTENNA) | \
38 1.3.4.2 chap (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
39 1.3.4.2 chap
40 1.3.4.2 chap struct rt2560_tx_radiotap_header {
41 1.3.4.2 chap struct ieee80211_radiotap_header wt_ihdr;
42 1.3.4.2 chap uint8_t wt_flags;
43 1.3.4.2 chap uint8_t wt_rate;
44 1.3.4.2 chap uint16_t wt_chan_freq;
45 1.3.4.2 chap uint16_t wt_chan_flags;
46 1.3.4.2 chap uint8_t wt_antenna;
47 1.3.4.2 chap } __packed;
48 1.3.4.2 chap
49 1.3.4.2 chap #define RT2560_TX_RADIOTAP_PRESENT \
50 1.3.4.2 chap ((1 << IEEE80211_RADIOTAP_FLAGS) | \
51 1.3.4.2 chap (1 << IEEE80211_RADIOTAP_RATE) | \
52 1.3.4.2 chap (1 << IEEE80211_RADIOTAP_CHANNEL) | \
53 1.3.4.2 chap (1 << IEEE80211_RADIOTAP_ANTENNA))
54 1.3.4.2 chap
55 1.3.4.2 chap struct rt2560_tx_data {
56 1.3.4.2 chap bus_dmamap_t map;
57 1.3.4.2 chap struct mbuf *m;
58 1.3.4.2 chap struct ieee80211_node *ni;
59 1.3.4.2 chap struct ieee80211_rssdesc id;
60 1.3.4.2 chap };
61 1.3.4.2 chap
62 1.3.4.2 chap struct rt2560_tx_ring {
63 1.3.4.2 chap bus_dmamap_t map;
64 1.3.4.2 chap bus_dma_segment_t seg;
65 1.3.4.2 chap bus_addr_t physaddr;
66 1.3.4.2 chap struct rt2560_tx_desc *desc;
67 1.3.4.2 chap struct rt2560_tx_data *data;
68 1.3.4.2 chap int count;
69 1.3.4.2 chap int queued;
70 1.3.4.2 chap int cur;
71 1.3.4.2 chap int next;
72 1.3.4.2 chap int cur_encrypt;
73 1.3.4.2 chap int next_encrypt;
74 1.3.4.2 chap };
75 1.3.4.2 chap
76 1.3.4.2 chap struct rt2560_rx_data {
77 1.3.4.2 chap bus_dmamap_t map;
78 1.3.4.2 chap struct mbuf *m;
79 1.3.4.2 chap int drop;
80 1.3.4.2 chap };
81 1.3.4.2 chap
82 1.3.4.2 chap struct rt2560_rx_ring {
83 1.3.4.2 chap bus_dmamap_t map;
84 1.3.4.2 chap bus_dma_segment_t seg;
85 1.3.4.2 chap bus_addr_t physaddr;
86 1.3.4.2 chap struct rt2560_rx_desc *desc;
87 1.3.4.2 chap struct rt2560_rx_data *data;
88 1.3.4.2 chap int count;
89 1.3.4.2 chap int cur;
90 1.3.4.2 chap int next;
91 1.3.4.2 chap int cur_decrypt;
92 1.3.4.2 chap };
93 1.3.4.2 chap
94 1.3.4.2 chap struct rt2560_node {
95 1.3.4.2 chap struct ieee80211_node ni;
96 1.3.4.2 chap struct ieee80211_rssadapt rssadapt;
97 1.3.4.2 chap };
98 1.3.4.2 chap
99 1.3.4.2 chap struct rt2560_softc {
100 1.3.4.2 chap struct device sc_dev;
101 1.3.4.2 chap
102 1.3.4.2 chap struct ieee80211com sc_ic;
103 1.3.4.2 chap int (*sc_newstate)(struct ieee80211com *,
104 1.3.4.2 chap enum ieee80211_state, int);
105 1.3.4.2 chap
106 1.3.4.2 chap int (*sc_enable)(struct rt2560_softc *);
107 1.3.4.2 chap void (*sc_disable)(struct rt2560_softc *);
108 1.3.4.2 chap void (*sc_power)(struct rt2560_softc *, int);
109 1.3.4.2 chap
110 1.3.4.2 chap bus_dma_tag_t sc_dmat;
111 1.3.4.2 chap bus_space_tag_t sc_st;
112 1.3.4.2 chap bus_space_handle_t sc_sh;
113 1.3.4.2 chap
114 1.3.4.2 chap struct sysctllog *sc_sysctllog;
115 1.3.4.2 chap
116 1.3.4.2 chap struct ethercom sc_ec;
117 1.3.4.2 chap
118 1.3.4.2 chap struct callout scan_ch;
119 1.3.4.2 chap struct callout rssadapt_ch;
120 1.3.4.2 chap
121 1.3.4.2 chap int sc_flags;
122 1.3.4.2 chap #define RT2560_ENABLED (1 << 0)
123 1.3.4.2 chap
124 1.3.4.2 chap int sc_tx_timer;
125 1.3.4.2 chap
126 1.3.4.2 chap uint32_t asic_rev;
127 1.3.4.2 chap uint8_t rf_rev;
128 1.3.4.2 chap
129 1.3.4.2 chap struct rt2560_tx_ring txq;
130 1.3.4.2 chap struct rt2560_tx_ring prioq;
131 1.3.4.2 chap struct rt2560_tx_ring atimq;
132 1.3.4.2 chap struct rt2560_tx_ring bcnq;
133 1.3.4.2 chap struct rt2560_rx_ring rxq;
134 1.3.4.2 chap
135 1.3.4.2 chap struct ieee80211_beacon_offsets sc_bo;
136 1.3.4.2 chap
137 1.3.4.2 chap uint32_t rf_regs[4];
138 1.3.4.2 chap uint8_t txpow[14];
139 1.3.4.2 chap
140 1.3.4.2 chap struct {
141 1.3.4.2 chap uint8_t reg;
142 1.3.4.2 chap uint8_t val;
143 1.3.4.2 chap } bbp_prom[16];
144 1.3.4.2 chap
145 1.3.4.2 chap int led_mode;
146 1.3.4.2 chap int hw_radio;
147 1.3.4.2 chap int rx_ant;
148 1.3.4.2 chap int tx_ant;
149 1.3.4.2 chap int nb_ant;
150 1.3.4.2 chap
151 1.3.4.2 chap int dwelltime;
152 1.3.4.2 chap
153 1.3.4.2 chap #if NBPFILTER > 0
154 1.3.4.2 chap caddr_t sc_drvbpf;
155 1.3.4.2 chap
156 1.3.4.2 chap union {
157 1.3.4.2 chap struct rt2560_rx_radiotap_header th;
158 1.3.4.2 chap uint8_t pad[64];
159 1.3.4.2 chap } sc_rxtapu;
160 1.3.4.2 chap #define sc_rxtap sc_rxtapu.th
161 1.3.4.2 chap int sc_rxtap_len;
162 1.3.4.2 chap
163 1.3.4.2 chap union {
164 1.3.4.2 chap struct rt2560_tx_radiotap_header th;
165 1.3.4.2 chap uint8_t pad[64];
166 1.3.4.2 chap } sc_txtapu;
167 1.3.4.2 chap #define sc_txtap sc_txtapu.th
168 1.3.4.2 chap int sc_txtap_len;
169 1.3.4.2 chap #endif
170 1.3.4.2 chap };
171 1.3.4.2 chap
172 1.3.4.2 chap #define sc_if sc_ec.ec_if
173 1.3.4.2 chap
174 1.3.4.2 chap int rt2560_attach(void *, int);
175 1.3.4.2 chap int rt2560_detach(void *);
176 1.3.4.2 chap int rt2560_intr(void *);
177