FreeBSD/Linux Kernel Cross Reference
sys/dev/awi/awivar.h
1 /* $NetBSD: awivar.h,v 1.20 2004/01/15 09:39:15 onoe Exp $ */
2 /* $FreeBSD: releng/5.4/sys/dev/awi/awivar.h 124546 2004-01-15 10:04:21Z onoe $ */
3
4 /*-
5 * Copyright (c) 1999,2000,2001 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Bill Sommerfeld
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the NetBSD
22 * Foundation, Inc. and its contributors.
23 * 4. Neither the name of The NetBSD Foundation nor the names of its
24 * contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40 #ifndef _DEV_IC_AWIVAR_H
41 #define _DEV_IC_AWIVAR_H
42
43 /* timer values in msec */
44 #define AWI_SELFTEST_TIMEOUT 5000
45 #define AWI_CMD_TIMEOUT 2000
46 #define AWI_LOCKOUT_TIMEOUT 50
47 #define AWI_ASCAN_DURATION 100
48 #define AWI_ASCAN_WAIT 3000
49 #define AWI_PSCAN_DURATION 200
50 #define AWI_PSCAN_WAIT 5000
51 #define AWI_TRANS_TIMEOUT 5000
52
53 #define AWI_NTXBUFS 4
54
55 enum awi_sub_state {
56 AWI_ST_NONE,
57 AWI_ST_SCAN_INIT,
58 AWI_ST_SCAN_SETMIB,
59 AWI_ST_SCAN_SCCMD,
60 AWI_ST_SUB_INIT,
61 AWI_ST_SUB_SETSS,
62 AWI_ST_SUB_SYNC
63 };
64
65 #define AWI_WAIT 0 /* must wait for completion */
66 #define AWI_NOWAIT 1 /* do not wait */
67
68 struct awi_chanset {
69 u_int8_t cs_type;
70 u_int8_t cs_region;
71 u_int8_t cs_min;
72 u_int8_t cs_max;
73 u_int8_t cs_def;
74 };
75
76 struct awi_softc {
77 #ifdef __NetBSD__
78 struct device sc_dev;
79 #endif
80 #ifdef __FreeBSD__
81 device_t sc_dev;
82 #endif
83 struct am79c930_softc sc_chip;
84 struct ieee80211com sc_ic;
85 u_char sc_banner[AWI_BANNER_LEN];
86 int (*sc_enable)(struct awi_softc *);
87 void (*sc_disable)(struct awi_softc *);
88 void (*sc_power)(struct awi_softc *, int);
89
90 int (*sc_newstate)(struct ieee80211com *,
91 enum ieee80211_state, int);
92 void (*sc_recv_mgmt)(struct ieee80211com *,
93 struct mbuf *, struct ieee80211_node *,
94 int, int, u_int32_t);
95 int (*sc_send_mgmt)(struct ieee80211com *,
96 struct ieee80211_node *, int, int);
97
98 void *sc_sdhook; /* shutdown hook */
99 void *sc_powerhook; /* power management hook */
100 unsigned int sc_attached:1,
101 sc_enabled:1,
102 sc_busy:1,
103 sc_cansleep:1,
104 sc_enab_intr:1,
105 sc_adhoc_ap:1,
106 sc_invalid:1;
107 enum ieee80211_state sc_nstate;
108 enum awi_sub_state sc_substate;
109 int sc_sleep_cnt;
110 u_int8_t sc_cmd_inprog;
111 u_int8_t sc_cur_chan;
112
113 int sc_rx_timer;
114 u_int32_t sc_rxdoff;
115 u_int32_t sc_rxmoff;
116 struct mbuf *sc_rxpend;
117
118 int sc_tx_timer;
119 u_int32_t sc_txbase;
120 u_int32_t sc_txend;
121 u_int32_t sc_txnext;
122 u_int32_t sc_txdone;
123
124 struct awi_mib_local sc_mib_local;
125 struct awi_mib_addr sc_mib_addr;
126 struct awi_mib_mac sc_mib_mac;
127 struct awi_mib_stat sc_mib_stat;
128 struct awi_mib_mgt sc_mib_mgt;
129 struct awi_mib_phy sc_mib_phy;
130 };
131
132 #define awi_read_1(sc, off) ((sc)->sc_chip.sc_ops->read_1)(&sc->sc_chip, off)
133 #define awi_read_2(sc, off) ((sc)->sc_chip.sc_ops->read_2)(&sc->sc_chip, off)
134 #define awi_read_4(sc, off) ((sc)->sc_chip.sc_ops->read_4)(&sc->sc_chip, off)
135 #define awi_read_bytes(sc, off, ptr, len) \
136 ((sc)->sc_chip.sc_ops->read_bytes)(&sc->sc_chip, off, ptr, len)
137
138 #define awi_write_1(sc, off, val) \
139 ((sc)->sc_chip.sc_ops->write_1)(&sc->sc_chip, off, val)
140 #define awi_write_2(sc, off, val) \
141 ((sc)->sc_chip.sc_ops->write_2)(&sc->sc_chip, off, val)
142 #define awi_write_4(sc, off, val) \
143 ((sc)->sc_chip.sc_ops->write_4)(&sc->sc_chip, off, val)
144 #define awi_write_bytes(sc, off, ptr, len) \
145 ((sc)->sc_chip.sc_ops->write_bytes)(&sc->sc_chip, off, ptr, len)
146
147 #define awi_drvstate(sc, state) \
148 awi_write_1(sc, AWI_DRIVERSTATE, \
149 ((state) | AWI_DRV_AUTORXLED|AWI_DRV_AUTOTXLED))
150
151 int awi_attach(struct awi_softc *);
152 int awi_detach(struct awi_softc *);
153 #ifdef __NetBSD__
154 int awi_activate(struct device *, enum devact);
155 void awi_power(int, void *);
156 #endif
157 void awi_shutdown(void *);
158 int awi_intr(void *);
159
160 #endif /* _DEV_IC_AWIVAR_H */
Cache object: d8493fd39fe83bf90e24f3ce64b5f5d9
|