ath.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright (c) 2008-2009 Atheros Communications Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef ATH_H
  17. #define ATH_H
  18. #include <linux/skbuff.h>
  19. #include <linux/if_ether.h>
  20. #include <net/mac80211.h>
  21. static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
  22. enum ath_device_state {
  23. ATH_HW_UNAVAILABLE,
  24. ATH_HW_INITIALIZED,
  25. };
  26. struct reg_dmn_pair_mapping {
  27. u16 regDmnEnum;
  28. u16 reg_5ghz_ctl;
  29. u16 reg_2ghz_ctl;
  30. };
  31. struct ath_regulatory {
  32. char alpha2[2];
  33. u16 country_code;
  34. u16 max_power_level;
  35. u32 tp_scale;
  36. u16 current_rd;
  37. u16 current_rd_ext;
  38. int16_t power_limit;
  39. struct reg_dmn_pair_mapping *regpair;
  40. };
  41. struct ath_ops {
  42. unsigned int (*read)(void *, u32 reg_offset);
  43. void (*write)(void *, u32 val, u32 reg_offset);
  44. };
  45. struct ath_common;
  46. struct ath_bus_ops {
  47. void (*read_cachesize)(struct ath_common *common, int *csz);
  48. void (*cleanup)(struct ath_common *common);
  49. bool (*eeprom_read)(struct ath_common *common, u32 off, u16 *data);
  50. void (*bt_coex_prep)(struct ath_common *common);
  51. };
  52. struct ath_common {
  53. void *ah;
  54. void *priv;
  55. struct ieee80211_hw *hw;
  56. int debug_mask;
  57. enum ath_device_state state;
  58. u16 cachelsz;
  59. u16 curaid;
  60. u8 macaddr[ETH_ALEN];
  61. u8 curbssid[ETH_ALEN];
  62. u8 bssidmask[ETH_ALEN];
  63. u8 tx_chainmask;
  64. u8 rx_chainmask;
  65. struct ath_regulatory regulatory;
  66. const struct ath_ops *ops;
  67. const struct ath_bus_ops *bus_ops;
  68. };
  69. struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
  70. u32 len,
  71. gfp_t gfp_mask);
  72. void ath_hw_setbssidmask(struct ath_common *common);
  73. #endif /* ATH_H */