Skip to content

Commit

Permalink
Merge branch 'espressif:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 authored Mar 7, 2024
2 parents a5829cf + 0de2912 commit 0fa1a1c
Show file tree
Hide file tree
Showing 384 changed files with 272,411 additions and 5,767 deletions.
25 changes: 8 additions & 17 deletions .gitlab/ci/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ variables:
MAKEFLAGS: "-j5 --no-keep-going"

# GitLab-CI environment

# now we have pack-objects cache, so clone strategy is faster than fetch
# Thanks to pack-objects cache, clone strategy should behave faster than fetch
# so we pick "clone" as default git strategy
# Shiny runners by default remove the CI_PROJECT_DIR every time at the beginning of one job
# and clone with a --depth=1
# Brew runners will fetch from locally mirror first, and cache the local CI_PROJECT_DIR
# In conclusion
# - set GIT_STRATEGY: "clone" to shiny runners
# - set GIT_STRATEGY: "fetch" to brew runners
GIT_STRATEGY: clone
# we will download archive for each submodule instead of clone.
# we don't do "recursive" when fetch submodule as they're not used in CI now.
Expand Down Expand Up @@ -299,21 +305,6 @@ variables:
- *setup_tools_and_idf_python_venv
- add_gitlab_ssh_keys

# git describe requires commit history until the latest tag
.before_script:fetch:git_describe:
variables:
GIT_STRATEGY: none
before_script:
- *git_init
- *git_fetch_from_mirror_url_if_exists
- git fetch origin refs/tags/"${LATEST_GIT_TAG}":refs/tags/"${LATEST_GIT_TAG}" --depth=1
- git repack -d
- git fetch origin $PIPELINE_COMMIT_SHA --shallow-since=$(git log -1 --format=%as "${LATEST_GIT_TAG}")
- *git_checkout_fetch_head
- *common-before_scripts
- *setup_tools_and_idf_python_venv
- add_gitlab_ssh_keys

# target test runners may locate in different places
# for runners set git mirror, we fetch from the mirror first, then fetch the HEAD commit
.before_script:fetch:target_test:
Expand Down
16 changes: 14 additions & 2 deletions .gitlab/ci/pre_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ check_version:
extends:
- .pre_check_template
- .rules:protected
- .before_script:fetch:git_describe
tags: [ brew, github_sync ]
variables:
# need a full clone to get the latest tag
# the --shallow-since=$(git log -1 --format=%as $LATEST_GIT_TAG) option is not accurate
GIT_STRATEGY: fetch
SUBMODULES_TO_FETCH: "none"
GIT_DEPTH: 0
script:
- export IDF_PATH=$PWD
- tools/ci/check_idf_version.sh
Expand Down Expand Up @@ -106,7 +112,13 @@ check_version_tag:
extends:
- .pre_check_template
- .rules:tag:release
- .before_script:fetch:git_describe
tags: [ brew, github_sync ]
variables:
# need a full clone to get the latest tag
# the --shallow-since=$(git log -1 --format=%as $LATEST_GIT_TAG) option is not accurate
GIT_STRATEGY: fetch
SUBMODULES_TO_FETCH: "none"
GIT_DEPTH: 0
script:
- (git cat-file -t $CI_COMMIT_REF_NAME | grep tag) || (echo "ESP-IDF versions must be annotated tags." && exit 1)

Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ else()
endif()

# SMP FreeRTOS user provided minimal idle hook. This allows the user to provide
# their own copy of vApplicationMinimalIdleHook()
if(CONFIG_FREERTOS_USE_MINIMAL_IDLE_HOOK)
list(APPEND link_options "-Wl,--wrap=vApplicationMinimalIdleHook")
# their own copy of vApplicationPassiveIdleHook()
if(CONFIG_FREERTOS_USE_PASSIVE_IDLE_HOOK)
list(APPEND link_options "-Wl,--wrap=vApplicationPassiveIdleHook")
endif()

