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