Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions include/zephyr/bluetooth/conn.h
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,24 @@ struct bt_conn_le_cs_capabilities {
* - Bit 4: 30dB
*/
uint8_t tx_snr_capability;
/** Supported T_IP2_IPT time durations during CS steps.
*
* - Bit 0: 10 us
* - Bit 1: 20 us
* - Bit 2: 30 us
* - Bit 3: 40 us
* - Bit 4: 50 us
* - Bit 5: 60 us
* - Bit 6: 80 us
*/
uint16_t t_ip2_ipt_times_supported;
/** Supported time in microseconds for the antenna switch period of the
* CS tones during IPT.
*
* 0x00, 0x01, 0x02, 0x04, or 0x0A - Time in microseconds for the
* antenna switch period of the CS tones
*/
uint8_t t_sw_ipt_time_supported;
};

/** Remote FAE Table for LE connections supporting CS */
Expand Down Expand Up @@ -825,6 +843,11 @@ struct bt_conn_le_cs_config {
enum bt_conn_le_cs_ch3c_shape ch3c_shape;
/** Number of channels skipped in each rising and falling sequence */
uint8_t ch3c_jump;
/** CS enhancements 1
* Bit 0 - IPT is enabled in the CS reflector.
* All other bits are reserved and shall be set to 0.
*/
uint8_t cs_enhancements_1;
/** Interlude time in microseconds between the RTT packets */
uint8_t t_ip1_time_us;
/** Interlude time in microseconds between the CS tones */
Expand Down
45 changes: 38 additions & 7 deletions include/zephyr/bluetooth/cs.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,13 @@
enum bt_conn_le_cs_rtt_type rtt_type;
/** CS Sync PHY */
enum bt_conn_le_cs_sync_phy cs_sync_phy;
/** Channel map used for CS procedure
* Channels n = 0, 1, 23, 24, 25, 77, and 78 are not allowed and shall be set to zero.
* Channel 79 is reserved for future use and shall be set to zero.
* At least 15 channels shall be enabled.
*/
uint8_t channel_map[10];
/** The number of times the Channel_Map field will be cycled through for non-mode-0 steps

Check notice on line 507 in include/zephyr/bluetooth/cs.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/bluetooth/cs.h:507 - uint8_t channel_map[10]; + uint8_t channel_map[10];
* within a CS procedure
*/
uint8_t channel_map_repetition;
Expand All @@ -508,12 +514,8 @@
enum bt_conn_le_cs_ch3c_shape ch3c_shape;
/** Number of channels skipped in each rising and falling sequence */
uint8_t ch3c_jump;
/** Channel map used for CS procedure
* Channels n = 0, 1, 23, 24, 25, 77, and 78 are not allowed and shall be set to zero.
* Channel 79 is reserved for future use and shall be set to zero.
* At least 15 channels shall be enabled.
*/
uint8_t channel_map[10];
/** CS enhancements 1 */
uint8_t cs_enhancements_1;
};

/** Callbacks for CS Test */
Expand Down Expand Up @@ -665,7 +667,7 @@
int bt_le_cs_create_config(struct bt_conn *conn, struct bt_le_cs_create_config_params *params,
enum bt_le_cs_create_config_context context);

/** @brief Create CS configuration
/** @brief Remove CS configuration
*
* This command is used to remove a CS configuration from the local controller
* identified by the config_id
Expand Down Expand Up @@ -852,6 +854,19 @@
*/
int bt_le_cs_read_local_supported_capabilities(struct bt_conn_le_cs_capabilities *ret);

/** @brief CS Read Local Supported Capabilities V2
*
* This command is used to read the CS capabilities that are supported
* by the local Controller.
*
* @note To use this API @kconfig{CONFIG_BT_CHANNEL_SOUNDING} must be set.
*
* @param ret Return values for the CS Procedure Enable command.
*
* @return Zero on success or (negative) error code on failure.
*/
int bt_le_cs_read_local_supported_capabilities_v2(struct bt_conn_le_cs_capabilities *ret);

/** @brief CS Write Cached Remote Supported Capabilities
*
* This command is used to write the cached copy of the CS capabilities
Expand All @@ -868,6 +883,22 @@
int bt_le_cs_write_cached_remote_supported_capabilities(
struct bt_conn *conn, const struct bt_conn_le_cs_capabilities *params);

/** @brief CS Write Cached Remote Supported Capabilities V2
*
* This command is used to write the cached copy of the CS capabilities
* that are supported by the remote Controller for the connection
* identified.
*
* @note To use this API @kconfig{CONFIG_BT_CHANNEL_SOUNDING} must be set.
*
* @param conn Connection Object.
* @param params Parameters for the CS Write Cached Remote Supported Capabilities command.
*
* @return Zero on success or (negative) error code on failure.
*/
int bt_le_cs_write_cached_remote_supported_capabilities_v2(
struct bt_conn *conn, const struct bt_conn_le_cs_capabilities *params);

