phy.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include "esp_phy_init.h"
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. #define ESP_CAL_DATA_CHECK_FAIL 1
  12. /**
  13. * @file phy.h
  14. * @brief Declarations for functions provided by libphy.a
  15. */
  16. /**
  17. * @brief Return ROM function pointer table from PHY library.
  18. */
  19. void phy_get_romfunc_addr(void);
  20. /**
  21. * @brief Initialize PHY module and do RF calibration
  22. * @param[in] init_data Initialization parameters to be used by the PHY
  23. * @param[inout] cal_data As input, calibration data previously obtained. As output, will contain new calibration data.
  24. * @param[in] cal_mode RF calibration mode
  25. * @return ESP_CAL_DATA_CHECK_FAIL if calibration data checksum fails, other values are reserved for future use
  26. */
  27. 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);
  28. /**
  29. * @brief Get the format version of calibration data used by PHY library.
  30. * @return Format version number, OR'ed with BIT(16) if PHY is in WIFI only mode.
  31. */
  32. uint32_t phy_get_rf_cal_version(void);
  33. /**
  34. * @brief Set RF/BB for only WIFI mode or coexist(WIFI & BT) mode
  35. * @param[in] true is for only WIFI mode, false is for coexist mode. default is 0.
  36. * @return NULL
  37. */
  38. void phy_set_wifi_mode_only(bool wifi_only);
  39. /**
  40. * @brief Set BT the highest priority in coexist mode.
  41. * @return NULL
  42. */
  43. void coex_bt_high_prio(void);
  44. /**
  45. * @brief Open PHY and RF.
  46. */
  47. void phy_wakeup_init(void);
  48. /**
  49. * @brief Shutdown PHY and RF.
  50. */
  51. void phy_close_rf(void);
  52. #if !CONFIG_IDF_TARGET_ESP32
  53. /**
  54. * @brief Disable PHY temperature sensor.
  55. */
  56. void phy_xpd_tsens(void);
  57. #endif
  58. /**
  59. * @brief Store and load PHY digital registers.
  60. *
  61. * @param backup_en if backup_en is true, store PHY digital registers to memory. Otherwise load PHY digital registers from memory
  62. * @param mem_addr Memory address to store and load PHY digital registers
  63. *
  64. * @return memory size
  65. */
  66. uint8_t phy_dig_reg_backup(bool backup_en, uint32_t *mem_addr);
  67. #if CONFIG_MAC_BB_PD
  68. /**
  69. * @brief Store and load baseband registers.
  70. */
  71. void phy_freq_mem_backup(bool backup_en, uint32_t *mem);
  72. #endif
  73. #ifdef __cplusplus
  74. }
  75. #endif