FreeBSD/Linux Kernel Cross Reference
sys/dev/ic/anvar.h
1 /* $NetBSD: anvar.h,v 1.10 2005/02/27 00:27:00 perry Exp $ */
2 /*
3 * Copyright (c) 1997, 1998, 1999
4 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Bill Paul.
17 * 4. Neither the name of the author nor the names of any co-contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 * $FreeBSD: src/sys/dev/an/if_aironet_ieee.h,v 1.2 2000/11/13 23:04:12 wpaul Exp $
34 */
35
36 #ifndef _DEV_IC_ANVAR_H
37 #define _DEV_IC_ANVAR_H
38
39 #define AN_TIMEOUT 65536
40 #define AN_MAGIC 0x414e
41
42 /* The interrupts we will handle */
43 #define AN_INTRS (AN_EV_RX | AN_EV_TX | AN_EV_TX_EXC | AN_EV_LINKSTAT)
44
45 /*
46 * register space access macros
47 */
48 #define CSR_WRITE_2(sc, reg, val) \
49 bus_space_write_2(sc->sc_iot, sc->sc_ioh, reg, val)
50
51 #define CSR_READ_2(sc, reg) \
52 bus_space_read_2(sc->sc_iot, sc->sc_ioh, reg)
53
54 #ifndef __BUS_SPACE_HAS_STREAM_METHODS
55 #define bus_space_write_multi_stream_2 bus_space_write_multi_2
56 #define bus_space_read_multi_stream_2 bus_space_read_multi_2
57 #endif
58
59 #define CSR_WRITE_MULTI_STREAM_2(sc, reg, val, count) \
60 bus_space_write_multi_stream_2(sc->sc_iot, sc->sc_ioh, reg, val, count)
61 #define CSR_READ_MULTI_STREAM_2(sc, reg, buf, count) \
62 bus_space_read_multi_stream_2(sc->sc_iot, sc->sc_ioh, reg, buf, count)
63
64 #define AN_TX_MAX_LEN \
65 (sizeof(struct an_txframe) + ETHER_TYPE_LEN + ETHER_MAX_LEN)
66 #define AN_TX_RING_CNT 4
67 #define AN_INC(x, y) (x) = (x + 1) % y
68
69 struct an_wepkey {
70 int an_wep_key[16];
71 int an_wep_keylen;
72 };
73
74 #define AN_GAPLEN_MAX 8
75
76 struct an_softc {
77 struct device sc_dev;
78 struct ieee80211com sc_ic;
79 bus_space_tag_t sc_iot;
80 bus_space_handle_t sc_ioh;
81 int (*sc_enable)(struct an_softc *);
82 void (*sc_disable)(struct an_softc *);
83 int (*sc_newstate)(struct ieee80211com *,
84 enum ieee80211_state, int);
85
86 int sc_enabled;
87 int sc_invalid;
88 int sc_attached;
89
90 int sc_bap_id;
91 int sc_bap_off;
92
93 int sc_use_leap;
94 struct an_wepkey sc_wepkeys[IEEE80211_WEP_NKID];
95 int sc_perskeylen[IEEE80211_WEP_NKID];
96 int sc_tx_key;
97 int sc_tx_perskey;
98 int sc_tx_timer;
99 struct an_txdesc {
100 int d_fid;
101 int d_inuse;
102 } sc_txd[AN_TX_RING_CNT];
103 int sc_txnext;
104 int sc_txcur;
105
106 struct an_rid_genconfig sc_config;
107 struct an_rid_caps sc_caps;
108 union {
109 u_int16_t sc_val[1];
110 u_int8_t sc_txbuf[AN_TX_MAX_LEN];
111 struct an_rid_ssidlist sc_ssidlist;
112 struct an_rid_aplist sc_aplist;
113 struct an_rid_status sc_status;
114 struct an_rid_wepkey sc_wepkey;
115 struct an_rid_leapkey sc_leapkey;
116 struct an_rid_encap sc_encap;
117 } sc_buf;
118 };
119
120 int an_attach(struct an_softc *);
121 int an_detach(struct an_softc *);
122 int an_activate(struct device *, enum devact);
123 void an_power(int, void *);
124 void an_shutdown(struct an_softc *);
125 int an_intr(void *);
126
127 #endif /* _DEV_IC_ANVAR_H */
Cache object: 1149f8b86a6ee3ce1446fbf678b199fc
|