/** @brief CS Write Cached Remote FAE Table
*
* This command is used to write a cached copy of the per-channel mode-0
Expand Down
178 changes: 175 additions & 3 deletions include/zephyr/bluetooth/hci_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2626,6 +2626,62 @@
uint8_t tx_snr_capability;
} __packed;

/** HCI opcode for LE Read Local Supported Capabilities (v2). */
#define BT_HCI_OP_LE_CS_READ_LOCAL_SUPPORTED_CAPABILITIES_V2 BT_OP(BT_OGF_LE, 0x00A5) /* 0x20A5 */
/** Test if LE Read Local Supported Capabilities v2 command is supported (octet 49, bit 2). */
#define BT_LE_CS_READ_LOCAL_SUPPORTED_CAPABILITIES_V2_SUPPORTED(cmd) \
BT_CMD_TEST(cmd, 49, 2)

/** HCI response parameters for LE Read Local Supported Capabilities command (v2). */
struct bt_hci_rp_le_read_local_supported_capabilities_v2 {
/** Status. */
uint8_t status;
/** Number of CS configurations supported. */
uint8_t num_config_supported;
/** Maximum consecutive procedures supported. */
uint16_t max_consecutive_procedures_supported;
/** Number of antennas supported. */
uint8_t num_antennas_supported;
/** Maximum antenna paths supported. */
uint8_t max_antenna_paths_supported;
/** Roles supported. */
uint8_t roles_supported;
/** Modes supported. */
uint8_t modes_supported;
/** RTT capability. */
uint8_t rtt_capability;
/** RTT AA-only N. */
uint8_t rtt_aa_only_n;
/** RTT sounding N. */
uint8_t rtt_sounding_n;
/** RTT random payload N. */
uint8_t rtt_random_payload_n;
/** NADM sounding capability. */
uint16_t nadm_sounding_capability;
/** NADM random capability. */
uint16_t nadm_random_capability;
/** CS sync PHYs supported. */
uint8_t cs_sync_phys_supported;
/** Subfeatures supported. */

Check notice on line 2665 in include/zephyr/bluetooth/hci_types.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/bluetooth/hci_types.h:2665 -#define BT_HCI_OP_LE_CS_READ_LOCAL_SUPPORTED_CAPABILITIES_V2 BT_OP(BT_OGF_LE, 0x00A5) /* 0x20A5 */ +#define BT_HCI_OP_LE_CS_READ_LOCAL_SUPPORTED_CAPABILITIES_V2 BT_OP(BT_OGF_LE, 0x00A5) /* 0x20A5 */ /** Test if LE Read Local Supported Capabilities v2 command is supported (octet 49, bit 2). */ -#define BT_LE_CS_READ_LOCAL_SUPPORTED_CAPABILITIES_V2_SUPPORTED(cmd) \ - BT_CMD_TEST(cmd, 49, 2) +#define BT_LE_CS_READ_LOCAL_SUPPORTED_CAPABILITIES_V2_SUPPORTED(cmd) BT_CMD_TEST(cmd, 49, 2) /** HCI response parameters for LE Read Local Supported Capabilities command (v2). */ struct bt_hci_rp_le_read_local_supported_capabilities_v2 { /** Status. */ - uint8_t status; + uint8_t status; /** Number of CS configurations supported. */ - uint8_t num_config_supported; + uint8_t num_config_supported; /** Maximum consecutive procedures supported. */ uint16_t max_consecutive_procedures_supported; /** Number of antennas supported. */ - uint8_t num_antennas_supported; + uint8_t num_antennas_supported; /** Maximum antenna paths supported. */ - uint8_t max_antenna_paths_supported; + uint8_t max_antenna_paths_supported; /** Roles supported. */ - uint8_t roles_supported; + uint8_t roles_supported; /** Modes supported. */ - uint8_t modes_supported; + uint8_t modes_supported; /** RTT capability. */ - uint8_t rtt_capability; + uint8_t rtt_capability; /** RTT AA-only N. */ - uint8_t rtt_aa_only_n; + uint8_t rtt_aa_only_n; /** RTT sounding N. */ - uint8_t rtt_sounding_n; + uint8_t rtt_sounding_n; /** RTT random payload N. */ - uint8_t rtt_random_payload_n; + uint8_t rtt_random_payload_n; /** NADM sounding capability. */ uint16_t nadm_sounding_capability; /** NADM random capability. */ uint16_t nadm_random_capability; /** CS sync PHYs supported. */ - uint8_t cs_sync_phys_supported; + uint8_t cs_sync_phys_supported;
uint16_t subfeatures_supported;
/** T_IP1 times supported. */
uint16_t t_ip1_times_supported;
/** T_IP2 times supported. */
uint16_t t_ip2_times_supported;
/** T_FCS times supported. */
uint16_t t_fcs_times_supported;
/** T_PM times supported. */
uint16_t t_pm_times_supported;
/** T_SW time supported. */
uint8_t t_sw_time_supported;
/** TX SNR capability. */
uint8_t tx_snr_capability;
/** T_IP2 IPT times supported. */
uint16_t t_ip2_ipt_times_supported;
/** T_SW IPT time supported. */
uint8_t t_sw_ipt_time_supported;
} __packed;

