mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'backport/need_commit_to_v3.3' into 'release/v3.3'
components/bt: Backport some fixes to v3.3 See merge request espressif/esp-idf!11470
This commit is contained in:
commit
e38adae62b
@ -52,7 +52,7 @@
|
||||
#define L2CAP_LINK_CONNECT_TOUT_EXT 120 /* 120 seconds */
|
||||
#define L2CAP_ECHO_RSP_TOUT 30 /* 30 seconds */
|
||||
#define L2CAP_LINK_FLOW_CONTROL_TOUT 2 /* 2 seconds */
|
||||
#define L2CAP_LINK_DISCONNECT_TOUT 30 /* 30 seconds */
|
||||
#define L2CAP_LINK_DISCONNECT_TOUT 45 /* 45 seconds */
|
||||
|
||||
#ifndef L2CAP_CHNL_CONNECT_TOUT /* BTIF needs to override for internal project needs */
|
||||
#define L2CAP_CHNL_CONNECT_TOUT 60 /* 60 seconds */
|
||||
|
@ -1100,10 +1100,10 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf)
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
while ( ((l2cb.controller_xmit_window != 0 && (p_lcb->transport == BT_TRANSPORT_BR_EDR)) ||
|
||||
(l2cb.controller_le_xmit_window != 0 && (p_lcb->transport == BT_TRANSPORT_LE)))
|
||||
&& (p_lcb->sent_not_acked <= p_lcb->link_xmit_quota))
|
||||
&& (p_lcb->sent_not_acked < p_lcb->link_xmit_quota))
|
||||
#else
|
||||
while ( (l2cb.controller_xmit_window != 0)
|
||||
&& (p_lcb->sent_not_acked <= p_lcb->link_xmit_quota))
|
||||
&& (p_lcb->sent_not_acked < p_lcb->link_xmit_quota))
|
||||
#endif
|
||||
{
|
||||
if (list_is_empty(p_lcb->link_xmit_data_q)) {
|
||||
@ -1122,7 +1122,7 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf)
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
while ( ((l2cb.controller_xmit_window != 0 && (p_lcb->transport == BT_TRANSPORT_BR_EDR)) ||
|
||||
(l2cb.controller_le_xmit_window != 0 && (p_lcb->transport == BT_TRANSPORT_LE)))
|
||||
&& (p_lcb->sent_not_acked <= p_lcb->link_xmit_quota))
|
||||
&& (p_lcb->sent_not_acked < p_lcb->link_xmit_quota))
|
||||
#else
|
||||
while ((l2cb.controller_xmit_window != 0) && (p_lcb->sent_not_acked < p_lcb->link_xmit_quota))
|
||||
#endif
|
||||
|
@ -178,6 +178,7 @@ struct osi_funcs_t {
|
||||
uint32_t _magic;
|
||||
};
|
||||
|
||||
typedef void (*workitem_handler_t)(void* arg);
|
||||
|
||||
/* External functions or values
|
||||
************************************************************************
|
||||
@ -194,13 +195,14 @@ extern void btdm_controller_disable(void);
|
||||
extern uint8_t btdm_controller_get_mode(void);
|
||||
extern const char *btdm_controller_get_compile_version(void);
|
||||
extern void btdm_rf_bb_init_phase2(void); // shall be called after PHY/RF is enabled
|
||||
extern int btdm_dispatch_work_to_controller(workitem_handler_t callback, void *arg, bool blocking);
|
||||
/* Sleep */
|
||||
extern void btdm_controller_enable_sleep(bool enable);
|
||||
extern void btdm_controller_set_sleep_mode(uint8_t mode);
|
||||
extern uint8_t btdm_controller_get_sleep_mode(void);
|
||||
extern bool btdm_power_state_active(void);
|
||||
extern void btdm_wakeup_request(bool request_lock);
|
||||
extern void btdm_wakeup_request_end(void);
|
||||
extern void btdm_wakeup_request(void);
|
||||
extern void btdm_in_wakeup_requesting_set(bool in_wakeup_requesting);
|
||||
/* Low Power Clock */
|
||||
extern bool btdm_lpclk_select_src(uint32_t sel);
|
||||
extern bool btdm_lpclk_set_div(uint32_t div);
|
||||
@ -279,7 +281,6 @@ static uint32_t IRAM_ATTR btdm_us_2_lpcycles(uint32_t us);
|
||||
static bool IRAM_ATTR btdm_sleep_check_duration(uint32_t *slot_cnt);
|
||||
static void btdm_sleep_enter_phase1_wrapper(uint32_t lpcycles);
|
||||
static void btdm_sleep_enter_phase2_wrapper(void);
|
||||
static void IRAM_ATTR btdm_sleep_exit_phase1_wrapper(void);
|
||||
static void btdm_sleep_exit_phase3_wrapper(void);
|
||||
static bool coex_bt_wakeup_request(void);
|
||||
static void coex_bt_wakeup_request_end(void);
|
||||
@ -327,7 +328,7 @@ static const struct osi_funcs_t osi_funcs_ro = {
|
||||
._btdm_sleep_check_duration = btdm_sleep_check_duration,
|
||||
._btdm_sleep_enter_phase1 = btdm_sleep_enter_phase1_wrapper,
|
||||
._btdm_sleep_enter_phase2 = btdm_sleep_enter_phase2_wrapper,
|
||||
._btdm_sleep_exit_phase1 = btdm_sleep_exit_phase1_wrapper,
|
||||
._btdm_sleep_exit_phase1 = NULL,
|
||||
._btdm_sleep_exit_phase2 = NULL,
|
||||
._btdm_sleep_exit_phase3 = btdm_sleep_exit_phase3_wrapper,
|
||||
._coex_bt_wakeup_request = coex_bt_wakeup_request,
|
||||
@ -379,11 +380,17 @@ static DRAM_ATTR portMUX_TYPE global_int_mux = portMUX_INITIALIZER_UNLOCKED;
|
||||
static DRAM_ATTR uint32_t btdm_lpcycle_us = 0;
|
||||
static DRAM_ATTR uint8_t btdm_lpcycle_us_frac = 0; // number of fractional bit for btdm_lpcycle_us
|
||||
|
||||
#if CONFIG_BTDM_MODEM_SLEEP_MODE_ORIG
|
||||
// used low power clock
|
||||
static DRAM_ATTR uint8_t btdm_lpclk_sel;
|
||||
#endif /* #ifdef CONFIG_BTDM_MODEM_SLEEP_MODE_ORIG */
|
||||
|
||||
static DRAM_ATTR QueueHandle_t s_wakeup_req_sem = NULL;
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
static DRAM_ATTR esp_timer_handle_t s_btdm_slp_tmr;
|
||||
static DRAM_ATTR esp_pm_lock_handle_t s_pm_lock;
|
||||
static DRAM_ATTR esp_pm_lock_handle_t s_light_sleep_pm_lock; // pm_lock to prevent light sleep due to incompatibility currently
|
||||
static DRAM_ATTR QueueHandle_t s_pm_lock_sem = NULL;
|
||||
static bool s_pm_lock_acquired = true;
|
||||
static void btdm_slp_tmr_callback(void *arg);
|
||||
#endif
|
||||
|
||||
@ -840,8 +847,10 @@ static void btdm_sleep_enter_phase2_wrapper(void)
|
||||
esp_modem_sleep_enter(MODEM_BLE_MODULE);
|
||||
esp_modem_sleep_enter(MODEM_CLASSIC_BT_MODULE);
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
esp_pm_lock_release(s_pm_lock);
|
||||
semphr_give_wrapper(s_pm_lock_sem);
|
||||
if (s_pm_lock_acquired) {
|
||||
esp_pm_lock_release(s_pm_lock);
|
||||
s_pm_lock_acquired = false;
|
||||
}
|
||||
#endif
|
||||
} else if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_EVED) {
|
||||
esp_modem_sleep_enter(MODEM_BLE_MODULE);
|
||||
@ -850,17 +859,15 @@ static void btdm_sleep_enter_phase2_wrapper(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void IRAM_ATTR btdm_sleep_exit_phase1_wrapper(void)
|
||||
static void btdm_sleep_exit_phase3_wrapper(void)
|
||||
{
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
if (semphr_take_from_isr_wrapper(s_pm_lock_sem, NULL) == pdTRUE) {
|
||||
if (!s_pm_lock_acquired) {
|
||||
s_pm_lock_acquired = true;
|
||||
esp_pm_lock_acquire(s_pm_lock);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void btdm_sleep_exit_phase3_wrapper(void)
|
||||
{
|
||||
if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_ORIG) {
|
||||
esp_modem_sleep_exit(MODEM_BLE_MODULE);
|
||||
esp_modem_sleep_exit(MODEM_CLASSIC_BT_MODULE);
|
||||
@ -876,45 +883,77 @@ static void btdm_sleep_exit_phase3_wrapper(void)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
static void IRAM_ATTR btdm_slp_tmr_callback(void *arg)
|
||||
static void btdm_slp_tmr_customer_callback(void * arg)
|
||||
{
|
||||
if (semphr_take_wrapper(s_pm_lock_sem, 0) == pdTRUE) {
|
||||
(void)(arg);
|
||||
|
||||
if (!s_pm_lock_acquired) {
|
||||
s_pm_lock_acquired = true;
|
||||
esp_pm_lock_acquire(s_pm_lock);
|
||||
}
|
||||
}
|
||||
|
||||
static void IRAM_ATTR btdm_slp_tmr_callback(void *arg)
|
||||
{
|
||||
(void)(arg);
|
||||
btdm_dispatch_work_to_controller(btdm_slp_tmr_customer_callback, NULL, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define BTDM_ASYNC_WAKEUP_REQ_HCI 0
|
||||
#define BTDM_ASYNC_WAKEUP_REQ_COEX 1
|
||||
#define BTDM_ASYNC_WAKEUP_REQMAX 2
|
||||
#define BTDM_ASYNC_WAKEUP_REQ_HCI 0
|
||||
#define BTDM_ASYNC_WAKEUP_REQ_COEX 1
|
||||
#define BTDM_ASYNC_WAKEUP_REQ_CTRL_DISA 2
|
||||
#define BTDM_ASYNC_WAKEUP_REQMAX 3
|
||||
|
||||
static void btdm_wakeup_request_callback(void * arg)
|
||||
{
|
||||
(void)(arg);
|
||||
|
||||
#if CONFIG_PM_ENABLE
|
||||
if (!s_pm_lock_acquired) {
|
||||
s_pm_lock_acquired = true;
|
||||
esp_pm_lock_acquire(s_pm_lock);
|
||||
}
|
||||
esp_timer_stop(s_btdm_slp_tmr);
|
||||
#endif
|
||||
btdm_wakeup_request();
|
||||
|
||||
semphr_give_wrapper(s_wakeup_req_sem);
|
||||
}
|
||||
|
||||
static bool async_wakeup_request(int event)
|
||||
{
|
||||
bool request_lock = false;
|
||||
bool do_wakeup_request = false;
|
||||
|
||||
switch (event) {
|
||||
case BTDM_ASYNC_WAKEUP_REQ_HCI:
|
||||
request_lock = true;
|
||||
btdm_in_wakeup_requesting_set(true);
|
||||
// NO break
|
||||
case BTDM_ASYNC_WAKEUP_REQ_CTRL_DISA:
|
||||
if (!btdm_power_state_active()) {
|
||||
do_wakeup_request = true;
|
||||
|
||||
btdm_dispatch_work_to_controller(btdm_wakeup_request_callback, NULL, true);
|
||||
semphr_take_wrapper(s_wakeup_req_sem, OSI_FUNCS_TIME_BLOCKING);
|
||||
}
|
||||
break;
|
||||
case BTDM_ASYNC_WAKEUP_REQ_COEX:
|
||||
request_lock = false;
|
||||
if (!btdm_power_state_active()) {
|
||||
do_wakeup_request = true;
|
||||
#if CONFIG_PM_ENABLE
|
||||
if (!s_pm_lock_acquired) {
|
||||
s_pm_lock_acquired = true;
|
||||
esp_pm_lock_acquire(s_pm_lock);
|
||||
}
|
||||
esp_timer_stop(s_btdm_slp_tmr);
|
||||
#endif
|
||||
btdm_wakeup_request();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool do_wakeup_request = false;
|
||||
|
||||
if (!btdm_power_state_active()) {
|
||||
#if CONFIG_PM_ENABLE
|
||||
if (semphr_take_wrapper(s_pm_lock_sem, 0)) {
|
||||
esp_pm_lock_acquire(s_pm_lock);
|
||||
}
|
||||
esp_timer_stop(s_btdm_slp_tmr);
|
||||
#endif
|
||||
do_wakeup_request = true;
|
||||
btdm_wakeup_request(request_lock);
|
||||
}
|
||||
|
||||
return do_wakeup_request;
|
||||
}
|
||||
|
||||
@ -926,6 +965,7 @@ static void async_wakeup_request_end(int event)
|
||||
request_lock = true;
|
||||
break;
|
||||
case BTDM_ASYNC_WAKEUP_REQ_COEX:
|
||||
case BTDM_ASYNC_WAKEUP_REQ_CTRL_DISA:
|
||||
request_lock = false;
|
||||
break;
|
||||
default:
|
||||
@ -933,7 +973,7 @@ static void async_wakeup_request_end(int event)
|
||||
}
|
||||
|
||||
if (request_lock) {
|
||||
btdm_wakeup_request_end();
|
||||
btdm_in_wakeup_requesting_set(false);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -957,13 +997,11 @@ bool esp_vhci_host_check_send_available(void)
|
||||
|
||||
void esp_vhci_host_send_packet(uint8_t *data, uint16_t len)
|
||||
{
|
||||
bool do_wakeup_request = async_wakeup_request(BTDM_ASYNC_WAKEUP_REQ_HCI);
|
||||
async_wakeup_request(BTDM_ASYNC_WAKEUP_REQ_HCI);
|
||||
|
||||
API_vhci_host_send_packet(data, len);
|
||||
|
||||
if (do_wakeup_request) {
|
||||
async_wakeup_request_end(BTDM_ASYNC_WAKEUP_REQ_HCI);
|
||||
}
|
||||
async_wakeup_request_end(BTDM_ASYNC_WAKEUP_REQ_HCI);
|
||||
}
|
||||
|
||||
esp_err_t esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callback)
|
||||
@ -1119,6 +1157,11 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
esp_err_t err;
|
||||
uint32_t btdm_cfg_mask = 0;
|
||||
|
||||
//if all the bt available memory was already released, cannot initialize bluetooth controller
|
||||
if (btdm_dram_available_region[0].mode == ESP_BT_MODE_IDLE) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
osi_funcs_p = (struct osi_funcs_t *)malloc_internal_wrapper(sizeof(struct osi_funcs_t));
|
||||
if (osi_funcs_p == NULL) {
|
||||
return ESP_ERR_NO_MEM;
|
||||
@ -1133,11 +1176,6 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
//if all the bt available memory was already released, cannot initialize bluetooth controller
|
||||
if (btdm_dram_available_region[0].mode == ESP_BT_MODE_IDLE) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (cfg == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
@ -1167,6 +1205,12 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
memset(btdm_queue_table, 0, sizeof(btdm_queue_item_t) * BTDM_MAX_QUEUE_NUM);
|
||||
#endif
|
||||
|
||||
s_wakeup_req_sem = semphr_create_wrapper(1, 0);
|
||||
if (s_wakeup_req_sem == NULL) {
|
||||
err = ESP_ERR_NO_MEM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
if ((err = esp_pm_lock_create(ESP_PM_NO_LIGHT_SLEEP, 0, "btLS", &s_light_sleep_pm_lock)) != ESP_OK) {
|
||||
goto error;
|
||||
@ -1183,36 +1227,48 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto error;
|
||||
}
|
||||
|
||||
s_pm_lock_sem = semphr_create_wrapper(1, 0);
|
||||
if (s_pm_lock_sem == NULL) {
|
||||
err = ESP_ERR_NO_MEM;
|
||||
goto error;
|
||||
}
|
||||
s_pm_lock_acquired = true;
|
||||
#endif
|
||||
|
||||
btdm_controller_mem_init();
|
||||
|
||||
periph_module_enable(PERIPH_BT_MODULE);
|
||||
|
||||
// set default sleep clock cycle and its fractional bits
|
||||
btdm_lpcycle_us_frac = RTC_CLK_CAL_FRACT;
|
||||
btdm_lpcycle_us = 32 << btdm_lpcycle_us_frac;
|
||||
btdm_lpcycle_us = 2 << btdm_lpcycle_us_frac;
|
||||
|
||||
#if CONFIG_BTDM_MODEM_SLEEP_MODE_ORIG
|
||||
bool select_src_ret = false;
|
||||
bool set_div_ret = false;
|
||||
#if CONFIG_BTDM_LPCLK_SEL_MAIN_XTAL
|
||||
select_src_ret = btdm_lpclk_select_src(BTDM_LPCLK_SEL_XTAL);
|
||||
set_div_ret = btdm_lpclk_set_div(rtc_clk_xtal_freq_get() * 2 - 1);
|
||||
assert(select_src_ret && set_div_ret);
|
||||
btdm_lpcycle_us_frac = RTC_CLK_CAL_FRACT;
|
||||
btdm_lpcycle_us = 2 << (btdm_lpcycle_us_frac);
|
||||
#elif CONFIG_BTDM_LPCLK_SEL_EXT_32K_XTAL
|
||||
select_src_ret = btdm_lpclk_select_src(BTDM_LPCLK_SEL_XTAL32K);
|
||||
set_div_ret = btdm_lpclk_set_div(0);
|
||||
assert(select_src_ret && set_div_ret);
|
||||
btdm_lpcycle_us_frac = RTC_CLK_CAL_FRACT;
|
||||
btdm_lpcycle_us = esp_clk_slowclk_cal_get();
|
||||
assert(btdm_lpcycle_us != 0);
|
||||
#endif // CONFIG_BTDM_LPCLK_SEL_XX
|
||||
|
||||
btdm_lpclk_sel = BTDM_LPCLK_SEL_XTAL; // set default value
|
||||
#if CONFIG_BTDM_LPCLK_SEL_EXT_32K_XTAL
|
||||
// check whether or not EXT_CRYS is working
|
||||
if (rtc_clk_slow_freq_get() == RTC_SLOW_FREQ_32K_XTAL) {
|
||||
btdm_lpclk_sel = BTDM_LPCLK_SEL_XTAL32K; // set default value
|
||||
} else {
|
||||
ESP_LOGW(BTDM_LOG_TAG, "32.768kHz XTAL not detected, fall back to main XTAL as Bluetooth sleep clock\n");
|
||||
btdm_lpclk_sel = BTDM_LPCLK_SEL_XTAL; // set default value
|
||||
}
|
||||
#else
|
||||
btdm_lpclk_sel = BTDM_LPCLK_SEL_XTAL; // set default value
|
||||
#endif
|
||||
|
||||
bool select_src_ret, set_div_ret;
|
||||
if (btdm_lpclk_sel == BTDM_LPCLK_SEL_XTAL) {
|
||||
select_src_ret = btdm_lpclk_select_src(BTDM_LPCLK_SEL_XTAL);
|
||||
set_div_ret = btdm_lpclk_set_div(rtc_clk_xtal_freq_get() * 2 - 1);
|
||||
assert(select_src_ret && set_div_ret);
|
||||
btdm_lpcycle_us_frac = RTC_CLK_CAL_FRACT;
|
||||
btdm_lpcycle_us = 2 << (btdm_lpcycle_us_frac);
|
||||
} else { // btdm_lpclk_sel == BTDM_LPCLK_SEL_XTAL32K
|
||||
select_src_ret = btdm_lpclk_select_src(BTDM_LPCLK_SEL_XTAL32K);
|
||||
set_div_ret = btdm_lpclk_set_div(0);
|
||||
assert(select_src_ret && set_div_ret);
|
||||
btdm_lpcycle_us_frac = RTC_CLK_CAL_FRACT;
|
||||
btdm_lpcycle_us = (RTC_CLK_CAL_FRACT > 15) ? (1000000 << (RTC_CLK_CAL_FRACT - 15)) :
|
||||
(1000000 >> (15 - RTC_CLK_CAL_FRACT));
|
||||
assert(btdm_lpcycle_us != 0);
|
||||
}
|
||||
btdm_controller_set_sleep_mode(BTDM_MODEM_SLEEP_MODE_ORIG);
|
||||
#elif CONFIG_BTDM_MODEM_SLEEP_MODE_EVED
|
||||
btdm_controller_set_sleep_mode(BTDM_MODEM_SLEEP_MODE_EVED);
|
||||
@ -1251,11 +1307,12 @@ error:
|
||||
esp_timer_delete(s_btdm_slp_tmr);
|
||||
s_btdm_slp_tmr = NULL;
|
||||
}
|
||||
if (s_pm_lock_sem) {
|
||||
semphr_delete_wrapper(s_pm_lock_sem);
|
||||
s_pm_lock_sem = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
if (s_wakeup_req_sem) {
|
||||
semphr_delete_wrapper(s_wakeup_req_sem);
|
||||
s_wakeup_req_sem = NULL;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1272,14 +1329,13 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
esp_pm_lock_delete(s_light_sleep_pm_lock);
|
||||
s_light_sleep_pm_lock = NULL;
|
||||
esp_pm_lock_delete(s_pm_lock);
|
||||
s_pm_lock = NULL;
|
||||
esp_timer_stop(s_btdm_slp_tmr);
|
||||
esp_timer_delete(s_btdm_slp_tmr);
|
||||
s_btdm_slp_tmr = NULL;
|
||||
semphr_delete_wrapper(s_pm_lock_sem);
|
||||
s_pm_lock_sem = NULL;
|
||||
s_pm_lock_acquired = false;
|
||||
#endif
|
||||
semphr_delete_wrapper(s_wakeup_req_sem);
|
||||
s_wakeup_req_sem = NULL;
|
||||
|
||||
#if CONFIG_SPIRAM_USE_MALLOC
|
||||
vSemaphoreDelete(btdm_queue_table_mux);
|
||||
@ -1370,9 +1426,7 @@ esp_err_t esp_bt_controller_disable(void)
|
||||
// disable modem sleep and wake up from sleep mode
|
||||
if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_ORIG) {
|
||||
btdm_controller_enable_sleep(false);
|
||||
if (!btdm_power_state_active()) {
|
||||
btdm_wakeup_request(false);
|
||||
}
|
||||
async_wakeup_request(BTDM_ASYNC_WAKEUP_REQ_CTRL_DISA);
|
||||
while (!btdm_power_state_active()) {
|
||||
ets_delay_us(1000);
|
||||
}
|
||||
@ -1490,26 +1544,6 @@ esp_err_t esp_bt_sleep_disable (void)
|
||||
return status;
|
||||
}
|
||||
|
||||
bool esp_bt_controller_is_sleeping(void)
|
||||
{
|
||||
if (btdm_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED ||
|
||||
btdm_controller_get_sleep_mode() != BTDM_MODEM_SLEEP_MODE_ORIG) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !btdm_power_state_active();
|
||||
}
|
||||
|
||||
void esp_bt_controller_wakeup_request(void)
|
||||
{
|
||||
if (btdm_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED ||
|
||||
btdm_controller_get_sleep_mode() != BTDM_MODEM_SLEEP_MODE_ORIG) {
|
||||
return;
|
||||
}
|
||||
|
||||
btdm_wakeup_request(false);
|
||||
}
|
||||
|
||||
esp_err_t esp_bredr_sco_datapath_set(esp_sco_data_path_t data_path)
|
||||
{
|
||||
if (btdm_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
|
@ -454,28 +454,6 @@ esp_err_t esp_bt_sleep_enable(void);
|
||||
*/
|
||||
esp_err_t esp_bt_sleep_disable(void);
|
||||
|
||||
/**
|
||||
* @brief to check whether bluetooth controller is sleeping at the instant, if modem sleep is enabled
|
||||
*
|
||||
* Note that this function shall not be invoked before esp_bt_controller_enable()
|
||||
* This function is supposed to be used ORIG mode of modem sleep
|
||||
*
|
||||
* @return true if in modem sleep state, false otherwise
|
||||
*/
|
||||
bool esp_bt_controller_is_sleeping(void);
|
||||
|
||||
/**
|
||||
* @brief request controller to wakeup from sleeping state during sleep mode
|
||||
*
|
||||
* Note that this function shall not be invoked before esp_bt_controller_enable()
|
||||
* Note that this function is supposed to be used ORIG mode of modem sleep
|
||||
* Note that after this request, bluetooth controller may again enter sleep as long as the modem sleep is enabled
|
||||
*
|
||||
* Profiling shows that it takes several milliseconds to wakeup from modem sleep after this request.
|
||||
* Generally it takes longer if 32kHz XTAL is used than the main XTAL, due to the lower frequency of the former as the bluetooth low power clock source.
|
||||
*/
|
||||
void esp_bt_controller_wakeup_request(void);
|
||||
|
||||
/**
|
||||
* @brief Manually clear scan duplicate list
|
||||
*
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit e96d99f61358eb132d493e3ae3e541caecf8948e
|
||||
Subproject commit f220b93046a03927a92bda5f222ccc8614d31184
|
@ -84,21 +84,6 @@ esp_err_t esp_coex_status_bit_set(esp_coex_status_type_t type, uint32_t status);
|
||||
*/
|
||||
esp_err_t esp_coex_status_bit_clear(esp_coex_status_type_t type, uint32_t status);
|
||||
|
||||
/**
|
||||
* @brief Enable BLE connection dynamic priority
|
||||
* @attention If the parameter is true, BLE connection performance will be better but WiFi performance
|
||||
* will be poorer. And vice versa.
|
||||
* @param low_interval : true - Increase BLE connection priority to be higher than WiFi's when BLE
|
||||
* connection interval is less or equal than 50 ms. The default value
|
||||
* is false.
|
||||
* false - not increace
|
||||
* @param high_interval : true - Increase BLE connection priority to be higher than WiFi's when BLE
|
||||
* connection interval is more than 50 ms. The default value is true.
|
||||
* false - not increace
|
||||
* @return : ESP_OK - success, other - failed
|
||||
*/
|
||||
esp_err_t esp_coex_ble_conn_dynamic_prio_enable(bool low_interval, bool high_interval);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -724,6 +724,7 @@ PROVIDE ( r_ld_acl_sniff = 0x4003617c );
|
||||
PROVIDE ( r_ld_acl_sniff_trans = 0x400360a8 );
|
||||
PROVIDE ( r_ld_acl_ssr_set = 0x40036274 );
|
||||
PROVIDE ( r_ld_acl_start = 0x40034ddc );
|
||||
PROVIDE ( ld_acl_sco_rsvd_check = 0x4002fa94 );
|
||||
PROVIDE ( r_ld_acl_stop = 0x4003532c );
|
||||
PROVIDE ( r_ld_acl_test_mode_set = 0x40036f24 );
|
||||
PROVIDE ( r_ld_acl_timing_accuracy_set = 0x4003673c );
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 80d7f67aab9dc7331300476192a25fecc31e364f
|
||||
Subproject commit 74336ed3201f3781ef8347f773621e9a096b6ed0
|
@ -28,7 +28,7 @@
|
||||
#define SPP_PROFILE_NUM 1
|
||||
#define SPP_PROFILE_APP_IDX 0
|
||||
#define ESP_SPP_APP_ID 0x56
|
||||
#define SAMPLE_DEVICE_NAME "ESP_SPP_SERVER"
|
||||
#define SAMPLE_DEVICE_NAME "ESP_SPP_SERVER" //The Device Name Characteristics in GAP
|
||||
#define SPP_SVC_INST_ID 0
|
||||
|
||||
/// SPP Service
|
||||
@ -46,7 +46,9 @@ static const uint16_t spp_service_uuid = 0xABF0;
|
||||
static const uint8_t spp_adv_data[23] = {
|
||||
0x02,0x01,0x06,
|
||||
0x03,0x03,0xF0,0xAB,
|
||||
0x0F,0x09,0x45,0x53,0x50,0x5f,0x53,0x50,0x50,0x5f,0x53,0x45,0x52,0x56,0x45,0x52
|
||||
|
||||
/* Complete Local Name in advertising */
|
||||
0x0F,0x09, 'E', 'S', 'P', '_', 'S', 'P', 'P', '_', 'S', 'E', 'R','V', 'E', 'R'
|
||||
};
|
||||
|
||||
static uint16_t spp_mtu_size = 23;
|
||||
|
Loading…
Reference in New Issue
Block a user