feat(ble/bluedroid): support bluedroid host channel sounding feature

This commit is contained in:
zhiweijian
2025-06-10 16:56:56 +08:00
parent 1115165ea0
commit b24239843b
20 changed files with 3329 additions and 2 deletions

View File

@@ -1108,7 +1108,22 @@ typedef void (tBTM_SET_VENDOR_EVT_MASK_CBACK) (tBTM_STATUS status);
#define BTM_BLE_GAP_PERIODIC_ADV_SUBEVT_DATA_REQUEST_EVT 55
#define BTM_BLE_GAP_PERIODIC_ADV_RESPONSE_REPORT_EVT 56
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#define BTM_BLE_5_GAP_UNKNOWN_EVT 57
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
#define BTM_BLE_GAP_CS_READ_LOCAL_SUPP_CAPS_EVT 57
#define BTM_BLE_GAP_CS_WRITE_CACHED_REMOTE_SUPP_CAPS_EVT 58
#define BTM_BLE_GAP_CS_SET_DEFAULT_SETTINGS_EVT 59
#define BTM_BLE_GAP_CS_WRITE_CACHED_REMOTE_FAE_TAB_EVT 60
#define BTM_BLE_GAP_CS_READ_REMOTE_SUPP_CAPS_CMPL_EVT 61
#define BTM_BLE_GAP_CS_SET_CHANNEL_CLASS_CMPL_EVT 62
#define BTM_BLE_GAP_CS_PROC_PARAMS_CMPL_EVT 63
#define BTM_BLE_GAP_CS_PROC_ENABLE_CMPL_EVT 64
#define BTM_BLE_GAP_CS_READ_REMOTE_FAE_TABLE_CMPL_EVT 65
#define BTM_BLE_GAP_CS_SECURITY_ENABLE_CMPL_EVT 66
#define BTM_BLE_GAP_CS_CONFIG_CMPL_EVT 67
#define BTM_BLE_GAP_CS_SUBEVENT_RESULT_EVT 68
#define BTM_BLE_GAP_CS_SUBEVENT_RESULT_CONTINUE_EVT 69
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
#define BTM_BLE_5_GAP_UNKNOWN_EVT 70
typedef UINT8 tBTM_BLE_5_GAP_EVENT;
#if (BLE_FEAT_ISO_EN == TRUE)
@@ -1519,6 +1534,161 @@ typedef struct {
} __attribute__((packed)) tBTM_BLE_PA_RSP_REPORT_EVT;
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CS_WRITE_CACHED_SUPPORT_CAPS_EVT;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CS_SET_DEFAULT_SETTINGS_EVT;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CS_WRITE_CACHED_REMOTE_FAE_TAB_EVT;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CS_SET_PAROC_PARAMS_EVT;
typedef struct {
UINT8 status;
UINT16 conn_handle;
UINT8 num_config_supported;
UINT16 max_consecutive_proc_supported;
UINT8 num_ant_supported;
UINT8 max_ant_paths_supported;
UINT8 roles_supported;
UINT8 modes_supported;
UINT8 rtt_capability;
UINT8 rtt_aa_only_n;
UINT8 rtt_sounding_n;
UINT8 rtt_random_payload_n;
UINT16 NADM_sounding_capability;
UINT16 NADM_random_capability;
UINT8 cs_sync_phys_supported;
UINT16 subfeatures_supported;
UINT16 T_IP1_times_supported;
UINT16 T_IP2_times_supported;
UINT16 T_FCS_times_supported;
UINT16 T_PM_times_supported;
UINT8 T_SW_times_supported;
UINT8 TX_SNR_capability;
} __attribute__((packed)) tBTM_BLE_CS_READ_REMOTE_SUPP_CAPS_CMPL_EVT;
typedef struct {
UINT8 status;
UINT16 conn_handle;
UINT8 remote_fae_table[72];
} __attribute__((packed)) tBTM_BLE_CS_READ_REMOTE_FAE_TAB_CMPL_EVT;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CS_SEC_ENABLE_CMPL_EVT;
typedef struct {
UINT8 status;
UINT16 conn_handle;
UINT8 config_id;
UINT8 action;
UINT8 main_mode_type;
UINT8 sub_mode_type;
UINT8 min_main_mode_steps;
UINT8 max_main_mode_steps;
UINT8 main_mode_repetition;
UINT8 mode_0_steps;
UINT8 role;
UINT8 rtt_type;
UINT8 cs_sync_phy;
UINT8 channel_map[10];
UINT8 channel_map_repetition;
UINT8 channel_selection_type;
UINT8 ch3c_shape;
UINT8 ch3c_jump;
UINT8 reserved;
UINT8 t_ip1_time;
UINT8 t_ip2_time;
UINT8 t_fcs_time;
UINT8 t_pm_time;
}__attribute__((packed)) tBTM_BLE_CS_CONFIG_CMPL_EVT;
typedef struct {
UINT8 status;
UINT16 conn_handle;
UINT8 config_id;
UINT8 state;
UINT8 tone_Ant_config_select;
INT8 select_tx_power;
UINT32 subevent_Len;
UINT8 subevents_per_event;
UINT16 subevent_interval;
UINT16 event_interval;
UINT16 procedure_interval;
UINT16 procedure_count;
UINT16 max_procedure_len;
}__attribute__((packed)) tBTM_BLE_CS_PROC_ENABLE_CMPL_EVT;
typedef struct {
UINT8 step_mode;
UINT8 step_channel;
UINT8 step_data_len;
UINT8 *data;
} __attribute__((packed)) tBTM_BLE_CS_STEP_INFO;
typedef struct {
UINT16 conn_handle;
UINT8 config_id;
UINT16 start_acl_conn_event_counter;
UINT16 procedure_counter;
INT16 frequency_compensation;
INT8 reference_power_level;
UINT8 procedure_done_status;
UINT8 subevent_done_status;
UINT8 abort_reason;
UINT8 num_ant_paths;
UINT8 num_steps_reported;
tBTM_BLE_CS_STEP_INFO *step_info;
}__attribute__((packed)) tBTM_BLE_CS_SUBEVT_RESULT_CMPL_EVT;
typedef struct {
UINT16 conn_handle;
UINT8 config_id;
UINT8 proc_done_status;
UINT8 subevt_done_status;
UINT8 abort_reason;
UINT8 num_ant_paths;
UINT8 num_steps_reported;
tBTM_BLE_CS_STEP_INFO *step_info;
}__attribute__((packed)) tBTM_BLE_CS_SUBEVT_RESULT_CONTINUE_EVT;
typedef struct {
UINT8 status;
UINT16 conn_handle;
UINT8 num_config_supported;
UINT16 max_consecutive_proc_supported;
UINT8 num_ant_supported;
UINT8 max_ant_paths_supported;
UINT8 roles_supported;
UINT8 modes_supported;
UINT8 rtt_capability;
UINT8 rtt_aa_only_n;
UINT8 rtt_sounding_n;
UINT8 rtt_random_payload_n;
UINT16 NADM_sounding_capability;
UINT16 NADM_random_capability;
UINT8 cs_sync_phys_supported;
UINT16 subfeatures_supported;
UINT16 T_IP1_times_supported;
UINT16 T_IP2_times_supported;
UINT16 T_FCS_times_supported;
UINT16 T_PM_times_supported;
UINT8 T_SW_times_supported;
UINT8 TX_SNR_capability;
} __attribute__((packed)) tBTM_BLE_CS_READ_LOCAL_SUPP_CAPS_CMPL_EVT;
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
typedef struct {
@@ -1892,6 +2062,20 @@ typedef union {
tBTM_BLE_PA_SUBEVT_DATA_REQ_EVT pa_subevent_data_req_evt;
tBTM_BLE_PA_RSP_REPORT_EVT pa_rsp_rpt_evt;
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
tBTM_BLE_CS_WRITE_CACHED_SUPPORT_CAPS_EVT cs_write_cached_remote_supp_caps;
tBTM_BLE_CS_SET_DEFAULT_SETTINGS_EVT cs_set_default_settings;
tBTM_BLE_CS_WRITE_CACHED_REMOTE_FAE_TAB_EVT cs_write_cached_remote_fae_tab;
tBTM_BLE_CS_SET_PAROC_PARAMS_EVT cs_set_proc_params;
tBTM_BLE_CS_READ_LOCAL_SUPP_CAPS_CMPL_EVT cs_read_local_supp_caps;
tBTM_BLE_CS_READ_REMOTE_SUPP_CAPS_CMPL_EVT cs_read_remote_supp_caps;
tBTM_BLE_CS_READ_REMOTE_FAE_TAB_CMPL_EVT cs_read_remote_fae_tab;
tBTM_BLE_CS_SEC_ENABLE_CMPL_EVT cs_security_enable;
tBTM_BLE_CS_PROC_ENABLE_CMPL_EVT cs_proc_en;
tBTM_BLE_CS_CONFIG_CMPL_EVT cs_config_update;
tBTM_BLE_CS_SUBEVT_RESULT_CMPL_EVT cs_subevt_result;
tBTM_BLE_CS_SUBEVT_RESULT_CONTINUE_EVT cs_subevt_result_continue;
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
} tBTM_BLE_5_GAP_CB_PARAMS;
typedef struct {
@@ -3455,4 +3639,35 @@ void BTM_BleSetPaResponseData(UINT16 sync_handle, UINT16 req_evt, UINT8 req_sube
void BTM_BleSetPaSyncSubevt(UINT16 sync_handle, UINT16 periodic_adv_properties, UINT8 num_subevents_to_sync, UINT8 *subevt);
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
void BTM_BleCSReadLocalSuppCaps(void);
void BTM_BleCSReadRemoteSuppCaps(UINT16 conn_handle);
void BTM_BleGapWriteCachedRemoteSupportedCaps(UINT16 conn_handle, UINT8 num_config_supported, UINT16 max_consecutive_proc_supported,
UINT8 num_ant_supported, UINT8 max_ant_paths_supported, UINT8 roles_supported,
UINT8 modes_supported, UINT8 rtt_capability, UINT8 rtt_aa_only_n,
UINT8 rtt_sounding_n, UINT8 rtt_random_payload_n, UINT16 NADM_sounding_capability,
UINT16 NADM_random_capability, UINT8 cs_sync_phys_supported, UINT16 subfeatures_supported,
UINT16 T_IP1_times_supported, UINT16 T_IP2_times_supported, UINT16 T_FCS_times_supported,
UINT16 T_PM_times_supported, UINT8 T_SW_times_supported, UINT8 TX_SNR_capability);
void BTM_BleGapCsSecurityEnable(UINT16 conn_handle);
void BTM_BleGapCsSetDefaultSetting(UINT16 conn_handle, UINT8 role_enable, UINT8 cs_sync_ant_selection, INT8 max_tx_power);
void BTM_BleGapCsReadRemoteFaeTable(UINT16 conn_handle);
void BTM_BleGapWriteCachedRemoteFaeTable(UINT16 conn_handle, UINT8 *remote_fae_table);
void BTM_BleGapCsCreateConfig(UINT16 conn_handle, UINT8 config_id, UINT8 create_context,
UINT8 main_mode_type, UINT8 sub_mode_type, UINT8 min_main_mode_steps,
UINT8 max_main_mode_steps, UINT8 main_mode_repetition, UINT8 mode_0_steps,
UINT8 role, UINT8 rtt_type, UINT8 cs_sync_phy, UINT8 *channel_map,
UINT8 channel_map_repetition, UINT8 channel_selection_type, UINT8 ch3c_shape,
UINT8 ch3c_jump,UINT8 reserved);
void BTM_BleGapCsRemoveConfig(UINT16 conn_handle, UINT8 config_id);
void BTM_BleGapCsSetChannelClass(UINT8 *channel_class);
void BTM_BleGapCsSetProcPatams(UINT16 conn_handle, UINT8 config_id, UINT16 max_procedure_len,
UINT16 min_procedure_interval, UINT16 max_procedure_interval,
UINT16 max_procedure_count, UINT32 min_subevent_len,
UINT32 max_subevent_len, UINT8 tone_ant_config_selection,
UINT8 phy, UINT8 tx_power_delta, UINT8 preferred_peer_antenna,
UINT8 SNR_control_initiator, UINT8 SNR_control_reflector);
void BTM_BleGapCsProcEnable(UINT16 conn_handle, UINT8 config_id, UINT8 enable);
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
#endif

View File

@@ -455,6 +455,21 @@
#define HCI_BLE_SET_PERIOD_ADV_PARAMS_V2 (0x0086 | HCI_GRP_BLE_CMDS)
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
#define HCI_BLE_CS_READ_LOCAL_SUPP_CAPS (0x0089 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CS_READ_REMOTE_SUPP_CAPS (0x008A | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CS_WRITE_CACHED_REMOTE_SUPP_CAPS (0x008B | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CS_SECURITY_ENABLE (0x008C | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CS_SET_DEFAULT_SETTINGS (0x008D | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CS_READ_REMOTE_FAE_TABLE (0x008E | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CS_WRITE_CACHED_REMOTE_FAE_TABLE (0x008F | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CS_CREATE_CONFIG (0x0090 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CS_REMOVE_CONFIG (0x0091 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CS_SET_CAHNNEL_CLASS (0x0092 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CS_SET_PROCEDURE_PARAMS (0x0093 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CS_SET_PROCEDURE_ENABLE (0x0094 | HCI_GRP_BLE_CMDS)
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
// Vendor OGF define
#define HCI_VENDOR_OGF 0x3F
@@ -938,6 +953,16 @@
#define HCI_BLE_PA_RESPONSE_REPORT_EVT 0x28
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
#define HCI_BLE_CS_READ_REMOTE_SUPP_CAPS_CMPL_EVT 0x2C
#define HCI_BLE_CS_READ_REMOTE_FAE_TAB_CMPL_EVT 0x2D
#define HCI_BLE_CS_SECURITY_ENABLE_CMPL_EVT 0x2E
#define HCI_BLE_CS_CONFIG_CMPL_EVT 0x2F
#define HCI_BLE_CS_PROC_ENABLE_CMPL_EVT 0x30
#define HCI_BLE_CS_SUBEVENT_RESULT_EVT 0x31
#define HCI_BLE_CS_SUBEVENT_RESULT_CONTINUE_EVT 0x32
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
/* Definitions for LE Channel Map */
#define HCI_BLE_CHNL_MAP_SIZE 5

View File

@@ -1284,4 +1284,49 @@ UINT8 btsnd_hcic_ble_set_ext_adv_params_v2(UINT8 adv_handle, UINT16 properties,
UINT8 primary_adv_phy_options, UINT8 secondary_adv_phy_options);
#endif // (BT_BLE_FEAT_ADV_CODING_SELECTION == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
#define HCIC_PARAM_SIZE_READ_LOCAL_SUPP_CAPS_PARAMS_LEN 0
#define HCIC_PARAM_SIZE_READ_REMOTE_SUPP_CAPS_PARAMS_LEN 2
#define HCIC_PARAM_SIZE_WRITE_CACHE_REMOTE_SUPP_CAPS_PARAMS_LEN 30
#define HCIC_PARAM_SIZE_SECURITY_ENABLE_PARAMS_LEN 2
#define HCIC_PARAM_SIZE_SET_DEFAULT_SETTINGS_PARAMS_LEN 5
#define HCIC_PARAM_SIZE_READ_REMOTE_FAE_TAB_PARAMS_LEN 2
#define HCIC_PARAM_SIZE_WRITE_CACHED_REMOTE_FAE_TAB_PARAMS_LEN 74
#define HCIC_PARAM_SIZE_CREATE_CONFIG_PARAMS_LEN 28
#define HCIC_PARAM_SIZE_REMOVE_CONFIG_PARAMS_LEN 3
#define HCIC_PARAM_SIZE_SET_CHANNEL_CLASS_PARAMS_LEN 10
#define HCIC_PARAM_SIZE_SET_PROCEDURE_PARAMS_LEN 21
#define HCIC_PARAM_SIZE_SET_PROCEDURE_ENABLE_PARAMS_LEN 4
UINT8 btsnd_hcic_ble_cs_read_local_supported_caps(void);
UINT8 btsnd_hcic_ble_cs_read_remote_supported_capabilities(UINT16 conn_handle);
UINT8 btsnd_hcic_ble_cs_write_cached_remote_supported_capabilities(UINT16 conn_handle, UINT8 num_config_supported, UINT16 max_consecutive_proc_supported,
UINT8 num_ant_supported, UINT8 max_ant_paths_supported, UINT8 roles_supported,
UINT8 modes_supported, UINT8 rtt_capability, UINT8 rtt_aa_only_n,
UINT8 rtt_sounding_n, UINT8 rtt_random_payload_n, UINT16 NADM_sounding_capability,
UINT16 NADM_random_capability, UINT8 cs_sync_phys_supported, UINT16 subfeatures_supported,
UINT16 T_IP1_times_supported, UINT16 T_IP2_times_supported, UINT16 T_FCS_times_supported,
UINT16 T_PM_times_supported, UINT8 T_SW_times_supported, UINT8 TX_SNR_capability);
UINT8 btsnd_hcic_ble_cs_security_enable(UINT16 conn_handle);
UINT8 btsnd_hcic_ble_cs_set_default_settings(UINT16 conn_handle, UINT8 role_enable, UINT8 cs_sync_ant_selection, INT8 max_tx_power);
UINT8 btsnd_hcic_ble_cs_read_remote_fae_table(UINT16 conn_handle);
UINT8 btsnd_hcic_ble_cs_write_cached_remote_fae_table(UINT16 conn_handle, UINT8 *remote_fae_table);
UINT8 btsnd_hcic_ble_cs_create_config(UINT16 conn_handle, UINT8 config_id, UINT8 create_context,
UINT8 main_mode_type, UINT8 sub_mode_type, UINT8 min_main_mode_steps,
UINT8 max_main_mode_steps, UINT8 main_mode_repetition, UINT8 mode_0_steps,
UINT8 role, UINT8 rtt_type, UINT8 cs_sync_phy, UINT8 *channel_map,
UINT8 channel_map_repetition, UINT8 channel_selection_type, UINT8 ch3c_shape,
UINT8 ch3c_jump,UINT8 reserved);
UINT8 btsnd_hcic_ble_cs_remove_config(UINT16 conn_handle, UINT8 config_id);
UINT8 btsnd_hcic_ble_cs_set_channel_classification(UINT8 *channel_class);
UINT8 btsnd_hcic_ble_cs_set_procedure_params(UINT16 conn_handle, UINT8 config_id, UINT16 max_procedure_len,
UINT16 min_procedure_interval, UINT16 max_procedure_interval,
UINT16 max_procedure_count, UINT32 min_subevent_len,
UINT32 max_subevent_len, UINT8 tone_ant_config_selection,
UINT8 phy, UINT8 tx_power_delta, UINT8 preferred_peer_antenna,
UINT8 SNR_control_initiator, UINT8 SNR_control_reflector);
UINT8 btsnd_hcic_ble_cs_procedure_enable(UINT16 conn_handle, UINT8 config_id, UINT8 enable);
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
#endif