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