Skip to content

Commit

Permalink
Merge branch 'espressif:release/v4.4' into release/v4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 authored Jan 30, 2024
2 parents a4252cd + 27ec26d commit c65e569
Show file tree
Hide file tree
Showing 63 changed files with 540 additions and 273 deletions.
6 changes: 0 additions & 6 deletions .gitlab/ci/target-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -782,12 +782,6 @@ UT_S3_FLASH:
- ESP32S3_IDF
- UT_T1_ESP_FLASH

component_ut_test_ip101:
extends: .component_ut_esp32_template
tags:
- ESP32
- COMPONENT_UT_IP101

component_ut_test_lan8720:
extends: .component_ut_esp32_template
tags:
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@
[submodule "components/json/cJSON"]
path = components/json/cJSON
url = ../../DaveGamble/cJSON.git
sbom-version = 1.7.15
sbom-version = 1.7.17
sbom-cpe = cpe:2.3:a:cjson_project:cjson:{}:*:*:*:*:*:*:*
sbom-supplier = Person: Dave Gamble
sbom-url = https://github.com/DaveGamble/cJSON
sbom-description = Ultralightweight JSON parser in ANSI C
sbom-hash = d348621ca93571343a56862df7de4ff3bc9b5667
sbom-hash = 87d8f0961a01bf09bef98ff89bae9fdec42181ee

[submodule "components/mbedtls/mbedtls"]
path = components/mbedtls/mbedtls
Expand Down
2 changes: 1 addition & 1 deletion components/bt/controller/esp32/Kconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ config BTDM_SCAN_DUPL_CACHE_SIZE
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.
When the maximum amount of device in the filter is reached, the oldest device will be refreshed.

config BTDM_SCAN_DUPL_CACHE_REFRESH_PERIOD
int "Duplicate scan list refresh period (seconds)"
Expand Down
8 changes: 8 additions & 0 deletions components/bt/controller/esp32c3/Kconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -467,3 +467,11 @@ config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
Disable active scan backoff. The bluetooth spec requires that scanners should run a backoff procedure to
minimize collision of scan request PDUs from nultiple scanners. If scan backoff is disabled, in active
scanning, scan request PDU will be sent every time when HW receives scannable ADV PDU.

config BT_BLE_ADV_DATA_LENGTH_ZERO_AUX
bool "Enable aux packet when ext adv data length is zero"
default n
help
When this option is enabled, auxiliary packets will be present in the events of
'Non-Connectable and Non-Scannable' regardless of whether the advertising length is 0.
If this option is not enabled, auxiliary packets will only be present when the advertising length is not 0.
43 changes: 24 additions & 19 deletions components/bt/controller/esp32c3/bt.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -694,7 +694,7 @@ static bool IRAM_ATTR is_in_isr_wrapper(void)

static void *malloc_internal_wrapper(size_t size)
{
void *p = heap_caps_malloc(size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL|MALLOC_CAP_DMA);
void *p = heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_DMA);
if(p == NULL) {
ESP_LOGE(BT_LOG_TAG, "Malloc failed");
}
Expand Down Expand Up @@ -1195,18 +1195,6 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)

btdm_controller_mem_init();

#if CONFIG_MAC_BB_PD
if (esp_register_mac_bb_pd_callback(btdm_mac_bb_power_down_cb) != 0) {
err = ESP_ERR_INVALID_ARG;
goto error;
}

if (esp_register_mac_bb_pu_callback(btdm_mac_bb_power_up_cb) != 0) {
err = ESP_ERR_INVALID_ARG;
goto error;
}
#endif

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;
Expand Down Expand Up @@ -1447,11 +1435,6 @@ static void bt_controller_deinit_internal(void)
btdm_lpcycle_us = 0;
} while (0);

#if CONFIG_MAC_BB_PD
esp_unregister_mac_bb_pd_callback(btdm_mac_bb_power_down_cb);
esp_unregister_mac_bb_pu_callback(btdm_mac_bb_power_up_cb);
#endif

esp_bt_power_domain_off();
#if CONFIG_MAC_BB_PD
esp_mac_bb_pd_mem_deinit();
Expand Down Expand Up @@ -1500,6 +1483,18 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
s_lp_stat.pm_lock_released = 0;
#endif

