feat(bt/bluedroid): Support BLE CTE in bluedroid host

This commit is contained in:
zhiweijian
2025-02-07 10:15:25 +08:00
parent 7128087646
commit fcad8b7ebd
22 changed files with 2316 additions and 0 deletions
@@ -1106,6 +1106,25 @@ typedef UINT8 tBTM_BLE_5_GAP_EVENT;
typedef UINT8 tBTM_BLE_ISO_EVENT;
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#define BTM_BLE_CTE_SET_TRANS_PARAMS_EVT 1
#define BTM_BLE_CTE_SET_TRANS_ENABLE_EVT 2
#define BTM_BLE_CTE_SET_IQ_SAMP_ENABLE_EVT 3
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define BTM_BLE_CTE_SET_CONN_RECV_PARAMS_EVT 4
#define BTM_BLE_CTE_SET_CONN_TRANS_PARAMS_EVT 5
#define BTM_BLE_CTE_SET_CONN_REQ_ENABLE_EVT 6
#define BTM_BLE_CTE_SET_CONN_RSP_ENABLE_EVT 7
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define BTM_BLE_CTE_READ_ANT_INFOR_EVT 8
#define BTM_BLE_CTE_CONNLESS_IQ_REPORT_EVT 9
#define BTM_BLE_CTE_CONN_IQ_REPORT_EVT 10
#define BTM_BLE_CTE_REQUEST_FAILED_EVT 11
typedef UINT8 tBTM_BLE_CTE_EVENT;
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#define BTM_BLE_EXT_ADV_DATA_COMPLETE 0x00
#define BTM_BLE_EXT_ADV_DATA_INCOMPLETE 0x01
@@ -1558,6 +1577,108 @@ typedef union {
typedef void (*tBTM_BLE_ISO_CBACK)(tBTM_BLE_ISO_EVENT event, tBTM_BLE_ISO_CB_PARAMS *params);
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
typedef struct {
UINT8 status;
} __attribute__((packed)) tBTM_BLE_CTE_SET_TRANS_PARAMS_CMPL;
typedef struct {
UINT8 status;
} __attribute__((packed)) tBTM_BLE_CTE_SET_TRANS_EN_CMPL;
typedef struct {
UINT8 status;
UINT16 sync_handle;
} __attribute__((packed)) tBTM_BLE_CTE_IQ_SAMP_EN_CMPL;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CTE_CONN_RECV_PARAMS_CMPL;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CTE_CONN_TRANS_PARAMS_CMPL;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CTE_CONN_REQ_ENABLE_CMPL;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CTE_CONN_RSP_ENABLE_CMPL;
typedef struct {
UINT8 status;
UINT8 supported_switching_sampling_rates;
UINT8 num_ant;
UINT8 max_switching_pattern_len;
UINT8 max_cte_len;
} __attribute__((packed)) tBTM_BLE_CTE_READ_ANT_INFOR_CMPL;
typedef struct {
UINT16 sync_handle;
UINT8 channel_idx;
INT16 rssi;
UINT8 rssi_ant_id;
UINT8 cte_type;
UINT8 slot_dur;
UINT8 pkt_status;
UINT16 periodic_evt_counter;
UINT8 sample_count;
UINT8 i_sample[0x52];
UINT8 q_sample[0x52];
} __attribute__((packed)) tBTM_BLE_CTE_CONNLESS_IQ_REPORT_EVT;
typedef struct {
UINT16 conn_handle;
UINT8 rx_phy;
UINT8 data_channel_idx;
INT16 rssi;
UINT8 rssi_ant_id;
UINT8 cte_type;
UINT8 slot_dur;
UINT8 pkt_status;
UINT16 conn_evt_counter;
UINT8 sample_count;
UINT8 i_sample[0x52];
UINT8 q_sample[0x52];
} __attribute__((packed)) tBTM_BLE_CTE_CONN_IQ_REPORT_EVT;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CTE_REQ_FAILED_EVT;
typedef union {
UINT8 status;
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
tBTM_BLE_CTE_SET_TRANS_PARAMS_CMPL cte_trans_params_cmpl;
tBTM_BLE_CTE_SET_TRANS_EN_CMPL cte_trans_en_cmpl;
tBTM_BLE_CTE_IQ_SAMP_EN_CMPL cte_iq_samp_en_cmpl;
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
tBTM_BLE_CTE_CONN_RECV_PARAMS_CMPL cte_recv_params_cmpl;
tBTM_BLE_CTE_CONN_TRANS_PARAMS_CMPL cte_conn_trans_params_cmpl;
tBTM_BLE_CTE_CONN_REQ_ENABLE_CMPL cte_conn_req_en_cmpl;
tBTM_BLE_CTE_CONN_RSP_ENABLE_CMPL cte_conn_rsp_en_cmpl;
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
tBTM_BLE_CTE_READ_ANT_INFOR_CMPL cte_read_ant_infor_cmpl;
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
tBTM_BLE_CTE_CONNLESS_IQ_REPORT_EVT cte_connless_iq_rpt;
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
tBTM_BLE_CTE_CONN_IQ_REPORT_EVT cte_conn_iq_rpt;
tBTM_BLE_CTE_REQ_FAILED_EVT cte_req_failed;
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
} tBTM_BLE_CTE_CB_PARAMS;
typedef void (*tBTM_BLE_CTE_CBACK)(tBTM_BLE_CTE_EVENT event, tBTM_BLE_CTE_CB_PARAMS *params);
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
typedef union {
UINT8 status;
tBTM_BLE_READ_PHY_CMPL read_phy;
@@ -3114,4 +3235,25 @@ tBTM_STATUS BTM_BleRejectCisReq(uint16_t cis_handle, uint8_t reason);
tBTM_STATUS BTM_BleDisconCis(uint16_t cis_handle, uint8_t reason);
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
void BTM_BleCteRegisterCallback(tBTM_BLE_CTE_CBACK cb);
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
tBTM_STATUS BTM_BleSetCteTransParams(uint8_t adv_handle, uint8_t cte_len, uint8_t cte_type, uint8_t cte_count, uint8_t switching_pattern_len, uint8_t *antenna_ids);
tBTM_STATUS BTM_BleCteSetConnectionlessTransEnable(uint8_t adv_handle, uint8_t cte_en);
tBTM_STATUS BTM_BleCteSetConnectionlessIqSamplingEnable(uint16_t sync_handle, uint8_t sampling_en, uint8_t slot_dur,
uint8_t max_sampled_ctes, uint8_t switching_pattern_len, uint8_t *ant_ids);
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
tBTM_STATUS BTM_BleCteSetConnectionReceiveParams(uint16_t conn_handle, uint8_t sampling_en, uint8_t slot_dur,
uint8_t switching_pattern_len, uint8_t *ant_ids);
tBTM_STATUS BTM_BleCteSetConnectionTransParams(uint16_t conn_handle, uint8_t cte_types, uint8_t switching_pattern_len, uint8_t *ant_ids);
tBTM_STATUS BTM_BleCteSetConnectionRequestEnable(uint16_t conn_handle, uint8_t enable, uint16_t cte_req_int,
uint8_t req_cte_len, uint8_t req_cte_type);
tBTM_STATUS BTM_BleCteSetConnectionRspEnable(uint16_t conn_handle, uint8_t enable);
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
tBTM_STATUS BTM_BleCteReadAntInfor(void);
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#endif
@@ -390,6 +390,20 @@
#define HCI_BLE_WR_RF_PATH_COMPENSATION (0x004D | HCI_GRP_BLE_CMDS)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#define HCI_BLE_SET_PRIVACY_MODE (0x004E | HCI_GRP_BLE_CMDS)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#define HCI_BLE_SET_CONNLESS_CTE_TRANS_PARAMS (0x0051 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_CONNLESS_CTE_TRANS_ENABLE (0x0052 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_CONNLESS_IQ_SAMPLING_ENABLE (0x0053 | HCI_GRP_BLE_CMDS)
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define HCI_BLE_SET_CONN_CTE_RECEIVE_PARAMS (0x0054 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_CONN_CTE_TRANS_PARAMS (0x0055 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_CONN_CTE_REQ_ENABLE (0x0056 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_CONN_CTE_RSP_ENABLE (0x0057 | HCI_GRP_BLE_CMDS)
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define HCI_BLE_READ_ANT_INFOR (0x0058 | HCI_GRP_BLE_CMDS)
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#define HCI_BLE_SET_PERIOD_ADV_RECV_ENABLE (0x0059 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_PERIOD_ADV_SYNC_TRANS (0x005A | HCI_GRP_BLE_CMDS)
@@ -846,6 +860,12 @@
#define HCI_BLE_PERIOD_ADV_SYNC_TRANS_RECV_EVT 0x18
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#define HCI_BLE_CONNLESS_IQ_REPORT_EVT 0x15
#define HCI_BLE_CONN_IQ_REPORT_EVT 0x16
#define HCI_BLE_CTE_REQUEST_FAILED_EVT 0x17
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#define HCI_BLE_CIS_ESTABLISHED_V1_EVT 0x19
#define HCI_BLE_CIS_REQUEST_EVT 0x1A
@@ -1185,4 +1185,34 @@ UINT8 btsnd_hcic_ble_iso_read_tx_sync(uint16_t iso_hdl);
UINT8 btsnd_hcic_ble_iso_read_iso_link_quality(uint16_t iso_hdl);
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#define HCIC_PARAM_SIZE_SET_CONNLESS_CTE_TRANS_PARAMS 5
#define HCIC_PARAM_SIZE_SET_CONNLESS_CTE_TRANS_ENABLE 2
#define HCIC_PARAM_SIZE_SET_CONNLESS_IQ_SAMPLING_ENABLE 6
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define HCIC_PARAM_SIZE_SET_CONN_CTE_RECEIVE_PARAMS 5
#define HCIC_PARAM_SIZE_SET_CONN_CTE_TRANS_PARAMS 4
#define HCIC_PARAM_SIZE_CONN_CTE_REQ_ENABLE 7
#define HCIC_PARAM_SIZE_CONN_CTE_RSP_ENABLE 3
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define HCIC_PARAM_SIZE_READ_ANT_INFO 0
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
UINT8 btsnd_hcic_ble_set_connless_cte_trans_params(uint8_t adv_hdl, uint8_t cte_len, uint8_t cte_type,
uint8_t cte_cnt, uint8_t switching_pattern_len, uint8_t *antenna_ids);
UINT8 btsnd_hcic_ble_set_connless_cte_enable(uint8_t adv_hdl, uint8_t cte_en);
UINT8 btsnd_hcic_ble_set_connless_iq_sampling_enable(uint16_t sync_hdl, uint8_t sampling_en, uint8_t slot_dur,
uint8_t max_sampled_ctes, uint8_t switching_pattern_len, uint8_t *antenna_ids);
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
UINT8 btsnd_hcic_ble_set_conn_cte_receive_params(uint16_t conn_hdl, uint8_t sampling_en, uint8_t slot_dur,
uint8_t switching_pattern_len, uint8_t *antenna_ids);
UINT8 btsnd_hcic_ble_set_conn_cte_trans_params(uint16_t conn_hdl, uint8_t cte_type, uint8_t switching_pattern_len, uint8_t *antenna_ids);
UINT8 btsnd_hcic_ble_conn_cte_req_enable(uint16_t conn_hdl, uint8_t enable, uint16_t cte_req_int, uint8_t req_cte_len, uint8_t req_cte_type);
UINT8 btsnd_hcic_ble_conn_cte_rsp_enable(uint16_t conn_hdl, uint8_t enable);
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
UINT8 btsnd_hcic_ble_read_antenna_info(void);
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#endif