esp_coexist_internal.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. // Copyright 2018-2018 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 __ESP_COEXIST_INTERNAL_H__
  15. #define __ESP_COEXIST_INTERNAL_H__
  16. #include <stdbool.h>
  17. #include "esp_coexist_adapter.h"
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. typedef enum {
  22. COEX_PREFER_WIFI = 0,
  23. COEX_PREFER_BT,
  24. COEX_PREFER_BALANCE,
  25. COEX_PREFER_NUM,
  26. } coex_prefer_t;
  27. typedef void (* coex_func_cb_t)(uint32_t event, int sched_cnt);
  28. /**
  29. * @brief Init software coexist
  30. * extern function for internal use.
  31. *
  32. * @return Init ok or failed.
  33. */
  34. esp_err_t coex_init(void);
  35. /**
  36. * @brief De-init software coexist
  37. * extern function for internal use.
  38. */
  39. void coex_deinit(void);
  40. /**
  41. * @brief Pause software coexist
  42. * extern function for internal use.
  43. */
  44. void coex_pause(void);
  45. /**
  46. * @brief Resume software coexist
  47. * extern function for internal use.
  48. */
  49. void coex_resume(void);
  50. /**
  51. * @brief Get software coexist version string
  52. * extern function for internal use.
  53. * @return : version string
  54. */
  55. const char *coex_version_get(void);
  56. /**
  57. * @brief Coexist performance preference set from libbt.a
  58. * extern function for internal use.
  59. *
  60. * @param prefer : the prefer enumeration value
  61. * @return : ESP_OK - success, other - failed
  62. */
  63. esp_err_t coex_preference_set(coex_prefer_t prefer);
  64. /**
  65. * @brief Get software coexist status.
  66. * @return : software coexist status
  67. */
  68. uint32_t coex_status_get(void);
  69. /**
  70. * @brief WiFi requests coexistence.
  71. *
  72. * @param event : WiFi event
  73. * @param latency : WiFi will request coexistence after latency
  74. * @param duration : duration for WiFi to request coexistence
  75. * @return : 0 - success, other - failed
  76. */
  77. int coex_wifi_request(uint32_t event, uint32_t latency, uint32_t duration);
  78. /**
  79. * @brief WiFi release coexistence.
  80. *
  81. * @param event : WiFi event
  82. * @return : 0 - success, other - failed
  83. */
  84. int coex_wifi_release(uint32_t event);
  85. /**
  86. * @brief Blue tooth requests coexistence.
  87. *
  88. * @param event : blue tooth event
  89. * @param latency : blue tooth will request coexistence after latency
  90. * @param duration : duration for blue tooth to request coexistence
  91. * @return : 0 - success, other - failed
  92. */
  93. int coex_bt_request(uint32_t event, uint32_t latency, uint32_t duration);
  94. /**
  95. * @brief Blue tooth release coexistence.
  96. *
  97. * @param event : blue tooth event
  98. * @return : 0 - success, other - failed
  99. */
  100. int coex_bt_release(uint32_t event);
  101. /**
  102. * @brief Register callback function for blue tooth.
  103. *
  104. * @param cb : callback function
  105. * @return : 0 - success, other - failed
  106. */
  107. int coex_register_bt_cb(coex_func_cb_t cb);
  108. /**
  109. * @brief Lock before reset base band.
  110. *
  111. * @return : lock value
  112. */
  113. uint32_t coex_bb_reset_lock(void);
  114. /**
  115. * @brief Unlock after reset base band.
  116. *
  117. * @param restore : lock value
  118. */
  119. void coex_bb_reset_unlock(uint32_t restore);
  120. /**
  121. * @brief Register coexistence adapter functions.
  122. *
  123. * @param funcs : coexistence adapter functions
  124. * @return : ESP_OK - success, other - failed
  125. */
  126. esp_err_t esp_coex_adapter_register(coex_adapter_funcs_t *funcs);
  127. /**
  128. * @brief Check the MD5 values of the coexistence adapter header files in IDF and WiFi library
  129. *
  130. * @attention 1. It is used for internal CI version check
  131. *
  132. * @return
  133. * - ESP_OK : succeed
  134. * - ESP_WIFI_INVALID_ARG : MD5 check fail
  135. */
  136. esp_err_t esp_coex_adapter_funcs_md5_check(const char *md5);
  137. #ifdef __cplusplus
  138. }
  139. #endif
  140. #endif /* __ESP_COEXIST_INTERNAL_H__ */