phy_init_data.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. // Copyright 2016 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include "esp_phy_init.h"
  16. #include "sdkconfig.h"
  17. // constrain a value between 'low' and 'high', inclusive
  18. #define LIMIT(val, low, high) ((val < low) ? low : (val > high) ? high : val)
  19. #define PHY_INIT_MAGIC "PHYINIT"
  20. static const char phy_init_magic_pre[] = PHY_INIT_MAGIC;
  21. /**
  22. * @brief Structure containing default recommended PHY initialization parameters.
  23. */
  24. static const esp_phy_init_data_t phy_init_data= {
  25. .param_ver_id = 0,
  26. .crystal_select = 3,
  27. .wifi_rx_gain_swp_step_1 = 0x05,
  28. .wifi_rx_gain_swp_step_2 = 0x04,
  29. .wifi_rx_gain_swp_step_3 = 0x06,
  30. .wifi_rx_gain_swp_step_4 = 0x05,
  31. .wifi_rx_gain_swp_step_5 = 0x01,
  32. .wifi_rx_gain_swp_step_6 = 0x06,
  33. .wifi_rx_gain_swp_step_7 = 0x05,
  34. .wifi_rx_gain_swp_step_8 = 0x04,
  35. .wifi_rx_gain_swp_step_9 = 0x06,
  36. .wifi_rx_gain_swp_step_10 = 0x04,
  37. .wifi_rx_gain_swp_step_11 = 0x05,
  38. .wifi_rx_gain_swp_step_12 = 0x00,
  39. .wifi_rx_gain_swp_step_13 = 0x00,
  40. .wifi_rx_gain_swp_step_14 = 0x00,
  41. .wifi_rx_gain_swp_step_15 = 0x00,
  42. .bt_rx_gain_swp_step_1 = 0x05,
  43. .bt_rx_gain_swp_step_2 = 0x04,
  44. .bt_rx_gain_swp_step_3 = 0x06,
  45. .bt_rx_gain_swp_step_4 = 0x05,
  46. .bt_rx_gain_swp_step_5 = 0x01,
  47. .bt_rx_gain_swp_step_6 = 0x06,
  48. .bt_rx_gain_swp_step_7 = 0x05,
  49. .bt_rx_gain_swp_step_8 = 0x00,
  50. .bt_rx_gain_swp_step_9 = 0x00,
  51. .bt_rx_gain_swp_step_10 = 0x00,
  52. .bt_rx_gain_swp_step_11 = 0x00,
  53. .bt_rx_gain_swp_step_12 = 0x00,
  54. .bt_rx_gain_swp_step_13 = 0x00,
  55. .bt_rx_gain_swp_step_14 = 0x00,
  56. .bt_rx_gain_swp_step_15 = 0x00,
  57. .gain_cmp_1 = 0x0a,
  58. .gain_cmp_6 = 0x0a,
  59. .gain_cmp_11 = 0x0c,
  60. .gain_cmp_ext2_1 = 0xf0,
  61. .gain_cmp_ext2_6 = 0xf0,
  62. .gain_cmp_ext2_11 = 0xf0,
  63. .gain_cmp_ext3_1 = 0xe0,
  64. .gain_cmp_ext3_6 = 0xe0,
  65. .gain_cmp_ext3_11 = 0xe0,
  66. .gain_cmp_bt_ofs_1 = 0x18,
  67. .gain_cmp_bt_ofs_6 = 0x18,
  68. .gain_cmp_bt_ofs_11 = 0x18,
  69. .target_power_qdb_0 = LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 78),
  70. .target_power_qdb_1 = LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 76),
  71. .target_power_qdb_2 = LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 74),
  72. .target_power_qdb_3 = LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 68),
  73. .target_power_qdb_4 = LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 64),
  74. .target_power_qdb_5 = LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 52),
  75. .target_power_index_mcs0 = 0,
  76. .target_power_index_mcs1 = 0,
  77. .target_power_index_mcs2 = 1,
  78. .target_power_index_mcs3 = 1,
  79. .target_power_index_mcs4 = 2,
  80. .target_power_index_mcs5 = 3,
  81. .target_power_index_mcs6 = 4,
  82. .target_power_index_mcs7 = 5,
  83. .pwr_ind_11b_en = 0,
  84. .pwr_ind_11b_0 = 0,
  85. .pwr_ind_11b_1 = 0,
  86. .chan_backoff_en = 0,
  87. .chan1_power_backoff_qdb = 0,
  88. .chan2_power_backoff_qdb = 0,
  89. .chan3_power_backoff_qdb = 0,
  90. .chan4_power_backoff_qdb = 0,
  91. .chan5_power_backoff_qdb = 0,
  92. .chan6_power_backoff_qdb = 0,
  93. .chan7_power_backoff_qdb = 0,
  94. .chan8_power_backoff_qdb = 0,
  95. .chan9_power_backoff_qdb = 0,
  96. .chan10_power_backoff_qdb = 0,
  97. .chan11_power_backoff_qdb = 0,
  98. .chan12_power_backoff_qdb = 0,
  99. .chan13_power_backoff_qdb = 0,
  100. .chan14_power_backoff_qdb = 0,
  101. .chan1_rate_backoff_index = 0,
  102. .chan2_rate_backoff_index = 0,
  103. .chan3_rate_backoff_index = 0,
  104. .chan4_rate_backoff_index = 0,
  105. .chan5_rate_backoff_index = 0,
  106. .chan6_rate_backoff_index = 0,
  107. .chan7_rate_backoff_index = 0,
  108. .chan8_rate_backoff_index = 0,
  109. .chan9_rate_backoff_index = 0,
  110. .chan10_rate_backoff_index = 0,
  111. .chan11_rate_backoff_index = 0,
  112. .chan12_rate_backoff_index = 0,
  113. .chan13_rate_backoff_index = 0,
  114. .chan14_rate_backoff_index = 0,
  115. .spur_freq_cfg_msb_1 = 0,
  116. .spur_freq_cfg_1 = 0,
  117. .spur_freq_cfg_div_1 = 0,
  118. .spur_freq_en_h_1 = 0,
  119. .spur_freq_en_l_1 = 0,
  120. .spur_freq_cfg_msb_2 = 0,
  121. .spur_freq_cfg_2 = 0,
  122. .spur_freq_cfg_div_2 = 0,
  123. .spur_freq_en_h_2 = 0,
  124. .spur_freq_en_l_2 = 0,
  125. .spur_freq_cfg_msb_3 = 0,
  126. .spur_freq_cfg_3 = 0,
  127. .spur_freq_cfg_div_3 = 0,
  128. .spur_freq_en_h_3 = 0,
  129. .spur_freq_en_l_3 = 0,
  130. .reserved = {0}
  131. };
  132. static const char phy_init_magic_post[] = PHY_INIT_MAGIC;