mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-03 18:40:59 +02:00
fix(ble/bluedroid): Fixed the connection count limit in multi-connection
This commit is contained in:
@@ -1210,9 +1210,13 @@ menu "BT DEBUG LOG LEVEL"
|
||||
endmenu #BT DEBUG LOG LEVEL
|
||||
|
||||
config BT_ACL_CONNECTIONS
|
||||
int "BT/BLE MAX ACL CONNECTIONS(1~9)"
|
||||
int "BT/BLE MAX ACL CONNECTIONS"
|
||||
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
|
||||
help
|
||||
Maximum BT/BLE connection count. The ESP32-C3/S3 chip supports a maximum of 10 instances,
|
||||
|
@@ -1132,8 +1132,12 @@
|
||||
|
||||
/* The number of security records for peer devices. 15 AS Default*/
|
||||
#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
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BTA_SDP_INCLUDED
|
||||
#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
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
break;
|
||||
}
|
||||
@@ -1030,9 +1030,9 @@ tGATT_TCB *gatt_tcb_alloc(UINT8 tcb_idx)
|
||||
/* Add tcb block to list in gatt_cb */
|
||||
list_append(gatt_cb.p_tcb_list, p_tcb);
|
||||
/* Update tcb id */
|
||||
gatt_tcb_id |= 1 << tcb_idx;
|
||||
} else if(p_tcb) {
|
||||
osi_free(p_tcb);
|
||||
gatt_tcb_id[tcb_idx >> 3] |= (1 << (tcb_idx & 0x7));
|
||||
} else if (p_tcb) {
|
||||
osi_free(p_tcb);
|
||||
p_tcb = NULL;
|
||||
}
|
||||
return p_tcb;
|
||||
@@ -1051,7 +1051,7 @@ void gatt_tcb_free( tGATT_TCB *p_tcb)
|
||||
{
|
||||
UINT8 tcb_idx = p_tcb->tcb_idx;
|
||||
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));
|
||||
}
|
||||
}
|
||||
/*******************************************************************************
|
||||
@@ -1078,9 +1078,9 @@ tGATT_TCB *gatt_allocate_tcb_by_bdaddr(BD_ADDR bda, tBT_TRANSPORT transport)
|
||||
}
|
||||
if (i != GATT_INDEX_INVALID) {
|
||||
p_tcb = gatt_tcb_alloc(i);
|
||||
if (!p_tcb) {
|
||||
return NULL;
|
||||
}
|
||||
if (!p_tcb) {
|
||||
return NULL;
|
||||
}
|
||||
if (allocated) {
|
||||
memset(p_tcb, 0, sizeof(tGATT_TCB));
|
||||
p_tcb->pending_enc_clcb = fixed_queue_new(QUEUE_SIZE_MAX);
|
||||
|
@@ -151,7 +151,11 @@ typedef UINT16 tGATT_DISCONN_REASON;
|
||||
#define GATT_INVALID_CONN_ID 0xFFFF
|
||||
|
||||
#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
|
||||
|
||||
#ifndef GATT_MAX_SCCB
|
||||
|
Reference in New Issue
Block a user