Skip to content

Commit

Permalink
Merge branch 'bugfix/ble_update_lib_20231229_v5.2' into 'release/v5.2'
Browse files Browse the repository at this point in the history
update lib on release/v5.2

See merge request espressif/esp-idf!28189
  • Loading branch information
Isl2017 committed Jan 22, 2024
2 parents 2710c37 + 86d6781 commit c54555b
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 93 deletions.
20 changes: 0 additions & 20 deletions components/bt/controller/esp32c2/Kconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -464,23 +464,3 @@ config BT_CTRL_BLE_ADV_REPORT_DISCARD_THRSHOLD
config BT_LE_RELEASE_IRAM_SUPPORTED
bool
default y

config BT_LE_TX_CCA_ENABLED
bool "BLE enable TX CCA feature"
default n
help
Enable the BLE (Bluetooth Low Energy) LBT (Listen Before Talk) function. Before transmitting a packet,
monitor the in-band CCA (Clear Channel Assessment). If the airborne carrier energy is too high, abandon
the packet transmission. Enabling this feature may potentially decrease BLE performance. In certain
countries and regions, when the maximum transmission power exceeds a certain limit, support for LBT
interference avoidance mechanisms is required. If the maximum transmission power does not reach the limit,
it may not be necessary to enable this function.
Please refer to the relevant certification regulations for details.

config BT_LE_CCA_RSSI_THRESH
int "Power threshold to refrain packet transmission in unit of -1 dBm"
depends on BT_LE_TX_CCA_ENABLED
range 1 100
default 75
help
If a carrier signal above the threshold is detected in the air, refrain from packet transmission.
2 changes: 1 addition & 1 deletion components/bt/controller/esp32c2/bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ void esp_ble_controller_log_dump_all(bool output)
esp_panic_handler_reconfigure_wdts(5000);
BT_ASSERT_PRINT("\r\n[DUMP_START:");
ble_log_async_output_dump_all(output);
BT_ASSERT_PRINT("]\r\n");
BT_ASSERT_PRINT(":DUMP_END]\r\n");
portEXIT_CRITICAL_SAFE(&spinlock);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
Expand Down
31 changes: 1 addition & 30 deletions components/bt/controller/esp32c6/Kconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ config BT_LE_WHITELIST_SIZE

config BT_LE_LL_DUP_SCAN_LIST_COUNT
int "BLE duplicate scan list count"
range 1 100
range 5 100
default 20
help
config the max count of duplicate scan list
Expand Down Expand Up @@ -543,15 +543,6 @@ config BT_LE_SCAN_DUPL_TYPE
default 2 if BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE
default 0

config BT_LE_SCAN_DUPL_CACHE_SIZE
int "Maximum number of devices in scan duplicate filter"
depends on BT_LE_SCAN_DUPL
range 10 1000
default 100
help
Maximum number of devices which can be recorded in scan duplicate filter.
When the maximum amount of device in the filter is reached, the cache will be refreshed.

config BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD
int "Duplicate scan list refresh period (seconds)"
depends on BT_LE_SCAN_DUPL
Expand All @@ -571,23 +562,3 @@ config BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD
config BT_LE_MSYS_INIT_IN_CONTROLLER
bool "Msys Mbuf Init in Controller"
default y

config BT_LE_TX_CCA_ENABLED
bool "BLE enable TX CCA feature"
default n
help
Enable the BLE (Bluetooth Low Energy) LBT (Listen Before Talk) function. Before transmitting a packet,
monitor the in-band CCA (Clear Channel Assessment). If the airborne carrier energy is too high, abandon
the packet transmission. Enabling this feature may potentially decrease BLE performance. In certain
countries and regions, when the maximum transmission power exceeds a certain limit, support for LBT
interference avoidance mechanisms is required. If the maximum transmission power does not reach the limit,
it may not be necessary to enable this function.
Please refer to the relevant certification regulations for details.

