2007-12-25 21:33:32 +03:00
|
|
|
/* $NetBSD: anvar.h,v 1.16 2007/12/25 18:33:38 perry Exp $ */
|
2000-12-12 02:16:50 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1997, 1998, 1999
|
|
|
|
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Bill Paul.
|
|
|
|
* 4. Neither the name of the author nor the names of any co-contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
|
|
* THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* $FreeBSD: src/sys/dev/an/if_aironet_ieee.h,v 1.2 2000/11/13 23:04:12 wpaul Exp $
|
|
|
|
*/
|
|
|
|
|
2000-12-12 08:11:15 +03:00
|
|
|
#ifndef _DEV_IC_ANVAR_H
|
|
|
|
#define _DEV_IC_ANVAR_H
|
2000-12-12 02:16:50 +03:00
|
|
|
|
2006-02-19 11:20:02 +03:00
|
|
|
#include <net80211/ieee80211_radiotap.h>
|
|
|
|
|
2000-12-12 08:11:15 +03:00
|
|
|
#define AN_TIMEOUT 65536
|
2004-01-28 18:07:52 +03:00
|
|
|
#define AN_MAGIC 0x414e
|
2000-12-12 08:11:15 +03:00
|
|
|
|
2000-12-21 02:30:36 +03:00
|
|
|
/* The interrupts we will handle */
|
2004-01-28 18:07:52 +03:00
|
|
|
#define AN_INTRS (AN_EV_RX | AN_EV_TX | AN_EV_TX_EXC | AN_EV_LINKSTAT)
|
2000-12-21 02:30:36 +03:00
|
|
|
|
2000-12-12 02:16:50 +03:00
|
|
|
/*
|
2000-12-12 08:11:15 +03:00
|
|
|
* register space access macros
|
2000-12-12 02:16:50 +03:00
|
|
|
*/
|
2000-12-12 08:11:15 +03:00
|
|
|
#define CSR_WRITE_2(sc, reg, val) \
|
2004-01-28 18:07:52 +03:00
|
|
|
bus_space_write_2(sc->sc_iot, sc->sc_ioh, reg, val)
|
2000-12-12 08:11:15 +03:00
|
|
|
|
|
|
|
#define CSR_READ_2(sc, reg) \
|
2004-01-28 18:07:52 +03:00
|
|
|
bus_space_read_2(sc->sc_iot, sc->sc_ioh, reg)
|
2000-12-12 08:11:15 +03:00
|
|
|
|
2004-01-28 18:07:52 +03:00
|
|
|
#ifndef __BUS_SPACE_HAS_STREAM_METHODS
|
|
|
|
#define bus_space_write_multi_stream_2 bus_space_write_multi_2
|
|
|
|
#define bus_space_read_multi_stream_2 bus_space_read_multi_2
|
2005-02-27 03:26:58 +03:00
|
|
|
#endif
|
2000-12-12 02:16:50 +03:00
|
|
|
|
2004-01-28 18:07:52 +03:00
|
|
|
#define CSR_WRITE_MULTI_STREAM_2(sc, reg, val, count) \
|
|
|
|
bus_space_write_multi_stream_2(sc->sc_iot, sc->sc_ioh, reg, val, count)
|
|
|
|
#define CSR_READ_MULTI_STREAM_2(sc, reg, buf, count) \
|
|
|
|
bus_space_read_multi_stream_2(sc->sc_iot, sc->sc_ioh, reg, buf, count)
|
2000-12-12 08:11:15 +03:00
|
|
|
|
2004-01-28 18:07:52 +03:00
|
|
|
#define AN_TX_MAX_LEN \
|
|
|
|
(sizeof(struct an_txframe) + ETHER_TYPE_LEN + ETHER_MAX_LEN)
|
2000-12-12 08:11:15 +03:00
|
|
|
#define AN_TX_RING_CNT 4
|
|
|
|
#define AN_INC(x, y) (x) = (x + 1) % y
|
2005-02-27 03:26:58 +03:00
|
|
|
|
2001-06-21 16:49:06 +04:00
|
|
|
struct an_wepkey {
|
|
|
|
int an_wep_key[16];
|
|
|
|
int an_wep_keylen;
|
|
|
|
};
|
|
|
|
|
2006-02-19 11:20:02 +03:00
|
|
|
/* Radio capture format for Aironet */
|
|
|
|
#define AN_RX_RADIOTAP_PRESENT ((1 << IEEE80211_RADIOTAP_FLAGS) | \
|
|
|
|
(1 << IEEE80211_RADIOTAP_RATE) | \
|
|
|
|
(1 << IEEE80211_RADIOTAP_CHANNEL) | \
|
|
|
|
(1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
|
|
|
|
|
|
|
|
struct an_rx_radiotap_header {
|
|
|
|
struct ieee80211_radiotap_header ar_ihdr;
|
|
|
|
u_int8_t ar_flags;
|
|
|
|
u_int8_t ar_rate;
|
|
|
|
u_int16_t ar_chan_freq;
|
|
|
|
u_int16_t ar_chan_flags;
|
|
|
|
int8_t ar_antsignal;
|
2007-12-25 21:33:32 +03:00
|
|
|
} __packed;
|
2006-02-19 11:20:02 +03:00
|
|
|
|
|
|
|
#define AN_TX_RADIOTAP_PRESENT ((1 << IEEE80211_RADIOTAP_FLAGS) | \
|
|
|
|
(1 << IEEE80211_RADIOTAP_RATE) | \
|
|
|
|
(1 << IEEE80211_RADIOTAP_CHANNEL))
|
|
|
|
|
|
|
|
struct an_tx_radiotap_header {
|
|
|
|
struct ieee80211_radiotap_header at_ihdr;
|
|
|
|
u_int8_t at_flags;
|
|
|
|
u_int8_t at_rate;
|
|
|
|
u_int16_t at_chan_freq;
|
|
|
|
u_int16_t at_chan_flags;
|
2007-12-25 21:33:32 +03:00
|
|
|
} __packed;
|
2006-02-19 11:20:02 +03:00
|
|
|
|
2005-01-15 14:01:46 +03:00
|
|
|
#define AN_GAPLEN_MAX 8
|
|
|
|
|
2000-12-12 08:11:15 +03:00
|
|
|
struct an_softc {
|
2004-01-28 18:07:52 +03:00
|
|
|
struct device sc_dev;
|
2005-06-22 10:14:51 +04:00
|
|
|
struct ethercom sc_ec;
|
2004-01-28 18:07:52 +03:00
|
|
|
struct ieee80211com sc_ic;
|
|
|
|
bus_space_tag_t sc_iot;
|
|
|
|
bus_space_handle_t sc_ioh;
|
|
|
|
int (*sc_enable)(struct an_softc *);
|
|
|
|
void (*sc_disable)(struct an_softc *);
|
|
|
|
int (*sc_newstate)(struct ieee80211com *,
|
|
|
|
enum ieee80211_state, int);
|
|
|
|
|
2000-12-12 08:11:15 +03:00
|
|
|
int sc_enabled;
|
2000-12-19 11:00:55 +03:00
|
|
|
int sc_invalid;
|
2004-01-28 18:07:52 +03:00
|
|
|
int sc_attached;
|
|
|
|
|
|
|
|
int sc_bap_id;
|
|
|
|
int sc_bap_off;
|
|
|
|
|
|
|
|
int sc_use_leap;
|
|
|
|
struct an_wepkey sc_wepkeys[IEEE80211_WEP_NKID];
|
|
|
|
int sc_perskeylen[IEEE80211_WEP_NKID];
|
|
|
|
int sc_tx_key;
|
|
|
|
int sc_tx_perskey;
|
|
|
|
int sc_tx_timer;
|
|
|
|
struct an_txdesc {
|
|
|
|
int d_fid;
|
|
|
|
int d_inuse;
|
|
|
|
} sc_txd[AN_TX_RING_CNT];
|
|
|
|
int sc_txnext;
|
|
|
|
int sc_txcur;
|
|
|
|
|
|
|
|
struct an_rid_genconfig sc_config;
|
|
|
|
struct an_rid_caps sc_caps;
|
|
|
|
union {
|
|
|
|
u_int16_t sc_val[1];
|
|
|
|
u_int8_t sc_txbuf[AN_TX_MAX_LEN];
|
|
|
|
struct an_rid_ssidlist sc_ssidlist;
|
|
|
|
struct an_rid_aplist sc_aplist;
|
|
|
|
struct an_rid_status sc_status;
|
|
|
|
struct an_rid_wepkey sc_wepkey;
|
|
|
|
struct an_rid_leapkey sc_leapkey;
|
|
|
|
struct an_rid_encap sc_encap;
|
|
|
|
} sc_buf;
|
2006-02-19 11:20:02 +03:00
|
|
|
|
|
|
|
/* radiotap header */
|
2007-03-04 08:59:00 +03:00
|
|
|
void * sc_drvbpf;
|
2006-02-19 11:20:02 +03:00
|
|
|
union {
|
|
|
|
struct an_rx_radiotap_header tap;
|
|
|
|
u_int8_t pad[64];
|
|
|
|
} sc_rxtapu;
|
|
|
|
union {
|
|
|
|
struct an_tx_radiotap_header tap;
|
|
|
|
u_int8_t pad[64];
|
|
|
|
} sc_txtapu;
|
2000-12-12 08:11:15 +03:00
|
|
|
};
|
2000-12-12 02:16:50 +03:00
|
|
|
|
2005-06-22 10:14:51 +04:00
|
|
|
#define sc_if sc_ec.ec_if
|
2006-02-19 11:20:02 +03:00
|
|
|
#define sc_rxtap sc_rxtapu.tap
|
|
|
|
#define sc_txtap sc_txtapu.tap
|
2005-06-22 10:14:51 +04:00
|
|
|
|
2004-01-28 18:07:52 +03:00
|
|
|
int an_attach(struct an_softc *);
|
|
|
|
int an_detach(struct an_softc *);
|
|
|
|
int an_activate(struct device *, enum devact);
|
|
|
|
int an_intr(void *);
|
2000-12-12 02:16:50 +03:00
|
|
|
|
2000-12-12 08:11:15 +03:00
|
|
|
#endif /* _DEV_IC_ANVAR_H */
|