Merge branch 'bugfix/btdm_backport_2_bugs_v3.2' into 'release/v3.2'

Bugfix/btdm backport 2 bugs v3.2

See merge request idf/esp-idf!5269
This commit is contained in:
Jiang Jiang Jian 2019-07-02 17:33:53 +08:00
commit cbec031c91
6 changed files with 62 additions and 18 deletions

View file

@ -11,6 +11,7 @@ if(CONFIG_BT_ENABLED)
bluedroid/bta/av/include
bluedroid/bta/dm/include
bluedroid/bta/gatt/include
bluedroid/bta/hf_client/include
bluedroid/bta/hh/include
bluedroid/bta/jv/include
bluedroid/bta/sdp/include
@ -93,6 +94,14 @@ if(CONFIG_BT_ENABLED)
"bluedroid/bta/jv/bta_jv_api.c"
"bluedroid/bta/jv/bta_jv_cfg.c"
"bluedroid/bta/jv/bta_jv_main.c"
"bluedroid/bta/hf_client/bta_hf_client_act.c"
"bluedroid/bta/hf_client/bta_hf_client_api.c"
"bluedroid/bta/hf_client/bta_hf_client_at.c"
"bluedroid/bta/hf_client/bta_hf_client_cmd.c"
"bluedroid/bta/hf_client/bta_hf_client_main.c"
"bluedroid/bta/hf_client/bta_hf_client_rfc.c"
"bluedroid/bta/hf_client/bta_hf_client_sco.c"
"bluedroid/bta/hf_client/bta_hf_client_sdp.c"
"bluedroid/bta/sdp/bta_sdp.c"
"bluedroid/bta/sdp/bta_sdp_act.c"
"bluedroid/bta/sdp/bta_sdp_api.c"
@ -122,6 +131,8 @@ if(CONFIG_BT_ENABLED)
"bluedroid/btc/profile/std/a2dp/btc_a2dp_source.c"
"bluedroid/btc/profile/std/a2dp/btc_av.c"
"bluedroid/btc/profile/std/avrc/btc_avrc.c"
"bluedroid/btc/profile/std/hf_client/btc_hf_client.c"
"bluedroid/btc/profile/std/hf_client/bta_hf_client_co.c"
"bluedroid/btc/profile/std/gap/btc_gap_ble.c"
"bluedroid/btc/profile/std/gap/btc_gap_bt.c"
"bluedroid/btc/profile/std/gatt/btc_gatt_common.c"

View file

@ -53,6 +53,29 @@ config BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN
BR/EDR Synchronize maximum connections of bluetooth controller.
Each connection uses 2KB static DRAM whenever the BT controller is enabled.
choice BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH
prompt "BR/EDR Sync(SCO/eSCO) default data path"
depends on BTDM_CONTROLLER_MODE_BR_EDR_ONLY || BTDM_CONTROLLER_MODE_BTDM
default BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_PCM
help
SCO data path, i.e. HCI or PCM.
SCO data can be sent/received through HCI synchronous packets, or the data
can be routed to on-chip PCM module on ESP32. PCM input/output signals can
be "matrixed" to GPIOs. The default data path can also be set using API
"esp_bredr_sco_datapath_set"
config BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_HCI
bool "HCI"
config BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_PCM
bool "PCM"
endchoice
config BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_EFF
int
default 0 if BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_HCI
default 1 if BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_PCM
default 0
config BTDM_CONTROLLER_BLE_MAX_CONN_EFF
int
default BTDM_CONTROLLER_BLE_MAX_CONN if BTDM_CONTROLLER_MODE_BLE_ONLY || BTDM_CONTROLLER_MODE_BTDM
@ -170,7 +193,6 @@ config BTDM_LPCLK_SEL_EXT_32K_XTAL
bool "External 32kHz crystal"
depends on ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL
endchoice
endmenu
config BLE_SCAN_DUPLICATE
@ -185,16 +207,16 @@ choice SCAN_DUPLICATE_TYPE
default SCAN_DUPLICATE_BY_DEVICE_ADDR
depends on BLE_SCAN_DUPLICATE
help
Scan duplicate have three ways. one is "Scan Duplicate By Device Address", This way is to use advertiser address
filtering. The adv packet of the same address is only allowed to be reported once. Another way is "Scan Duplicate
By Device Address And Advertising Data". This way is to use advertising data and device address filtering. All
different adv packets with the same address are allowed to be reported. The last way is "Scan Duplicate By Advertising
Scan duplicate have three ways. one is "Scan Duplicate By Device Address", This way is to use advertiser address
filtering. The adv packet of the same address is only allowed to be reported once. Another way is "Scan Duplicate
By Device Address And Advertising Data". This way is to use advertising data and device address filtering. All
different adv packets with the same address are allowed to be reported. The last way is "Scan Duplicate By Advertising
Data". This way is to use advertising data filtering. All same advertising data only allow to be reported once even though
they are from different devices.
config SCAN_DUPLICATE_BY_DEVICE_ADDR
bool "Scan Duplicate By Device Address"
help
help
This way is to use advertiser address filtering. The adv packet of the same address is only allowed to be reported once
config SCAN_DUPLICATE_BY_ADV_DATA
@ -206,7 +228,7 @@ config SCAN_DUPLICATE_BY_ADV_DATA
config SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR
bool "Scan Duplicate By Device Address And Advertising Data"
help
This way is to use advertising data and device address filtering. All different adv packets with the same address are
This way is to use advertising data and device address filtering. All different adv packets with the same address are
allowed to be reported.
endchoice
@ -369,15 +391,15 @@ endchoice
choice HFP_AUDIO_DATA_PATH
prompt "audio(SCO) data path"
depends on HFP_ENABLE
help
SCO data path, i.e. HCI or PCM. This option is set using API
"esp_bredr_sco_datapath_set" in Bluetooth host. Default SCO data
path can also be set in Bluetooth Controller.
config HFP_AUDIO_DATA_PATH_PCM
bool "PCM"
help
This enables the Serial Port Profile
config HFP_AUDIO_DATA_PATH_HCI
bool "HCI"
help
This enables the Serial Port Profile
endchoice
config GATTS_ENABLE

