summaryrefslogtreecommitdiffstats
path: root/sys/dev/awi/awivar.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/awi/awivar.h')
-rw-r--r--sys/dev/awi/awivar.h190
1 files changed, 55 insertions, 135 deletions
diff --git a/sys/dev/awi/awivar.h b/sys/dev/awi/awivar.h
index 0fcf4e2..b9f24e4 100644
--- a/sys/dev/awi/awivar.h
+++ b/sys/dev/awi/awivar.h
@@ -1,8 +1,8 @@
-/* $NetBSD: awivar.h,v 1.12 2000/07/21 04:48:56 onoe Exp $ */
+/* $NetBSD: awivar.h,v 1.20 2004/01/15 09:39:15 onoe Exp $ */
/* $FreeBSD$ */
/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1999,2000,2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -37,6 +37,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef _DEV_IC_AWIVAR_H
+#define _DEV_IC_AWIVAR_H
+
/* timer values in msec */
#define AWI_SELFTEST_TIMEOUT 5000
#define AWI_CMD_TIMEOUT 2000
@@ -45,96 +48,67 @@
#define AWI_ASCAN_WAIT 3000
#define AWI_PSCAN_DURATION 200
#define AWI_PSCAN_WAIT 5000
-#define AWI_TRANS_TIMEOUT 2000
+#define AWI_TRANS_TIMEOUT 5000
#define AWI_NTXBUFS 4
-#define AWI_MAX_KEYLEN 16
-
-enum awi_status {
- AWI_ST_INIT,
- AWI_ST_SCAN,
- AWI_ST_SETSS,
- AWI_ST_SYNC,
- AWI_ST_AUTH,
- AWI_ST_ASSOC,
- AWI_ST_RUNNING
-};
-struct awi_bss
-{
- TAILQ_ENTRY(awi_bss) list;
- u_int8_t esrc[ETHER_ADDR_LEN];
- u_int8_t chanset; /* channel set to use */
- u_int8_t pattern; /* hop pattern to use */
- u_int8_t index; /* index to use */
- u_int8_t rssi; /* strength of this beacon */
- u_int16_t dwell_time; /* dwell time */
- u_int8_t timestamp[8]; /* timestamp of this bss */
- u_int8_t bssid[ETHER_ADDR_LEN];
- u_int16_t capinfo;
- u_int32_t rxtime; /* unit's local time */
- u_int16_t interval; /* beacon interval */
- u_int8_t txrate;
- u_int8_t fails;
- u_int8_t essid[IEEE80211_NWID_LEN + 2];
+enum awi_sub_state {
+ AWI_ST_NONE,
+ AWI_ST_SCAN_INIT,
+ AWI_ST_SCAN_SETMIB,
+ AWI_ST_SCAN_SCCMD,
+ AWI_ST_SUB_INIT,
+ AWI_ST_SUB_SETSS,
+ AWI_ST_SUB_SYNC
};
-struct awi_wep_algo {
- char *awa_name;
- int (*awa_ctxlen)(void);
- void (*awa_setkey)(void *, u_char *, int);
- void (*awa_encrypt)(void *, u_char *, u_char *, int);
- void (*awa_decrypt)(void *, u_char *, u_char *, int);
+#define AWI_WAIT 0 /* must wait for completion */
+#define AWI_NOWAIT 1 /* do not wait */
+
+struct awi_chanset {
+ u_int8_t cs_type;
+ u_int8_t cs_region;
+ u_int8_t cs_min;
+ u_int8_t cs_max;
+ u_int8_t cs_def;
};
-struct awi_softc
-{
+struct awi_softc {
#ifdef __NetBSD__
- struct device sc_dev;
- struct ethercom sc_ec;
- void *sc_ih; /* interrupt handler */
-#endif
-#ifdef __FreeBSD__
-#if __FreeBSD_version >= 40000
- struct {
- char dv_xname[64]; /*XXX*/
- } sc_dev;
-#else
struct device sc_dev;
#endif
- struct arpcom sc_ec;
+#ifdef __FreeBSD__
+ device_t sc_dev;
#endif
struct am79c930_softc sc_chip;
- struct ifnet *sc_ifp;
+ struct ieee80211com sc_ic;
+ u_char sc_banner[AWI_BANNER_LEN];
int (*sc_enable)(struct awi_softc *);
void (*sc_disable)(struct awi_softc *);
-
- struct ifmedia sc_media;
- enum awi_status sc_status;
- unsigned int sc_enabled:1,
+ void (*sc_power)(struct awi_softc *, int);
+
+ int (*sc_newstate)(struct ieee80211com *,
+ enum ieee80211_state, int);
+ void (*sc_recv_mgmt)(struct ieee80211com *,
+ struct mbuf *, struct ieee80211_node *,
+ int, int, u_int32_t);
+ int (*sc_send_mgmt)(struct ieee80211com *,
+ struct ieee80211_node *, int, int);
+
+ void *sc_sdhook; /* shutdown hook */
+ void *sc_powerhook; /* power management hook */
+ unsigned int sc_attached:1,
+ sc_enabled:1,
sc_busy:1,
sc_cansleep:1,
- sc_invalid:1,
sc_enab_intr:1,
- sc_format_llc:1,
- sc_start_bss:1,
- sc_rawbpf:1,
- sc_no_bssid:1,
- sc_active_scan:1,
- sc_attached:1; /* attach has succeeded */
- u_int8_t sc_cmd_inprog;
+ sc_adhoc_ap:1,
+ sc_invalid:1;
+ enum ieee80211_state sc_nstate;
+ enum awi_sub_state sc_substate;
int sc_sleep_cnt;
-
- int sc_mgt_timer;
-
- TAILQ_HEAD(, awi_bss) sc_scan;
- u_int8_t sc_scan_cur;
- u_int8_t sc_scan_min;
- u_int8_t sc_scan_max;
- u_int8_t sc_scan_set;
- struct awi_bss sc_bss;
- u_int8_t sc_ownssid[IEEE80211_NWID_LEN + 2];
- u_int8_t sc_ownch;
+ u_int8_t sc_cmd_inprog;
+ u_int8_t sc_cur_chan;
int sc_rx_timer;
u_int32_t sc_rxdoff;
@@ -142,20 +116,11 @@ struct awi_softc
struct mbuf *sc_rxpend;
int sc_tx_timer;
- u_int8_t sc_tx_rate;
- struct ifqueue sc_mgtq;
u_int32_t sc_txbase;
u_int32_t sc_txend;
u_int32_t sc_txnext;
u_int32_t sc_txdone;
- int sc_wep_keylen[IEEE80211_WEP_NKID]; /* keylen */
- u_int8_t sc_wep_key[IEEE80211_WEP_NKID][AWI_MAX_KEYLEN];
- int sc_wep_defkid;
- void *sc_wep_ctx; /* work area */
- struct awi_wep_algo *sc_wep_algo;
-
- u_char sc_banner[AWI_BANNER_LEN];
struct awi_mib_local sc_mib_local;
struct awi_mib_addr sc_mib_addr;
struct awi_mib_mac sc_mib_mac;
@@ -167,7 +132,8 @@ struct awi_softc
#define awi_read_1(sc, off) ((sc)->sc_chip.sc_ops->read_1)(&sc->sc_chip, off)
#define awi_read_2(sc, off) ((sc)->sc_chip.sc_ops->read_2)(&sc->sc_chip, off)
#define awi_read_4(sc, off) ((sc)->sc_chip.sc_ops->read_4)(&sc->sc_chip, off)
-#define awi_read_bytes(sc, off, ptr, len) ((sc)->sc_chip.sc_ops->read_bytes)(&sc->sc_chip, off, ptr, len)
+#define awi_read_bytes(sc, off, ptr, len) \
+ ((sc)->sc_chip.sc_ops->read_bytes)(&sc->sc_chip, off, ptr, len)
#define awi_write_1(sc, off, val) \
((sc)->sc_chip.sc_ops->write_1)(&sc->sc_chip, off, val)
@@ -182,59 +148,13 @@ struct awi_softc
awi_write_1(sc, AWI_DRIVERSTATE, \
((state) | AWI_DRV_AUTORXLED|AWI_DRV_AUTOTXLED))
-/* unalligned little endian access */
-#define LE_READ_2(p) \
- (((u_int8_t *)(p))[0] | (((u_int8_t *)(p))[1] << 8))
-#define LE_READ_4(p) \
- (((u_int8_t *)(p))[0] | (((u_int8_t *)(p))[1] << 8) | \
- (((u_int8_t *)(p))[2] << 16) | (((u_int8_t *)(p))[3] << 24))
-#define LE_WRITE_2(p, v) \
- ((((u_int8_t *)(p))[0] = ((u_int32_t)(v) & 0xff)), \
- (((u_int8_t *)(p))[1] = (((u_int32_t)(v) >> 8) & 0xff)))
-#define LE_WRITE_4(p, v) \
- ((((u_int8_t *)(p))[0] = ((u_int32_t)(v) & 0xff)), \
- (((u_int8_t *)(p))[1] = (((u_int32_t)(v) >> 8) & 0xff)), \
- (((u_int8_t *)(p))[2] = (((u_int32_t)(v) >> 16) & 0xff)), \
- (((u_int8_t *)(p))[3] = (((u_int32_t)(v) >> 24) & 0xff)))
-
-#define AWI_80211_RATE(rate) (((rate) & 0x7f) * 5)
-
int awi_attach(struct awi_softc *);
-int awi_intr(void *);
-void awi_reset(struct awi_softc *);
+int awi_detach(struct awi_softc *);
#ifdef __NetBSD__
int awi_activate(struct device *, enum devact);
-int awi_detach(struct awi_softc *);
-void awi_power(struct awi_softc *, int);
-#endif
-
-void awi_stop(struct awi_softc *sc);
-int awi_init(struct awi_softc *sc);
-int awi_init_region(struct awi_softc *);
-int awi_wicfg(struct ifnet *, u_long, caddr_t);
-
-#ifndef SIOCS80211NWKEY
-/*
- * This structure is part of the NetBSD public ioctl interface but
- * used internally by the driver. Declare it here for non-NetBSD
- * systems.
- */
-/* the first member must be matched with struct ifreq */
-struct ieee80211_nwkey {
- char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
- int i_wepon; /* wep enabled flag */
- int i_defkid; /* default encrypt key id */
- struct {
- int i_keylen;
- u_int8_t *i_keydat;
- } i_key[IEEE80211_WEP_NKID];
-};
+void awi_power(int, void *);
#endif
+void awi_shutdown(void *);
+int awi_intr(void *);
-int awi_wep_setnwkey(struct awi_softc *, struct ieee80211_nwkey *);
-int awi_wep_getnwkey(struct awi_softc *, struct ieee80211_nwkey *);
-int awi_wep_getalgo(struct awi_softc *);
-int awi_wep_setalgo(struct awi_softc *, int);
-int awi_wep_setkey(struct awi_softc *, int, unsigned char *, int);
-int awi_wep_getkey(struct awi_softc *, int, unsigned char *, int *);
-struct mbuf *awi_wep_encrypt(struct awi_softc *, struct mbuf *, int);
+#endif /* _DEV_IC_AWIVAR_H */
OpenPOWER on IntegriCloud