bt: add coexistence internal API declarations and clean up some unused coexistence hooks

This commit is contained in:
wangmengyang
2023-02-21 16:30:54 +08:00
committed by BOT
parent b3a040aa98
commit 2c4fc5d9ea
8 changed files with 68 additions and 23 deletions

View File

@@ -691,8 +691,8 @@ endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
REQUIRES esp_timer esp_wifi esp_coex
PRIV_REQUIRES nvs_flash soc esp_pm esp_phy mbedtls driver vfs
REQUIRES esp_timer esp_wifi
PRIV_REQUIRES nvs_flash soc esp_pm esp_phy esp_coex mbedtls driver vfs
LDFRAGMENTS "linker.lf")
if(CONFIG_BT_ENABLED)

View File

@@ -219,20 +219,6 @@ extern int bredr_txpwr_set(int min_power_level, int max_power_level);
extern int bredr_txpwr_get(int *min_power_level, int *max_power_level);
extern void bredr_sco_datapath_set(uint8_t data_path);
extern void btdm_controller_scan_duplicate_list_clear(void);
/* Coexistence */
extern int coex_bt_request(uint32_t event, uint32_t latency, uint32_t duration);
extern int coex_bt_release(uint32_t event);
extern int coex_register_bt_cb(coex_func_cb_t cb);
extern uint32_t coex_bb_reset_lock(void);
extern void coex_bb_reset_unlock(uint32_t restore);
extern int coex_schm_register_callback(coex_schm_callback_type_t type, void *callback);
extern void coex_schm_status_bit_clear(uint32_t type, uint32_t status);
extern void coex_schm_status_bit_set(uint32_t type, uint32_t status);
extern uint32_t coex_schm_interval_get(void);
extern uint8_t coex_schm_curr_period_get(void);
extern void * coex_schm_curr_phase_get(void);
extern int coex_wifi_channel_get(uint8_t *primary, uint8_t *secondary);
extern int coex_register_wifi_channel_change_callback(void *cb);
/* Shutdown */
extern void esp_bt_controller_shutdown(void);

View File

