From 611eef480a8c5562d7ecee324ddc6d0f3c6ca3cc Mon Sep 17 00:00:00 2001 From: zhiweijian Date: Fri, 27 Feb 2026 18:00:07 +0800 Subject: [PATCH] fix(ble/bluedroid): fix ISO HCI layer and update Kconfig - Fix ISO HCI functions and remove unused code - Fix spelling: BROCASTER to BROADCASTER in Kconfig and headers - Update common config headers for consistency --- components/bt/host/bluedroid/Kconfig.in | 4 +- .../include/common/bluedroid_user_config.h | 4 +- .../common/include/common/bt_target.h | 6 +- .../bt/host/bluedroid/hci/ble_hci_iso.c | 60 ------------------- components/bt/host/bluedroid/hci/hci_hal_h4.c | 3 +- .../bluedroid/hci/include/hci/ble_hci_iso.h | 4 -- 6 files changed, 9 insertions(+), 72 deletions(-) diff --git a/components/bt/host/bluedroid/Kconfig.in b/components/bt/host/bluedroid/Kconfig.in index 52a0ea6a468..90e4abc996b 100644 --- a/components/bt/host/bluedroid/Kconfig.in +++ b/components/bt/host/bluedroid/Kconfig.in @@ -1443,11 +1443,11 @@ config BT_BLE_FEAT_ISO_60_EN Enable iso 6.0 feature config BT_BLE_FEAT_ISO_BIG_BROCASTER - bool "Enable BLE iso BIG brocaster" + bool "Enable BLE iso BIG broadcaster" depends on BT_BLE_FEAT_ISO_EN default y help - Enable BLE 5.2 BIG brocaster + Enable BLE 5.2 BIG broadcaster config BT_BLE_FEAT_ISO_BIG_SYNCER bool "Enable BLE iso BIG syncer" diff --git a/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h b/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h index d82ec6b5476..ca66639b366 100644 --- a/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h +++ b/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h @@ -303,9 +303,9 @@ #endif #ifdef CONFIG_BT_BLE_FEAT_ISO_BIG_BROCASTER -#define UC_BT_BLE_FEAT_ISO_BIG_BROCASTER CONFIG_BT_BLE_FEAT_ISO_BIG_BROCASTER +#define UC_BT_BLE_FEAT_ISO_BIG_BROADCASTER CONFIG_BT_BLE_FEAT_ISO_BIG_BROCASTER #else -#define UC_BT_BLE_FEAT_ISO_BIG_BROCASTER FALSE +#define UC_BT_BLE_FEAT_ISO_BIG_BROADCASTER FALSE #endif #ifdef CONFIG_BT_BLE_FEAT_ISO_CIG_CENTRAL diff --git a/components/bt/host/bluedroid/common/include/common/bt_target.h b/components/bt/host/bluedroid/common/include/common/bt_target.h index 2766a27fa9f..df0cdbc1bac 100644 --- a/components/bt/host/bluedroid/common/include/common/bt_target.h +++ b/components/bt/host/bluedroid/common/include/common/bt_target.h @@ -337,10 +337,10 @@ #define BLE_FEAT_ISO_60_EN FALSE #endif -#if (UC_BT_BLE_FEAT_ISO_BIG_BROCASTER == TRUE) -#define BLE_FEAT_ISO_BIG_BROCASTER_EN TRUE +#if (UC_BT_BLE_FEAT_ISO_BIG_BROADCASTER == TRUE) +#define BLE_FEAT_ISO_BIG_BROADCASTER_EN TRUE #else -#define BLE_FEAT_ISO_BIG_BROCASTER_EN FALSE +#define BLE_FEAT_ISO_BIG_BROADCASTER_EN FALSE #endif #if (UC_BT_BLE_FEAT_ISO_BIG_SYNCER == TRUE) diff --git a/components/bt/host/bluedroid/hci/ble_hci_iso.c b/components/bt/host/bluedroid/hci/ble_hci_iso.c index 6a61836ef21..92db66d3110 100644 --- a/components/bt/host/bluedroid/hci/ble_hci_iso.c +++ b/components/bt/host/bluedroid/hci/ble_hci_iso.c @@ -79,33 +79,6 @@ ble_hci_set_iso_buf_sz(uint16_t pktlen, uint8_t max_pkts) return 0; } -void -ble_hci_get_iso_buf_size(uint16_t *pktlen, uint8_t *max_pkts) -{ - assert(pktlen && max_pkts); - - *pktlen = ble_hs_iso_buf_sz; - *max_pkts = ble_hs_iso_max_pkts; -} - -#if (BLE_ISO_STD_FLOW_CTRL == TRUE) -void -ble_hci_add_iso_avail_pkts(uint16_t delta) -{ - osi_mutex_global_lock(); - - if (ble_hs_iso_avail_pkts + delta > ble_hs_iso_max_pkts) { - HCI_TRACE_ERROR("ISO_HS_RESET %u %u %u\n", ble_hs_iso_avail_pkts, delta, ble_hs_iso_max_pkts); - // ble_hs_sched_reset(BLE_HS_ECONTROLLER); - assert(0); - } else { - ble_hs_iso_avail_pkts += delta; - } - - osi_mutex_global_unlock(); -} -#endif /* (BLE_ISO_STD_FLOW_CTRL) */ - #define BLE_ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) struct ble_hci_iso_conn * @@ -156,39 +129,6 @@ ble_hci_iso_alloc_conn(uint16_t conn_handle) return NULL; } -#if (BLE_ISO_STD_FLOW_CTRL == TRUE) -static uint8_t -ble_hci_iso_buf_needed(struct ble_hs_iso_conn *conn) -{ - uint16_t sdu_offset; - uint16_t dl_len; - uint8_t dlh_len; - uint8_t count; - - dlh_len = (conn->ts_flag ? BLE_HCI_ISO_DATA_LOAD_TS_SZ : 0) + BLE_HCI_ISO_DATA_LOAD_HDR_SZ; - sdu_offset = 0; - count = 1; /* 1 extra since framed pdu may be used */ - - while (1) { - dl_len = min(dlh_len + conn->sdu_len - sdu_offset, ble_hs_iso_buf_sz); - - count += 1; - - sdu_offset += dl_len - dlh_len; - assert(sdu_offset <= conn->sdu_len); - - if (sdu_offset == conn->sdu_len) { - break; - } - - /* No data load header for continuation/last segment */ - dlh_len = 0; - } - - return count; -} -#endif /* (BLE_ISO_STD_FLOW_CTRL) */ - static void ble_hci_iso_hdr_append(struct ble_hci_iso_conn *conn, uint8_t *frag, diff --git a/components/bt/host/bluedroid/hci/hci_hal_h4.c b/components/bt/host/bluedroid/hci/hci_hal_h4.c index 53316950b73..b4b3ec17d6e 100644 --- a/components/bt/host/bluedroid/hci/hci_hal_h4.c +++ b/components/bt/host/bluedroid/hci/hci_hal_h4.c @@ -357,7 +357,8 @@ int hci_adv_credits_prep_to_release(uint16_t num) osi_mutex_lock(&hci_hal_env.adv_flow_lock, OSI_MUTEX_MAX_TIMEOUT); int credits_to_release = hci_hal_env.adv_credits_to_release + num; - assert(hci_hal_env.adv_credits_to_release <= BLE_ADV_REPORT_FLOW_CONTROL_NUM); + assert(num <= BLE_ADV_REPORT_FLOW_CONTROL_NUM); + assert(credits_to_release >= 0 && credits_to_release <= BLE_ADV_REPORT_FLOW_CONTROL_NUM); hci_hal_env.adv_credits_to_release = credits_to_release; osi_mutex_unlock(&hci_hal_env.adv_flow_lock); diff --git a/components/bt/host/bluedroid/hci/include/hci/ble_hci_iso.h b/components/bt/host/bluedroid/hci/include/hci/ble_hci_iso.h index 9b289677962..4394363eadf 100644 --- a/components/bt/host/bluedroid/hci/include/hci/ble_hci_iso.h +++ b/components/bt/host/bluedroid/hci/include/hci/ble_hci_iso.h @@ -69,10 +69,6 @@ struct ble_hci_iso_conn { int ble_hci_set_iso_buf_sz(uint16_t pktlen, uint8_t max_pkts); -void ble_hci_get_iso_buf_size(uint16_t *pktlen, uint8_t *max_pkts); - -void ble_hci_add_iso_avail_pkts(uint16_t delta); - struct ble_hci_iso_conn *ble_hci_iso_conn_find(uint16_t conn_handle); int esp_ble_hci_iso_tx(uint16_t conn_handle, const uint8_t *sdu, uint16_t sdu_len,