phy_init_data.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. #ifndef PHY_INIT_DATA_H
  15. #define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */
  16. #include "esp_phy_init.h"
  17. #include "sdkconfig.h"
  18. // constrain a value between 'low' and 'high', inclusive
  19. #define LIMIT(val, low, high) ((val < low) ? low : (val > high) ? high : val)
  20. #define PHY_INIT_MAGIC "PHYINIT"
  21. // define the lowest tx power as LOWEST_PHY_TX_POWER
  22. #define PHY_TX_POWER_LOWEST LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 52)
  23. #define PHY_TX_POWER_OFFSET 44
  24. #define PHY_TX_POWER_NUM 5
  25. static const char phy_init_magic_pre[] = PHY_INIT_MAGIC;
  26. /**
  27. * @brief Structure containing default recommended PHY initialization parameters.
  28. */
  29. static const esp_phy_init_data_t phy_init_data= { {
  30. 3,
  31. 3,
  32. 0x05,
  33. 0x09,
  34. 0x06,
  35. 0x05,
  36. 0x03,
  37. 0x06,
  38. 0x05,
  39. 0x04,
  40. 0x06,
  41. 0x04,
  42. 0x05,
  43. 0x00,
  44. 0x00,
  45. 0x00,
  46. 0x00,
  47. 0x05,
  48. 0x09,
  49. 0x06,
  50. 0x05,
  51. 0x03,
  52. 0x06,
  53. 0x05,
  54. 0x00,
  55. 0x00,
  56. 0x00,
  57. 0x00,
  58. 0x00,
  59. 0x00,
  60. 0x00,
  61. 0x00,
  62. 0xfc,
  63. 0xfc,
  64. 0xfe,
  65. 0xf0,
  66. 0xf0,
  67. 0xf0,
  68. 0xe0,
  69. 0xe0,
  70. 0xe0,
  71. 0x18,
  72. 0x18,
  73. 0x18,
  74. LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 78),
  75. LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 72),
  76. LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 66),
  77. LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 60),
  78. LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 56),
  79. LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 52),
  80. 0,
  81. 1,
  82. 1,
  83. 2,
  84. 2,
  85. 3,
  86. 4,
  87. 5,
  88. 0,
  89. 0,
  90. 0,
  91. 0,
  92. 0,
  93. 0,
  94. 0,
  95. 0,
  96. 0,
  97. 0,
  98. 0,
  99. 0,
  100. 0,
  101. 0,
  102. 0,
  103. 0,
  104. 0,
  105. 0,
  106. 0,
  107. 0,
  108. 0,
  109. 0,
  110. 0,
  111. 0,
  112. 0,
  113. 0,
  114. 0,
  115. 0,
  116. 0,
  117. 0,
  118. 0,
  119. 0,
  120. 0,
  121. 0,
  122. 0,
  123. 0,
  124. 0,
  125. 0,
  126. 0,
  127. 0,
  128. 0,
  129. 0,
  130. 0,
  131. 0,
  132. 0,
  133. 0,
  134. 0,
  135. 0,
  136. 0,
  137. } };
  138. static const char phy_init_magic_post[] = PHY_INIT_MAGIC;
  139. #endif /* PHY_INIT_DATA_H */