anvar.h revision 1.6 1 1.6 onoe /* $NetBSD: anvar.h,v 1.6 2001/06/21 12:49:06 onoe 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.1 onoe /*
40 1.1 onoe * This header defines a simple command interface to the FreeBSD
41 1.1 onoe * Aironet driver (an) driver, which is used to set certain
42 1.1 onoe * device-specific parameters which can't be easily managed through
43 1.1 onoe * ifconfig(8). No, sysctl(2) is not the answer. I said a _simple_
44 1.1 onoe * interface, didn't I.
45 1.1 onoe */
46 1.1 onoe
47 1.1 onoe #ifndef SIOCSAIRONET
48 1.1 onoe #define SIOCSAIRONET SIOCSIFGENERIC
49 1.1 onoe #endif
50 1.1 onoe
51 1.1 onoe #ifndef SIOCGAIRONET
52 1.1 onoe #define SIOCGAIRONET SIOCGIFGENERIC
53 1.1 onoe #endif
54 1.1 onoe
55 1.2 onoe #define AN_TIMEOUT 65536
56 1.2 onoe
57 1.2 onoe /* Default network name: ANY */
58 1.2 onoe #define AN_DEFAULT_NETNAME ""
59 1.2 onoe
60 1.2 onoe /* The nodename must be less than 16 bytes */
61 1.2 onoe #define AN_DEFAULT_NODENAME "NetBSD"
62 1.2 onoe
63 1.2 onoe #define AN_DEFAULT_IBSS "NetBSD IBSS"
64 1.5 onoe
65 1.5 onoe /* The interrupts we will handle */
66 1.5 onoe #define AN_INTRS \
67 1.5 onoe (AN_EV_RX|AN_EV_TX|AN_EV_TX_EXC|AN_EV_ALLOC|AN_EV_LINKSTAT)
68 1.2 onoe
69 1.1 onoe /*
70 1.2 onoe * register space access macros
71 1.1 onoe */
72 1.2 onoe #define CSR_WRITE_2(sc, reg, val) \
73 1.2 onoe bus_space_write_2(sc->an_btag, sc->an_bhandle, reg, val)
74 1.2 onoe
75 1.2 onoe #define CSR_READ_2(sc, reg) \
76 1.2 onoe bus_space_read_2(sc->an_btag, sc->an_bhandle, reg)
77 1.2 onoe
78 1.2 onoe #define CSR_WRITE_1(sc, reg, val) \
79 1.2 onoe bus_space_write_1(sc->an_btag, sc->an_bhandle, reg, val)
80 1.2 onoe
81 1.2 onoe #define CSR_READ_1(sc, reg) \
82 1.2 onoe bus_space_read_1(sc->an_btag, sc->an_bhandle, reg)
83 1.1 onoe
84 1.1 onoe /*
85 1.1 onoe * Technically I don't think there's a limit to a record
86 1.1 onoe * length. The largest record is the one that contains the CIS
87 1.1 onoe * data, which is 240 words long, so 256 should be a safe
88 1.1 onoe * value.
89 1.1 onoe */
90 1.1 onoe #define AN_MAX_DATALEN 512
91 1.1 onoe
92 1.1 onoe struct an_req {
93 1.1 onoe u_int16_t an_len;
94 1.1 onoe u_int16_t an_type;
95 1.1 onoe u_int16_t an_val[AN_MAX_DATALEN];
96 1.1 onoe };
97 1.1 onoe
98 1.1 onoe /*
99 1.1 onoe * Private LTV records (interpreted only by the driver). This is
100 1.1 onoe * a minor kludge to allow reading the interface statistics from
101 1.1 onoe * the driver.
102 1.1 onoe */
103 1.1 onoe #define AN_RID_IFACE_STATS 0x0100
104 1.1 onoe #define AN_RID_MGMT_XMIT 0x0200
105 1.1 onoe #define AN_RID_ZERO_CACHE 0x0300
106 1.1 onoe #define AN_RID_READ_CACHE 0x0400
107 1.2 onoe #define AN_RID_TX_SPEED 0x1234
108 1.1 onoe
109 1.1 onoe /*
110 1.1 onoe * Aironet IEEE signal strength cache
111 1.1 onoe *
112 1.1 onoe * driver keeps cache of last
113 1.1 onoe * MAXANCACHE packets to arrive including signal strength info.
114 1.1 onoe * daemons may read this via ioctl
115 1.1 onoe *
116 1.1 onoe * Each entry in the wi_sigcache has a unique macsrc.
117 1.1 onoe */
118 1.1 onoe #define MAXANCACHE 10
119 1.1 onoe
120 1.1 onoe struct an_sigcache {
121 1.1 onoe char macsrc[6]; /* unique MAC address for entry */
122 1.1 onoe int ipsrc; /* ip address associated with packet */
123 1.1 onoe int signal; /* signal strength of the packet */
124 1.1 onoe int noise; /* noise value */
125 1.1 onoe int quality; /* quality of the packet */
126 1.1 onoe };
127 1.1 onoe
128 1.2 onoe #define AN_TXGAP_80211 0
129 1.2 onoe #define AN_TXGAP_8023 0
130 1.1 onoe
131 1.2 onoe #define AN_TX_RING_CNT 4
132 1.2 onoe #define AN_INC(x, y) (x) = (x + 1) % y
133 1.2 onoe
134 1.2 onoe struct an_tx_ring_data {
135 1.2 onoe u_int16_t an_tx_fids[AN_TX_RING_CNT];
136 1.2 onoe u_int16_t an_tx_ring[AN_TX_RING_CNT];
137 1.2 onoe int an_tx_prod;
138 1.2 onoe int an_tx_cons;
139 1.2 onoe };
140 1.2 onoe
141 1.6 onoe struct an_wepkey {
142 1.6 onoe int an_wep_key[16];
143 1.6 onoe int an_wep_keylen;
144 1.6 onoe };
145 1.6 onoe
146 1.2 onoe struct an_softc {
147 1.2 onoe struct device an_dev;
148 1.2 onoe struct ethercom arpcom;
149 1.2 onoe int (*sc_enable) __P((struct an_softc *));
150 1.2 onoe void (*sc_disable) __P((struct an_softc *));
151 1.2 onoe int sc_enabled;
152 1.4 onoe int sc_invalid;
153 1.2 onoe struct ifmedia sc_media;
154 1.2 onoe
155 1.2 onoe bus_space_handle_t an_bhandle;
156 1.2 onoe bus_space_tag_t an_btag;
157 1.2 onoe struct an_ltv_genconfig an_config;
158 1.2 onoe struct an_ltv_caps an_caps;
159 1.2 onoe struct an_ltv_ssidlist an_ssidlist;
160 1.2 onoe struct an_ltv_aplist an_aplist;
161 1.6 onoe struct an_wepkey an_wepkeys[IEEE80211_WEP_NKID];
162 1.6 onoe int an_tx_key;
163 1.6 onoe int an_perskeylen[IEEE80211_WEP_NKID];
164 1.6 onoe int an_tx_perskey;
165 1.2 onoe int an_tx_rate;
166 1.2 onoe int an_if_flags;
167 1.2 onoe struct an_tx_ring_data an_rdata;
168 1.2 onoe struct an_ltv_status an_status;
169 1.2 onoe u_int8_t an_associated;
170 1.2 onoe int an_sigitems;
171 1.2 onoe struct an_sigcache an_sigcache[MAXANCACHE];
172 1.2 onoe int an_nextitem;
173 1.2 onoe struct callout an_stat_ch;
174 1.6 onoe struct an_req an_reqbuf;
175 1.2 onoe };
176 1.2 onoe
177 1.2 onoe int an_attach __P((struct an_softc *));
178 1.2 onoe int an_detach __P((struct an_softc *));
179 1.4 onoe int an_activate __P((struct device *, enum devact));
180 1.4 onoe void an_power __P((int, void *));
181 1.4 onoe void an_shutdown __P((void *));
182 1.2 onoe int an_intr __P((void *));
183 1.1 onoe
184 1.2 onoe #endif /* _DEV_IC_ANVAR_H */
185