You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

common.h 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) 2009-2011 Atheros Communications Inc.
  3. *
  4. * Modified for iPXE by Scott K Logan <logans@cottsay.net> July 2011
  5. * Original from Linux kernel 3.0.1
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for any
  8. * purpose with or without fee is hereby granted, provided that the above
  9. * copyright notice and this permission notice appear in all copies.
  10. *
  11. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  12. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  13. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  14. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  15. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  16. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  17. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #include "../ath.h"
  20. #include "hw.h"
  21. #include "hw-ops.h"
  22. /* Common header for Atheros 802.11n base driver cores */
  23. #define WME_NUM_TID 16
  24. #define WME_BA_BMP_SIZE 64
  25. #define WME_MAX_BA WME_BA_BMP_SIZE
  26. #define ATH_TID_MAX_BUFS (2 * WME_MAX_BA)
  27. #define WME_AC_BE 2
  28. #define WME_NUM_AC 1
  29. #define ATH_RSSI_DUMMY_MARKER 0x127
  30. #define ATH_RSSI_LPF_LEN 10
  31. #define RSSI_LPF_THRESHOLD -20
  32. #define ATH_RSSI_EP_MULTIPLIER (1<<7)
  33. #define ATH_EP_MUL(x, mul) ((x) * (mul))
  34. #define ATH_RSSI_IN(x) (ATH_EP_MUL((x), ATH_RSSI_EP_MULTIPLIER))
  35. #define ATH_LPF_RSSI(x, y, len) \
  36. ((x != ATH_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y))
  37. #define ATH_RSSI_LPF(x, y) do { \
  38. if ((y) >= RSSI_LPF_THRESHOLD) \
  39. x = ATH_LPF_RSSI((x), ATH_RSSI_IN((y)), ATH_RSSI_LPF_LEN); \
  40. } while (0)
  41. #define ATH_EP_RND(x, mul) \
  42. ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
  43. void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
  44. struct net80211_channel *chan);
  45. struct ath9k_channel *ath9k_cmn_get_curchannel(struct net80211_device *dev,
  46. struct ath_hw *ah);
  47. void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow,
  48. u16 new_txpow, u16 *txpower);