Check notice on line 2683 in include/zephyr/bluetooth/hci_types.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/bluetooth/hci_types.h:2683 - uint8_t t_sw_time_supported; + uint8_t t_sw_time_supported; /** TX SNR capability. */ - uint8_t tx_snr_capability; + uint8_t tx_snr_capability; /** T_IP2 IPT times supported. */ - uint16_t t_ip2_ipt_times_supported; + uint16_t t_ip2_ipt_times_supported; /** T_SW IPT time supported. */ - uint8_t t_sw_ipt_time_supported; + uint8_t t_sw_ipt_time_supported;

#define BT_HCI_OP_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES BT_OP(BT_OGF_LE, 0x008A) /* 0x208A */

struct bt_hci_cp_le_read_remote_supported_capabilities {
Expand Down Expand Up @@ -2659,6 +2715,60 @@
uint8_t tx_snr_capability;
} __packed;

/** HCI opcode for LE CS Write Cached Remote Supported Capabilities (v2). */
#define BT_HCI_OP_LE_CS_WRITE_CACHED_REMOTE_SUPPORTED_CAPABILITIES_V2 \
BT_OP(BT_OGF_LE, 0x00A6) /* 0x20A6 */

Check notice on line 2720 in include/zephyr/bluetooth/hci_types.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/bluetooth/hci_types.h:2720 -#define BT_HCI_OP_LE_CS_WRITE_CACHED_REMOTE_SUPPORTED_CAPABILITIES_V2 \ +#define BT_HCI_OP_LE_CS_WRITE_CACHED_REMOTE_SUPPORTED_CAPABILITIES_V2 \

/** HCI command parameters for LE CS Write Cached Remote Supported Capabilities (v2). */
struct bt_hci_cp_le_write_cached_remote_supported_capabilities_v2 {
/** Connection handle. */
uint16_t handle;
/** Number of CS configurations supported. */
uint8_t num_config_supported;
/** Maximum consecutive procedures supported. */
uint16_t max_consecutive_procedures_supported;
/** Number of antennas supported. */
uint8_t num_antennas_supported;
/** Maximum antenna paths supported. */
uint8_t max_antenna_paths_supported;
/** Roles supported. */
uint8_t roles_supported;
/** Modes supported. */
uint8_t modes_supported;
/** RTT capability. */
uint8_t rtt_capability;
/** RTT AA-only N. */
uint8_t rtt_aa_only_n;
/** RTT sounding N. */
uint8_t rtt_sounding_n;
/** RTT random payload N. */
uint8_t rtt_random_payload_n;
/** NADM sounding capability. */
uint16_t nadm_sounding_capability;
/** NADM random capability. */
uint16_t nadm_random_capability;
/** CS sync PHYs supported. */
uint8_t cs_sync_phys_supported;
/** Subfeatures supported. */

Check notice on line 2752 in include/zephyr/bluetooth/hci_types.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/bluetooth/hci_types.h:2752 - uint8_t num_config_supported; + uint8_t num_config_supported; /** Maximum consecutive procedures supported. */ uint16_t max_consecutive_procedures_supported; /** Number of antennas supported. */ - uint8_t num_antennas_supported; + uint8_t num_antennas_supported; /** Maximum antenna paths supported. */ - uint8_t max_antenna_paths_supported; + uint8_t max_antenna_paths_supported; /** Roles supported. */ - uint8_t roles_supported; + uint8_t roles_supported; /** Modes supported. */ - uint8_t modes_supported; + uint8_t modes_supported; /** RTT capability. */ - uint8_t rtt_capability; + uint8_t rtt_capability; /** RTT AA-only N. */ - uint8_t rtt_aa_only_n; + uint8_t rtt_aa_only_n; /** RTT sounding N. */ - uint8_t rtt_sounding_n; + uint8_t rtt_sounding_n; /** RTT random payload N. */ - uint8_t rtt_random_payload_n; + uint8_t rtt_random_payload_n; /** NADM sounding capability. */ uint16_t nadm_sounding_capability; /** NADM random capability. */ uint16_t nadm_random_capability; /** CS sync PHYs supported. */ - uint8_t cs_sync_phys_supported; + uint8_t cs_sync_phys_supported;
uint16_t subfeatures_supported;
/** T_IP1 times supported. */
uint16_t t_ip1_times_supported;
/** T_IP2 times supported. */
uint16_t t_ip2_times_supported;
/** T_FCS times supported. */
uint16_t t_fcs_times_supported;
/** T_PM times supported. */
uint16_t t_pm_times_supported;
/** T_SW time supported. */
uint8_t t_sw_time_supported;
/** TX SNR capability. */
uint8_t tx_snr_capability;
/** T_IP2 IPT times supported. */
uint16_t t_ip2_ipt_times_supported;
/** T_SW IPT time supported. */
uint8_t t_sw_ipt_time_supported;
} __packed;

