#ifndef _DEV_IC_ANVAR_H
#define _DEV_IC_ANVAR_H
#define AN_TIMEOUT 65536
#define AN_MAGIC 0x414e
#define AN_INTRS (AN_EV_RX | AN_EV_TX | AN_EV_TX_EXC | AN_EV_LINKSTAT)
#define CSR_WRITE_2(sc, reg, val) \
bus_space_write_2(sc->sc_iot, sc->sc_ioh, reg, val)
#define CSR_READ_2(sc, reg) \
bus_space_read_2(sc->sc_iot, sc->sc_ioh, reg)
#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
#endif
#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)
#define AN_TX_MAX_LEN \
(sizeof(struct an_txframe) + ETHER_TYPE_LEN + ETHER_MAX_LEN)
#define AN_TX_RING_CNT 4
#define AN_INC(x, y) (x) = (x + 1) % y
struct an_wepkey {
int an_wep_key[16];
int an_wep_keylen;
};
#define AN_GAPLEN_MAX 8
#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;
} __packed;
#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;
} __packed;
struct an_softc {
struct device sc_dev;
struct ieee80211com sc_ic;
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
void *sc_ih;
int (*sc_enable)(struct an_softc *);
void (*sc_disable)(struct an_softc *);
int (*sc_newstate)(struct ieee80211com *,
enum ieee80211_state, int);
int sc_enabled;
int sc_invalid;
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;
caddr_t sc_drvbpf;
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;
};
#define sc_rxtap sc_rxtapu.tap
#define sc_txtap sc_txtapu.tap
int an_attach(struct an_softc *);
int an_detach(struct an_softc *);
int an_intr(void *);
int an_init(struct ifnet *);
void an_stop(struct ifnet *, int);
#endif