1*4882a593Smuzhiyun /*- 2*4882a593Smuzhiyun * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting 3*4882a593Smuzhiyun * All rights reserved. 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Redistribution and use in source and binary forms, with or without 6*4882a593Smuzhiyun * modification, are permitted provided that the following conditions 7*4882a593Smuzhiyun * are met: 8*4882a593Smuzhiyun * 1. Redistributions of source code must retain the above copyright 9*4882a593Smuzhiyun * notice, this list of conditions and the following disclaimer, 10*4882a593Smuzhiyun * without modification. 11*4882a593Smuzhiyun * 2. Redistributions in binary form must reproduce at minimum a disclaimer 12*4882a593Smuzhiyun * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 13*4882a593Smuzhiyun * redistribution must be conditioned upon including a substantially 14*4882a593Smuzhiyun * similar Disclaimer requirement for further binary redistribution. 15*4882a593Smuzhiyun * 3. Neither the names of the above-listed copyright holders nor the names 16*4882a593Smuzhiyun * of any contributors may be used to endorse or promote products derived 17*4882a593Smuzhiyun * from this software without specific prior written permission. 18*4882a593Smuzhiyun * 19*4882a593Smuzhiyun * Alternatively, this software may be distributed under the terms of the 20*4882a593Smuzhiyun * GNU General Public License ("GPL") version 2 as published by the Free 21*4882a593Smuzhiyun * Software Foundation. 22*4882a593Smuzhiyun * 23*4882a593Smuzhiyun * NO WARRANTY 24*4882a593Smuzhiyun * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25*4882a593Smuzhiyun * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26*4882a593Smuzhiyun * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 27*4882a593Smuzhiyun * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 28*4882a593Smuzhiyun * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 29*4882a593Smuzhiyun * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30*4882a593Smuzhiyun * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31*4882a593Smuzhiyun * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32*4882a593Smuzhiyun * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33*4882a593Smuzhiyun * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 34*4882a593Smuzhiyun * THE POSSIBILITY OF SUCH DAMAGES. 35*4882a593Smuzhiyun * 36*4882a593Smuzhiyun */ 37*4882a593Smuzhiyun 38*4882a593Smuzhiyun /* 39*4882a593Smuzhiyun * Definitions for the Atheros Wireless LAN controller driver. 40*4882a593Smuzhiyun */ 41*4882a593Smuzhiyun #ifndef _DEV_ATH5K_BASE_H 42*4882a593Smuzhiyun #define _DEV_ATH5K_BASE_H 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun struct ieee80211_vif; 45*4882a593Smuzhiyun struct ieee80211_hw; 46*4882a593Smuzhiyun struct ath5k_hw; 47*4882a593Smuzhiyun struct ath5k_txq; 48*4882a593Smuzhiyun struct ieee80211_channel; 49*4882a593Smuzhiyun struct ath_bus_ops; 50*4882a593Smuzhiyun struct ieee80211_tx_control; 51*4882a593Smuzhiyun enum nl80211_iftype; 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun enum ath5k_srev_type { 54*4882a593Smuzhiyun AR5K_VERSION_MAC, 55*4882a593Smuzhiyun AR5K_VERSION_RAD, 56*4882a593Smuzhiyun }; 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun struct ath5k_srev_name { 59*4882a593Smuzhiyun const char *sr_name; 60*4882a593Smuzhiyun enum ath5k_srev_type sr_type; 61*4882a593Smuzhiyun u_int sr_val; 62*4882a593Smuzhiyun }; 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun struct ath5k_buf { 65*4882a593Smuzhiyun struct list_head list; 66*4882a593Smuzhiyun struct ath5k_desc *desc; /* virtual addr of desc */ 67*4882a593Smuzhiyun dma_addr_t daddr; /* physical addr of desc */ 68*4882a593Smuzhiyun struct sk_buff *skb; /* skbuff for buf */ 69*4882a593Smuzhiyun dma_addr_t skbaddr; /* physical addr of skb data */ 70*4882a593Smuzhiyun struct ieee80211_tx_rate rates[4]; /* number of multi-rate stages */ 71*4882a593Smuzhiyun }; 72*4882a593Smuzhiyun 73*4882a593Smuzhiyun struct ath5k_vif { 74*4882a593Smuzhiyun bool assoc; /* are we associated or not */ 75*4882a593Smuzhiyun enum nl80211_iftype opmode; 76*4882a593Smuzhiyun int bslot; 77*4882a593Smuzhiyun struct ath5k_buf *bbuf; /* beacon buffer */ 78*4882a593Smuzhiyun }; 79*4882a593Smuzhiyun 80*4882a593Smuzhiyun struct ath5k_vif_iter_data { 81*4882a593Smuzhiyun const u8 *hw_macaddr; 82*4882a593Smuzhiyun u8 mask[ETH_ALEN]; 83*4882a593Smuzhiyun u8 active_mac[ETH_ALEN]; /* first active MAC */ 84*4882a593Smuzhiyun bool need_set_hw_addr; 85*4882a593Smuzhiyun bool found_active; 86*4882a593Smuzhiyun bool any_assoc; 87*4882a593Smuzhiyun enum nl80211_iftype opmode; 88*4882a593Smuzhiyun int n_stas; 89*4882a593Smuzhiyun }; 90*4882a593Smuzhiyun 91*4882a593Smuzhiyun void ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif); 92*4882a593Smuzhiyun bool ath5k_any_vif_assoc(struct ath5k_hw *ah); 93*4882a593Smuzhiyun 94*4882a593Smuzhiyun int ath5k_start(struct ieee80211_hw *hw); 95*4882a593Smuzhiyun void ath5k_stop(struct ieee80211_hw *hw); 96*4882a593Smuzhiyun 97*4882a593Smuzhiyun void ath5k_beacon_update_timers(struct ath5k_hw *ah, u64 bc_tsf); 98*4882a593Smuzhiyun int ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 99*4882a593Smuzhiyun void ath5k_beacon_config(struct ath5k_hw *ah); 100*4882a593Smuzhiyun void ath5k_set_beacon_filter(struct ieee80211_hw *hw, bool enable); 101*4882a593Smuzhiyun 102*4882a593Smuzhiyun void ath5k_update_bssid_mask_and_opmode(struct ath5k_hw *ah, 103*4882a593Smuzhiyun struct ieee80211_vif *vif); 104*4882a593Smuzhiyun int ath5k_chan_set(struct ath5k_hw *ah, struct cfg80211_chan_def *chandef); 105*4882a593Smuzhiyun void ath5k_txbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf); 106*4882a593Smuzhiyun void ath5k_rxbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf); 107*4882a593Smuzhiyun void ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, 108*4882a593Smuzhiyun struct ath5k_txq *txq, struct ieee80211_tx_control *control); 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun const char *ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val); 111*4882a593Smuzhiyun 112*4882a593Smuzhiyun int ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops); 113*4882a593Smuzhiyun void ath5k_deinit_ah(struct ath5k_hw *ah); 114*4882a593Smuzhiyun 115*4882a593Smuzhiyun /* Check whether BSSID mask is supported */ 116*4882a593Smuzhiyun #define ath5k_hw_hasbssidmask(_ah) (ah->ah_version == AR5K_AR5212) 117*4882a593Smuzhiyun 118*4882a593Smuzhiyun /* Check whether virtual EOL is supported */ 119*4882a593Smuzhiyun #define ath5k_hw_hasveol(_ah) (ah->ah_version != AR5K_AR5210) 120*4882a593Smuzhiyun 121*4882a593Smuzhiyun #endif /* _DEV_ATH5K_BASE_H */ 122