View file

@ -1156,10 +1156,16 @@ static UINT8 btc_get_num_aa_frame(void)
/* calculate nbr of frames pending for this media tick */
result = btc_aa_src_cb.media_feeding_state.pcm.counter / pcm_bytes_per_frame;
if (result > MAX_PCM_FRAME_NUM_PER_TICK) {
APPL_TRACE_WARNING("%s() - Limiting frames to be sent from %d to %d"
, __FUNCTION__, result, MAX_PCM_FRAME_NUM_PER_TICK);
result = MAX_PCM_FRAME_NUM_PER_TICK;
/* limit the frames to be sent */
UINT32 frm_nb_threshold = MAX_OUTPUT_A2DP_SRC_FRAME_QUEUE_SZ - fixed_queue_length(btc_aa_src_cb.TxAaQ);
if (frm_nb_threshold > MAX_PCM_FRAME_NUM_PER_TICK) {
frm_nb_threshold = MAX_PCM_FRAME_NUM_PER_TICK;
}
if (result > frm_nb_threshold) {
APPL_TRACE_EVENT("Limit frms to send from %d to %d", result, frm_nb_threshold);
result = frm_nb_threshold;
}
btc_aa_src_cb.media_feeding_state.pcm.counter -= result * pcm_bytes_per_frame;

View file

@ -95,7 +95,7 @@ typedef enum {
#define BTC_A2DP_SOURCE_TASK_STACK_SIZE (CONFIG_A2DP_SOURCE_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) // by menuconfig
#define BTC_A2DP_SOURCE_TASK_NAME "BtA2dSourceT"
#define BTC_A2DP_SOURCE_TASK_PRIO (configMAX_PRIORITIES - 3)
#define BTC_A2DP_SOURCE_DATA_QUEUE_LEN (3)
#define BTC_A2DP_SOURCE_DATA_QUEUE_LEN (1)
#define BTC_A2DP_SOURCE_CTRL_QUEUE_LEN (5)
#define BTC_A2DP_SOURCE_TASK_QUEUE_SET_LEN (BTC_A2DP_SOURCE_DATA_QUEUE_LEN + BTC_A2DP_SOURCE_CTRL_QUEUE_LEN)

View file

@ -25,7 +25,7 @@
extern "C" {
#endif
#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x5A5AA5A5
#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20190506
/**
* @brief Bluetooth mode for controller enable/disable
@ -100,6 +100,9 @@ the adv packet will be discarded until the memory is restored. */
#define BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_LIMIT 7 //Maximum ACL connection limitation
#define BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_LIMIT 3 //Maximum SCO/eSCO connection limitation
#define BTDM_CONTROLLER_SCO_DATA_PATH_HCI 0 // SCO data is routed to HCI
#define BTDM_CONTROLLER_SCO_DATA_PATH_PCM 1 // SCO data path is PCM
#define BT_CONTROLLER_INIT_CONFIG_DEFAULT() { \
.controller_task_stack_size = ESP_TASK_BT_CONTROLLER_STACK, \
.controller_task_prio = ESP_TASK_BT_CONTROLLER_PRIO, \
@ -114,6 +117,7 @@ the adv packet will be discarded until the memory is restored. */
.mode = BTDM_CONTROLLER_MODE_EFF, \
.ble_max_conn = CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF, \
.bt_max_acl_conn = CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF, \
.bt_sco_datapath = CONFIG_BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_EFF, \
.bt_max_sync_conn = CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF, \
.magic = ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL, \
};
@ -144,6 +148,7 @@ typedef struct {
uint8_t mode; /*!< Controller mode: BR/EDR, BLE or Dual Mode */
uint8_t ble_max_conn; /*!< BLE maximum connection numbers */
uint8_t bt_max_acl_conn; /*!< BR/EDR maximum ACL connection numbers */
uint8_t bt_sco_datapath; /*!< SCO data path, i.e. HCI or PCM module */
/*
* Following parameters can not be configured runtime when call esp_bt_controller_init()
* It will be overwrite with a constant value which in menuconfig or from a macro.

@ -1 +1 @@
Subproject commit 8b002f21e077a0fb856e143de3b838839994023e
Subproject commit 69ee8fc3a2384e2eb61614266c5a279343c18b65