@@ -114,7 +114,6 @@ struct ext_funcs_t {
*/
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
extern int coex_core_ble_conn_dyn_prio_get(bool *low, bool *high);
extern int ble_controller_init(esp_bt_controller_config_t *cfg);
extern int ble_controller_deinit(void);
extern int ble_controller_enable(uint8_t mode);

View File

@@ -235,7 +235,6 @@ extern int ble_txpwr_set(int power_type, int power_level);
extern int ble_txpwr_get(int power_type);
extern uint16_t l2c_ble_link_get_tx_buf_num(void);
extern int coex_core_ble_conn_dyn_prio_get(bool *low, bool *high);
extern void coex_pti_v2(void);
extern bool btdm_deep_sleep_mem_init(void);
@@ -365,7 +364,7 @@ static const struct osi_funcs_t osi_funcs_ro = {
._btdm_sleep_exit_phase2 = NULL,
._btdm_sleep_exit_phase3 = btdm_sleep_exit_phase3_wrapper,
._coex_wifi_sleep_set = coex_wifi_sleep_set_hook,
._coex_core_ble_conn_dyn_prio_get = coex_core_ble_conn_dyn_prio_get,
._coex_core_ble_conn_dyn_prio_get = NULL,
._coex_schm_status_bit_set = coex_schm_status_bit_set_wrapper,
._coex_schm_status_bit_clear = coex_schm_status_bit_clear_wrapper,
._interrupt_on = interrupt_on_wrapper,

View File

@@ -110,7 +110,6 @@ struct ext_funcs_t {
************************************************************************
*/
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
extern int coex_core_ble_conn_dyn_prio_get(bool *low, bool *high);
extern int ble_controller_init(esp_bt_controller_config_t *cfg);
extern int ble_controller_deinit(void);
extern int ble_controller_enable(uint8_t mode);

View File

@@ -113,7 +113,6 @@ struct ext_funcs_t {
extern int ble_plf_set_log_level(int level);
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
extern int coex_core_ble_conn_dyn_prio_get(bool *low, bool *high);
extern int ble_controller_init(esp_bt_controller_config_t *cfg);
extern int ble_controller_deinit(void);
extern int ble_controller_enable(uint8_t mode);

View File

@@ -240,7 +240,6 @@ extern int ble_txpwr_set(int power_type, int power_level);
extern int ble_txpwr_get(int power_type);
extern uint16_t l2c_ble_link_get_tx_buf_num(void);
extern int coex_core_ble_conn_dyn_prio_get(bool *low, bool *high);
extern void coex_pti_v2(void);
extern bool btdm_deep_sleep_mem_init(void);
@@ -369,7 +368,7 @@ static const struct osi_funcs_t osi_funcs_ro = {
._btdm_sleep_exit_phase2 = NULL,
._btdm_sleep_exit_phase3 = btdm_sleep_exit_phase3_wrapper,
._coex_wifi_sleep_set = coex_wifi_sleep_set_hook,
._coex_core_ble_conn_dyn_prio_get = coex_core_ble_conn_dyn_prio_get,
._coex_core_ble_conn_dyn_prio_get = NULL,
._coex_schm_status_bit_set = coex_schm_status_bit_set_wrapper,
._coex_schm_status_bit_clear = coex_schm_status_bit_clear_wrapper,
._interrupt_on = interrupt_on_wrapper,

View File

@@ -30,6 +30,7 @@ typedef enum {
typedef void (* coex_func_cb_t)(uint32_t event, int sched_cnt);
typedef esp_err_t (* coex_set_lpclk_source_callback_t)(void);
typedef void (* coex_wifi_channel_change_cb_t)(uint8_t primary, uint8_t secondary);
/**
* @brief Pre-Init software coexist
@@ -122,6 +123,15 @@ int coex_wifi_release(uint32_t event);
*/
int coex_wifi_channel_set(uint8_t primary, uint8_t secondary);
/**
* @brief Get WiFi channel from coexistence module.
*
* @param primary : pointer to value of WiFi primary channel
* @param secondary : pointer to value of WiFi secondary channel
* @return : 0 - success, other - failed
*/
int coex_wifi_channel_get(uint8_t *primary, uint8_t *secondary);
/**
* @brief Register application callback function to Wi-Fi update low power clock module.
*
@@ -129,6 +139,60 @@ int coex_wifi_channel_set(uint8_t primary, uint8_t secondary);
*/
void coex_wifi_register_update_lpclk_callback(coex_set_lpclk_source_callback_t callback);
/**
* @brief Bluetooth requests coexistence
*
* @param event : Bluetooth event
* @param latency : Bluetooth will request coexistence after latency
* @param duration : duration for Bluetooth to request coexistence
* @return : 0 - success, other - failed
*/
int coex_bt_request(uint32_t event, uint32_t latency, uint32_t duration);
/**
* @brief Bluetooth release coexistence.
*
* @param event : Bluetooth event
* @return : 0 - success, other - failed
*/
int coex_bt_release(uint32_t event);
#if CONFIG_IDF_TARGET_ESP32
/**
* @brief Bluetooth registers callback function to coexistence module
* This function is only used on ESP32.
*
* @param callback: callback function registered to coexistence module
* @return : 0 - success, other - failed
*/
int coex_register_bt_cb(coex_func_cb_t callback);
/**
* @brief To acquire the spin-lock used in resetting Bluetooth baseband.
* This function is only used to workaround ESP32 hardware issue.
*
* @param callback: callback function registered to coexistence module
* @return : value of the spinlock to be restored
*/
uint32_t coex_bb_reset_lock(void);
/**
* @brief To release the spin-lock used in resetting Bluetooth baseband.
* This function is only used to workaround ESP32 hardware issue.
*
* @param restore: value of the spinlock returned from previous call of coex_bb_rest_lock
*/
void coex_bb_reset_unlock(uint32_t restore);
#endif /* CONFIG_IDF_TARGET_ESP32 */
/**
* @brief Bluetooth registers callback function to receive notification when Wi-Fi channel changes
*
* @param callback: callback function registered to coexistence module
* @return : 0 - success, other - failed
*/
int coex_register_wifi_channel_change_callback(coex_wifi_channel_change_cb_t callback);
/**
* @brief Update low power clock interval
*/