dm.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009-2012 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. *****************************************************************************/
  29. #ifndef __RTL_92S_DM_H__
  30. #define __RTL_92S_DM_H__
  31. struct dig_t {
  32. u8 dig_enable_flag;
  33. u8 dig_algorithm;
  34. u8 dig_twoport_algorithm;
  35. u8 dig_ext_port_stage;
  36. u8 dig_dbgmode;
  37. u8 dig_slgorithm_switch;
  38. long rssi_lowthresh;
  39. long rssi_highthresh;
  40. u32 fa_lowthresh;
  41. u32 fa_highthresh;
  42. long rssi_highpower_lowthresh;
  43. long rssi_highpower_highthresh;
  44. u8 dig_state;
  45. u8 dig_highpwrstate;
  46. u8 cur_sta_connectstate;
  47. u8 pre_sta_connectstate;
  48. u8 cur_ap_connectstate;
  49. u8 pre_ap_connectstate;
  50. u8 cur_pd_thstate;
  51. u8 pre_pd_thstate;
  52. u8 cur_cs_ratiostate;
  53. u8 pre_cs_ratiostate;
  54. u32 pre_igvalue;
  55. u32 cur_igvalue;
  56. u8 backoff_enable_flag;
  57. char backoff_val;
  58. char backoffval_range_max;
  59. char backoffval_range_min;
  60. u8 rx_gain_range_max;
  61. u8 rx_gain_range_min;
  62. long rssi_val;
  63. };
  64. enum dm_dig_alg {
  65. DIG_ALGO_BY_FALSE_ALARM = 0,
  66. DIG_ALGO_BY_RSSI = 1,
  67. DIG_ALGO_BEFORE_CONNECT_BY_RSSI_AND_ALARM = 2,
  68. DIG_ALGO_BY_TOW_PORT = 3,
  69. DIG_ALGO_MAX
  70. };
  71. enum dm_dig_two_port_alg {
  72. DIG_TWO_PORT_ALGO_RSSI = 0,
  73. DIG_TWO_PORT_ALGO_FALSE_ALARM = 1,
  74. };
  75. enum dm_dig_dbg {
  76. DM_DBG_OFF = 0,
  77. DM_DBG_ON = 1,
  78. DM_DBG_MAX
  79. };
  80. enum dm_dig_sta {
  81. DM_STA_DIG_OFF = 0,
  82. DM_STA_DIG_ON,
  83. DM_STA_DIG_MAX
  84. };
  85. enum dm_dig_connect {
  86. DIG_STA_DISCONNECT = 0,
  87. DIG_STA_CONNECT = 1,
  88. DIG_STA_BEFORE_CONNECT = 2,
  89. DIG_AP_DISCONNECT = 3,
  90. DIG_AP_CONNECT = 4,
  91. DIG_AP_ADD_STATION = 5,
  92. DIG_CONNECT_MAX
  93. };
  94. enum dm_dig_ext_port_alg {
  95. DIG_EXT_PORT_STAGE_0 = 0,
  96. DIG_EXT_PORT_STAGE_1 = 1,
  97. DIG_EXT_PORT_STAGE_2 = 2,
  98. DIG_EXT_PORT_STAGE_3 = 3,
  99. DIG_EXT_PORT_STAGE_MAX = 4,
  100. };
  101. enum dm_ratr_sta {
  102. DM_RATR_STA_HIGH = 0,
  103. DM_RATR_STA_MIDDLEHIGH = 1,
  104. DM_RATR_STA_MIDDLE = 2,
  105. DM_RATR_STA_MIDDLELOW = 3,
  106. DM_RATR_STA_LOW = 4,
  107. DM_RATR_STA_ULTRALOW = 5,
  108. DM_RATR_STA_MAX
  109. };
  110. #define DM_TYPE_BYFW 0
  111. #define DM_TYPE_BYDRIVER 1
  112. #define TX_HIGH_PWR_LEVEL_NORMAL 0
  113. #define TX_HIGH_PWR_LEVEL_LEVEL1 1
  114. #define TX_HIGH_PWR_LEVEL_LEVEL2 2
  115. #define HAL_DM_DIG_DISABLE BIT(0) /* Disable Dig */
  116. #define HAL_DM_HIPWR_DISABLE BIT(1) /* Disable High Power */
  117. #define TX_HIGHPWR_LEVEL_NORMAL 0
  118. #define TX_HIGHPWR_LEVEL_NORMAL1 1
  119. #define TX_HIGHPWR_LEVEL_NORMAL2 2
  120. #define TX_POWER_NEAR_FIELD_THRESH_LVL2 74
  121. #define TX_POWER_NEAR_FIELD_THRESH_LVL1 67
  122. #define DM_DIG_THRESH_HIGH 40
  123. #define DM_DIG_THRESH_LOW 35
  124. #define DM_FALSEALARM_THRESH_LOW 40
  125. #define DM_FALSEALARM_THRESH_HIGH 1000
  126. #define DM_DIG_HIGH_PWR_THRESH_HIGH 75
  127. #define DM_DIG_HIGH_PWR_THRESH_LOW 70
  128. #define DM_DIG_BACKOFF 12
  129. #define DM_DIG_MAX 0x3e
  130. #define DM_DIG_MIN 0x1c
  131. #define DM_DIG_MIN_Netcore 0x12
  132. #define DM_DIG_BACKOFF_MAX 12
  133. #define DM_DIG_BACKOFF_MIN -4
  134. extern struct dig_t digtable;
  135. void rtl92s_dm_watchdog(struct ieee80211_hw *hw);
  136. void rtl92s_dm_init(struct ieee80211_hw *hw);
  137. void rtl92s_dm_init_edca_turbo(struct ieee80211_hw *hw);
  138. #endif