# Placing jump tables in flash would cause issues with code that required
Expand Down
16 changes: 13 additions & 3 deletions components/bt/common/btc/profile/esp/blufi/include/blufi_int.h
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 All @@ -9,6 +9,11 @@

#include "btc/btc_task.h"
#include "esp_blufi_api.h"

#ifdef __cplusplus
extern "C" {
#endif

#if (BLUFI_INCLUDED == TRUE)

#define BTC_BLUFI_GREAT_VER 0x01 //Version + Subversion
Expand Down Expand Up @@ -193,5 +198,10 @@ void btc_blufi_cb_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);

void btc_blufi_cb_deep_free(btc_msg_t *msg);

#endif /* __BLUFI_INT_H__ */
#endif ///BLUFI_INCLUDED == TRUE
#endif ///BLUFI_INCLUDED == TRUE

#ifdef __cplusplus
}
#endif

#endif /* __BLUFI_INT_H__ */
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -20,6 +20,10 @@
#include "esp_gap_ble_api.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

#define BLUFI_APP_UUID 0xFFFF
#define BLUFI_DEVICE_NAME "BLUFI_DEVICE"

Expand Down Expand Up @@ -96,4 +100,7 @@ void esp_blufi_send_encap(void *arg);
int esp_blufi_handle_gap_events(struct ble_gap_event *event, void *arg);
#endif

#ifdef __cplusplus
}
#endif
#endif/* _ESP_BLUFI_ */
10 changes: 9 additions & 1 deletion components/bt/common/btc/profile/esp/include/btc_blufi_prf.h
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 All @@ -21,6 +21,11 @@
#define ESP_BLUFI_SUCCESS 0x00
#endif


#ifdef __cplusplus
extern "C" {
#endif

#define BT_BD_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x"
#define BT_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]

Expand Down Expand Up @@ -100,4 +105,7 @@ void btc_blufi_call_deep_free(btc_msg_t *msg);

uint16_t btc_blufi_get_version(void);

#ifdef __cplusplus
}
#endif
#endif /* __BTC_BLUFI_PRF_H__ */
2 changes: 1 addition & 1 deletion components/bt/controller/lib_esp32
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ typedef struct {
esp_ble_gap_ext_adv_data_status_t data_status; /*!< data type */
uint8_t adv_data_len; /*!< extend advertising data length */
uint8_t adv_data[251]; /*!< extend advertising data */
} esp_ble_gap_ext_adv_reprot_t;
} esp_ble_gap_ext_adv_report_t;

