iPXE
common.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2009-2011 Atheros Communications Inc.
00003  *
00004  * Modified for iPXE by Scott K Logan <logans@cottsay.net> July 2011
00005  * Original from Linux kernel 3.0.1
00006  *
00007  * Permission to use, copy, modify, and/or distribute this software for any
00008  * purpose with or without fee is hereby granted, provided that the above
00009  * copyright notice and this permission notice appear in all copies.
00010  *
00011  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
00012  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00013  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
00014  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00015  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00016  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00017  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00018  */
00019 
00020 FILE_LICENCE ( BSD2 );
00021 
00022 #include "../ath.h"
00023 
00024 #include "hw.h"
00025 #include "hw-ops.h"
00026 
00027 /* Common header for Atheros 802.11n base driver cores */
00028 
00029 #define WME_NUM_TID             16
00030 #define WME_BA_BMP_SIZE         64
00031 #define WME_MAX_BA              WME_BA_BMP_SIZE
00032 #define ATH_TID_MAX_BUFS        (2 * WME_MAX_BA)
00033 
00034 #define WME_AC_BE   2
00035 #define WME_NUM_AC  1
00036 
00037 #define ATH_RSSI_DUMMY_MARKER   0x127
00038 #define ATH_RSSI_LPF_LEN                10
00039 #define RSSI_LPF_THRESHOLD              -20
00040 #define ATH_RSSI_EP_MULTIPLIER     (1<<7)
00041 #define ATH_EP_MUL(x, mul)         ((x) * (mul))
00042 #define ATH_RSSI_IN(x)             (ATH_EP_MUL((x), ATH_RSSI_EP_MULTIPLIER))
00043 #define ATH_LPF_RSSI(x, y, len) \
00044     ((x != ATH_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y))
00045 #define ATH_RSSI_LPF(x, y) do {                                         \
00046     if ((y) >= RSSI_LPF_THRESHOLD)                                      \
00047         x = ATH_LPF_RSSI((x), ATH_RSSI_IN((y)), ATH_RSSI_LPF_LEN);      \
00048 } while (0)
00049 #define ATH_EP_RND(x, mul)                                              \
00050         ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
00051 
00052 
00053 void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
00054                                struct net80211_channel *chan);
00055 struct ath9k_channel *ath9k_cmn_get_curchannel(struct net80211_device *dev,
00056                                                struct ath_hw *ah);
00057 void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow,
00058                             u16 new_txpow, u16 *txpower);