phy.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Copyright 2015-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. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. #define ESP_CAL_DATA_CHECK_FAIL 1
  20. #if CONFIG_MAC_BB_PD
  21. #define MAC_BB_PD_MEM_SIZE (192*4)
  22. #endif
  23. /**
  24. * @file phy.h
  25. * @brief Declarations for functions provided by libphy.a
  26. */
  27. /**
  28. * @brief Return ROM function pointer table from PHY library.
  29. */
  30. void phy_get_romfunc_addr(void);
  31. /**
  32. * @brief Initialize PHY module and do RF calibration
  33. * @param[in] init_data Initialization parameters to be used by the PHY
  34. * @param[inout] cal_data As input, calibration data previously obtained. As output, will contain new calibration data.
  35. * @param[in] cal_mode RF calibration mode
  36. * @return ESP_CAL_DATA_CHECK_FAIL if calibration data checksum fails, other values are reserved for future use
  37. */
  38. int register_chipv7_phy(const esp_phy_init_data_t* init_data, esp_phy_calibration_data_t *cal_data, esp_phy_calibration_mode_t cal_mode);
  39. /**
  40. * @brief Get the format version of calibration data used by PHY library.
  41. * @return Format version number, OR'ed with BIT(16) if PHY is in WIFI only mode.
  42. */
  43. uint32_t phy_get_rf_cal_version(void);
  44. /**
  45. * @brief Set RF/BB for only WIFI mode or coexist(WIFI & BT) mode
  46. * @param[in] true is for only WIFI mode, false is for coexist mode. default is 0.
  47. * @return NULL
  48. */
  49. void phy_set_wifi_mode_only(bool wifi_only);
  50. /**
  51. * @brief Set BT the highest priority in coexist mode.
  52. * @return NULL
  53. */
  54. void coex_bt_high_prio(void);
  55. /**
  56. * @brief Open PHY and RF.
  57. */
  58. void phy_wakeup_init(void);
  59. /**
  60. * @brief Shutdown PHY and RF.
  61. */
  62. void phy_close_rf(void);
  63. #if CONFIG_MAC_BB_PD
  64. /**
  65. * @brief Store and load baseband registers.
  66. */
  67. void phy_freq_mem_backup(bool backup_en, uint32_t *mem);
  68. #endif
  69. #ifdef __cplusplus
  70. }
  71. #endif