1 /* $NetBSD: awivar.h,v 1.25 2009/09/15 18:32:00 dyoung Exp $ */
4 * Copyright (c) 1999,2000,2001 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _DEV_IC_AWIVAR_H
33 #define _DEV_IC_AWIVAR_H
35 /* timer values in msec */
36 #define AWI_SELFTEST_TIMEOUT 5000
37 #define AWI_CMD_TIMEOUT 2000
38 #define AWI_LOCKOUT_TIMEOUT 50
39 #define AWI_ASCAN_DURATION 100
40 #define AWI_ASCAN_WAIT 3000
41 #define AWI_PSCAN_DURATION 200
42 #define AWI_PSCAN_WAIT 5000
43 #define AWI_TRANS_TIMEOUT 5000
57 #define AWI_WAIT 0 /* must wait for completion */
58 #define AWI_NOWAIT 1 /* do not wait */
70 struct am79c930_softc sc_chip
;
71 struct ethercom sc_ec
;
72 struct ieee80211com sc_ic
;
73 u_char sc_banner
[AWI_BANNER_LEN
];
74 int (*sc_enable
)(struct awi_softc
*);
75 void (*sc_disable
)(struct awi_softc
*);
76 void (*sc_power
)(struct awi_softc
*, int);
78 int (*sc_newstate
)(struct ieee80211com
*,
79 enum ieee80211_state
, int);
80 void (*sc_recv_mgmt
)(struct ieee80211com
*,
81 struct mbuf
*, struct ieee80211_node
*,
83 int (*sc_send_mgmt
)(struct ieee80211com
*,
84 struct ieee80211_node
*, int, int);
86 void *sc_sdhook
; /* shutdown hook */
87 void *sc_powerhook
; /* power management hook */
88 unsigned int sc_attached
:1,
94 enum ieee80211_state sc_nstate
;
95 enum awi_sub_state sc_substate
;
97 u_int8_t sc_cmd_inprog
;
103 struct mbuf
*sc_rxpend
;
111 struct awi_mib_local sc_mib_local
;
112 struct awi_mib_addr sc_mib_addr
;
113 struct awi_mib_mac sc_mib_mac
;
114 struct awi_mib_stat sc_mib_stat
;
115 struct awi_mib_mgt sc_mib_mgt
;
116 struct awi_mib_phy sc_mib_phy
;
119 #define sc_if sc_ec.ec_if
121 #define awi_read_1(sc, off) ((sc)->sc_chip.sc_ops->read_1)(&sc->sc_chip, off)
122 #define awi_read_2(sc, off) ((sc)->sc_chip.sc_ops->read_2)(&sc->sc_chip, off)
123 #define awi_read_4(sc, off) ((sc)->sc_chip.sc_ops->read_4)(&sc->sc_chip, off)
124 #define awi_read_bytes(sc, off, ptr, len) \
125 ((sc)->sc_chip.sc_ops->read_bytes)(&sc->sc_chip, off, ptr, len)
127 #define awi_write_1(sc, off, val) \
128 ((sc)->sc_chip.sc_ops->write_1)(&sc->sc_chip, off, val)
129 #define awi_write_2(sc, off, val) \
130 ((sc)->sc_chip.sc_ops->write_2)(&sc->sc_chip, off, val)
131 #define awi_write_4(sc, off, val) \
132 ((sc)->sc_chip.sc_ops->write_4)(&sc->sc_chip, off, val)
133 #define awi_write_bytes(sc, off, ptr, len) \
134 ((sc)->sc_chip.sc_ops->write_bytes)(&sc->sc_chip, off, ptr, len)
136 #define awi_drvstate(sc, state) \
137 awi_write_1(sc, AWI_DRIVERSTATE, \
138 ((state) | AWI_DRV_AUTORXLED|AWI_DRV_AUTOTXLED))
140 int awi_attach(struct awi_softc
*);
141 int awi_detach(struct awi_softc
*);
142 int awi_activate(device_t
, enum devact
);
143 void awi_power(int, void *);
144 void awi_shutdown(void *);
145 int awi_intr(void *);
147 #endif /* _DEV_IC_AWIVAR_H */