base.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009-2010 Realtek Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. * The full GNU General Public License is included in this distribution in the
  19. * file called LICENSE.
  20. *
  21. * Contact Information:
  22. * wlanfae <wlanfae@realtek.com>
  23. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  24. * Hsinchu 300, Taiwan.
  25. *
  26. * Larry Finger <Larry.Finger@lwfinger.net>
  27. *****************************************************************************/
  28. #ifndef __RTL_BASE_H__
  29. #define __RTL_BASE_H__
  30. #define RTL_DUMMY_OFFSET 0
  31. #define RTL_DUMMY_UNIT 8
  32. #define RTL_TX_DUMMY_SIZE (RTL_DUMMY_OFFSET * RTL_DUMMY_UNIT)
  33. #define RTL_TX_DESC_SIZE 32
  34. #define RTL_TX_HEADER_SIZE (RTL_TX_DESC_SIZE + RTL_TX_DUMMY_SIZE)
  35. #define HT_AMSDU_SIZE_4K 3839
  36. #define HT_AMSDU_SIZE_8K 7935
  37. #define MAX_BIT_RATE_40MHZ_MCS15 300 /* Mbps */
  38. #define MAX_BIT_RATE_40MHZ_MCS7 150 /* Mbps */
  39. #define RTL_RATE_COUNT_LEGACY 12
  40. #define RTL_CHANNEL_COUNT 14
  41. #define FRAME_OFFSET_FRAME_CONTROL 0
  42. #define FRAME_OFFSET_DURATION 2
  43. #define FRAME_OFFSET_ADDRESS1 4
  44. #define FRAME_OFFSET_ADDRESS2 10
  45. #define FRAME_OFFSET_ADDRESS3 16
  46. #define FRAME_OFFSET_SEQUENCE 22
  47. #define FRAME_OFFSET_ADDRESS4 24
  48. #define SET_80211_HDR_FRAME_CONTROL(_hdr, _val) \
  49. WRITEEF2BYTE(_hdr, _val)
  50. #define SET_80211_HDR_TYPE_AND_SUBTYPE(_hdr, _val) \
  51. WRITEEF1BYTE(_hdr, _val)
  52. #define SET_80211_HDR_PWR_MGNT(_hdr, _val) \
  53. SET_BITS_TO_LE_2BYTE(_hdr, 12, 1, _val)
  54. #define SET_80211_HDR_TO_DS(_hdr, _val) \
  55. SET_BITS_TO_LE_2BYTE(_hdr, 8, 1, _val)
  56. #define SET_80211_PS_POLL_AID(_hdr, _val) \
  57. WRITEEF2BYTE(((u8 *)(_hdr)) + 2, _val)
  58. #define SET_80211_PS_POLL_BSSID(_hdr, _val) \
  59. CP_MACADDR(((u8 *)(_hdr)) + 4, (u8 *)(_val))
  60. #define SET_80211_PS_POLL_TA(_hdr, _val) \
  61. CP_MACADDR(((u8 *)(_hdr)) + 10, (u8 *)(_val))
  62. #define SET_80211_HDR_DURATION(_hdr, _val) \
  63. WRITEEF2BYTE((u8 *)(_hdr)+FRAME_OFFSET_DURATION, _val)
  64. #define SET_80211_HDR_ADDRESS1(_hdr, _val) \
  65. CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS1, (u8*)(_val))
  66. #define SET_80211_HDR_ADDRESS2(_hdr, _val) \
  67. CP_MACADDR((u8 *)(_hdr) + FRAME_OFFSET_ADDRESS2, (u8 *)(_val))
  68. #define SET_80211_HDR_ADDRESS3(_hdr, _val) \
  69. CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS3, (u8 *)(_val))
  70. #define SET_80211_HDR_FRAGMENT_SEQUENCE(_hdr, _val) \
  71. WRITEEF2BYTE((u8 *)(_hdr)+FRAME_OFFSET_SEQUENCE, _val)
  72. #define SET_BEACON_PROBE_RSP_TIME_STAMP_LOW(__phdr, __val) \
  73. WRITEEF4BYTE(((u8 *)(__phdr)) + 24, __val)
  74. #define SET_BEACON_PROBE_RSP_TIME_STAMP_HIGH(__phdr, __val) \
  75. WRITEEF4BYTE(((u8 *)(__phdr)) + 28, __val)
  76. #define SET_BEACON_PROBE_RSP_BEACON_INTERVAL(__phdr, __val) \
  77. WRITEEF2BYTE(((u8 *)(__phdr)) + 32, __val)
  78. #define GET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr) \
  79. READEF2BYTE(((u8 *)(__phdr)) + 34)
  80. #define SET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, __val) \
  81. WRITEEF2BYTE(((u8 *)(__phdr)) + 34, __val)
  82. #define MASK_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, __val) \
  83. SET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, \
  84. (GET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr) & (~(__val))))
  85. int rtl_init_core(struct ieee80211_hw *hw);
  86. void rtl_deinit_core(struct ieee80211_hw *hw);
  87. void rtl_init_rx_config(struct ieee80211_hw *hw);
  88. void rtl_init_rfkill(struct ieee80211_hw *hw);
  89. void rtl_deinit_rfkill(struct ieee80211_hw *hw);
  90. void rtl_watch_dog_timer_callback(unsigned long data);
  91. void rtl_deinit_deferred_work(struct ieee80211_hw *hw);
  92. bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx);
  93. bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb);
  94. u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx);
  95. void rtl_watch_dog_timer_callback(unsigned long data);
  96. int rtl_tx_agg_start(struct ieee80211_hw *hw, const u8 *ra,
  97. u16 tid, u16 *ssn);
  98. int rtl_tx_agg_stop(struct ieee80211_hw *hw, const u8 *ra, u16 tid);
  99. void rtl_watchdog_wq_callback(void *data);
  100. void rtl_get_tcb_desc(struct ieee80211_hw *hw,
  101. struct ieee80211_tx_info *info,
  102. struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc);
  103. extern struct attribute_group rtl_attribute_group;
  104. #endif