mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-03 10:30:58 +02:00
fix(ble/bluedroid): Fixed the connection count limit in multi-connection
(cherry picked from commit 437aba1653
)
Co-authored-by: chenjianhua <chenjianhua@espressif.com>
This commit is contained in:
@@ -1087,9 +1087,13 @@ menu "BT DEBUG LOG LEVEL"
|
|||||||
endmenu #BT DEBUG LOG LEVEL
|
endmenu #BT DEBUG LOG LEVEL
|
||||||
|
|
||||||
config BT_ACL_CONNECTIONS
|
config BT_ACL_CONNECTIONS
|
||||||
int "BT/BLE MAX ACL CONNECTIONS(1~9)"
|
int "BT/BLE MAX ACL CONNECTIONS"
|
||||||
depends on BT_BLUEDROID_ENABLED
|
depends on BT_BLUEDROID_ENABLED
|
||||||
range 1 9
|
range 1 2 if IDF_TARGET_ESP32C2
|
||||||
|
range 1 9 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
|
||||||
|
range 1 15 if IDF_TARGET_ESP32H2
|
||||||
|
range 1 50
|
||||||
|
default 2 if IDF_TARGET_ESP32C2
|
||||||
default 4
|
default 4
|
||||||
help
|
help
|
||||||
Maximum BT/BLE connection count. The ESP32-C3/S3 chip supports a maximum of 10 instances,
|
Maximum BT/BLE connection count. The ESP32-C3/S3 chip supports a maximum of 10 instances,
|
||||||
|
@@ -1057,8 +1057,12 @@
|
|||||||
|
|
||||||
/* The number of security records for peer devices. 15 AS Default*/
|
/* The number of security records for peer devices. 15 AS Default*/
|
||||||
#ifndef BTM_SEC_MAX_DEVICE_RECORDS
|
#ifndef BTM_SEC_MAX_DEVICE_RECORDS
|
||||||
|
#if (UC_BT_SMP_MAX_BONDS < UC_BT_ACL_CONNECTIONS)
|
||||||
|
#define BTM_SEC_MAX_DEVICE_RECORDS UC_BT_ACL_CONNECTIONS
|
||||||
|
#else
|
||||||
#define BTM_SEC_MAX_DEVICE_RECORDS UC_BT_SMP_MAX_BONDS
|
#define BTM_SEC_MAX_DEVICE_RECORDS UC_BT_SMP_MAX_BONDS
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if BTA_SDP_INCLUDED
|
#if BTA_SDP_INCLUDED
|
||||||
#define BTM_SDP_SEC_SERVICE_RECORDS 1
|
#define BTM_SDP_SEC_SERVICE_RECORDS 1
|
||||||
|
@@ -78,7 +78,7 @@ static const UINT8 base_uuid[LEN_UUID_128] = {0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x0
|
|||||||
0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT32 gatt_tcb_id;
|
static UINT8 gatt_tcb_id[GATT_MAX_PHY_CHANNEL / 8 + 1];
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
@@ -1005,7 +1005,7 @@ UINT8 gatt_find_i_tcb_free(void)
|
|||||||
UINT8 i = 0, j = GATT_INDEX_INVALID;
|
UINT8 i = 0, j = GATT_INDEX_INVALID;
|
||||||
|
|
||||||
for (i = 0; i < GATT_MAX_PHY_CHANNEL; i ++) {
|
for (i = 0; i < GATT_MAX_PHY_CHANNEL; i ++) {
|
||||||
if (!((1 << i) & gatt_tcb_id)) {
|
if (!(gatt_tcb_id[i >> 3] & (1 << (i & 0x7)))) {
|
||||||
j = i;
|
j = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1030,7 +1030,7 @@ tGATT_TCB *gatt_tcb_alloc(UINT8 tcb_idx)
|
|||||||
/* Add tcb block to list in gatt_cb */
|
/* Add tcb block to list in gatt_cb */
|
||||||
list_append(gatt_cb.p_tcb_list, p_tcb);
|
list_append(gatt_cb.p_tcb_list, p_tcb);
|
||||||
/* Update tcb id */
|
/* Update tcb id */
|
||||||
gatt_tcb_id |= 1 << tcb_idx;
|
gatt_tcb_id[tcb_idx >> 3] |= (1 << (tcb_idx & 0x7));
|
||||||
} else if (p_tcb) {
|
} else if (p_tcb) {
|
||||||
osi_free(p_tcb);
|
osi_free(p_tcb);
|
||||||
p_tcb = NULL;
|
p_tcb = NULL;
|
||||||
@@ -1051,7 +1051,7 @@ void gatt_tcb_free( tGATT_TCB *p_tcb)
|
|||||||
{
|
{
|
||||||
UINT8 tcb_idx = p_tcb->tcb_idx;
|
UINT8 tcb_idx = p_tcb->tcb_idx;
|
||||||
if (list_remove(gatt_cb.p_tcb_list, p_tcb)) {
|
if (list_remove(gatt_cb.p_tcb_list, p_tcb)) {
|
||||||
gatt_tcb_id &= ~(1 << tcb_idx);
|
gatt_tcb_id[tcb_idx >> 3] &= ~(1 << (tcb_idx & 0x7));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@@ -151,7 +151,11 @@ typedef UINT16 tGATT_DISCONN_REASON;
|
|||||||
#define GATT_INVALID_CONN_ID 0xFFFF
|
#define GATT_INVALID_CONN_ID 0xFFFF
|
||||||
|
|
||||||
#ifndef GATT_CL_MAX_LCB
|
#ifndef GATT_CL_MAX_LCB
|
||||||
#define GATT_CL_MAX_LCB 12 // 22
|
#if (GATT_MAX_PHY_CHANNEL > 12)
|
||||||
|
#define GATT_CL_MAX_LCB GATT_MAX_PHY_CHANNEL
|
||||||
|
#else
|
||||||
|
#define GATT_CL_MAX_LCB 12
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GATT_MAX_SCCB
|
#ifndef GATT_MAX_SCCB
|
||||||
|
Reference in New Issue
Block a user