Check notice on line 2770 in include/zephyr/bluetooth/hci_types.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/bluetooth/hci_types.h:2770 - uint8_t t_sw_time_supported; + uint8_t t_sw_time_supported; /** TX SNR capability. */ - uint8_t tx_snr_capability; + uint8_t tx_snr_capability; /** T_IP2 IPT times supported. */ - uint16_t t_ip2_ipt_times_supported; + uint16_t t_ip2_ipt_times_supported; /** T_SW IPT time supported. */ - uint8_t t_sw_ipt_time_supported; + uint8_t t_sw_ipt_time_supported;

#define BT_HCI_OP_LE_CS_SECURITY_ENABLE BT_OP(BT_OGF_LE, 0x008C) /* 0x208C */

struct bt_hci_cp_le_security_enable {
Expand Down Expand Up @@ -2865,8 +2975,9 @@
uint8_t t_pm_time;
uint8_t t_sw_time;
uint8_t tone_antenna_config_selection;
uint8_t reserved;
/** CS enhancements 1. */
uint8_t cs_enhancements_1;
uint8_t snr_control_initiator;

Check notice on line 2980 in include/zephyr/bluetooth/hci_types.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/bluetooth/hci_types.h:2980 - uint8_t cs_enhancements_1; + uint8_t cs_enhancements_1;
uint8_t snr_control_reflector;
uint16_t drbg_nonce;
uint8_t channel_map_repetition;
Expand Down Expand Up @@ -2895,8 +3006,9 @@
uint8_t channel_selection_type;
uint8_t ch3c_shape;
uint8_t ch3c_jump;
uint8_t reserved;
/** CS enhancements 1. */
uint8_t cs_enhancements_1;
} __packed;

Check notice on line 3011 in include/zephyr/bluetooth/hci_types.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/bluetooth/hci_types.h:3011 - uint8_t cs_enhancements_1; + uint8_t cs_enhancements_1;

#define BT_HCI_OP_LE_CS_REMOVE_CONFIG BT_OP(BT_OGF_LE, 0x0091) /* 0x2091 */

Expand Down Expand Up @@ -3871,6 +3983,7 @@
#define BT_HCI_LE_CS_TX_SNR_CAPABILITY_30DB_MASK BIT(4)

#define BT_HCI_EVT_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE 0x2C

struct bt_hci_evt_le_cs_read_remote_supported_capabilities_complete {
uint8_t status;
uint16_t conn_handle;
Expand All @@ -3896,6 +4009,61 @@
uint8_t tx_snr_capability;
} __packed;

/** HCI LE CS Read Remote Supported Capabilities Complete event (v2). */
#define BT_HCI_EVT_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE_V2 0x38

