Home | History | Annotate | Download | only in ural
      1  6629  zf162725 /*
      2  9345    Quaker  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
      3  6629  zf162725  * Use is subject to license terms.
      4  6629  zf162725  */
      5  6629  zf162725 
      6  6629  zf162725 /*
      7  6629  zf162725  * Copyright (c) 2005
      8  6629  zf162725  *	Damien Bergamini <damien.bergamini (at) free.fr>
      9  6629  zf162725  *
     10  6629  zf162725  * Permission to use, copy, modify, and distribute this software for any
     11  6629  zf162725  * purpose with or without fee is hereby granted, provided that the above
     12  6629  zf162725  * copyright notice and this permission notice appear in all copies.
     13  6629  zf162725  *
     14  6629  zf162725  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     15  6629  zf162725  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     16  6629  zf162725  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     17  6629  zf162725  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     18  6629  zf162725  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     19  6629  zf162725  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     20  6629  zf162725  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     21  6629  zf162725  */
     22  6629  zf162725 #ifndef	_URAL_VAR_H
     23  6629  zf162725 #define	_URAL_VAR_H
     24  6629  zf162725 
     25  6629  zf162725 #ifdef __cplusplus
     26  6629  zf162725 extern "C" {
     27  6629  zf162725 #endif
     28  6629  zf162725 
     29  6629  zf162725 #define	RAL_FLAG_RUNNING	(1<<0)
     30  6629  zf162725 
     31  6629  zf162725 #define	RAL_RCR_PROMISC		(1<<0)
     32  6629  zf162725 #define	RAL_RCR_MULTI		(2<<0)
     33  6629  zf162725 
     34  6629  zf162725 #ifndef	DDI_NT_NET_WIFI
     35  6629  zf162725 #define	DDI_NT_NET_WIFI		"ddi_network:wifi"
     36  6629  zf162725 #endif
     37  6629  zf162725 
     38  6629  zf162725 /*
     39  6629  zf162725  * Bit flags in the ral_dbg_flags
     40  6629  zf162725  */
     41  6629  zf162725 #define	RAL_DBG_MSG		0x000001
     42  6629  zf162725 #define	RAL_DBG_ERR		0x000002
     43  6629  zf162725 #define	RAL_DBG_USB		0x000004
     44  6629  zf162725 #define	RAL_DBG_TX		0x000008
     45  6629  zf162725 #define	RAL_DBG_RX		0x000010
     46  6629  zf162725 #define	RAL_DBG_IOCTL		0x000020
     47  6629  zf162725 #define	RAL_DBG_HW		0x000040
     48  6629  zf162725 #define	RAL_DBG_ALL		0x000fff
     49  6629  zf162725 
     50  6629  zf162725 #define	RAL_TX_LIST_COUNT	8
     51  6629  zf162725 #define	RAL_RX_LIST_COUNT	8
     52  6629  zf162725 
     53  6629  zf162725 struct ural_amrr {
     54  6629  zf162725 	int	txcnt;
     55  6629  zf162725 	int	retrycnt;
     56  6629  zf162725 	int	success;
     57  6629  zf162725 	int	success_threshold;
     58  6629  zf162725 	int	recovery;
     59  6629  zf162725 };
     60  6629  zf162725 
     61  6629  zf162725 struct ural_softc {
     62  6629  zf162725 	struct ieee80211com	sc_ic;
     63  6629  zf162725 	dev_info_t		*sc_dev;
     64  6629  zf162725 
     65  6629  zf162725 	usb_client_dev_data_t	*sc_udev;	/* usb dev */
     66  6629  zf162725 
     67  6629  zf162725 	uint32_t		asic_rev;
     68  6629  zf162725 	uint8_t			rf_rev;
     69  6629  zf162725 
     70  6629  zf162725 	kmutex_t		sc_genlock;
     71  6629  zf162725 
     72  6629  zf162725 	usb_pipe_handle_t	sc_rx_pipeh;
     73  6629  zf162725 	usb_pipe_handle_t	sc_tx_pipeh;
     74  6629  zf162725 
     75  6629  zf162725 	enum ieee80211_state	sc_state;
     76  6629  zf162725 	struct ural_amrr	amrr;
     77  6629  zf162725 
     78  6629  zf162725 	kmutex_t		tx_lock;
     79  6629  zf162725 	kmutex_t		rx_lock;
     80  6629  zf162725 
     81  6629  zf162725 	int			tx_queued;
     82  6629  zf162725 	int			rx_queued;
     83  6629  zf162725 
     84  6629  zf162725 	int			sc_tx_timer;
     85  6629  zf162725 
     86  6629  zf162725 	timeout_id_t		sc_scan_id;
     87  6629  zf162725 	timeout_id_t		sc_amrr_id;
     88  6629  zf162725 
     89  6629  zf162725 	uint32_t		sc_need_sched;
     90  6629  zf162725 	uint32_t		sc_flags;
     91  6629  zf162725 	uint32_t		sc_rcr;		/* RAL RCR */
     92  6629  zf162725 
     93  6629  zf162725 	int			dwelltime;
     94  6629  zf162725 
     95  6629  zf162725 	uint16_t		sta[11];
     96  6629  zf162725 	uint32_t		rf_regs[4];
     97  6629  zf162725 	uint8_t			txpow[14];
     98  6629  zf162725 
     99  6629  zf162725 #pragma pack(1)
    100  6629  zf162725 	struct {
    101  6629  zf162725 		uint8_t		val;
    102  6629  zf162725 		uint8_t		reg;
    103  6629  zf162725 	} 			bbp_prom[16];
    104  6629  zf162725 #pragma pack()
    105  6629  zf162725 
    106  6629  zf162725 	int			led_mode;
    107  6629  zf162725 	int			hw_radio;
    108  6629  zf162725 	int			rx_ant;
    109  6629  zf162725 	int			tx_ant;
    110  6629  zf162725 	int			nb_ant;
    111  6629  zf162725 
    112  6629  zf162725 	/* kstats */
    113  6629  zf162725 	uint32_t		sc_tx_nobuf;
    114  6629  zf162725 	uint32_t		sc_rx_nobuf;
    115  6629  zf162725 	uint32_t		sc_tx_err;
    116  6629  zf162725 	uint32_t		sc_rx_err;
    117  6629  zf162725 	uint32_t		sc_tx_retries;
    118  6629  zf162725 
    119  6629  zf162725 	int			(*sc_newstate)(struct ieee80211com *,
    120  6629  zf162725 				    enum ieee80211_state, int);
    121  6629  zf162725 
    122  6629  zf162725 };
    123  6629  zf162725 
    124  6629  zf162725 #define	RAL_IS_RUNNING(_sc)	((_sc)->sc_flags & RAL_FLAG_RUNNING)
    125  6629  zf162725 #define	RAL_LOCK(sc)		mutex_enter(&(sc)->sc_genlock)
    126  6629  zf162725 #define	RAL_UNLOCK(sc)		mutex_exit(&(sc)->sc_genlock)
    127  6629  zf162725 
    128  6629  zf162725 #define	MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
    129  6629  zf162725 #define	MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
    130  6629  zf162725 
    131  6629  zf162725 #ifdef __cplusplus
    132  6629  zf162725 }
    133  6629  zf162725 #endif
    134  6629  zf162725 
    135  6629  zf162725 #endif /* _URAL_VAR_H */
    136