/**
* @brief periodic adv report parameters
Expand Down Expand Up @@ -1410,7 +1410,7 @@ typedef union {
* @brief ESP_GAP_BLE_EXT_ADV_REPORT_EVT
*/
struct ble_ext_adv_report_param {
esp_ble_gap_ext_adv_reprot_t params; /*!< extend advertising report parameters */
esp_ble_gap_ext_adv_report_t params; /*!< extend advertising report parameters */
} ext_adv_report; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_REPORT_EVT */
/**
* @brief ESP_GAP_BLE_PERIODIC_ADV_REPORT_EVT
Expand Down
24 changes: 20 additions & 4 deletions components/bt/host/bluedroid/btc/core/btc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,34 @@ uint32_t btc_get_ble_status(void)
}

#if (SMP_INCLUDED == TRUE)
// Number of recorded devices
extern uint8_t btm_ble_sec_dev_active_count(void);
if (btm_ble_sec_dev_active_count()) {
status |= BIT(BTC_BLE_STATUS_KEYS);
}

// Number of saved bonded devices
if (btc_storage_get_num_ble_bond_devices()) {
status |= BIT(BTC_BLE_STATUS_BOND);
}
#endif

#if (BLE_PRIVACY_SPT == TRUE)
// Privacy enabled
extern uint8_t btm_ble_privacy_is_enabled(void);
if (btm_ble_privacy_is_enabled()) {
status |= BIT(BTC_BLE_STATUS_PRIVACY);
}
#endif
#endif

// Number of recorded devices
extern uint8_t btdm_sec_dev_active_count(void);
if (btdm_sec_dev_active_count()) {
status |= BIT(BTC_BLE_STATUS_DEV);
#if (BLE_50_FEATURE_SUPPORT == TRUE)
// Number of active extended advertsing
extern uint8_t btm_ble_ext_adv_active_count(void);
if (btm_ble_ext_adv_active_count()) {
status |= BIT(BTC_BLE_STATUS_EXT_ADV);
}
#endif

// Number of active ACL connection
extern uint8_t btm_acl_active_count(void);
Expand Down
4 changes: 3 additions & 1 deletion components/bt/host/bluedroid/btc/include/btc/btc_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ typedef enum {
#define BTC_BLE_STATUS_IDLE 0
typedef enum {
BTC_BLE_STATUS_ADV = 0, // Advertising exist
BTC_BLE_STATUS_EXT_ADV, // Extended advertising exist
BTC_BLE_STATUS_SCAN, // Scanning exist
BTC_BLE_STATUS_CONN, // Connection exist
BTC_BLE_STATUS_DEV, // Device record exist
BTC_BLE_STATUS_KEYS, // Device keys record exist
BTC_BLE_STATUS_BOND, // Bond info exist
BTC_BLE_STATUS_GATTC_CACHE, // GATTC cache exist
BTC_BLE_STATUS_GATTC_APP, // GATTC application exist
BTC_BLE_STATUS_GATTS_SRVC, // GATTS service exist
BTC_BLE_STATUS_PRIVACY, // Privacy enabled
} tBTC_BLE_STATUS;

future_t **btc_main_get_future_p(btc_main_future_type_t type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
break;
case BTA_DM_BLE_5_GAP_EXT_ADV_REPORT_EVT:
msg.act = ESP_GAP_BLE_EXT_ADV_REPORT_EVT;
memcpy(&param.ext_adv_report.params, &params->ext_adv_report, sizeof(esp_ble_gap_ext_adv_reprot_t));
memcpy(&param.ext_adv_report.params, &params->ext_adv_report, sizeof(esp_ble_gap_ext_adv_report_t));
if (params->ext_adv_report.adv_data) {
memcpy(param.ext_adv_report.params.adv_data,
params->ext_adv_report.adv_data, params->ext_adv_report.adv_data_len);
Expand Down
27 changes: 27 additions & 0 deletions components/bt/host/bluedroid/stack/btm/btm_ble.c
Original file line number Diff line number Diff line change
Expand Up @@ -2931,4 +2931,31 @@ uint8_t btm_ble_scan_active_count(void)
return count;
}

#if (SMP_INCLUDED == TRUE)
uint8_t btm_ble_sec_dev_active_count(void)
{
tBTM_SEC_DEV_REC *p_dev_rec = NULL;
list_node_t *p_node = NULL;
uint8_t count = 0;

/* First look for the non-paired devices for the oldest entry */
for (p_node = list_begin(btm_cb.p_sec_dev_rec_list); p_node; p_node = list_next(p_node)) {
p_dev_rec = list_node(p_node);
if (p_dev_rec && (p_dev_rec->sec_flags & BTM_SEC_IN_USE) && (p_dev_rec->ble.key_type != BTM_LE_KEY_NONE)) {
count++;
}
}

return count;
}
#endif

#if (BLE_PRIVACY_SPT == TRUE)
uint8_t btm_ble_privacy_is_enabled(void)
{
tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
return (p_cb->privacy_mode != BTM_PRIVACY_NONE);
}
#endif

