anvar.h revision 1.13 1 1.13 dyoung /* $NetBSD: anvar.h,v 1.13 2006/02/19 08:20:02 dyoung Exp $ */
2 1.1 onoe /*
3 1.1 onoe * Copyright (c) 1997, 1998, 1999
4 1.1 onoe * Bill Paul <wpaul (at) ctr.columbia.edu>. All rights reserved.
5 1.1 onoe *
6 1.1 onoe * Redistribution and use in source and binary forms, with or without
7 1.1 onoe * modification, are permitted provided that the following conditions
8 1.1 onoe * are met:
9 1.1 onoe * 1. Redistributions of source code must retain the above copyright
10 1.1 onoe * notice, this list of conditions and the following disclaimer.
11 1.1 onoe * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 onoe * notice, this list of conditions and the following disclaimer in the
13 1.1 onoe * documentation and/or other materials provided with the distribution.
14 1.1 onoe * 3. All advertising materials mentioning features or use of this software
15 1.1 onoe * must display the following acknowledgement:
16 1.1 onoe * This product includes software developed by Bill Paul.
17 1.1 onoe * 4. Neither the name of the author nor the names of any co-contributors
18 1.1 onoe * may be used to endorse or promote products derived from this software
19 1.1 onoe * without specific prior written permission.
20 1.1 onoe *
21 1.1 onoe * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
22 1.1 onoe * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 1.1 onoe * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 1.1 onoe * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
25 1.1 onoe * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 1.1 onoe * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 1.1 onoe * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 1.1 onoe * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 1.1 onoe * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 1.1 onoe * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 1.1 onoe * THE POSSIBILITY OF SUCH DAMAGE.
32 1.1 onoe *
33 1.1 onoe * $FreeBSD: src/sys/dev/an/if_aironet_ieee.h,v 1.2 2000/11/13 23:04:12 wpaul Exp $
34 1.1 onoe */
35 1.1 onoe
36 1.2 onoe #ifndef _DEV_IC_ANVAR_H
37 1.2 onoe #define _DEV_IC_ANVAR_H
38 1.1 onoe
39 1.13 dyoung #include <net80211/ieee80211_radiotap.h>
40 1.13 dyoung
41 1.2 onoe #define AN_TIMEOUT 65536
42 1.8 onoe #define AN_MAGIC 0x414e
43 1.5 onoe
44 1.5 onoe /* The interrupts we will handle */
45 1.8 onoe #define AN_INTRS (AN_EV_RX | AN_EV_TX | AN_EV_TX_EXC | AN_EV_LINKSTAT)
46 1.2 onoe
47 1.1 onoe /*
48 1.2 onoe * register space access macros
49 1.1 onoe */
50 1.2 onoe #define CSR_WRITE_2(sc, reg, val) \
51 1.8 onoe bus_space_write_2(sc->sc_iot, sc->sc_ioh, reg, val)
52 1.2 onoe
53 1.2 onoe #define CSR_READ_2(sc, reg) \
54 1.8 onoe bus_space_read_2(sc->sc_iot, sc->sc_ioh, reg)
55 1.2 onoe
56 1.8 onoe #ifndef __BUS_SPACE_HAS_STREAM_METHODS
57 1.8 onoe #define bus_space_write_multi_stream_2 bus_space_write_multi_2
58 1.8 onoe #define bus_space_read_multi_stream_2 bus_space_read_multi_2
59 1.10 perry #endif
60 1.8 onoe
61 1.8 onoe #define CSR_WRITE_MULTI_STREAM_2(sc, reg, val, count) \
62 1.8 onoe bus_space_write_multi_stream_2(sc->sc_iot, sc->sc_ioh, reg, val, count)
63 1.8 onoe #define CSR_READ_MULTI_STREAM_2(sc, reg, buf, count) \
64 1.8 onoe bus_space_read_multi_stream_2(sc->sc_iot, sc->sc_ioh, reg, buf, count)
65 1.1 onoe
66 1.8 onoe #define AN_TX_MAX_LEN \
67 1.8 onoe (sizeof(struct an_txframe) + ETHER_TYPE_LEN + ETHER_MAX_LEN)
68 1.2 onoe #define AN_TX_RING_CNT 4
69 1.2 onoe #define AN_INC(x, y) (x) = (x + 1) % y
70 1.10 perry
71 1.6 onoe struct an_wepkey {
72 1.6 onoe int an_wep_key[16];
73 1.6 onoe int an_wep_keylen;
74 1.6 onoe };
75 1.6 onoe
76 1.13 dyoung /* Radio capture format for Aironet */
77 1.13 dyoung #define AN_RX_RADIOTAP_PRESENT ((1 << IEEE80211_RADIOTAP_FLAGS) | \
78 1.13 dyoung (1 << IEEE80211_RADIOTAP_RATE) | \
79 1.13 dyoung (1 << IEEE80211_RADIOTAP_CHANNEL) | \
80 1.13 dyoung (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
81 1.13 dyoung
82 1.13 dyoung struct an_rx_radiotap_header {
83 1.13 dyoung struct ieee80211_radiotap_header ar_ihdr;
84 1.13 dyoung u_int8_t ar_flags;
85 1.13 dyoung u_int8_t ar_rate;
86 1.13 dyoung u_int16_t ar_chan_freq;
87 1.13 dyoung u_int16_t ar_chan_flags;
88 1.13 dyoung int8_t ar_antsignal;
89 1.13 dyoung } __attribute__((__packed__));
90 1.13 dyoung
91 1.13 dyoung #define AN_TX_RADIOTAP_PRESENT ((1 << IEEE80211_RADIOTAP_FLAGS) | \
92 1.13 dyoung (1 << IEEE80211_RADIOTAP_RATE) | \
93 1.13 dyoung (1 << IEEE80211_RADIOTAP_CHANNEL))
94 1.13 dyoung
95 1.13 dyoung struct an_tx_radiotap_header {
96 1.13 dyoung struct ieee80211_radiotap_header at_ihdr;
97 1.13 dyoung u_int8_t at_flags;
98 1.13 dyoung u_int8_t at_rate;
99 1.13 dyoung u_int16_t at_chan_freq;
100 1.13 dyoung u_int16_t at_chan_flags;
101 1.13 dyoung } __attribute__((__packed__));
102 1.13 dyoung
103 1.9 dyoung #define AN_GAPLEN_MAX 8
104 1.9 dyoung
105 1.2 onoe struct an_softc {
106 1.8 onoe struct device sc_dev;
107 1.11 dyoung struct ethercom sc_ec;
108 1.8 onoe struct ieee80211com sc_ic;
109 1.8 onoe bus_space_tag_t sc_iot;
110 1.8 onoe bus_space_handle_t sc_ioh;
111 1.8 onoe int (*sc_enable)(struct an_softc *);
112 1.8 onoe void (*sc_disable)(struct an_softc *);
113 1.8 onoe int (*sc_newstate)(struct ieee80211com *,
114 1.8 onoe enum ieee80211_state, int);
115 1.8 onoe
116 1.2 onoe int sc_enabled;
117 1.4 onoe int sc_invalid;
118 1.8 onoe int sc_attached;
119 1.8 onoe
120 1.8 onoe int sc_bap_id;
121 1.8 onoe int sc_bap_off;
122 1.2 onoe
123 1.8 onoe int sc_use_leap;
124 1.8 onoe struct an_wepkey sc_wepkeys[IEEE80211_WEP_NKID];
125 1.8 onoe int sc_perskeylen[IEEE80211_WEP_NKID];
126 1.8 onoe int sc_tx_key;
127 1.8 onoe int sc_tx_perskey;
128 1.8 onoe int sc_tx_timer;
129 1.8 onoe struct an_txdesc {
130 1.8 onoe int d_fid;
131 1.8 onoe int d_inuse;
132 1.8 onoe } sc_txd[AN_TX_RING_CNT];
133 1.8 onoe int sc_txnext;
134 1.8 onoe int sc_txcur;
135 1.8 onoe
136 1.8 onoe struct an_rid_genconfig sc_config;
137 1.8 onoe struct an_rid_caps sc_caps;
138 1.8 onoe union {
139 1.8 onoe u_int16_t sc_val[1];
140 1.8 onoe u_int8_t sc_txbuf[AN_TX_MAX_LEN];
141 1.8 onoe struct an_rid_ssidlist sc_ssidlist;
142 1.8 onoe struct an_rid_aplist sc_aplist;
143 1.8 onoe struct an_rid_status sc_status;
144 1.8 onoe struct an_rid_wepkey sc_wepkey;
145 1.8 onoe struct an_rid_leapkey sc_leapkey;
146 1.8 onoe struct an_rid_encap sc_encap;
147 1.8 onoe } sc_buf;
148 1.13 dyoung
149 1.13 dyoung /* radiotap header */
150 1.13 dyoung caddr_t sc_drvbpf;
151 1.13 dyoung union {
152 1.13 dyoung struct an_rx_radiotap_header tap;
153 1.13 dyoung u_int8_t pad[64];
154 1.13 dyoung } sc_rxtapu;
155 1.13 dyoung union {
156 1.13 dyoung struct an_tx_radiotap_header tap;
157 1.13 dyoung u_int8_t pad[64];
158 1.13 dyoung } sc_txtapu;
159 1.2 onoe };
160 1.2 onoe
161 1.11 dyoung #define sc_if sc_ec.ec_if
162 1.13 dyoung #define sc_rxtap sc_rxtapu.tap
163 1.13 dyoung #define sc_txtap sc_txtapu.tap
164 1.11 dyoung
165 1.8 onoe int an_attach(struct an_softc *);
166 1.8 onoe int an_detach(struct an_softc *);
167 1.8 onoe int an_activate(struct device *, enum devact);
168 1.8 onoe void an_power(int, void *);
169 1.8 onoe void an_shutdown(struct an_softc *);
170 1.8 onoe int an_intr(void *);
171 1.1 onoe
172 1.2 onoe #endif /* _DEV_IC_ANVAR_H */
173