esp32: make btstack_config depend on esp-idf sdkconfig and target mcu

This commit is contained in:
Matthias Ringwald 2022-06-08 11:55:40 +02:00
parent cbd6aad84f
commit c50041a4d4

View File

@ -14,44 +14,52 @@
#define HAVE_FREERTOS_TASK_NOTIFICATIONS
#define HAVE_MALLOC
// BTstack features that can be enabled
#define ENABLE_ATT_DELAYED_RESPONSE
#define ENABLE_BLE
#define ENABLE_CLASSIC
#define ENABLE_LE_CENTRAL
#define ENABLE_L2CAP_LE_CREDIT_BASED_FLOW_CONTROL_MODE
#define ENABLE_LE_DATA_LENGTH_EXTENSION
#define ENABLE_LE_PERIPHERAL
#define ENABLE_LE_SECURE_CONNECTIONS
#define ENABLE_PRINTF_HEXDUMP
// HCI Controller to Host Flow Control
#define ENABLE_HCI_CONTROLLER_TO_HOST_FLOW_CONTROL
// ESP32 supports ECDH HCI Commands, but micro-ecc lib is already provided anyway
// BTstack features that can be enabled
#define ENABLE_PRINTF_HEXDUMP
#define ENABLE_LOG_ERROR
#define ENABLE_LOG_INFO
#define ENABLE_MICRO_ECC_FOR_LE_SECURE_CONNECTIONS
// Enable Classic/LE based on esp-idf sdkconfig
#include "sdkconfig.h"
#if CONFIG_BT_SOC_SUPPORT_5_0
// ESP32-C3 and ESP32-S3 with LE-only Controller
#define ENABLE_BLE
#else /* CONFIG_BT_SOC_SUPPORT_5_0 */
// ESP32 as dual-mode Controller
#define ENABLE_CLASSIC
#define ENABLE_BLE
#endif
// Classic configuration
#ifdef ENABLE_CLASSIC
#define ENABLE_HFP_WIDE_BAND_SPEECH
#define ENABLE_SCO_OVER_HCI
// work around to link layer issues in ESP32
// https://github.com/espressif/esp-idf/issues/5494
#define ENABLE_CLASSIC_LEGACY_CONNECTIONS_FOR_SCO_DEMOS
// BTstack configuration. buffers, sizes, ...
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
// HCI Controller to Host Flow Control
#define ENABLE_HCI_CONTROLLER_TO_HOST_FLOW_CONTROL
// Internal ring buffer: 21 kB
#define HCI_HOST_ACL_PACKET_LEN 1024
#define HCI_HOST_ACL_PACKET_NUM 20
#define HCI_HOST_SCO_PACKET_LEN 60
#define HCI_HOST_SCO_PACKET_NUM 10
// Link Key DB and LE Device DB using TLV
#define NVM_NUM_DEVICE_DB_ENTRIES 16
#define NVM_NUM_LINK_KEYS 16
#endif
// LE configuration
#ifdef ENABLE_BLE
#define ENABLE_L2CAP_LE_CREDIT_BASED_FLOW_CONTROL_MODE
#define ENABLE_LE_CENTRAL
#define ENABLE_LE_DATA_LENGTH_EXTENSION
#define ENABLE_LE_PERIPHERAL
#define ENABLE_LE_SECURE_CONNECTIONS
// ESP32 supports ECDH HCI Commands, but micro-ecc lib is already provided anyway
#define ENABLE_MICRO_ECC_FOR_LE_SECURE_CONNECTIONS
#define NVM_NUM_DEVICE_DB_ENTRIES 16
// Mesh Configuration
#define ENABLE_MESH
@ -69,4 +77,31 @@
// allow for one NetKey update
#define MAX_NR_MESH_NETWORK_KEYS (MAX_NR_MESH_SUBNETS+1)
#endif
// BTstack configuration. buffers, sizes, ...
#ifdef ENABLE_CLASSIC
// ACL buffer large enough for Ethernet frame in BNEP/PAN
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
#define HCI_HOST_ACL_PACKET_LEN 1024
#define HCI_HOST_ACL_PACKET_NUM 20
#define HCI_HOST_SCO_PACKET_LEN 60
#define HCI_HOST_SCO_PACKET_NUM 10
#else
// ACL buffer large enough to allow for 512 byte Characteristic
#define HCI_ACL_PAYLOAD_SIZE (512 + 4 + 3)
#define HCI_HOST_ACL_PACKET_LEN HCI_ACL_PAYLOAD_SIZE
#define HCI_HOST_ACL_PACKET_NUM 20
#define HCI_HOST_SCO_PACKET_LEN 0
#define HCI_HOST_SCO_PACKET_NUM 0
#endif
#endif