#endif /* BLE_INCLUDED */
18 changes: 18 additions & 0 deletions components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ static tBTM_STATUS btm_ble_ext_adv_set_data_validate(UINT8 instance, UINT16 len,
typedef struct {
uint16_t ter_con_handle;
bool invalid;
bool enabled;
UINT8 instance;
int duration;
int max_events;
Expand Down Expand Up @@ -540,6 +541,7 @@ tBTM_STATUS BTM_BleStartExtAdv(BOOLEAN enable, UINT8 num, tBTM_BLE_EXT_ADV *ext_
for (uint8_t i = 0; i < MAX_BLE_ADV_INSTANCE; i++)
{
adv_record[i].invalid = false;
adv_record[i].enabled = false;
adv_record[i].instance = INVALID_VALUE;
adv_record[i].duration = INVALID_VALUE;
adv_record[i].max_events = INVALID_VALUE;
Expand All @@ -550,6 +552,7 @@ tBTM_STATUS BTM_BleStartExtAdv(BOOLEAN enable, UINT8 num, tBTM_BLE_EXT_ADV *ext_
{
uint8_t index = ext_adv[i].instance;
adv_record[index].invalid = false;
adv_record[index].enabled = false;
adv_record[index].instance = INVALID_VALUE;
adv_record[index].duration = INVALID_VALUE;
adv_record[index].max_events = INVALID_VALUE;
Expand All @@ -563,6 +566,7 @@ tBTM_STATUS BTM_BleStartExtAdv(BOOLEAN enable, UINT8 num, tBTM_BLE_EXT_ADV *ext_
{
uint8_t index = ext_adv[i].instance;
adv_record[index].invalid = true;
adv_record[index].enabled = true;
adv_record[index].instance = ext_adv[i].instance;
adv_record[index].duration = ext_adv[i].duration;
adv_record[index].max_events = ext_adv[i].max_events;
Expand Down Expand Up @@ -1196,6 +1200,7 @@ void btm_ble_adv_set_terminated_evt(tBTM_BLE_ADV_TERMINAT *params)
adv_record[params->adv_handle].ter_con_handle = INVALID_VALUE;
adv_record[params->adv_handle].invalid = false;
}
adv_record[params->adv_handle].enabled = false;

memcpy(&cb_params.adv_term, params, sizeof(tBTM_BLE_ADV_TERMINAT));

Expand Down Expand Up @@ -1311,6 +1316,19 @@ void btm_ble_periodic_adv_sync_establish_evt(tBTM_BLE_PERIOD_ADV_SYNC_ESTAB *par

}

uint8_t btm_ble_ext_adv_active_count(void)
{
uint8_t count = 0;

for (uint8_t i = 0; i < MAX_BLE_ADV_INSTANCE; i++) {
if (adv_record[i].enabled == true) {
count++;
}
}

return count;
}

#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)

#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
Expand Down
17 changes: 0 additions & 17 deletions components/bt/host/bluedroid/stack/btm/btm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,3 @@ uint8_t btm_acl_active_count(void)

return count;
}

uint8_t btdm_sec_dev_active_count(void)
{
tBTM_SEC_DEV_REC *p_dev_rec = NULL;
list_node_t *p_node = NULL;
uint8_t count = 0;

/* First look for the non-paired devices for the oldest entry */
for (p_node = list_begin(btm_cb.p_sec_dev_rec_list); p_node; p_node = list_next(p_node)) {
p_dev_rec = list_node(p_node);
if (p_dev_rec && (p_dev_rec->sec_flags & BTM_SEC_IN_USE)) {
count++;
}
}

return count;
}
6 changes: 3 additions & 3 deletions components/bt/host/bluedroid/stack/btu/btu_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ void btu_init_core(void)
#endif

#if BLE_INCLUDED == TRUE
#if (defined(GATT_INCLUDED) && GATT_INCLUDED == true)
gatt_init();
#endif
#if (defined(SMP_INCLUDED) && SMP_INCLUDED == TRUE)
SMP_Init();
#endif
#if (defined(GATT_INCLUDED) && GATT_INCLUDED == true)
gatt_init();
#endif
btm_ble_init();
#endif
Expand Down
Loading

0 comments on commit 0fa1a1c

Please sign in to comment.