#if CONFIG_MAC_BB_PD
if (esp_register_mac_bb_pd_callback(btdm_mac_bb_power_down_cb) != 0) {
ret = ESP_ERR_INVALID_ARG;
goto error;
}

if (esp_register_mac_bb_pu_callback(btdm_mac_bb_power_up_cb) != 0) {
ret = ESP_ERR_INVALID_ARG;
goto error;
}
#endif

if (s_lp_cntl.enable) {
btdm_controller_enable_sleep(true);
}
Expand All @@ -1519,6 +1514,11 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
error:
// disable low power mode
do {
#if CONFIG_MAC_BB_PD
esp_unregister_mac_bb_pd_callback(btdm_mac_bb_power_down_cb);
esp_unregister_mac_bb_pu_callback(btdm_mac_bb_power_up_cb);
#endif

btdm_controller_enable_sleep(false);
#ifdef CONFIG_PM_ENABLE
if (s_lp_cntl.no_light_sleep) {
Expand Down Expand Up @@ -1565,6 +1565,11 @@ esp_err_t esp_bt_controller_disable(void)

// disable low power mode
do {
#if CONFIG_MAC_BB_PD
esp_unregister_mac_bb_pd_callback(btdm_mac_bb_power_down_cb);
esp_unregister_mac_bb_pu_callback(btdm_mac_bb_power_up_cb);
#endif

#ifdef CONFIG_PM_ENABLE
if (s_lp_cntl.no_light_sleep) {
esp_pm_lock_release(s_light_sleep_pm_lock);
Expand Down
2 changes: 1 addition & 1 deletion components/bt/controller/lib_esp32
2 changes: 1 addition & 1 deletion components/bt/controller/lib_esp32c3_family
22 changes: 22 additions & 0 deletions components/bt/esp_ble_mesh/Kconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,20 @@ if BLE_MESH
Provisioner can provision up to 20 nodes and each node contains two elements,
then the replay protection list size of Provisioner should be at least 40.

config BLE_MESH_NOT_RELAY_REPLAY_MSG
bool "Not relay replayed messages in a mesh network"
depends on BLE_MESH_EXPERIMENTAL
default n
help
There may be many expired messages in a complex mesh network that would be
considered replayed messages.
Enable this option will refuse to relay such messages, which could help to
reduce invalid packets in the mesh network.
However, it should be noted that enabling this option may result in packet
loss in certain environments.
Therefore, users need to decide whether to enable this option according to
the actual usage situation.

config BLE_MESH_MSG_CACHE_SIZE
int "Network message cache size"
default 10
Expand Down Expand Up @@ -1248,4 +1262,12 @@ if BLE_MESH

endmenu

config BLE_MESH_EXPERIMENTAL
bool "Make BLE Mesh experimental features visible"
default n
help
Make BLE Mesh Experimental features visible.
Experimental features list:
- CONFIG_BLE_MESH_NOT_RELAY_REPLAY_MSG

endif # BLE_MESH
10 changes: 7 additions & 3 deletions components/bt/esp_ble_mesh/mesh_core/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*
* SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2018-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -1265,7 +1265,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
#endif

if (!buf) {
BT_ERR("Out of relay buffers");
BT_INFO("Out of relay buffers");
return;
}

Expand Down Expand Up @@ -1509,7 +1509,11 @@ void bt_mesh_net_recv(struct net_buf_simple *data, int8_t rssi,
* was neither a local element nor an LPN we're Friends for.
*/
if (!BLE_MESH_ADDR_IS_UNICAST(rx.ctx.recv_dst) ||
(!rx.local_match && !rx.friend_match)) {
(!rx.local_match && !rx.friend_match
#if CONFIG_BLE_MESH_NOT_RELAY_REPLAY_MSG
&& !rx.replay_msg
#endif
)) {
net_buf_simple_restore(&buf, &state);
bt_mesh_net_relay(&buf, &rx);
}
Expand Down
3 changes: 3 additions & 0 deletions components/bt/esp_ble_mesh/mesh_core/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ struct bt_mesh_net_rx {
ctl:1, /* Network Control */
net_if:2, /* Network interface */
local_match:1, /* Matched a local element */
#if CONFIG_BLE_MESH_NOT_RELAY_REPLAY_MSG
replay_msg:1, /* Replayed messages */
#endif
friend_match:1; /* Matched an LPN we're friends for */
uint16_t msg_cache_idx; /* Index of entry in message cache */
};
Expand Down
3 changes: 3 additions & 0 deletions components/bt/esp_ble_mesh/mesh_core/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,9 @@ bool bt_mesh_rpl_check(struct bt_mesh_net_rx *rx, struct bt_mesh_rpl **match)

return false;
} else {
#if CONFIG_BLE_MESH_NOT_RELAY_REPLAY_MSG
rx->replay_msg = 1;
#endif
return true;
}
}
Expand Down
7 changes: 5 additions & 2 deletions components/bt/host/bluedroid/Kconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ config BT_BLUEDROID_PINNED_TO_CORE
config BT_BTU_TASK_STACK_SIZE
int "Bluetooth Bluedroid Host Stack task stack size"
depends on BT_BLUEDROID_ENABLED
default 4096
default 4352
help
This select btu task stack size

Expand Down Expand Up @@ -207,7 +207,10 @@ config BT_GATTS_ROBUST_CACHING_ENABLED
depends on BT_GATTS_ENABLE
default n
help
This option enable gatt robust caching feature on server
This option enables the GATT robust caching feature on the server.
if turned on, the Client Supported Features characteristic, Database Hash characteristic,
and Server Supported Features characteristic will be included in the GAP SERVICE.


config BT_GATTS_DEVICE_NAME_WRITABLE
bool "Allow to write device name by GATT clients"
Expand Down
5 changes: 5 additions & 0 deletions components/bt/host/bluedroid/api/esp_gap_ble_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ esp_err_t esp_ble_gap_register_callback(esp_gap_ble_cb_t callback)
return (btc_profile_cb_set(BTC_PID_GAP_BLE, callback) == 0 ? ESP_OK : ESP_FAIL);
}

esp_gap_ble_cb_t esp_ble_gap_get_callback(void)
{
return (esp_gap_ble_cb_t) btc_profile_cb_get(BTC_PID_GAP_BLE);
}

#if (BLE_42_FEATURE_SUPPORT == TRUE)
esp_err_t esp_ble_gap_config_adv_data(esp_ble_adv_data_t *adv_data)
{
Expand Down
7 changes: 6 additions & 1 deletion components/bt/host/bluedroid/api/esp_gattc_api.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -29,6 +29,11 @@ esp_err_t esp_ble_gattc_register_callback(esp_gattc_cb_t callback)
return ESP_OK;
}

esp_gattc_cb_t esp_ble_gattc_get_callback(void)
{
return (esp_gattc_cb_t) btc_profile_cb_get(BTC_PID_GATTC);
}

esp_err_t esp_ble_gattc_app_register(uint16_t app_id)
{
btc_msg_t msg = {0};
Expand Down
5 changes: 5 additions & 0 deletions components/bt/host/bluedroid/api/esp_gatts_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ esp_err_t esp_ble_gatts_register_callback(esp_gatts_cb_t callback)
return (btc_profile_cb_set(BTC_PID_GATTS, callback) == 0 ? ESP_OK : ESP_FAIL);
}

esp_gatts_cb_t esp_ble_gatts_get_callback(void)
{
return (esp_gatts_cb_t) btc_profile_cb_get(BTC_PID_GATTS);
}

esp_err_t esp_ble_gatts_app_register(uint16_t app_id)
{
btc_msg_t msg = {0};
Expand Down
21 changes: 17 additions & 4 deletions components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -419,7 +419,10 @@ typedef enum {
typedef enum {
BLE_SCAN_DUPLICATE_DISABLE = 0x0, /*!< the Link Layer should generate advertising reports to the host for each packet received */
BLE_SCAN_DUPLICATE_ENABLE = 0x1, /*!< the Link Layer should filter out duplicate advertising reports to the Host */
BLE_SCAN_DUPLICATE_MAX = 0x2, /*!< 0x02 – 0xFF, Reserved for future use */
#if (BLE_50_FEATURE_SUPPORT == TRUE)
BLE_SCAN_DUPLICATE_ENABLE_RESET, /*!< Duplicate filtering enabled, reset for each scan period, only supported in BLE 5.0. */
#endif
BLE_SCAN_DUPLICATE_MAX /*!< Reserved for future use. */
} esp_ble_scan_duplicate_t;
#if (BLE_42_FEATURE_SUPPORT == TRUE)
/// Ble scan parameters
Expand Down Expand Up @@ -1411,6 +1414,15 @@ typedef void (* esp_gap_ble_cb_t)(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_p
*/
esp_err_t esp_ble_gap_register_callback(esp_gap_ble_cb_t callback);

/**
* @brief This function is called to get the current gap callback
*
* @return
* - esp_gap_ble_cb_t : callback function
*
*/
esp_gap_ble_cb_t esp_ble_gap_get_callback(void);

#if (BLE_42_FEATURE_SUPPORT == TRUE)
/**
* @brief This function is called to override the BTA default ADV parameters.
Expand Down Expand Up @@ -2210,8 +2222,9 @@ esp_err_t esp_ble_gap_set_ext_scan_params(const esp_ble_ext_scan_params_t *param
/**
* @brief This function is used to enable scanning.
*
* @param[in] duration : Scan duration
* @param[in] period : Time interval from when the Controller started its last Scan Duration until it begins the subsequent Scan Duration.
* @param[in] duration Scan duration time, where Time = N * 10 ms. Range: 0x0001 to 0xFFFF.
* @param[in] period Time interval from when the Controller started its last Scan Duration until it begins the subsequent Scan Duration.
* Time = N * 1.28 sec. Range: 0x0001 to 0xFFFF.
*
* @return - ESP_OK : success
* - other : failed
Expand Down
9 changes: 9 additions & 0 deletions components/bt/host/bluedroid/api/include/api/esp_gattc_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,15 @@ typedef void (* esp_gattc_cb_t)(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_
*/
esp_err_t esp_ble_gattc_register_callback(esp_gattc_cb_t callback);

/**
* @brief This function is called to get the current application callbacks
* with BTA GATTC module.
*
* @return
* - esp_gattC_cb_t : current callback
*
*/
esp_gattc_cb_t esp_ble_gattc_get_callback(void);

/**
* @brief This function is called to register application callbacks
Expand Down
10 changes: 10 additions & 0 deletions components/bt/host/bluedroid/api/include/api/esp_gatts_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,16 @@ typedef void (* esp_gatts_cb_t)(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_
*/
esp_err_t esp_ble_gatts_register_callback(esp_gatts_cb_t callback);

/**
* @brief This function is called to get the current application callbacks
* with BTA GATTS module.
*
* @return
* - esp_gatts_cb_t : current callback
*
*/
esp_gatts_cb_t esp_ble_gatts_get_callback(void);

/**
* @brief This function is called to register application identifier
*
Expand Down
2 changes: 1 addition & 1 deletion components/bt/host/bluedroid/bta/gatt/bta_gattc_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ BOOLEAN bta_gattc_mark_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR_PTR remote_bda
#if (!CONFIG_BT_STACK_NO_LOG)
char bdstr[18] = {0};
#endif
APPL_TRACE_ERROR("%s unable to find the bg connection mask for: %s", __func__,
APPL_TRACE_WARNING("%s unable to find the bg connection mask for: %s", __func__,
bdaddr_to_string((bt_bdaddr_t *)remote_bda_ptr, bdstr, sizeof(bdstr)));
}
return FALSE;
Expand Down
2 changes: 1 addition & 1 deletion components/bt/host/bluedroid/bta/include/bta/bta_jv_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ extern tBTA_JV_STATUS BTA_JvRfcommConnect(tBTA_SEC sec_mask,
** BTA_JV_FAILURE, otherwise.
**
*******************************************************************************/
extern tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
extern tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, void *user_data);

/*******************************************************************************
**
Expand Down
Loading

0 comments on commit c65e569

Please sign in to comment.