config BT_LE_CCA_RSSI_THRESH
int "Power threshold to refrain packet transmission in unit of -1 dBm"
depends on BT_LE_TX_CCA_ENABLED
range 1 100
default 75
help
If a carrier signal above the threshold is detected in the air, refrain from packet transmission.
10 changes: 5 additions & 5 deletions components/bt/controller/esp32c6/bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ void ble_controller_scan_duplicate_config(void)
uint32_t duplicate_mode = FILTER_DUPLICATE_DEFAULT;
uint32_t cache_size = 100;
#if CONFIG_BT_LE_SCAN_DUPL == true
cache_size = CONFIG_BT_LE_SCAN_DUPL_CACHE_SIZE;
cache_size = CONFIG_BT_LE_LL_DUP_SCAN_LIST_COUNT;
if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 0) {
duplicate_mode = FILTER_DUPLICATE_ADDRESS | FILTER_DUPLICATE_PDUTYPE;
} else if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 1) {
Expand Down Expand Up @@ -911,9 +911,9 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
esp_pm_lock_acquire(s_pm_lock);
#endif // CONFIG_PM_ENABLE
esp_phy_enable(PHY_MODEM_BT);
esp_btbb_enable();
s_ble_active = true;
}
esp_btbb_enable();
#if CONFIG_SW_COEXIST_ENABLE
coex_enable();
#endif // CONFIG_SW_COEXIST_ENABLE
Expand All @@ -929,8 +929,8 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
#if CONFIG_SW_COEXIST_ENABLE
coex_disable();
#endif
esp_btbb_disable();
if (s_ble_active) {
esp_btbb_disable();
esp_phy_disable(PHY_MODEM_BT);
#if CONFIG_PM_ENABLE
esp_pm_lock_release(s_pm_lock);
Expand All @@ -952,8 +952,8 @@ esp_err_t esp_bt_controller_disable(void)
#if CONFIG_SW_COEXIST_ENABLE
coex_disable();
#endif
esp_btbb_disable();
if (s_ble_active) {
esp_btbb_disable();
esp_phy_disable(PHY_MODEM_BT);
#if CONFIG_PM_ENABLE
esp_pm_lock_release(s_pm_lock);
Expand Down Expand Up @@ -1192,7 +1192,7 @@ void esp_ble_controller_log_dump_all(bool output)
esp_panic_handler_reconfigure_wdts(5000);
BT_ASSERT_PRINT("\r\n[DUMP_START:");
ble_log_async_output_dump_all(output);
BT_ASSERT_PRINT("]\r\n");
BT_ASSERT_PRINT(":DUMP_END]\r\n");
portEXIT_CRITICAL_SAFE(&spinlock);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
Expand Down
32 changes: 1 addition & 31 deletions components/bt/controller/esp32h2/Kconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ config BT_LE_WHITELIST_SIZE

config BT_LE_LL_DUP_SCAN_LIST_COUNT
int "BLE duplicate scan list count"
range 1 100
range 5 100
default 20
help
config the max count of duplicate scan list
Expand Down Expand Up @@ -535,16 +535,6 @@ config BT_LE_SCAN_DUPL_TYPE
default 2 if BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE
default 0


config BT_LE_SCAN_DUPL_CACHE_SIZE
int "Maximum number of devices in scan duplicate filter"
depends on BT_LE_SCAN_DUPL
range 10 1000
default 100
help
Maximum number of devices which can be recorded in scan duplicate filter.
When the maximum amount of device in the filter is reached, the cache will be refreshed.

config BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD
int "Duplicate scan list refresh period (seconds)"
depends on BT_LE_SCAN_DUPL
Expand All @@ -564,23 +554,3 @@ config BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD
config BT_LE_MSYS_INIT_IN_CONTROLLER
bool
default y

config BT_LE_TX_CCA_ENABLED
bool "BLE enable TX CCA feature"
default n
help
Enable the BLE (Bluetooth Low Energy) LBT (Listen Before Talk) function. Before transmitting a packet,
monitor the in-band CCA (Clear Channel Assessment). If the airborne carrier energy is too high, abandon
the packet transmission. Enabling this feature may potentially decrease BLE performance. In certain
countries and regions, when the maximum transmission power exceeds a certain limit, support for LBT
interference avoidance mechanisms is required. If the maximum transmission power does not reach the limit,
it may not be necessary to enable this function.
Please refer to the relevant certification regulations for details.

config BT_LE_CCA_RSSI_THRESH
int "Power threshold to refrain packet transmission in unit of -1 dBm"
depends on BT_LE_TX_CCA_ENABLED
range 1 100
default 75
help
If a carrier signal above the threshold is detected in the air, refrain from packet transmission.
4 changes: 2 additions & 2 deletions components/bt/controller/esp32h2/bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ void ble_controller_scan_duplicate_config(void)
uint32_t duplicate_mode = FILTER_DUPLICATE_DEFAULT;
uint32_t cache_size = 100;
#if CONFIG_BT_LE_SCAN_DUPL == true
cache_size = CONFIG_BT_LE_SCAN_DUPL_CACHE_SIZE;
cache_size = CONFIG_BT_LE_LL_DUP_SCAN_LIST_COUNT;
if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 0) {
duplicate_mode = FILTER_DUPLICATE_ADDRESS | FILTER_DUPLICATE_PDUTYPE;
} else if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 1) {
Expand Down Expand Up @@ -1164,7 +1164,7 @@ void esp_ble_controller_log_dump_all(bool output)
esp_panic_handler_reconfigure_wdts(5000);
BT_ASSERT_PRINT("\r\n[DUMP_START:");
ble_log_async_output_dump_all(output);
BT_ASSERT_PRINT("]\r\n");
BT_ASSERT_PRINT(":DUMP_END]\r\n");
portEXIT_CRITICAL_SAFE(&spinlock);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
Expand Down
2 changes: 1 addition & 1 deletion components/bt/controller/lib_esp32c2/esp32c2-bt-lib
2 changes: 1 addition & 1 deletion components/bt/controller/lib_esp32c6/esp32c6-bt-lib
2 changes: 1 addition & 1 deletion components/bt/controller/lib_esp32h2/esp32h2-bt-lib
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ struct npl_funcs_t {
void (*p_ble_npl_hw_exit_critical)(uint32_t);
uint32_t (*p_ble_npl_get_time_forever)(void);
uint8_t (*p_ble_npl_hw_is_in_critical)(void);
void (*p_ble_npl_eventq_put_to_front)(struct ble_npl_eventq *, struct ble_npl_event *);
};

extern struct npl_funcs_t *npl_funcs;
Expand Down
37 changes: 36 additions & 1 deletion components/bt/porting/npl/freertos/src/npl_os_freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*
* SPDX-FileContributor: 2019-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2019-2023 Espressif Systems (Shanghai) CO LTD
*/

#include <assert.h>
Expand Down Expand Up @@ -37,11 +37,19 @@ static const char *TAG = "Timer";
#error "not defined SOC_ESP_NIMBLE_CONTROLLER or SOC_ESP_NIMBLE_CONTROLLER is zero"
#endif

#if CONFIG_BT_NIMBLE_ENABLED
#define BLE_HOST_CO_COUNT (8)
#define BLE_HOST_EV_COUNT (11 + BLE_HOST_CO_COUNT)
#define BLE_HOST_EVQ_COUNT (3)
#define BLE_HOST_SEM_COUNT (10)
#define BLE_HOST_MUTEX_COUNT (4)
#else
#define BLE_HOST_CO_COUNT (0)
#define BLE_HOST_EV_COUNT (0)
#define BLE_HOST_EVQ_COUNT (0)
#define BLE_HOST_SEM_COUNT (0)
#define BLE_HOST_MUTEX_COUNT (0)
#endif

struct os_mempool ble_freertos_ev_pool;
static os_membuf_t *ble_freertos_ev_buf = NULL;
Expand Down Expand Up @@ -240,6 +248,32 @@ IRAM_ATTR npl_freertos_eventq_put(struct ble_npl_eventq *evq, struct ble_npl_eve
BLE_LL_ASSERT(ret == pdPASS);
}

void
IRAM_ATTR npl_freertos_eventq_put_to_front(struct ble_npl_eventq *evq, struct ble_npl_event *ev)
{
BaseType_t woken;
BaseType_t ret;
struct ble_npl_eventq_freertos *eventq = (struct ble_npl_eventq_freertos *)evq->eventq;
struct ble_npl_event_freertos *event = (struct ble_npl_event_freertos *)ev->event;

if (event->queued) {
return;
}

event->queued = true;

if (in_isr()) {
ret = xQueueSendToFrontFromISR(eventq->q, &ev, &woken);
if( woken == pdTRUE ) {
portYIELD_FROM_ISR();
}
} else {
ret = xQueueSendToFront(eventq->q, &ev, portMAX_DELAY);
}

BLE_LL_ASSERT(ret == pdPASS);
}

void
IRAM_ATTR npl_freertos_eventq_remove(struct ble_npl_eventq *evq,
struct ble_npl_event *ev)
Expand Down Expand Up @@ -986,6 +1020,7 @@ const struct npl_funcs_t npl_funcs_ro = {
.p_ble_npl_eventq_deinit = npl_freertos_eventq_deinit,
.p_ble_npl_eventq_get = npl_freertos_eventq_get,
.p_ble_npl_eventq_put = npl_freertos_eventq_put,
.p_ble_npl_eventq_put_to_front = npl_freertos_eventq_put_to_front,
.p_ble_npl_eventq_remove = npl_freertos_eventq_remove,
.p_ble_npl_event_run = npl_freertos_event_run,
.p_ble_npl_eventq_is_empty = npl_freertos_eventq_is_empty,
Expand Down
1 change: 1 addition & 0 deletions examples/bluetooth/nimble/power_save/sdkconfig.32m.esp32h2
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y
# Sleep Config
#
CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y
CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y
# end of Sleep Config
1 change: 1 addition & 0 deletions examples/bluetooth/nimble/power_save/sdkconfig.40m.esp32c6
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ CONFIG_FREERTOS_USE_TICKLESS_IDLE=y
#
CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y
CONFIG_ESP_PHY_MAC_BB_PD=y
CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y
# end of Sleep Config
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ CONFIG_XTAL_FREQ=26
# Sleep Config
#
CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y
CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ CONFIG_FREERTOS_USE_TICKLESS_IDLE=y
#
CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y
CONFIG_ESP_PHY_MAC_BB_PD=y
CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y
# end of Sleep Config

#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP=y
# Sleep Config
#
CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y
CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y
# end of Sleep Config

#
Expand Down

0 comments on commit c54555b

Please sign in to comment.