rtw_rf.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
  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. *
  19. ******************************************************************************/
  20. #ifndef __RTW_RF_H_
  21. #define __RTW_RF_H_
  22. #define OFDM_PHY 1
  23. #define MIXED_PHY 2
  24. #define CCK_PHY 3
  25. #define NumRates (13)
  26. // slot time for 11g
  27. #define SHORT_SLOT_TIME 9
  28. #define NON_SHORT_SLOT_TIME 20
  29. #define RTL8711_RF_MAX_SENS 6
  30. #define RTL8711_RF_DEF_SENS 4
  31. //
  32. // We now define the following channels as the max channels in each channel plan.
  33. // 2G, total 14 chnls
  34. // {1,2,3,4,5,6,7,8,9,10,11,12,13,14}
  35. // 5G, total 24 chnls
  36. // {36,40,44,48,52,56,60,64,100,104,108,112,116,120,124,128,132,136,140,149,153,157,161,165}
  37. #define MAX_CHANNEL_NUM_2G 14
  38. #define MAX_CHANNEL_NUM_5G 24
  39. #define MAX_CHANNEL_NUM 38//14+24
  40. //#define NUM_REGULATORYS 21
  41. #define NUM_REGULATORYS 1
  42. //Country codes
  43. #define USA 0x555320
  44. #define EUROPE 0x1 //temp, should be provided later
  45. #define JAPAN 0x2 //temp, should be provided later
  46. struct regulatory_class {
  47. u32 starting_freq; //MHz,
  48. u8 channel_set[MAX_CHANNEL_NUM];
  49. u8 channel_cck_power[MAX_CHANNEL_NUM];//dbm
  50. u8 channel_ofdm_power[MAX_CHANNEL_NUM];//dbm
  51. u8 txpower_limit; //dbm
  52. u8 channel_spacing; //MHz
  53. u8 modem;
  54. };
  55. typedef enum _CAPABILITY{
  56. cESS = 0x0001,
  57. cIBSS = 0x0002,
  58. cPollable = 0x0004,
  59. cPollReq = 0x0008,
  60. cPrivacy = 0x0010,
  61. cShortPreamble = 0x0020,
  62. cPBCC = 0x0040,
  63. cChannelAgility = 0x0080,
  64. cSpectrumMgnt = 0x0100,
  65. cQos = 0x0200, // For HCCA, use with CF-Pollable and CF-PollReq
  66. cShortSlotTime = 0x0400,
  67. cAPSD = 0x0800,
  68. cRM = 0x1000, // RRM (Radio Request Measurement)
  69. cDSSS_OFDM = 0x2000,
  70. cDelayedBA = 0x4000,
  71. cImmediateBA = 0x8000,
  72. }CAPABILITY, *PCAPABILITY;
  73. enum _REG_PREAMBLE_MODE{
  74. PREAMBLE_LONG = 1,
  75. PREAMBLE_AUTO = 2,
  76. PREAMBLE_SHORT = 3,
  77. };
  78. enum _RTL8712_RF_MIMO_CONFIG_{
  79. RTL8712_RFCONFIG_1T=0x10,
  80. RTL8712_RFCONFIG_2T=0x20,
  81. RTL8712_RFCONFIG_1R=0x01,
  82. RTL8712_RFCONFIG_2R=0x02,
  83. RTL8712_RFCONFIG_1T1R=0x11,
  84. RTL8712_RFCONFIG_1T2R=0x12,
  85. RTL8712_RFCONFIG_TURBO=0x92,
  86. RTL8712_RFCONFIG_2T2R=0x22
  87. };
  88. typedef enum _RF90_RADIO_PATH{
  89. RF90_PATH_A = 0, //Radio Path A
  90. RF90_PATH_B = 1, //Radio Path B
  91. RF90_PATH_C = 2, //Radio Path C
  92. RF90_PATH_D = 3 //Radio Path D
  93. //RF90_PATH_MAX //Max RF number 90 support
  94. }RF90_RADIO_PATH_E, *PRF90_RADIO_PATH_E;
  95. // Bandwidth Offset
  96. #define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0
  97. #define HAL_PRIME_CHNL_OFFSET_LOWER 1
  98. #define HAL_PRIME_CHNL_OFFSET_UPPER 2
  99. // Represent Channel Width in HT Capabilities
  100. //
  101. typedef enum _CHANNEL_WIDTH{
  102. CHANNEL_WIDTH_20 = 0,
  103. CHANNEL_WIDTH_40 = 1,
  104. CHANNEL_WIDTH_80 = 2,
  105. CHANNEL_WIDTH_160 = 3,
  106. CHANNEL_WIDTH_80_80 = 4,
  107. CHANNEL_WIDTH_MAX = 5,
  108. }CHANNEL_WIDTH, *PCHANNEL_WIDTH;
  109. //
  110. // Represent Extention Channel Offset in HT Capabilities
  111. // This is available only in 40Mhz mode.
  112. //
  113. typedef enum _EXTCHNL_OFFSET{
  114. EXTCHNL_OFFSET_NO_EXT = 0,
  115. EXTCHNL_OFFSET_UPPER = 1,
  116. EXTCHNL_OFFSET_NO_DEF = 2,
  117. EXTCHNL_OFFSET_LOWER = 3,
  118. }EXTCHNL_OFFSET, *PEXTCHNL_OFFSET;
  119. typedef enum _VHT_DATA_SC{
  120. VHT_DATA_SC_DONOT_CARE = 0,
  121. VHT_DATA_SC_20_UPPER_OF_80MHZ = 1,
  122. VHT_DATA_SC_20_LOWER_OF_80MHZ = 2,
  123. VHT_DATA_SC_20_UPPERST_OF_80MHZ = 3,
  124. VHT_DATA_SC_20_LOWEST_OF_80MHZ = 4,
  125. VHT_DATA_SC_20_RECV1 = 5,
  126. VHT_DATA_SC_20_RECV2 = 6,
  127. VHT_DATA_SC_20_RECV3 = 7,
  128. VHT_DATA_SC_20_RECV4 = 8,
  129. VHT_DATA_SC_40_UPPER_OF_80MHZ = 9,
  130. VHT_DATA_SC_40_LOWER_OF_80MHZ = 10,
  131. }VHT_DATA_SC, *PVHT_DATA_SC_E;
  132. typedef enum _PROTECTION_MODE{
  133. PROTECTION_MODE_AUTO = 0,
  134. PROTECTION_MODE_FORCE_ENABLE = 1,
  135. PROTECTION_MODE_FORCE_DISABLE = 2,
  136. }PROTECTION_MODE, *PPROTECTION_MODE;
  137. #define LDPC_VHT_ENABLE_RX BIT0
  138. #define LDPC_VHT_ENABLE_TX BIT1
  139. #define LDPC_VHT_TEST_TX_ENABLE BIT2
  140. #define LDPC_VHT_CAP_TX BIT3
  141. #define STBC_VHT_ENABLE_RX BIT0
  142. #define STBC_VHT_ENABLE_TX BIT1
  143. #define STBC_VHT_TEST_TX_ENABLE BIT2
  144. #define STBC_VHT_CAP_TX BIT3
  145. #define BEAMFORMING_VHT_BEAMFORMER_ENABLE BIT0 // Declare our NIC supports beamformer
  146. #define BEAMFORMING_VHT_BEAMFORMEE_ENABLE BIT1 // Declare our NIC supports beamformee
  147. #define BEAMFORMING_VHT_BEAMFORMER_TEST BIT2 // Transmiting Beamforming no matter the target supports it or not
  148. /* 2007/11/15 MH Define different RF type. */
  149. typedef enum _RT_RF_TYPE_DEFINITION
  150. {
  151. RF_1T2R = 0,
  152. RF_2T4R = 1,
  153. RF_2T2R = 2,
  154. RF_1T1R = 3,
  155. RF_2T2R_GREEN = 4,
  156. RF_MAX_TYPE = 5,
  157. }RT_RF_TYPE_DEF_E;
  158. u32 rtw_ch2freq(u32 ch);
  159. u32 rtw_freq2ch(u32 freq);
  160. #endif //_RTL8711_RF_H_