anvar.h revision 1.10 1 1.10 perry /* $NetBSD: anvar.h,v 1.10 2005/02/27 00:27:00 perry 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.2 onoe #define AN_TIMEOUT 65536
40 1.8 onoe #define AN_MAGIC 0x414e
41 1.5 onoe
42 1.5 onoe /* The interrupts we will handle */
43 1.8 onoe #define AN_INTRS (AN_EV_RX | AN_EV_TX | AN_EV_TX_EXC | AN_EV_LINKSTAT)
44 1.2 onoe
45 1.1 onoe /*
46 1.2 onoe * register space access macros
47 1.1 onoe */
48 1.2 onoe #define CSR_WRITE_2(sc, reg, val) \
49 1.8 onoe bus_space_write_2(sc->sc_iot, sc->sc_ioh, reg, val)
50 1.2 onoe
51 1.2 onoe #define CSR_READ_2(sc, reg) \
52 1.8 onoe bus_space_read_2(sc->sc_iot, sc->sc_ioh, reg)
53 1.2 onoe
54 1.8 onoe #ifndef __BUS_SPACE_HAS_STREAM_METHODS
55 1.8 onoe #define bus_space_write_multi_stream_2 bus_space_write_multi_2
56 1.8 onoe #define bus_space_read_multi_stream_2 bus_space_read_multi_2
57 1.10 perry #endif
58 1.8 onoe
59 1.8 onoe #define CSR_WRITE_MULTI_STREAM_2(sc, reg, val, count) \
60 1.8 onoe bus_space_write_multi_stream_2(sc->sc_iot, sc->sc_ioh, reg, val, count)
61 1.8 onoe #define CSR_READ_MULTI_STREAM_2(sc, reg, buf, count) \
62 1.8 onoe bus_space_read_multi_stream_2(sc->sc_iot, sc->sc_ioh, reg, buf, count)
63 1.1 onoe
64 1.8 onoe #define AN_TX_MAX_LEN \
65 1.8 onoe (sizeof(struct an_txframe) + ETHER_TYPE_LEN + ETHER_MAX_LEN)
66 1.2 onoe #define AN_TX_RING_CNT 4
67 1.2 onoe #define AN_INC(x, y) (x) = (x + 1) % y
68 1.10 perry
69 1.6 onoe struct an_wepkey {
70 1.6 onoe int an_wep_key[16];
71 1.6 onoe int an_wep_keylen;
72 1.6 onoe };
73 1.6 onoe
74 1.9 dyoung #define AN_GAPLEN_MAX 8
75 1.9 dyoung
76 1.2 onoe struct an_softc {
77 1.8 onoe struct device sc_dev;
78 1.8 onoe struct ieee80211com sc_ic;
79 1.8 onoe bus_space_tag_t sc_iot;
80 1.8 onoe bus_space_handle_t sc_ioh;
81 1.8 onoe int (*sc_enable)(struct an_softc *);
82 1.8 onoe void (*sc_disable)(struct an_softc *);
83 1.8 onoe int (*sc_newstate)(struct ieee80211com *,
84 1.8 onoe enum ieee80211_state, int);
85 1.8 onoe
86 1.2 onoe int sc_enabled;
87 1.4 onoe int sc_invalid;
88 1.8 onoe int sc_attached;
89 1.8 onoe
90 1.8 onoe int sc_bap_id;
91 1.8 onoe int sc_bap_off;
92 1.2 onoe
93 1.8 onoe int sc_use_leap;
94 1.8 onoe struct an_wepkey sc_wepkeys[IEEE80211_WEP_NKID];
95 1.8 onoe int sc_perskeylen[IEEE80211_WEP_NKID];
96 1.8 onoe int sc_tx_key;
97 1.8 onoe int sc_tx_perskey;
98 1.8 onoe int sc_tx_timer;
99 1.8 onoe struct an_txdesc {
100 1.8 onoe int d_fid;
101 1.8 onoe int d_inuse;
102 1.8 onoe } sc_txd[AN_TX_RING_CNT];
103 1.8 onoe int sc_txnext;
104 1.8 onoe int sc_txcur;
105 1.8 onoe
106 1.8 onoe struct an_rid_genconfig sc_config;
107 1.8 onoe struct an_rid_caps sc_caps;
108 1.8 onoe union {
109 1.8 onoe u_int16_t sc_val[1];
110 1.8 onoe u_int8_t sc_txbuf[AN_TX_MAX_LEN];
111 1.8 onoe struct an_rid_ssidlist sc_ssidlist;
112 1.8 onoe struct an_rid_aplist sc_aplist;
113 1.8 onoe struct an_rid_status sc_status;
114 1.8 onoe struct an_rid_wepkey sc_wepkey;
115 1.8 onoe struct an_rid_leapkey sc_leapkey;
116 1.8 onoe struct an_rid_encap sc_encap;
117 1.8 onoe } sc_buf;
118 1.2 onoe };
119 1.2 onoe
120 1.8 onoe int an_attach(struct an_softc *);
121 1.8 onoe int an_detach(struct an_softc *);
122 1.8 onoe int an_activate(struct device *, enum devact);
123 1.8 onoe void an_power(int, void *);
124 1.8 onoe void an_shutdown(struct an_softc *);
125 1.8 onoe int an_intr(void *);
126 1.1 onoe
127 1.2 onoe #endif /* _DEV_IC_ANVAR_H */
128