mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 21:24:32 +02:00
Merge branch 'bugfix/unify_btbb_init' into 'master'
esp_phy: added API esp_btbb_disable See merge request espressif/esp-idf!22806
This commit is contained in:
@@ -67,7 +67,6 @@
|
|||||||
#define ACL_DATA_MBUF_LEADINGSPCAE 4
|
#define ACL_DATA_MBUF_LEADINGSPCAE 4
|
||||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||||
|
|
||||||
#define PHY_ENABLE_VERSION_PRINT (1)
|
|
||||||
|
|
||||||
/* Types definition
|
/* Types definition
|
||||||
************************************************************************
|
************************************************************************
|
||||||
@@ -120,7 +119,6 @@ extern int esp_ble_ll_set_public_addr(const uint8_t *addr);
|
|||||||
extern int esp_register_npl_funcs (struct npl_funcs_t *p_npl_func);
|
extern int esp_register_npl_funcs (struct npl_funcs_t *p_npl_func);
|
||||||
extern void esp_unregister_npl_funcs (void);
|
extern void esp_unregister_npl_funcs (void);
|
||||||
extern void npl_freertos_mempool_deinit(void);
|
extern void npl_freertos_mempool_deinit(void);
|
||||||
extern void bt_bb_v2_init_cmplx(uint8_t i);
|
|
||||||
extern int os_msys_buf_alloc(void);
|
extern int os_msys_buf_alloc(void);
|
||||||
extern uint32_t r_os_cputime_get32(void);
|
extern uint32_t r_os_cputime_get32(void);
|
||||||
extern uint32_t r_os_cputime_ticks_to_usecs(uint32_t ticks);
|
extern uint32_t r_os_cputime_ticks_to_usecs(uint32_t ticks);
|
||||||
@@ -631,7 +629,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL, 249);
|
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL, 249);
|
||||||
esp_phy_modem_init();
|
esp_phy_modem_init();
|
||||||
esp_phy_enable();
|
esp_phy_enable();
|
||||||
bt_bb_v2_init_cmplx(PHY_ENABLE_VERSION_PRINT);
|
esp_btbb_enable();
|
||||||
s_ble_active = true;
|
s_ble_active = true;
|
||||||
|
|
||||||
if (ble_osi_coex_funcs_register((struct osi_coex_funcs_t *)&s_osi_coex_funcs_ro) != 0) {
|
if (ble_osi_coex_funcs_register((struct osi_coex_funcs_t *)&s_osi_coex_funcs_ro) != 0) {
|
||||||
@@ -669,6 +667,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
free_controller:
|
free_controller:
|
||||||
controller_sleep_deinit();
|
controller_sleep_deinit();
|
||||||
ble_controller_deinit();
|
ble_controller_deinit();
|
||||||
|
esp_btbb_disable();
|
||||||
esp_phy_disable();
|
esp_phy_disable();
|
||||||
esp_phy_modem_deinit();
|
esp_phy_modem_deinit();
|
||||||
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||||
@@ -695,6 +694,8 @@ esp_err_t esp_bt_controller_deinit(void)
|
|||||||
|
|
||||||
controller_sleep_deinit();
|
controller_sleep_deinit();
|
||||||
|
|
||||||
|
esp_btbb_disable();
|
||||||
|
|
||||||
if (s_ble_active) {
|
if (s_ble_active) {
|
||||||
esp_phy_disable();
|
esp_phy_disable();
|
||||||
s_ble_active = false;
|
s_ble_active = false;
|
||||||
|
@@ -67,7 +67,6 @@
|
|||||||
#define ACL_DATA_MBUF_LEADINGSPCAE 4
|
#define ACL_DATA_MBUF_LEADINGSPCAE 4
|
||||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||||
|
|
||||||
#define PHY_ENABLE_VERSION_PRINT (1)
|
|
||||||
|
|
||||||
/* Types definition
|
/* Types definition
|
||||||
************************************************************************
|
************************************************************************
|
||||||
@@ -120,7 +119,6 @@ extern int esp_ble_ll_set_public_addr(const uint8_t *addr);
|
|||||||
extern int esp_register_npl_funcs (struct npl_funcs_t *p_npl_func);
|
extern int esp_register_npl_funcs (struct npl_funcs_t *p_npl_func);
|
||||||
extern void esp_unregister_npl_funcs (void);
|
extern void esp_unregister_npl_funcs (void);
|
||||||
extern void npl_freertos_mempool_deinit(void);
|
extern void npl_freertos_mempool_deinit(void);
|
||||||
extern void bt_bb_v2_init_cmplx(uint8_t i);
|
|
||||||
extern int os_msys_buf_alloc(void);
|
extern int os_msys_buf_alloc(void);
|
||||||
extern uint32_t r_os_cputime_get32(void);
|
extern uint32_t r_os_cputime_get32(void);
|
||||||
extern uint32_t r_os_cputime_ticks_to_usecs(uint32_t ticks);
|
extern uint32_t r_os_cputime_ticks_to_usecs(uint32_t ticks);
|
||||||
@@ -659,6 +657,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
// modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL, 249);
|
// modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL, 249);
|
||||||
// esp_phy_modem_init();
|
// esp_phy_modem_init();
|
||||||
esp_phy_enable();
|
esp_phy_enable();
|
||||||
|
esp_btbb_enable();
|
||||||
s_ble_active = true;
|
s_ble_active = true;
|
||||||
|
|
||||||
if (ble_osi_coex_funcs_register((struct osi_coex_funcs_t *)&s_osi_coex_funcs_ro) != 0) {
|
if (ble_osi_coex_funcs_register((struct osi_coex_funcs_t *)&s_osi_coex_funcs_ro) != 0) {
|
||||||
@@ -696,6 +695,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
free_controller:
|
free_controller:
|
||||||
controller_sleep_deinit();
|
controller_sleep_deinit();
|
||||||
ble_controller_deinit();
|
ble_controller_deinit();
|
||||||
|
esp_btbb_disable();
|
||||||
esp_phy_disable();
|
esp_phy_disable();
|
||||||
// esp_phy_modem_deinit();
|
// esp_phy_modem_deinit();
|
||||||
// modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
// modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||||
@@ -722,6 +722,8 @@ esp_err_t esp_bt_controller_deinit(void)
|
|||||||
|
|
||||||
controller_sleep_deinit();
|
controller_sleep_deinit();
|
||||||
|
|
||||||
|
esp_btbb_disable();
|
||||||
|
|
||||||
if (s_ble_active) {
|
if (s_ble_active) {
|
||||||
esp_phy_disable();
|
esp_phy_disable();
|
||||||
s_ble_active = false;
|
s_ble_active = false;
|
||||||
|
@@ -123,7 +123,6 @@ extern int esp_ble_ll_set_public_addr(const uint8_t *addr);
|
|||||||
extern int esp_register_npl_funcs (struct npl_funcs_t *p_npl_func);
|
extern int esp_register_npl_funcs (struct npl_funcs_t *p_npl_func);
|
||||||
extern void esp_unregister_npl_funcs (void);
|
extern void esp_unregister_npl_funcs (void);
|
||||||
extern void npl_freertos_mempool_deinit(void);
|
extern void npl_freertos_mempool_deinit(void);
|
||||||
extern void bt_bb_v2_init_cmplx(uint8_t i);
|
|
||||||
extern int os_msys_buf_alloc(void);
|
extern int os_msys_buf_alloc(void);
|
||||||
extern uint32_t r_os_cputime_get32(void);
|
extern uint32_t r_os_cputime_get32(void);
|
||||||
extern uint32_t r_os_cputime_ticks_to_usecs(uint32_t ticks);
|
extern uint32_t r_os_cputime_ticks_to_usecs(uint32_t ticks);
|
||||||
@@ -641,6 +640,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
|
|
||||||
// init phy
|
// init phy
|
||||||
esp_phy_enable();
|
esp_phy_enable();
|
||||||
|
esp_btbb_enable();
|
||||||
s_ble_active = true;
|
s_ble_active = true;
|
||||||
// set bb delay
|
// set bb delay
|
||||||
bt_bb_set_le_tx_on_delay(50);
|
bt_bb_set_le_tx_on_delay(50);
|
||||||
@@ -681,6 +681,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
free_controller:
|
free_controller:
|
||||||
controller_sleep_deinit();
|
controller_sleep_deinit();
|
||||||
ble_controller_deinit();
|
ble_controller_deinit();
|
||||||
|
esp_btbb_disable();
|
||||||
esp_phy_disable();
|
esp_phy_disable();
|
||||||
#if CONFIG_BT_NIMBLE_ENABLED
|
#if CONFIG_BT_NIMBLE_ENABLED
|
||||||
ble_npl_eventq_deinit(nimble_port_get_dflt_eventq());
|
ble_npl_eventq_deinit(nimble_port_get_dflt_eventq());
|
||||||
@@ -703,6 +704,8 @@ esp_err_t esp_bt_controller_deinit(void)
|
|||||||
|
|
||||||
controller_sleep_deinit();
|
controller_sleep_deinit();
|
||||||
|
|
||||||
|
esp_btbb_disable();
|
||||||
|
|
||||||
if (s_ble_active) {
|
if (s_ble_active) {
|
||||||
esp_phy_disable();
|
esp_phy_disable();
|
||||||
s_ble_active = false;
|
s_ble_active = false;
|
||||||
@@ -725,8 +728,6 @@ esp_err_t esp_bt_controller_deinit(void)
|
|||||||
|
|
||||||
npl_freertos_mempool_deinit();
|
npl_freertos_mempool_deinit();
|
||||||
|
|
||||||
esp_phy_disable();
|
|
||||||
|
|
||||||
ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
@@ -180,6 +180,15 @@ void esp_phy_disable(void);
|
|||||||
*/
|
*/
|
||||||
void esp_btbb_enable(void);
|
void esp_btbb_enable(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disable BTBB module
|
||||||
|
*
|
||||||
|
* Dsiable BTBB module, used by IEEE802154 or Bluetooth.
|
||||||
|
* Users should not call this API in their application.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void esp_btbb_disable(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Load calibration data from NVS and initialize PHY and RF module
|
* @brief Load calibration data from NVS and initialize PHY and RF module
|
||||||
*/
|
*/
|
||||||
|
@@ -23,3 +23,12 @@ void esp_btbb_enable(void)
|
|||||||
s_btbb_access_ref++;
|
s_btbb_access_ref++;
|
||||||
_lock_release(&s_btbb_access_lock);
|
_lock_release(&s_btbb_access_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void esp_btbb_disable(void)
|
||||||
|
{
|
||||||
|
_lock_acquire(&s_btbb_access_lock);
|
||||||
|
if (s_btbb_access_ref > 0) {
|
||||||
|
s_btbb_access_ref--;
|
||||||
|
}
|
||||||
|
_lock_release(&s_btbb_access_lock);
|
||||||
|
}
|
||||||
|
@@ -48,7 +48,6 @@ void esp_phy_enable(void)
|
|||||||
_lock_acquire(&s_phy_access_lock);
|
_lock_acquire(&s_phy_access_lock);
|
||||||
if (s_phy_access_ref == 0) {
|
if (s_phy_access_ref == 0) {
|
||||||
register_chipv7_phy(NULL, NULL, PHY_RF_CAL_FULL);
|
register_chipv7_phy(NULL, NULL, PHY_RF_CAL_FULL);
|
||||||
bt_bb_v2_init_cmplx(PHY_ENABLE_VERSION_PRINT);
|
|
||||||
phy_version_print();
|
phy_version_print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user