Home | History | Annotate | Line # | Download | only in ic
wivar.h revision 1.4.2.18
      1  1.4.2.18  thorpej /*	$NetBSD: wivar.h,v 1.4.2.18 2003/01/15 18:44:17 thorpej Exp $	*/
      2   1.4.2.2  nathanw 
      3   1.4.2.2  nathanw /*
      4   1.4.2.2  nathanw  * Copyright (c) 1997, 1998, 1999
      5   1.4.2.2  nathanw  *	Bill Paul <wpaul (at) ctr.columbia.edu>.  All rights reserved.
      6   1.4.2.2  nathanw  *
      7   1.4.2.2  nathanw  * Redistribution and use in source and binary forms, with or without
      8   1.4.2.2  nathanw  * modification, are permitted provided that the following conditions
      9   1.4.2.2  nathanw  * are met:
     10   1.4.2.2  nathanw  * 1. Redistributions of source code must retain the above copyright
     11   1.4.2.2  nathanw  *    notice, this list of conditions and the following disclaimer.
     12   1.4.2.2  nathanw  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.4.2.2  nathanw  *    notice, this list of conditions and the following disclaimer in the
     14   1.4.2.2  nathanw  *    documentation and/or other materials provided with the distribution.
     15   1.4.2.2  nathanw  * 3. All advertising materials mentioning features or use of this software
     16   1.4.2.2  nathanw  *    must display the following acknowledgement:
     17   1.4.2.2  nathanw  *	This product includes software developed by Bill Paul.
     18   1.4.2.2  nathanw  * 4. Neither the name of the author nor the names of any co-contributors
     19   1.4.2.2  nathanw  *    may be used to endorse or promote products derived from this software
     20   1.4.2.2  nathanw  *    without specific prior written permission.
     21   1.4.2.2  nathanw  *
     22   1.4.2.2  nathanw  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
     23   1.4.2.2  nathanw  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24   1.4.2.2  nathanw  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25   1.4.2.2  nathanw  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
     26   1.4.2.2  nathanw  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     27   1.4.2.2  nathanw  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     28   1.4.2.2  nathanw  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     29   1.4.2.2  nathanw  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     30   1.4.2.2  nathanw  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     31   1.4.2.2  nathanw  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     32   1.4.2.2  nathanw  * THE POSSIBILITY OF SUCH DAMAGE.
     33   1.4.2.2  nathanw  */
     34   1.4.2.2  nathanw 
     35   1.4.2.2  nathanw /*
     36   1.4.2.2  nathanw  * FreeBSD driver ported to NetBSD by Bill Sommerfeld in the back of the
     37   1.4.2.2  nathanw  * Oslo IETF plenary meeting.
     38   1.4.2.2  nathanw  */
     39   1.4.2.2  nathanw struct wi_softc	{
     40   1.4.2.2  nathanw 	struct device		sc_dev;
     41  1.4.2.14  nathanw 	struct ieee80211com	sc_ic;
     42  1.4.2.14  nathanw 	void			*sc_ih;		/* interrupt handler */
     43  1.4.2.14  nathanw 	int			(*sc_enable)(struct wi_softc *);
     44  1.4.2.14  nathanw 	void			(*sc_disable)(struct wi_softc *);
     45  1.4.2.14  nathanw 
     46  1.4.2.14  nathanw 	int			sc_attached;
     47  1.4.2.14  nathanw 	int			sc_enabled;
     48  1.4.2.14  nathanw 	int			sc_firmware_type;
     49  1.4.2.11  nathanw #define	WI_NOTYPE	0
     50  1.4.2.11  nathanw #define	WI_LUCENT	1
     51  1.4.2.11  nathanw #define	WI_INTERSIL	2
     52  1.4.2.11  nathanw #define	WI_SYMBOL	3
     53  1.4.2.14  nathanw 	int			sc_pri_firmware_ver;	/* Primary firm vers */
     54  1.4.2.14  nathanw 	int			sc_sta_firmware_ver;	/* Station firm vers */
     55  1.4.2.14  nathanw 	int			sc_pci;			/* attach to PCI-Bus */
     56  1.4.2.14  nathanw 
     57  1.4.2.14  nathanw 	bus_space_tag_t		sc_iot;			/* bus cookie */
     58  1.4.2.14  nathanw 	bus_space_handle_t	sc_ioh;			/* bus i/o handle */
     59  1.4.2.13  thorpej 
     60   1.4.2.2  nathanw 	struct ifmedia		sc_media;
     61  1.4.2.14  nathanw 	caddr_t			sc_drvbpf;
     62  1.4.2.14  nathanw 	int			sc_flags;
     63  1.4.2.14  nathanw 	int			sc_bap_id;
     64  1.4.2.14  nathanw 	int			sc_bap_off;
     65  1.4.2.14  nathanw 
     66  1.4.2.15  thorpej 	u_int16_t		sc_dbm_adjust;
     67  1.4.2.14  nathanw 	u_int16_t		sc_max_datalen;
     68  1.4.2.15  thorpej 	u_int16_t		sc_frag_thresh;
     69  1.4.2.14  nathanw 	u_int16_t		sc_rts_thresh;
     70  1.4.2.14  nathanw 	u_int16_t		sc_system_scale;
     71  1.4.2.14  nathanw 	u_int16_t		sc_tx_rate;
     72  1.4.2.14  nathanw 	u_int16_t		sc_cnfauthmode;
     73  1.4.2.14  nathanw 	u_int16_t		sc_roaming_mode;
     74  1.4.2.14  nathanw 	u_int16_t		sc_microwave_oven;
     75  1.4.2.14  nathanw 
     76  1.4.2.14  nathanw 	int			sc_nodelen;
     77  1.4.2.14  nathanw 	char			sc_nodename[IEEE80211_NWID_LEN];
     78  1.4.2.14  nathanw 
     79  1.4.2.14  nathanw 	int			sc_buflen;
     80  1.4.2.14  nathanw #define	WI_NTXBUF	3
     81  1.4.2.14  nathanw 	struct sc_txdesc {
     82  1.4.2.14  nathanw 		int		d_fid;
     83  1.4.2.14  nathanw 		int		d_len;
     84  1.4.2.14  nathanw 	}			sc_txd[WI_NTXBUF];
     85  1.4.2.14  nathanw 	int			sc_txnext;
     86  1.4.2.14  nathanw 	int			sc_txcur;
     87  1.4.2.14  nathanw 	int			sc_tx_timer;
     88  1.4.2.14  nathanw 	int			sc_scan_timer;
     89  1.4.2.17  thorpej 	int			sc_syn_timer;
     90  1.4.2.13  thorpej 
     91  1.4.2.14  nathanw 	struct wi_counters	sc_stats;
     92  1.4.2.14  nathanw 	u_int16_t		sc_ibss_port;
     93  1.4.2.14  nathanw 
     94  1.4.2.14  nathanw 	struct wi_apinfo	sc_aps[MAXAPINFO];
     95  1.4.2.14  nathanw 	int 			sc_naps;
     96  1.4.2.17  thorpej 
     97  1.4.2.17  thorpej 	int			sc_false_syns;
     98  1.4.2.18  thorpej 
     99  1.4.2.18  thorpej 	u_int16_t		sc_txbuf[IEEE80211_MAX_LEN/2];
    100   1.4.2.2  nathanw };
    101   1.4.2.2  nathanw 
    102  1.4.2.14  nathanw #define	sc_if			sc_ic.ic_if
    103  1.4.2.14  nathanw 
    104  1.4.2.17  thorpej /* maximum consecutive false change-of-BSSID indications */
    105  1.4.2.17  thorpej #define	WI_MAX_FALSE_SYNS		10
    106  1.4.2.17  thorpej 
    107  1.4.2.14  nathanw #define	WI_SCAN_INQWAIT			3	/* wait sec before inquire */
    108  1.4.2.14  nathanw #define	WI_SCAN_WAIT			5	/* maximum scan wait */
    109  1.4.2.14  nathanw 
    110  1.4.2.12  nathanw /* Values for wi_flags. */
    111  1.4.2.12  nathanw #define	WI_FLAGS_ATTACHED		0x0001
    112  1.4.2.12  nathanw #define	WI_FLAGS_INITIALIZED		0x0002
    113  1.4.2.14  nathanw #define	WI_FLAGS_OUTRANGE		0x0004
    114  1.4.2.14  nathanw #define	WI_FLAGS_HAS_MOR		0x0010
    115  1.4.2.14  nathanw #define	WI_FLAGS_HAS_ROAMING		0x0020
    116  1.4.2.14  nathanw #define	WI_FLAGS_HAS_DIVERSITY		0x0040
    117  1.4.2.14  nathanw #define	WI_FLAGS_HAS_SYSSCALE		0x0080
    118  1.4.2.14  nathanw #define	WI_FLAGS_BUG_AUTOINC		0x0100
    119  1.4.2.15  thorpej #define	WI_FLAGS_HAS_FRAGTHR		0x0200
    120  1.4.2.16  thorpej #define	WI_FLAGS_HAS_DBMADJUST		0x0400
    121  1.4.2.12  nathanw 
    122  1.4.2.11  nathanw struct wi_card_ident {
    123  1.4.2.11  nathanw 	u_int16_t	card_id;
    124  1.4.2.11  nathanw 	char		*card_name;
    125  1.4.2.11  nathanw 	u_int8_t	firm_type;
    126  1.4.2.11  nathanw };
    127  1.4.2.11  nathanw 
    128  1.4.2.14  nathanw /*
    129  1.4.2.14  nathanw  * register space access macros
    130  1.4.2.14  nathanw  */
    131  1.4.2.14  nathanw #ifdef WI_AT_BIGENDIAN_BUS_HACK
    132  1.4.2.14  nathanw 	/*
    133  1.4.2.14  nathanw 	 * XXX - ugly hack for sparc bus_space_* macro deficiencies:
    134  1.4.2.14  nathanw 	 *       assume the bus we are accessing is big endian.
    135  1.4.2.14  nathanw 	 */
    136  1.4.2.14  nathanw 
    137  1.4.2.14  nathanw #define CSR_WRITE_4(sc, reg, val)	\
    138  1.4.2.14  nathanw 	bus_space_write_4(sc->sc_iot, sc->sc_ioh,	\
    139  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg) , htole32(val))
    140  1.4.2.14  nathanw #define CSR_WRITE_2(sc, reg, val)	\
    141  1.4.2.14  nathanw 	bus_space_write_2(sc->sc_iot, sc->sc_ioh,	\
    142  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg), htole16(val))
    143  1.4.2.14  nathanw #define CSR_WRITE_1(sc, reg, val)	\
    144  1.4.2.14  nathanw 	bus_space_write_1(sc->sc_iot, sc->sc_ioh,	\
    145  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg), val)
    146  1.4.2.14  nathanw 
    147  1.4.2.14  nathanw #define CSR_READ_4(sc, reg)		\
    148  1.4.2.14  nathanw 	le32toh(bus_space_read_4(sc->sc_iot, sc->sc_ioh,	\
    149  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg)))
    150  1.4.2.14  nathanw #define CSR_READ_2(sc, reg)		\
    151  1.4.2.14  nathanw 	le16toh(bus_space_read_2(sc->sc_iot, sc->sc_ioh,	\
    152  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg)))
    153  1.4.2.14  nathanw #define CSR_READ_1(sc, reg)		\
    154  1.4.2.14  nathanw 	bus_space_read_1(sc->sc_iot, sc->sc_ioh,	\
    155  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg))
    156  1.4.2.14  nathanw 
    157  1.4.2.14  nathanw #else
    158  1.4.2.14  nathanw 
    159  1.4.2.14  nathanw #define CSR_WRITE_4(sc, reg, val)	\
    160  1.4.2.14  nathanw 	bus_space_write_4(sc->sc_iot, sc->sc_ioh,	\
    161  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg) , val)
    162  1.4.2.14  nathanw #define CSR_WRITE_2(sc, reg, val)	\
    163  1.4.2.14  nathanw 	bus_space_write_2(sc->sc_iot, sc->sc_ioh,	\
    164  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg), val)
    165  1.4.2.14  nathanw #define CSR_WRITE_1(sc, reg, val)	\
    166  1.4.2.14  nathanw 	bus_space_write_1(sc->sc_iot, sc->sc_ioh,	\
    167  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg), val)
    168  1.4.2.14  nathanw 
    169  1.4.2.14  nathanw #define CSR_READ_4(sc, reg)		\
    170  1.4.2.14  nathanw 	bus_space_read_4(sc->sc_iot, sc->sc_ioh,	\
    171  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg))
    172  1.4.2.14  nathanw #define CSR_READ_2(sc, reg)		\
    173  1.4.2.14  nathanw 	bus_space_read_2(sc->sc_iot, sc->sc_ioh,	\
    174  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg))
    175  1.4.2.14  nathanw #define CSR_READ_1(sc, reg)		\
    176  1.4.2.14  nathanw 	bus_space_read_1(sc->sc_iot, sc->sc_ioh,	\
    177  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg))
    178  1.4.2.14  nathanw #endif
    179  1.4.2.14  nathanw 
    180  1.4.2.14  nathanw #ifndef __BUS_SPACE_HAS_STREAM_METHODS
    181  1.4.2.14  nathanw #define bus_space_write_stream_2	bus_space_write_2
    182  1.4.2.14  nathanw #define bus_space_write_multi_stream_2	bus_space_write_multi_2
    183  1.4.2.14  nathanw #define bus_space_read_stream_2		bus_space_read_2
    184  1.4.2.14  nathanw #define bus_space_read_multi_stream_2		bus_space_read_multi_2
    185  1.4.2.14  nathanw #endif
    186  1.4.2.14  nathanw 
    187  1.4.2.14  nathanw #define CSR_WRITE_STREAM_2(sc, reg, val)	\
    188  1.4.2.14  nathanw 	bus_space_write_stream_2(sc->sc_iot, sc->sc_ioh,	\
    189  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg), val)
    190  1.4.2.14  nathanw #define CSR_WRITE_MULTI_STREAM_2(sc, reg, val, count)	\
    191  1.4.2.14  nathanw 	bus_space_write_multi_stream_2(sc->sc_iot, sc->sc_ioh,	\
    192  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg), val, count)
    193  1.4.2.14  nathanw #define CSR_READ_STREAM_2(sc, reg)		\
    194  1.4.2.14  nathanw 	bus_space_read_stream_2(sc->sc_iot, sc->sc_ioh,	\
    195  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg))
    196  1.4.2.14  nathanw #define CSR_READ_MULTI_STREAM_2(sc, reg, buf, count)		\
    197  1.4.2.14  nathanw 	bus_space_read_multi_stream_2(sc->sc_iot, sc->sc_ioh,	\
    198  1.4.2.14  nathanw 			(sc->sc_pci? reg * 2: reg), buf, count)
    199  1.4.2.14  nathanw 
    200  1.4.2.14  nathanw 
    201  1.4.2.14  nathanw int	wi_attach(struct wi_softc *);
    202  1.4.2.14  nathanw int	wi_detach(struct wi_softc *);
    203  1.4.2.14  nathanw int	wi_activate(struct device *, enum devact);
    204  1.4.2.14  nathanw int	wi_intr(void *arg);
    205  1.4.2.14  nathanw void	wi_power(struct wi_softc *, int);
    206  1.4.2.14  nathanw void	wi_shutdown(struct wi_softc *);
    207