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