16629Szf162725 /* 2*9345SQuaker.Fang@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 36629Szf162725 * Use is subject to license terms. 46629Szf162725 */ 56629Szf162725 66629Szf162725 /* 76629Szf162725 * Copyright (c) 2005 86629Szf162725 * Damien Bergamini <damien.bergamini@free.fr> 96629Szf162725 * 106629Szf162725 * Permission to use, copy, modify, and distribute this software for any 116629Szf162725 * purpose with or without fee is hereby granted, provided that the above 126629Szf162725 * copyright notice and this permission notice appear in all copies. 136629Szf162725 * 146629Szf162725 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 156629Szf162725 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 166629Szf162725 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 176629Szf162725 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 186629Szf162725 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 196629Szf162725 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 206629Szf162725 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 216629Szf162725 */ 226629Szf162725 #ifndef _URAL_VAR_H 236629Szf162725 #define _URAL_VAR_H 246629Szf162725 256629Szf162725 #ifdef __cplusplus 266629Szf162725 extern "C" { 276629Szf162725 #endif 286629Szf162725 296629Szf162725 #define RAL_FLAG_RUNNING (1<<0) 306629Szf162725 316629Szf162725 #define RAL_RCR_PROMISC (1<<0) 326629Szf162725 #define RAL_RCR_MULTI (2<<0) 336629Szf162725 346629Szf162725 #ifndef DDI_NT_NET_WIFI 356629Szf162725 #define DDI_NT_NET_WIFI "ddi_network:wifi" 366629Szf162725 #endif 376629Szf162725 386629Szf162725 /* 396629Szf162725 * Bit flags in the ral_dbg_flags 406629Szf162725 */ 416629Szf162725 #define RAL_DBG_MSG 0x000001 426629Szf162725 #define RAL_DBG_ERR 0x000002 436629Szf162725 #define RAL_DBG_USB 0x000004 446629Szf162725 #define RAL_DBG_TX 0x000008 456629Szf162725 #define RAL_DBG_RX 0x000010 466629Szf162725 #define RAL_DBG_IOCTL 0x000020 476629Szf162725 #define RAL_DBG_HW 0x000040 486629Szf162725 #define RAL_DBG_ALL 0x000fff 496629Szf162725 506629Szf162725 #define RAL_TX_LIST_COUNT 8 516629Szf162725 #define RAL_RX_LIST_COUNT 8 526629Szf162725 536629Szf162725 struct ural_amrr { 546629Szf162725 int txcnt; 556629Szf162725 int retrycnt; 566629Szf162725 int success; 576629Szf162725 int success_threshold; 586629Szf162725 int recovery; 596629Szf162725 }; 606629Szf162725 616629Szf162725 struct ural_softc { 626629Szf162725 struct ieee80211com sc_ic; 636629Szf162725 dev_info_t *sc_dev; 646629Szf162725 656629Szf162725 usb_client_dev_data_t *sc_udev; /* usb dev */ 666629Szf162725 676629Szf162725 uint32_t asic_rev; 686629Szf162725 uint8_t rf_rev; 696629Szf162725 706629Szf162725 kmutex_t sc_genlock; 716629Szf162725 726629Szf162725 usb_pipe_handle_t sc_rx_pipeh; 736629Szf162725 usb_pipe_handle_t sc_tx_pipeh; 746629Szf162725 756629Szf162725 enum ieee80211_state sc_state; 766629Szf162725 struct ural_amrr amrr; 776629Szf162725 786629Szf162725 kmutex_t tx_lock; 796629Szf162725 kmutex_t rx_lock; 806629Szf162725 816629Szf162725 int tx_queued; 826629Szf162725 int rx_queued; 836629Szf162725 846629Szf162725 int sc_tx_timer; 856629Szf162725 866629Szf162725 timeout_id_t sc_scan_id; 876629Szf162725 timeout_id_t sc_amrr_id; 886629Szf162725 896629Szf162725 uint32_t sc_need_sched; 906629Szf162725 uint32_t sc_flags; 916629Szf162725 uint32_t sc_rcr; /* RAL RCR */ 926629Szf162725 936629Szf162725 int dwelltime; 946629Szf162725 956629Szf162725 uint16_t sta[11]; 966629Szf162725 uint32_t rf_regs[4]; 976629Szf162725 uint8_t txpow[14]; 986629Szf162725 996629Szf162725 #pragma pack(1) 1006629Szf162725 struct { 1016629Szf162725 uint8_t val; 1026629Szf162725 uint8_t reg; 1036629Szf162725 } bbp_prom[16]; 1046629Szf162725 #pragma pack() 1056629Szf162725 1066629Szf162725 int led_mode; 1076629Szf162725 int hw_radio; 1086629Szf162725 int rx_ant; 1096629Szf162725 int tx_ant; 1106629Szf162725 int nb_ant; 1116629Szf162725 1126629Szf162725 /* kstats */ 1136629Szf162725 uint32_t sc_tx_nobuf; 1146629Szf162725 uint32_t sc_rx_nobuf; 1156629Szf162725 uint32_t sc_tx_err; 1166629Szf162725 uint32_t sc_rx_err; 1176629Szf162725 uint32_t sc_tx_retries; 1186629Szf162725 1196629Szf162725 int (*sc_newstate)(struct ieee80211com *, 1206629Szf162725 enum ieee80211_state, int); 1216629Szf162725 1226629Szf162725 }; 1236629Szf162725 1246629Szf162725 #define RAL_IS_RUNNING(_sc) ((_sc)->sc_flags & RAL_FLAG_RUNNING) 1256629Szf162725 #define RAL_LOCK(sc) mutex_enter(&(sc)->sc_genlock) 1266629Szf162725 #define RAL_UNLOCK(sc) mutex_exit(&(sc)->sc_genlock) 1276629Szf162725 1286629Szf162725 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] 1296629Szf162725 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" 1306629Szf162725 1316629Szf162725 #ifdef __cplusplus 1326629Szf162725 } 1336629Szf162725 #endif 1346629Szf162725 1356629Szf162725 #endif /* _URAL_VAR_H */ 136