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

This commit is contained in:
zhiweijian
2025-12-30 11:28:50 +08:00
parent 37c75157dc
commit ba96bb2c1d
20 changed files with 3329 additions and 2 deletions
@@ -1824,3 +1824,288 @@ void btm_ble_pa_rsp_rpt_evt(tBTM_BLE_PA_RSP_REPORT_EVT *params)
}
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
void BTM_BleCSReadLocalSuppCaps(void)
{
btsnd_hcic_ble_cs_read_local_supported_caps();
}
void btm_ble_cs_read_local_supp_caps_cmpl_evt(uint8_t *p)
{
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
STREAM_TO_UINT8(cb_params.cs_read_local_supp_caps.status, p);
if (cb_params.cs_read_local_supp_caps.status != HCI_SUCCESS) {
BTM_TRACE_ERROR("%s cmd err = 0x%x", __func__, cb_params.cs_read_local_supp_caps.status);
cb_params.cs_read_local_supp_caps.status |= BTM_HCI_ERROR;
goto _error;
}
STREAM_TO_UINT16(cb_params.cs_read_local_supp_caps.conn_handle, p);
STREAM_TO_UINT8(cb_params.cs_read_local_supp_caps.num_config_supported, p);
STREAM_TO_UINT16(cb_params.cs_read_local_supp_caps.max_consecutive_proc_supported, p);
STREAM_TO_UINT8(cb_params.cs_read_local_supp_caps.num_ant_supported, p);
STREAM_TO_UINT8(cb_params.cs_read_local_supp_caps.max_ant_paths_supported, p);
STREAM_TO_UINT8(cb_params.cs_read_local_supp_caps.roles_supported, p);
STREAM_TO_UINT8(cb_params.cs_read_local_supp_caps.modes_supported, p);
STREAM_TO_UINT8(cb_params.cs_read_local_supp_caps.rtt_capability, p);
STREAM_TO_UINT8(cb_params.cs_read_local_supp_caps.rtt_aa_only_n, p);
STREAM_TO_UINT8(cb_params.cs_read_local_supp_caps.rtt_sounding_n, p);
STREAM_TO_UINT8(cb_params.cs_read_local_supp_caps.rtt_random_payload_n, p);
STREAM_TO_UINT16(cb_params.cs_read_local_supp_caps.NADM_sounding_capability, p);
STREAM_TO_UINT16(cb_params.cs_read_local_supp_caps.NADM_random_capability, p);
STREAM_TO_UINT8(cb_params.cs_read_local_supp_caps.cs_sync_phys_supported, p);
STREAM_TO_UINT16(cb_params.cs_read_local_supp_caps.subfeatures_supported, p);
STREAM_TO_UINT16(cb_params.cs_read_local_supp_caps.T_IP1_times_supported, p);
STREAM_TO_UINT16(cb_params.cs_read_local_supp_caps.T_IP2_times_supported, p);
STREAM_TO_UINT16(cb_params.cs_read_local_supp_caps.T_FCS_times_supported, p);
STREAM_TO_UINT16(cb_params.cs_read_local_supp_caps.T_PM_times_supported, p);
STREAM_TO_UINT8(cb_params.cs_read_local_supp_caps.T_SW_times_supported, p);
STREAM_TO_UINT8(cb_params.cs_read_local_supp_caps.TX_SNR_capability, p);
_error:
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_READ_LOCAL_SUPP_CAPS_EVT, &cb_params);
}
void BTM_BleCSReadRemoteSuppCaps(UINT16 conn_handle)
{
btsnd_hcic_ble_cs_read_remote_supported_capabilities(conn_handle);
}
void btm_ble_cs_read_remote_supp_caps_cmd_status(UINT8 status)
{
if (status != HCI_SUCCESS) {
tBTM_BLE_CS_READ_REMOTE_SUPP_CAPS_CMPL_EVT cs_read_remote_supp_caps = {0};
cs_read_remote_supp_caps.status = (status | BTM_HCI_ERROR);
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_READ_REMOTE_SUPP_CAPS_CMPL_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)&cs_read_remote_supp_caps);
}
}
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)
{
tBTM_STATUS status = BTM_SUCCESS;
tHCI_STATUS err = HCI_SUCCESS;
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_cs_write_cached_remote_supported_capabilities(conn_handle, num_config_supported, max_consecutive_proc_supported,
num_ant_supported, max_ant_paths_supported, roles_supported,
modes_supported, rtt_capability, rtt_aa_only_n,
rtt_sounding_n, rtt_random_payload_n, NADM_sounding_capability,
NADM_random_capability, cs_sync_phys_supported, subfeatures_supported,
T_IP1_times_supported, T_IP2_times_supported, T_FCS_times_supported,
T_PM_times_supported, T_SW_times_supported, TX_SNR_capability)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("cs write cached remote support caps, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
cb_params.cs_write_cached_remote_supp_caps.status = status;
cb_params.cs_write_cached_remote_supp_caps.conn_handle = conn_handle;
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_WRITE_CACHED_REMOTE_SUPP_CAPS_EVT, &cb_params);
}
void BTM_BleGapCsSecurityEnable(UINT16 conn_handle)
{
btsnd_hcic_ble_cs_security_enable(conn_handle);
}
void btm_ble_cs_security_enable_cmd_status(UINT8 status)
{
tBTM_BLE_CS_SEC_ENABLE_CMPL_EVT cs_security_enable = {0};
if (status != HCI_SUCCESS) {
cs_security_enable.status = (status | BTM_HCI_ERROR);
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_SECURITY_ENABLE_CMPL_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)&cs_security_enable);
}
}
void BTM_BleGapCsSetDefaultSetting(UINT16 conn_handle, UINT8 role_enable, UINT8 cs_sync_ant_selection, INT8 max_tx_power)
{
tBTM_STATUS status = BTM_SUCCESS;
tHCI_STATUS err = HCI_SUCCESS;
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_cs_set_default_settings(conn_handle, role_enable, cs_sync_ant_selection, max_tx_power)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("cs set default setting, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
cb_params.cs_set_default_settings.status = status;
cb_params.cs_set_default_settings.conn_handle = conn_handle;
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_SET_DEFAULT_SETTINGS_EVT, &cb_params);
}
void BTM_BleGapCsReadRemoteFaeTable(UINT16 conn_handle)
{
btsnd_hcic_ble_cs_read_remote_fae_table(conn_handle);
}
void btm_ble_cs_read_remote_fae_table_cmd_status(UINT8 status)
{
tBTM_BLE_CS_READ_REMOTE_FAE_TAB_CMPL_EVT cs_read_remote_fae_tab = {0};
if (status != HCI_SUCCESS) {
cs_read_remote_fae_tab.status = (status | BTM_HCI_ERROR);
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_READ_REMOTE_FAE_TABLE_CMPL_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)&cs_read_remote_fae_tab);
}
}
void BTM_BleGapWriteCachedRemoteFaeTable(UINT16 conn_handle, UINT8 *remote_fae_table)
{
tBTM_STATUS status = BTM_SUCCESS;
tHCI_STATUS err = HCI_SUCCESS;
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_cs_write_cached_remote_fae_table(conn_handle, remote_fae_table)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("cs write cached remote fae tab, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
cb_params.cs_write_cached_remote_fae_tab.status = status;
cb_params.cs_write_cached_remote_fae_tab.conn_handle = conn_handle;
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_WRITE_CACHED_REMOTE_FAE_TAB_EVT, &cb_params);
}
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)
{
btsnd_hcic_ble_cs_create_config(conn_handle, config_id, create_context,
main_mode_type, sub_mode_type, min_main_mode_steps,
max_main_mode_steps, main_mode_repetition, mode_0_steps,
role, rtt_type, cs_sync_phy, channel_map,
channel_map_repetition, channel_selection_type, ch3c_shape,
ch3c_jump, reserved);
}
void BTM_BleGapCsRemoveConfig(UINT16 conn_handle, UINT8 config_id)
{
btsnd_hcic_ble_cs_remove_config(conn_handle, config_id);
}
void btm_ble_cs_update_config_cmd_status(UINT8 status, BOOLEAN create)
{
tBTM_BLE_CS_CONFIG_CMPL_EVT config_cmpl = {0};
if (status != HCI_SUCCESS) {
config_cmpl.status = (status | BTM_HCI_ERROR);
config_cmpl.action = (create? 0x01:0x00);
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_CONFIG_CMPL_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)&config_cmpl);
}
}
void BTM_BleGapCsSetChannelClass(UINT8 *channel_class)
{
tBTM_STATUS status = BTM_SUCCESS;
tHCI_STATUS err = HCI_SUCCESS;
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_cs_set_channel_classification(channel_class)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("cs set channel class, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
cb_params.status = status;
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_SET_CHANNEL_CLASS_CMPL_EVT, &cb_params);
}
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)
{
tBTM_STATUS status = BTM_SUCCESS;
tHCI_STATUS err = HCI_SUCCESS;
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_cs_set_procedure_params(conn_handle, config_id, max_procedure_len,
min_procedure_interval, max_procedure_interval,
max_procedure_count, min_subevent_len,
max_subevent_len, tone_ant_config_selection,
phy, tx_power_delta, preferred_peer_antenna,
SNR_control_initiator, SNR_control_reflector)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("cs set procedure params, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
cb_params.cs_set_proc_params.status = status;
cb_params.cs_set_proc_params.conn_handle = conn_handle;
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_PROC_PARAMS_CMPL_EVT, &cb_params);
}
void BTM_BleGapCsProcEnable(UINT16 conn_handle, UINT8 config_id, UINT8 enable)
{
btsnd_hcic_ble_cs_procedure_enable(conn_handle, config_id, enable);
}
void btm_ble_cs_read_remote_supp_caps_cmpl_evt(tBTM_BLE_CS_READ_REMOTE_SUPP_CAPS_CMPL_EVT *cs_read_remote_supp_caps)
{
if (cs_read_remote_supp_caps->status != HCI_SUCCESS) {
BTM_TRACE_ERROR("%s cmd err = 0x%x", __func__, cs_read_remote_supp_caps->status);
cs_read_remote_supp_caps->status |= BTM_HCI_ERROR;
}
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_READ_REMOTE_SUPP_CAPS_CMPL_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)cs_read_remote_supp_caps);
}
void btm_ble_cs_read_remote_fae_tab_cmpl_evt(tBTM_BLE_CS_READ_REMOTE_FAE_TAB_CMPL_EVT *cs_read_remote_fae_tab)
{
if (cs_read_remote_fae_tab->status != HCI_SUCCESS) {
BTM_TRACE_ERROR("%s cmd err = 0x%x", __func__, cs_read_remote_fae_tab->status);
cs_read_remote_fae_tab->status |= BTM_HCI_ERROR;
}
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_READ_REMOTE_FAE_TABLE_CMPL_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)cs_read_remote_fae_tab);
}
void btm_ble_cs_securuty_enable_cmpl_evt(tBTM_BLE_CS_SEC_ENABLE_CMPL_EVT *cs_security_enable)
{
if (cs_security_enable->status != HCI_SUCCESS) {
BTM_TRACE_ERROR("%s cmd err = 0x%x", __func__, cs_security_enable->status);
cs_security_enable->status |= BTM_HCI_ERROR;
}
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_SECURITY_ENABLE_CMPL_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)cs_security_enable);
}
void btm_ble_cs_config_cmpl_evt(tBTM_BLE_CS_CONFIG_CMPL_EVT *config_cmpl)
{
if (config_cmpl->status != HCI_SUCCESS) {
BTM_TRACE_ERROR("%s cmd err = 0x%x", __func__, config_cmpl->status);
config_cmpl->status |= BTM_HCI_ERROR;
}
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_CONFIG_CMPL_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)config_cmpl);
}
void btm_ble_cs_proc_enable_cmpl_evt(tBTM_BLE_CS_PROC_ENABLE_CMPL_EVT *proc_en)
{
if (proc_en->status != HCI_SUCCESS) {
BTM_TRACE_ERROR("%s cmd err = 0x%x", __func__, proc_en->status);
proc_en->status |= BTM_HCI_ERROR;
}
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_PROC_ENABLE_CMPL_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)proc_en);
}
void btm_ble_cs_subevt_result_evt(tBTM_BLE_CS_SUBEVT_RESULT_CMPL_EVT *subevt_result)
{
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_SUBEVENT_RESULT_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)subevt_result);
}
void btm_ble_cs_subevt_continue_result_evt(tBTM_BLE_CS_SUBEVT_RESULT_CONTINUE_EVT *subevt_result_continue)
{
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_CS_SUBEVENT_RESULT_CONTINUE_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)subevt_result_continue);
}
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
@@ -611,6 +611,17 @@ void btm_ble_pa_subevt_data_req_evt(tBTM_BLE_PA_SUBEVT_DATA_REQ_EVT *params);
void btm_ble_pa_rsp_rpt_evt(tBTM_BLE_PA_RSP_REPORT_EVT *params);
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
void btm_ble_cs_read_remote_supp_caps_cmpl_evt(tBTM_BLE_CS_READ_REMOTE_SUPP_CAPS_CMPL_EVT *cs_read_remote_supp_caps);
void btm_ble_cs_read_remote_fae_tab_cmpl_evt(tBTM_BLE_CS_READ_REMOTE_FAE_TAB_CMPL_EVT *cs_read_remote_fae_tab);
void btm_ble_cs_securuty_enable_cmpl_evt(tBTM_BLE_CS_SEC_ENABLE_CMPL_EVT *cs_security_enable);
void btm_ble_cs_config_cmpl_evt(tBTM_BLE_CS_CONFIG_CMPL_EVT *config_cmpl);
void btm_ble_cs_proc_enable_cmpl_evt(tBTM_BLE_CS_PROC_ENABLE_CMPL_EVT *proc_en);
void btm_ble_cs_subevt_result_evt(tBTM_BLE_CS_SUBEVT_RESULT_CMPL_EVT *subevt_result);
void btm_ble_cs_subevt_continue_result_evt(tBTM_BLE_CS_SUBEVT_RESULT_CONTINUE_EVT *subevt_continue_result);
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
/*
#ifdef __cplusplus
}
@@ -1137,6 +1137,14 @@ void btm_read_remote_trans_pwr_level_cmpl(UINT8 status);
void btm_subrate_req_cmd_status(UINT8 status);
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
void btm_ble_cs_read_local_supp_caps_cmpl_evt(UINT8 *p);
void btm_ble_cs_read_remote_supp_caps_cmd_status(UINT8 status);
void btm_ble_cs_security_enable_cmd_status(UINT8 status);
void btm_ble_cs_read_remote_fae_table_cmd_status(UINT8 status);
void btm_ble_cs_update_config_cmd_status(UINT8 status, BOOLEAN create);
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
/* Internal functions provided by btm_sco.c
********************************************
*/
@@ -233,6 +233,16 @@ static void btu_ble_pa_subevt_data_request_evt(UINT8 *p);
static void btu_ble_pa_response_report_evt(UINT8 *p);
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
static void btu_ble_cs_read_remote_supp_caps_evt(UINT8 *p);
static void btu_ble_cs_read_remote_fae_tab_evt(UINT8 *p);
static void btu_ble_cs_security_enable_cmpl_evt(UINT8 *p);
static void btu_ble_cs_config_cmpl_evt(UINT8 *p);
static void btu_ble_cs_proc_enable_cmpl_evt(UINT8 *p);
static void btu_ble_cs_subevt_result_evt(UINT8 *p);
static void btu_ble_cs_subevt_result_continue_evt(UINT8 *p);
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
#if (BLE_42_ADV_EN == TRUE)
extern osi_sem_t adv_enable_sem;
extern osi_sem_t adv_data_sem;
@@ -607,6 +617,29 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
btu_ble_pa_response_report_evt(p);
break;
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
case HCI_BLE_CS_READ_REMOTE_SUPP_CAPS_CMPL_EVT:
btu_ble_cs_read_remote_supp_caps_evt(p);
break;
case HCI_BLE_CS_READ_REMOTE_FAE_TAB_CMPL_EVT:
btu_ble_cs_read_remote_fae_tab_evt(p);
break;
case HCI_BLE_CS_SECURITY_ENABLE_CMPL_EVT:
btu_ble_cs_security_enable_cmpl_evt(p);
break;
case HCI_BLE_CS_CONFIG_CMPL_EVT:
btu_ble_cs_config_cmpl_evt(p);
break;
case HCI_BLE_CS_PROC_ENABLE_CMPL_EVT:
btu_ble_cs_proc_enable_cmpl_evt(p);
break;
case HCI_BLE_CS_SUBEVENT_RESULT_EVT:
btu_ble_cs_subevt_result_evt(p);
break;
case HCI_BLE_CS_SUBEVENT_RESULT_CONTINUE_EVT:
btu_ble_cs_subevt_result_continue_evt(p);
break;
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
}
break;
#endif /* BLE_INCLUDED */
@@ -1411,7 +1444,11 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
btm_enh_read_trans_pwr_level_cmpl_evt(p);
break;
#endif //#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
case HCI_BLE_CS_READ_LOCAL_SUPP_CAPS:
btm_ble_cs_read_local_supp_caps_cmpl_evt(p);
break;
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
#endif /* (BLE_INCLUDED == TRUE) */
default: {
@@ -1619,6 +1656,23 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
btm_subrate_req_cmd_status(status);
break;
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
case HCI_BLE_CS_READ_REMOTE_SUPP_CAPS:
btm_ble_cs_read_remote_supp_caps_cmd_status(status);
break;
case HCI_BLE_CS_SECURITY_ENABLE:
btm_ble_cs_security_enable_cmd_status(status);
break;
case HCI_BLE_CS_READ_REMOTE_FAE_TABLE:
btm_ble_cs_read_remote_fae_table_cmd_status(status);
break;
case HCI_BLE_CS_CREATE_CONFIG:
btm_ble_cs_update_config_cmd_status(status, true);
break;
case HCI_BLE_CS_REMOVE_CONFIG:
btm_ble_cs_update_config_cmd_status(status, false);
break;
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
default:
/* If command failed to start, we may need to tell BTM */
if (status != HCI_SUCCESS) {
@@ -3191,6 +3245,228 @@ static void btu_ble_pa_response_report_evt(UINT8 *p)
}
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
static void btu_ble_cs_read_remote_supp_caps_evt(UINT8 *p)
{
tBTM_BLE_CS_READ_REMOTE_SUPP_CAPS_CMPL_EVT cs_read_remote_supp_caps = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT8(cs_read_remote_supp_caps.status, p);
STREAM_TO_UINT16(cs_read_remote_supp_caps.conn_handle, p);
STREAM_TO_UINT8(cs_read_remote_supp_caps.num_config_supported, p);
STREAM_TO_UINT16(cs_read_remote_supp_caps.max_consecutive_proc_supported, p);
STREAM_TO_UINT8(cs_read_remote_supp_caps.num_ant_supported, p);
STREAM_TO_UINT8(cs_read_remote_supp_caps.max_ant_paths_supported, p);
STREAM_TO_UINT8(cs_read_remote_supp_caps.roles_supported, p);
STREAM_TO_UINT8(cs_read_remote_supp_caps.modes_supported, p);
STREAM_TO_UINT8(cs_read_remote_supp_caps.rtt_capability, p);
STREAM_TO_UINT8(cs_read_remote_supp_caps.rtt_aa_only_n, p);
STREAM_TO_UINT8(cs_read_remote_supp_caps.rtt_sounding_n, p);
STREAM_TO_UINT8(cs_read_remote_supp_caps.rtt_random_payload_n, p);
STREAM_TO_UINT16(cs_read_remote_supp_caps.NADM_sounding_capability, p);
STREAM_TO_UINT16(cs_read_remote_supp_caps.NADM_random_capability, p);
STREAM_TO_UINT8(cs_read_remote_supp_caps.cs_sync_phys_supported, p);
STREAM_TO_UINT16(cs_read_remote_supp_caps.subfeatures_supported, p);
STREAM_TO_UINT16(cs_read_remote_supp_caps.T_IP1_times_supported, p);
STREAM_TO_UINT16(cs_read_remote_supp_caps.T_IP2_times_supported, p);
STREAM_TO_UINT16(cs_read_remote_supp_caps.T_FCS_times_supported, p);
STREAM_TO_UINT16(cs_read_remote_supp_caps.T_PM_times_supported, p);
STREAM_TO_UINT8(cs_read_remote_supp_caps.T_SW_times_supported, p);
STREAM_TO_UINT8(cs_read_remote_supp_caps.TX_SNR_capability, p);
btm_ble_cs_read_remote_supp_caps_cmpl_evt(&cs_read_remote_supp_caps);
}
static void btu_ble_cs_read_remote_fae_tab_evt(UINT8 *p)
{
tBTM_BLE_CS_READ_REMOTE_FAE_TAB_CMPL_EVT cs_read_remote_fae_tab = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT8(cs_read_remote_fae_tab.status, p);
STREAM_TO_UINT16(cs_read_remote_fae_tab.conn_handle, p);
STREAM_TO_ARRAY(cs_read_remote_fae_tab.remote_fae_table, p, 72);
btm_ble_cs_read_remote_fae_tab_cmpl_evt(&cs_read_remote_fae_tab);
}
static void btu_ble_cs_security_enable_cmpl_evt(UINT8 *p)
{
tBTM_BLE_CS_SEC_ENABLE_CMPL_EVT cs_security_enable = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT8(cs_security_enable.status, p);
STREAM_TO_UINT16(cs_security_enable.conn_handle, p);
btm_ble_cs_securuty_enable_cmpl_evt(&cs_security_enable);
}
static void btu_ble_cs_config_cmpl_evt(UINT8 *p)
{
tBTM_BLE_CS_CONFIG_CMPL_EVT config_cmpl = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT8(config_cmpl.status, p);
STREAM_TO_UINT16(config_cmpl.conn_handle, p);
STREAM_TO_UINT8(config_cmpl.config_id, p);
STREAM_TO_UINT8(config_cmpl.action, p);;
STREAM_TO_UINT8(config_cmpl.main_mode_type, p);
STREAM_TO_UINT8(config_cmpl.sub_mode_type, p);
STREAM_TO_UINT8(config_cmpl.min_main_mode_steps, p);
STREAM_TO_UINT8(config_cmpl.max_main_mode_steps, p);
STREAM_TO_UINT8(config_cmpl.main_mode_repetition, p);
STREAM_TO_UINT8(config_cmpl.mode_0_steps, p);
STREAM_TO_UINT8(config_cmpl.role, p);
STREAM_TO_UINT8(config_cmpl.rtt_type, p);
STREAM_TO_UINT8(config_cmpl.cs_sync_phy, p);
STREAM_TO_ARRAY(config_cmpl.channel_map, p, 10);
STREAM_TO_UINT8(config_cmpl.channel_map_repetition, p);
STREAM_TO_UINT8(config_cmpl.channel_selection_type, p);
STREAM_TO_UINT8(config_cmpl.ch3c_shape, p);
STREAM_TO_UINT8(config_cmpl.ch3c_jump, p);
STREAM_TO_UINT8(config_cmpl.reserved, p);
STREAM_TO_UINT8(config_cmpl.t_ip1_time, p);
STREAM_TO_UINT8(config_cmpl.t_ip2_time, p);
STREAM_TO_UINT8(config_cmpl.t_fcs_time, p);
STREAM_TO_UINT8(config_cmpl.t_pm_time, p);
btm_ble_cs_config_cmpl_evt(&config_cmpl);
}
static void btu_ble_cs_proc_enable_cmpl_evt(UINT8 *p)
{
tBTM_BLE_CS_PROC_ENABLE_CMPL_EVT proc_en = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT8(proc_en.status, p);
STREAM_TO_UINT16(proc_en.conn_handle, p);
STREAM_TO_UINT8(proc_en.config_id, p);
STREAM_TO_UINT8(proc_en.state, p);
STREAM_TO_UINT8(proc_en.tone_Ant_config_select, p);
STREAM_TO_UINT8(proc_en.select_tx_power, p);
STREAM_TO_UINT24(proc_en.subevent_Len, p);
STREAM_TO_UINT8(proc_en.subevents_per_event, p);
STREAM_TO_UINT16(proc_en.subevent_interval, p);
STREAM_TO_UINT16(proc_en.event_interval, p);
STREAM_TO_UINT16(proc_en.procedure_interval, p);
STREAM_TO_UINT16(proc_en.procedure_count, p);
STREAM_TO_UINT16(proc_en.max_procedure_len, p);
btm_ble_cs_proc_enable_cmpl_evt(&proc_en);
}
static void btu_ble_cs_subevt_result_evt(UINT8 *p)
{
tBTM_BLE_CS_SUBEVT_RESULT_CMPL_EVT subevt_result = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT16(subevt_result.conn_handle, p);
STREAM_TO_UINT8(subevt_result.config_id, p);
STREAM_TO_UINT16(subevt_result.start_acl_conn_event_counter, p);
STREAM_TO_UINT16(subevt_result.procedure_counter, p);
STREAM_TO_UINT16(subevt_result.frequency_compensation, p);
STREAM_TO_UINT8(subevt_result.reference_power_level, p);
STREAM_TO_UINT8(subevt_result.procedure_done_status, p);
STREAM_TO_UINT8(subevt_result.subevent_done_status, p);
STREAM_TO_UINT8(subevt_result.abort_reason, p);
STREAM_TO_UINT8(subevt_result.num_ant_paths, p);
STREAM_TO_UINT8(subevt_result.num_steps_reported, p);
subevt_result.step_info = osi_malloc(subevt_result.num_steps_reported * sizeof(tBTM_BLE_CS_STEP_INFO));
if (subevt_result.step_info) {
for (uint8_t i = 0; i < subevt_result.num_steps_reported; i++)
{
STREAM_TO_UINT8(subevt_result.step_info[i].step_mode, p);
STREAM_TO_UINT8(subevt_result.step_info[i].step_channel, p);
STREAM_TO_UINT8(subevt_result.step_info[i].step_data_len, p);
subevt_result.step_info[i].data = osi_malloc(subevt_result.step_info[i].step_data_len);
if (subevt_result.step_info[i].data) {
STREAM_TO_ARRAY(subevt_result.step_info[i].data, p, subevt_result.step_info[i].step_data_len);
} else if (subevt_result.step_info[i].step_data_len) {
HCI_TRACE_ERROR("%s, no memory.", __func__);
}
}
}
btm_ble_cs_subevt_result_evt(&subevt_result);
if (subevt_result.step_info)
{
for (UINT8 i = 0; i < subevt_result.num_steps_reported; i++)
{
if (subevt_result.step_info[i].data) {
osi_free(subevt_result.step_info[i].data);
}
}
osi_free(subevt_result.step_info);
}
}
static void btu_ble_cs_subevt_result_continue_evt(UINT8 *p)
{
tBTM_BLE_CS_SUBEVT_RESULT_CONTINUE_EVT subevt_continue_result = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT16(subevt_continue_result.conn_handle, p);
STREAM_TO_UINT8(subevt_continue_result.config_id, p);
STREAM_TO_UINT8(subevt_continue_result.proc_done_status, p);
STREAM_TO_UINT8(subevt_continue_result.subevt_done_status, p);
STREAM_TO_UINT8(subevt_continue_result.abort_reason, p);
STREAM_TO_UINT8(subevt_continue_result.num_ant_paths, p);
STREAM_TO_UINT8(subevt_continue_result.num_steps_reported, p);
subevt_continue_result.step_info = osi_malloc(subevt_continue_result.num_steps_reported * sizeof(tBTM_BLE_CS_STEP_INFO));
if (subevt_continue_result.step_info) {
for (uint8_t i = 0; i < subevt_continue_result.num_steps_reported; i++) {
STREAM_TO_UINT8(subevt_continue_result.step_info[i].step_mode, p);
STREAM_TO_UINT8(subevt_continue_result.step_info[i].step_channel, p);
STREAM_TO_UINT8(subevt_continue_result.step_info[i].step_data_len, p);
subevt_continue_result.step_info[i].data = osi_malloc(subevt_continue_result.step_info[i].step_data_len);
if (subevt_continue_result.step_info[i].data) {
STREAM_TO_ARRAY(subevt_continue_result.step_info[i].data, p, subevt_continue_result.step_info[i].step_data_len);
} else if (subevt_continue_result.step_info[i].step_data_len) {
HCI_TRACE_ERROR("%s, no memory.", __func__);
}
}
}
btm_ble_cs_subevt_continue_result_evt(&subevt_continue_result);
if (subevt_continue_result.step_info)
{
for (UINT8 i = 0; i < subevt_continue_result.num_steps_reported; i++)
{
if (subevt_continue_result.step_info[i].data) {
osi_free(subevt_continue_result.step_info[i].data);
}
}
osi_free(subevt_continue_result.step_info);
}
}
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
/**********************************************
** End of BLE Events Handler
***********************************************/
@@ -3080,3 +3080,324 @@ UINT8 btsnd_hcic_ble_set_periodic_sync_subevt(UINT16 sync_handle, UINT16 periodi
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
UINT8 btsnd_hcic_ble_cs_read_local_supported_caps(void)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("cs read local supported caps");
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_READ_LOCAL_SUPP_CAPS_PARAMS_LEN);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_CS_READ_LOCAL_SUPP_CAPS);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_READ_LOCAL_SUPP_CAPS_PARAMS_LEN);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
return (TRUE);
}
UINT8 btsnd_hcic_ble_cs_read_remote_supported_capabilities(UINT16 conn_handle)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_ERROR("cs read remote supported caps, conn_handle %d", conn_handle);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_READ_REMOTE_SUPP_CAPS_PARAMS_LEN);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_CS_READ_REMOTE_SUPP_CAPS);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_READ_REMOTE_SUPP_CAPS_PARAMS_LEN);
UINT16_TO_STREAM(pp, conn_handle);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
return (TRUE);
}
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)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("cs write cached remote supported caps");
HCI_TRACE_DEBUG("conn_handle %d num_config_supported %d max_consecutive_proc_supported %d, num_ant_supported %d max_ant_paths_supported %d roles_supported %d,\
modes_supported %d, rtt_capability %d, rtt_aa_only_n %d, rtt_sounding_n %d, rtt_random_payload_n %d, NADM_sounding_capability %d, NADM_random_capability %d\
,cs_sync_phys_supported %d, subfeatures_supported %d, T_IP1_times_supported %d, T_IP2_times_supported %d, T_FCS_times_supported %d, T_PM_times_supported %d\
,T_SW_times_supported %d, TX_SNR_capability %d",
conn_handle, num_config_supported, max_consecutive_proc_supported, num_ant_supported, max_ant_paths_supported, roles_supported,
modes_supported, rtt_capability, rtt_aa_only_n, rtt_sounding_n, rtt_random_payload_n, NADM_sounding_capability,
NADM_random_capability, cs_sync_phys_supported, subfeatures_supported, T_IP1_times_supported, T_IP2_times_supported, T_FCS_times_supported,
T_PM_times_supported, T_SW_times_supported, TX_SNR_capability);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_WRITE_CACHE_REMOTE_SUPP_CAPS_PARAMS_LEN);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_CS_WRITE_CACHED_REMOTE_SUPP_CAPS);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_CACHE_REMOTE_SUPP_CAPS_PARAMS_LEN);
UINT16_TO_STREAM(pp, conn_handle);
UINT8_TO_STREAM(pp, num_config_supported);
UINT16_TO_STREAM(pp, max_consecutive_proc_supported);
UINT8_TO_STREAM(pp, num_ant_supported);
UINT8_TO_STREAM(pp, max_ant_paths_supported);
UINT8_TO_STREAM(pp, roles_supported);
UINT8_TO_STREAM(pp, modes_supported);
UINT8_TO_STREAM(pp, rtt_capability);
UINT8_TO_STREAM(pp, rtt_aa_only_n);
UINT8_TO_STREAM(pp, rtt_sounding_n);
UINT8_TO_STREAM(pp, rtt_random_payload_n);
UINT16_TO_STREAM(pp, NADM_sounding_capability);
UINT16_TO_STREAM(pp, NADM_random_capability);
UINT8_TO_STREAM(pp, cs_sync_phys_supported);
UINT16_TO_STREAM(pp, subfeatures_supported);
UINT16_TO_STREAM(pp, T_IP1_times_supported);
UINT16_TO_STREAM(pp, T_IP2_times_supported);
UINT16_TO_STREAM(pp, T_FCS_times_supported);
UINT16_TO_STREAM(pp, T_PM_times_supported);
UINT8_TO_STREAM(pp, T_SW_times_supported);
UINT8_TO_STREAM(pp, TX_SNR_capability);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_cs_security_enable(UINT16 conn_handle)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("cs security enable conn_handle %d", conn_handle);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SECURITY_ENABLE_PARAMS_LEN);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_CS_SECURITY_ENABLE);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SECURITY_ENABLE_PARAMS_LEN);
UINT16_TO_STREAM(pp, conn_handle);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
return (TRUE);
}
UINT8 btsnd_hcic_ble_cs_set_default_settings(UINT16 conn_handle, UINT8 role_enable, UINT8 cs_sync_ant_selection, INT8 max_tx_power)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("cs set default settings, conn_handle %d role_enable %d cs_sync_ant_selection %d max_tx_power %d", conn_handle, role_enable, cs_sync_ant_selection, max_tx_power);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_DEFAULT_SETTINGS_PARAMS_LEN);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_CS_SET_DEFAULT_SETTINGS);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_DEFAULT_SETTINGS_PARAMS_LEN);
UINT16_TO_STREAM(pp, conn_handle);
UINT8_TO_STREAM(pp, role_enable);
UINT8_TO_STREAM(pp, cs_sync_ant_selection);
INT8_TO_STREAM(pp, max_tx_power);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_cs_read_remote_fae_table(UINT16 conn_handle)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("cs read remote fae table, conn_handle %d", conn_handle);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_READ_REMOTE_FAE_TAB_PARAMS_LEN);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_CS_READ_REMOTE_FAE_TABLE);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_READ_REMOTE_FAE_TAB_PARAMS_LEN);
UINT16_TO_STREAM(pp, conn_handle);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
return (TRUE);
}
UINT8 btsnd_hcic_ble_cs_write_cached_remote_fae_table(UINT16 conn_handle, UINT8 *remote_fae_table)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("cs write cached remote fae table, conn_handle %d", conn_handle);
esp_log_buffer_hex_internal("remote_fae_table", remote_fae_table, 72, ESP_LOG_DEBUG);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_WRITE_CACHED_REMOTE_FAE_TAB_PARAMS_LEN);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_CS_WRITE_CACHED_REMOTE_FAE_TABLE);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_CACHED_REMOTE_FAE_TAB_PARAMS_LEN);
UINT16_TO_STREAM(pp, conn_handle);
ARRAY_TO_STREAM(pp, remote_fae_table, 72);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
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)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("cs create config");
HCI_TRACE_DEBUG("conn_handle %d config_id %d create_context %d main_mode_type %d sub_mode_type %d min_main_mode_steps %d max_main_mode_steps\
%d main_mode_repetition %d mode_0_steps %d role %d rtt_type %d cs_sync_phy %d, channel_map_repetition %d, channel_selection_type %d\
ch3c_shape %d ch3c_jump %d,reserved %d", conn_handle, config_id, create_context, main_mode_type, sub_mode_type, min_main_mode_steps, max_main_mode_steps,\
main_mode_repetition, mode_0_steps, role, rtt_type, cs_sync_phy, channel_map_repetition, channel_selection_type\
,ch3c_shape, ch3c_jump, reserved);
esp_log_buffer_hex_internal("channel_map", channel_map, 10, ESP_LOG_DEBUG);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_CREATE_CONFIG_PARAMS_LEN);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_CS_CREATE_CONFIG);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CREATE_CONFIG_PARAMS_LEN);
UINT16_TO_STREAM(pp, conn_handle);
UINT8_TO_STREAM(pp, config_id);
UINT8_TO_STREAM(pp, create_context);
UINT8_TO_STREAM(pp, main_mode_type);
UINT8_TO_STREAM(pp, sub_mode_type);
UINT8_TO_STREAM(pp, min_main_mode_steps);
UINT8_TO_STREAM(pp, max_main_mode_steps);
UINT8_TO_STREAM(pp, main_mode_repetition);
UINT8_TO_STREAM(pp, mode_0_steps);
UINT8_TO_STREAM(pp, role);
UINT8_TO_STREAM(pp, rtt_type);
UINT8_TO_STREAM(pp, cs_sync_phy);
ARRAY_TO_STREAM(pp, channel_map, 10);
UINT8_TO_STREAM(pp, channel_map_repetition);
UINT8_TO_STREAM(pp, channel_selection_type);
UINT8_TO_STREAM(pp, ch3c_shape);
UINT8_TO_STREAM(pp, ch3c_jump);
UINT8_TO_STREAM(pp, reserved);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
return (TRUE);
}
UINT8 btsnd_hcic_ble_cs_remove_config(UINT16 conn_handle, UINT8 config_id)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_ERROR("cs remove config, conn_handle %d config_id %d", conn_handle, config_id);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_REMOVE_CONFIG_PARAMS_LEN);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_CS_REMOVE_CONFIG);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_REMOVE_CONFIG_PARAMS_LEN);
UINT16_TO_STREAM(pp, conn_handle);
UINT8_TO_STREAM(pp, config_id);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
return TRUE;
}
UINT8 btsnd_hcic_ble_cs_set_channel_classification(UINT8 *channel_class)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("cs set channel class");
esp_log_buffer_hex_internal("channel", channel_class, 10, ESP_LOG_DEBUG);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_CHANNEL_CLASS_PARAMS_LEN);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_CS_SET_CAHNNEL_CLASS);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_CHANNEL_CLASS_PARAMS_LEN);
ARRAY_TO_STREAM(pp, channel_class, 10);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
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)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("cs set procedure params");
HCI_TRACE_DEBUG("conn_handle %d config_id %d max_procedure_len %d min_procedure_interval %d max_procedure_interval %d\
max_procedure_count %d min_subevent_len %d max_subevent_len %d tone_ant_config_selection %d phy %d tx_power_delta %d,\
preferred_peer_antenna %d SNR_control_initiator %d SNR_control_reflector %d\n",
conn_handle, config_id, max_procedure_len, min_procedure_interval, max_procedure_interval, max_procedure_count, min_subevent_len, max_subevent_len,
tone_ant_config_selection, phy, tx_power_delta, preferred_peer_antenna, SNR_control_initiator, SNR_control_reflector);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_PROCEDURE_PARAMS_LEN);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_CS_SET_PROCEDURE_PARAMS);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_PROCEDURE_PARAMS_LEN);
UINT16_TO_STREAM(pp, conn_handle);
UINT8_TO_STREAM(pp, config_id);
UINT16_TO_STREAM(pp, max_procedure_len);
UINT16_TO_STREAM(pp, min_procedure_interval);
UINT16_TO_STREAM(pp, max_procedure_interval);
UINT16_TO_STREAM(pp, max_procedure_count);
UINT24_TO_STREAM(pp, min_subevent_len);
UINT24_TO_STREAM(pp, max_subevent_len);
UINT8_TO_STREAM(pp, tone_ant_config_selection);
UINT8_TO_STREAM(pp, phy);
UINT8_TO_STREAM(pp, tx_power_delta);
UINT8_TO_STREAM(pp, preferred_peer_antenna);
UINT8_TO_STREAM(pp, SNR_control_initiator);
UINT8_TO_STREAM(pp, SNR_control_reflector);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_cs_procedure_enable(UINT16 conn_handle, UINT8 config_id, UINT8 enable)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("cs set procedure enable, conn_handle %d config_id %d enable %d", conn_handle, config_id, enable);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_PROCEDURE_ENABLE_PARAMS_LEN);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_CS_SET_PROCEDURE_ENABLE);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_PROCEDURE_ENABLE_PARAMS_LEN);
UINT16_TO_STREAM(pp, conn_handle);
UINT8_TO_STREAM(pp, config_id);
UINT8_TO_STREAM(pp, enable);
btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
return TRUE;
}
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
@@ -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
@@ -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
@@ -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