fix(ble): support ble iso for esp32h4 eco1

This commit is contained in:
wangjialiang
2026-04-03 17:10:40 +08:00
parent 57102610a0
commit ca8354932c
8 changed files with 24 additions and 45 deletions
+1 -1
View File
@@ -1437,7 +1437,7 @@ config BT_BLE_FEAT_CREATE_SYNC_RETRY_MAX
menuconfig BT_BLE_FEAT_ISO_EN
bool "Enable BLE 5.2 iso feature"
depends on (BT_BLE_50_FEATURES_SUPPORTED && ((BT_CONTROLLER_ENABLED && SOC_BLE_AUDIO_SUPPORTED) || BT_CONTROLLER_DISABLED)) # NOERROR
depends on (BT_BLE_50_FEATURES_SUPPORTED && ((BT_CONTROLLER_ENABLED && SOC_BLE_ISO_SUPPORTED) || BT_CONTROLLER_DISABLED)) # NOERROR
default n
help
Enable BLE 5.2 iso
@@ -3074,6 +3074,7 @@ extern void BTA_DmBleGapIsoBigSyncTerminate(tBTA_DM_BLE_BIG_SYNC_TERMINATE_PARAM
extern void BTA_DmBleGapIsoDataPathSet(tBTA_DM_BLE_ISO_SET_DATA_PATH_PARAMS *p_iso_data_path_param);
extern void BTA_DmBleGapIsoDataPathRemove(tBTA_DM_BLE_ISO_REMOVE_DATA_PATH_PARAMS *p_iso_data_path_param);
extern void BTA_DmBleGapIsoReadTxSync(uint16_t iso_handle);
extern void BTA_DmBleGapIsoReadLinkQuality(uint16_t iso_handle);
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
extern void BTA_DmBleIsoSetCigParams(uint8_t cig_id, uint32_t sdu_int_c_to_p, uint32_t sdu_int_p_to_c, uint8_t worse_case_SCA, uint8_t packing,
uint8_t framing, uint16_t mtl_c_to_p, uint16_t mtl_p_to_c, uint8_t cis_cnt, uint8_t *cis_params);
+12 -3
View File
@@ -22,6 +22,7 @@
#include "hci/ble_hci_iso.h"
#include "common/bt_target.h"
#include "osi/mutex.h"
#include "esp_hci_internal.h"
#if (BLE_FEAT_ISO_EN == TRUE)
@@ -79,6 +80,15 @@ 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;
}
#define BLE_ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
struct ble_hci_iso_conn *
@@ -169,7 +179,6 @@ ble_hci_tx_iso_data(const uint8_t *data, uint16_t len, void *arg)
int rc = 1;
#if CONFIG_BT_LE_ISO_SUPPORT
// return ble_transport_to_ll_iso(data, len, arg);
extern int ble_hci_trans_hs_iso_tx(const uint8_t *data, uint16_t length, void *arg);
rc = ble_hci_trans_hs_iso_tx(data, len, arg);
#endif // #if CONFIG_BT_LE_ISO_SUPPORT
return rc;
@@ -193,8 +202,8 @@ ble_hci_iso_tx_now(struct ble_hci_iso_conn *conn, const uint8_t *sdu,
return 1;
}
#elif (BLE_ISO_NON_STD_FLOW_CTRL == TRUE)
extern uint16_t ble_ll_iso_free_buf_num_get(uint16_t conn_handle);
if (ble_ll_iso_free_buf_num_get(conn->conn_handle) == 0) {
extern uint16_t r_ble_ll_iso_free_buf_num_get(uint16_t conn_handle);
if (r_ble_ll_iso_free_buf_num_get(conn->conn_handle) == 0) {
HCI_TRACE_ERROR("ISO flow control!\n");
return 1;
}
@@ -240,23 +240,6 @@ typedef void ble_host_rx_iso_data_fn(uint8_t *data, uint16_t len);
static ble_host_rx_iso_data_fn *ble_host_iso_rx_cb = NULL;
void ble_host_register_rx_iso_data_cb(void *cb)
{
/* If the iso rx cb is already registered, we will give
* a warning log here, and the cb will still be updated.
*/
if (ble_host_iso_rx_cb) {
HCI_TRACE_WARNING("iso rx cb %p already registered\n", ble_host_iso_rx_cb);
}
ble_host_iso_rx_cb = cb;
}
void ble_hci_register_rx_iso_data_cb(void *cb)
{
ble_host_register_rx_iso_data_cb(cb);
}
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
// Internal functions
@@ -68,6 +68,7 @@ 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);
struct ble_hci_iso_conn *ble_hci_iso_conn_find(uint16_t conn_handle);
+6 -6
View File
@@ -768,15 +768,15 @@ menu "BLE 5.x Features"
config BT_NIMBLE_ISO_BIS
int "Maximum number of BIS"
range 1 3
range 1 6
default 2
help
Maximum number of BIS.
config BT_NIMBLE_ISO_BIS_PER_BIG
int "Maximum number of BIS per BIG"
range 1 3
default 2
range 1 BT_NIMBLE_ISO_BIS
default BT_NIMBLE_ISO_BIS
help
Maximum number of BIS per BIG.
@@ -789,15 +789,15 @@ menu "BLE 5.x Features"
config BT_NIMBLE_ISO_CIS
int "Maximum number of CIS"
range 1 3
range 1 6
default 2
help
Maximum number of CIS.
config BT_NIMBLE_ISO_CIS_PER_CIG
int "Maximum number of CIS per CIG"
range 1 3
default 2
range 1 BT_NIMBLE_ISO_CIS
default BT_NIMBLE_ISO_CIS
help
Maximum number of CIS per CIG.
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -40,18 +40,8 @@ typedef int esp_hci_internal_rx_iso_fn(const uint8_t *data, uint16_t len, void *
void r_ble_iso_trans_cfg_hs(esp_hci_internal_rx_iso_fn *iso_cb, void *iso_arg);
#define ble_iso_trans_cfg_hs r_ble_iso_trans_cfg_hs
/**
* @brief Transmit ISO (Isochronous) data over BLE HCItransport.
*
* @param data Pointer to the ISO data buffer to be transmitted.
* @param length Length of the ISO data in bytes.
* @param arg Optional user-defined argument, passed through
* the transport layer and may be used by the underlying driver or callback.
*
* @return 0 on success, or a non-zero error code on failure.
*/
int r_ble_hci_trans_hs_iso_tx(const uint8_t *data, uint16_t length, void *arg);
extern int r_ble_hci_trans_hs_iso_tx(const uint8_t *data, uint16_t length, void *arg);
#define ble_hci_trans_hs_iso_tx r_ble_hci_trans_hs_iso_tx
#endif // CONFIG_BT_LE_ISO_SUPPORT
/**
@@ -90,11 +80,6 @@ int r_ble_hci_trans_hs_acl_tx(struct ble_mbuf *om);
*/
int r_ble_hci_trans_hs_cmd_tx(uint8_t *cmd);
#if CONFIG_BT_LE_ISO_SUPPORT
int ble_hci_trans_hs_iso_tx(const uint8_t *data, uint16_t length, void *arg);
#endif /* CONFIG_BT_LE_ISO_SUPPORT */
/**
* Allocates a flat buffer of the specified type.
*