From f05c0a36e8bf5dde59581e1e32a3e728abb7d99e Mon Sep 17 00:00:00 2001 From: "wanglai@espressif.com" Date: Thu, 13 Jul 2023 10:47:50 +0800 Subject: [PATCH 1/2] feat(bt): Add BQB enabling and rfcomm msc command sending support 1: add the CONFIG_BT_BQB_ENABLED for some functions of bqb test. 2: add bqb_rfc_send_msc_cmd function to send rfcomm msc command with only address arg input. --- components/bt/host/bluedroid/Kconfig.in | 8 ++++ .../include/common/bluedroid_user_config.h | 7 +++ .../common/include/common/bt_target.h | 6 +++ .../bluedroid/stack/rfcomm/rfc_ts_frames.c | 44 +++++++++++++++++++ 4 files changed, 65 insertions(+) diff --git a/components/bt/host/bluedroid/Kconfig.in b/components/bt/host/bluedroid/Kconfig.in index e84f5a6064..2d8b5efc20 100644 --- a/components/bt/host/bluedroid/Kconfig.in +++ b/components/bt/host/bluedroid/Kconfig.in @@ -47,6 +47,14 @@ config BT_CLASSIC_ENABLED help For now this option needs "SMP_ENABLE" to be set to yes +config BT_BQB_ENABLED + bool "BT HOST BQB" + depends on BT_CLASSIC_ENABLED + default n + help + This enables the BQB support. + Only for bt BQB test. + config BT_A2DP_ENABLE bool "A2DP" depends on BT_CLASSIC_ENABLED diff --git a/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h b/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h index 20ac5f88a5..1cf013ba2b 100644 --- a/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h +++ b/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h @@ -95,6 +95,13 @@ #define UC_BT_SSP_ENABLED FALSE #endif +//BQB(BT) +#ifdef CONFIG_BT_BQB_ENABLED +#define UC_BT_BQB_ENABLED CONFIG_BT_BQB_ENABLED +#else +#define UC_BT_BQB_ENABLED FALSE +#endif + //BLE #ifdef CONFIG_BT_BLE_ENABLED #define UC_BT_BLE_ENABLED CONFIG_BT_BLE_ENABLED diff --git a/components/bt/host/bluedroid/common/include/common/bt_target.h b/components/bt/host/bluedroid/common/include/common/bt_target.h index 6090cefdf6..ac4bab44a6 100644 --- a/components/bt/host/bluedroid/common/include/common/bt_target.h +++ b/components/bt/host/bluedroid/common/include/common/bt_target.h @@ -519,6 +519,12 @@ #define BTM_BLE_PRIVATE_ADDR_INT UC_BT_BLE_RPA_TIMEOUT #endif +#if (UC_BT_BQB_ENABLED == TRUE) +#define BT_BQB_INCLUDED TRUE +#else +#define BT_BQB_INCLUDED FALSE +#endif + /* This feature is used to eanble interleaved scan*/ #ifndef BTA_HOST_INTERLEAVE_SEARCH #define BTA_HOST_INTERLEAVE_SEARCH FALSE diff --git a/components/bt/host/bluedroid/stack/rfcomm/rfc_ts_frames.c b/components/bt/host/bluedroid/stack/rfcomm/rfc_ts_frames.c index 0640c67fc9..6da9ff442d 100644 --- a/components/bt/host/bluedroid/stack/rfcomm/rfc_ts_frames.c +++ b/components/bt/host/bluedroid/stack/rfcomm/rfc_ts_frames.c @@ -500,6 +500,50 @@ void rfc_send_rpn (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command, rfc_send_buf_uih (p_mcb, RFCOMM_MX_DLCI, p_buf); } +#if BT_BQB_INCLUDED +/******************************************************************************* +** +** Function bqb_rfc_send_msc_cmd +** +** Description This function sends msc command for BQB test. +** +*******************************************************************************/ +void bqb_rfc_send_msc_cmd(BD_ADDR cert_pts_addr) +{ + UINT8 i; + UINT8 dlci; + BOOLEAN get_dlci = FALSE; + tPORT *p_port; + tPORT_CTRL *p_pars; + tRFC_MCB *p_mcb; + + if ((p_pars = (tPORT_CTRL *)osi_malloc(sizeof(tPORT_CTRL))) == NULL) { + return; + } + + p_pars->modem_signal = 0; + p_pars->break_signal = 0; + p_pars->fc = TRUE; + + p_mcb = port_find_mcb (cert_pts_addr); + + for (i = 0; i < MAX_RFC_PORTS; i++) { + p_port = &rfc_cb.port.port[i]; + if (p_port->in_use && !memcmp (p_port->bd_addr, cert_pts_addr, BD_ADDR_LEN)) { + dlci = p_port->dlci; + get_dlci = TRUE; + break; + } + } + + if (get_dlci) { + rfc_send_msc(p_mcb, dlci, TRUE, p_pars); + } else { + RFCOMM_TRACE_ERROR ("Get dlci fail"); + } + osi_free(p_pars); +} +#endif /* BT_BQB_INCLUDED */ /******************************************************************************* ** From 2b8e8e832a7ee33507f41b90b4bcf55716ed02da Mon Sep 17 00:00:00 2001 From: "wanglai@espressif.com" Date: Tue, 25 Jul 2023 14:17:28 +0800 Subject: [PATCH 2/2] fix(bt/bqb): Modify BQB related configurations --- components/bt/host/bluedroid/Kconfig.in | 7 +++---- .../common/include/common/bluedroid_user_config.h | 6 +++--- .../host/bluedroid/common/include/common/bt_target.h | 12 +++++++++--- .../bt/host/bluedroid/stack/rfcomm/rfc_ts_frames.c | 8 ++++---- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/components/bt/host/bluedroid/Kconfig.in b/components/bt/host/bluedroid/Kconfig.in index 2d8b5efc20..c15013719a 100644 --- a/components/bt/host/bluedroid/Kconfig.in +++ b/components/bt/host/bluedroid/Kconfig.in @@ -47,13 +47,12 @@ config BT_CLASSIC_ENABLED help For now this option needs "SMP_ENABLE" to be set to yes -config BT_BQB_ENABLED - bool "BT HOST BQB" +config BT_CLASSIC_BQB_ENABLED + bool "Host Qualitifcation support for Classic Bluetooth" depends on BT_CLASSIC_ENABLED default n help - This enables the BQB support. - Only for bt BQB test. + This enables functionalities of Host qualification for Classic Bluetooth. config BT_A2DP_ENABLE bool "A2DP" diff --git a/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h b/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h index 1cf013ba2b..244e3e8596 100644 --- a/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h +++ b/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h @@ -96,10 +96,10 @@ #endif //BQB(BT) -#ifdef CONFIG_BT_BQB_ENABLED -#define UC_BT_BQB_ENABLED CONFIG_BT_BQB_ENABLED +#ifdef CONFIG_BT_CLASSIC_BQB_ENABLED +#define UC_BT_CLASSIC_BQB_ENABLED CONFIG_BT_CLASSIC_BQB_ENABLED #else -#define UC_BT_BQB_ENABLED FALSE +#define UC_BT_CLASSIC_BQB_ENABLED FALSE #endif //BLE diff --git a/components/bt/host/bluedroid/common/include/common/bt_target.h b/components/bt/host/bluedroid/common/include/common/bt_target.h index ac4bab44a6..1bbe99f20c 100644 --- a/components/bt/host/bluedroid/common/include/common/bt_target.h +++ b/components/bt/host/bluedroid/common/include/common/bt_target.h @@ -519,10 +519,10 @@ #define BTM_BLE_PRIVATE_ADDR_INT UC_BT_BLE_RPA_TIMEOUT #endif -#if (UC_BT_BQB_ENABLED == TRUE) -#define BT_BQB_INCLUDED TRUE +#if (UC_BT_CLASSIC_BQB_ENABLED == TRUE) +#define BT_CLASSIC_BQB_INCLUDED TRUE #else -#define BT_BQB_INCLUDED FALSE +#define BT_CLASSIC_BQB_INCLUDED FALSE #endif /* This feature is used to eanble interleaved scan*/ @@ -1536,6 +1536,12 @@ #define RFCOMM_INCLUDED FALSE #endif +#if (RFCOMM_INCLUDED == TRUE) && (BT_CLASSIC_BQB_INCLUDED == TRUE) +#define BT_RFCOMM_BQB_INCLUDED TRUE +#else +#define BT_RFCOMM_BQB_INCLUDED FALSE +#endif + #ifndef BTA_JV_RFCOMM_INCLUDED #define BTA_JV_RFCOMM_INCLUDED FALSE #endif diff --git a/components/bt/host/bluedroid/stack/rfcomm/rfc_ts_frames.c b/components/bt/host/bluedroid/stack/rfcomm/rfc_ts_frames.c index 6da9ff442d..86ba2550a5 100644 --- a/components/bt/host/bluedroid/stack/rfcomm/rfc_ts_frames.c +++ b/components/bt/host/bluedroid/stack/rfcomm/rfc_ts_frames.c @@ -500,15 +500,15 @@ void rfc_send_rpn (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command, rfc_send_buf_uih (p_mcb, RFCOMM_MX_DLCI, p_buf); } -#if BT_BQB_INCLUDED +#if BT_RFCOMM_BQB_INCLUDED /******************************************************************************* ** -** Function bqb_rfc_send_msc_cmd +** Function rfc_bqb_send_msc_cmd ** ** Description This function sends msc command for BQB test. ** *******************************************************************************/ -void bqb_rfc_send_msc_cmd(BD_ADDR cert_pts_addr) +void rfc_bqb_send_msc_cmd(BD_ADDR cert_pts_addr) { UINT8 i; UINT8 dlci; @@ -543,7 +543,7 @@ void bqb_rfc_send_msc_cmd(BD_ADDR cert_pts_addr) } osi_free(p_pars); } -#endif /* BT_BQB_INCLUDED */ +#endif /* BT_RFCOMM_BQB_INCLUDED */ /******************************************************************************* **