/** HCI event parameters for LE CS Read Remote Supported Capabilities Complete (v2). */
struct bt_hci_evt_le_cs_read_remote_supported_capabilities_complete_v2 {
/** Status. */
uint8_t status;
/** Connection handle. */
uint16_t conn_handle;
/** Number of CS configurations supported. */
uint8_t num_config_supported;
/** Maximum consecutive procedures supported. */
uint16_t max_consecutive_procedures_supported;
/** Number of antennas supported. */
uint8_t num_antennas_supported;
/** Maximum antenna paths supported. */
uint8_t max_antenna_paths_supported;
/** Roles supported. */
uint8_t roles_supported;
/** Modes supported. */
uint8_t modes_supported;
/** RTT capability. */
uint8_t rtt_capability;
/** RTT AA-only N. */
uint8_t rtt_aa_only_n;
/** RTT sounding N. */
uint8_t rtt_sounding_n;
/** RTT random payload N. */
uint8_t rtt_random_payload_n;
/** NADM sounding capability. */
uint16_t nadm_sounding_capability;
/** NADM random capability. */
uint16_t nadm_random_capability;
/** CS sync PHYs supported. */
uint8_t cs_sync_phys_supported;
/** Subfeatures supported. */

Check notice on line 4047 in include/zephyr/bluetooth/hci_types.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/bluetooth/hci_types.h:4047 - uint8_t status; + uint8_t status; /** Connection handle. */ uint16_t conn_handle; /** Number of CS configurations supported. */ - uint8_t num_config_supported; + uint8_t num_config_supported; /** Maximum consecutive procedures supported. */ uint16_t max_consecutive_procedures_supported; /** Number of antennas supported. */ - uint8_t num_antennas_supported; + uint8_t num_antennas_supported; /** Maximum antenna paths supported. */ - uint8_t max_antenna_paths_supported; + uint8_t max_antenna_paths_supported; /** Roles supported. */ - uint8_t roles_supported; + uint8_t roles_supported; /** Modes supported. */ - uint8_t modes_supported; + uint8_t modes_supported; /** RTT capability. */ - uint8_t rtt_capability; + uint8_t rtt_capability; /** RTT AA-only N. */ - uint8_t rtt_aa_only_n; + uint8_t rtt_aa_only_n; /** RTT sounding N. */ - uint8_t rtt_sounding_n; + uint8_t rtt_sounding_n; /** RTT random payload N. */ - uint8_t rtt_random_payload_n; + uint8_t rtt_random_payload_n; /** NADM sounding capability. */ uint16_t nadm_sounding_capability; /** NADM random capability. */ uint16_t nadm_random_capability; /** CS sync PHYs supported. */ - uint8_t cs_sync_phys_supported; + uint8_t cs_sync_phys_supported;
uint16_t subfeatures_supported;
/** T_IP1 times supported. */
uint16_t t_ip1_times_supported;
/** T_IP2 times supported. */
uint16_t t_ip2_times_supported;
/** T_FCS times supported. */
uint16_t t_fcs_times_supported;
/** T_PM times supported. */
uint16_t t_pm_times_supported;
/** T_SW time supported. */
uint8_t t_sw_time_supported;
/** TX SNR capability. */
uint8_t tx_snr_capability;
/** T_IP2 IPT times supported. */
uint16_t t_ip2_ipt_times_supported;
/** T_SW IPT time supported. */
uint8_t t_sw_ipt_time_supported;
} __packed;

Check notice on line 4065 in include/zephyr/bluetooth/hci_types.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/bluetooth/hci_types.h:4065 - uint8_t t_sw_time_supported; + uint8_t t_sw_time_supported; /** TX SNR capability. */ - uint8_t tx_snr_capability; + uint8_t tx_snr_capability; /** T_IP2 IPT times supported. */ uint16_t t_ip2_ipt_times_supported; /** T_SW IPT time supported. */ - uint8_t t_sw_ipt_time_supported; + uint8_t t_sw_ipt_time_supported;

#define BT_HCI_EVT_LE_CS_READ_REMOTE_FAE_TABLE_COMPLETE 0x2D
struct bt_hci_evt_le_cs_read_remote_fae_table_complete {
uint8_t status;
Expand Down Expand Up @@ -3932,7 +4100,8 @@
uint8_t channel_selection_type;
uint8_t ch3c_shape;
uint8_t ch3c_jump;
uint8_t reserved;
/** CS enhancements 1. */
uint8_t cs_enhancements_1;
uint8_t t_ip1_time;
uint8_t t_ip2_time;
uint8_t t_fcs_time;
Expand Down Expand Up @@ -4323,6 +4492,9 @@
#define BT_EVT_MASK_LE_FRAME_SPACE_UPDATE_COMPLETE BT_EVT_BIT(52)
#define BT_EVT_MASK_LE_CONN_RATE_CHANGE BT_EVT_BIT(54)

/** Event mask for LE CS Read Remote Supported Capabilities Complete (v2). */
#define BT_EVT_MASK_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE_V2 BT_EVT_BIT(55)

/** HCI Error Codes, BT Core Spec v5.4 [Vol 1, Part F]. */
#define BT_HCI_ERR_SUCCESS 0x00
#define BT_HCI_ERR_UNKNOWN_CMD 0x01
Expand Down
Loading
Loading