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
3 changes: 2 additions & 1 deletion boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.dts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@

&radio {
status = "okay";
/* This feature is not yet supported by the RADIO model */
/* These features are not yet supported by the RADIO model */
/delete-property/ dfe-supported;
/delete-property/ cs-supported;
};

&clock {
Expand Down
7 changes: 7 additions & 0 deletions dts/bindings/net/wireless/nordic,nrf-radio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,10 @@ properties:
description: |
If set, indicates that the radio hardware supports high TX power
settings.

cs-supported:
type: boolean
description: |
If set, the radio hardware supports the BLE Channel Sounding feature.
This property should be treated as read-only and should not be overridden;
the correct value is provided for your target's SoC already.
1 change: 1 addition & 0 deletions dts/common/nordic/nrf54h20.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@
status = "disabled";
ble-2mbps-supported;
ble-coded-phy-supported;
cs-supported;
dfe-supported;
ieee802154-supported;
interrupts = <44 NRF_DEFAULT_IRQ_PRIORITY>;
Expand Down
1 change: 1 addition & 0 deletions dts/common/nordic/nrf54l15.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
ieee802154-supported;
ble-2mbps-supported;
ble-coded-phy-supported;
cs-supported;

ieee802154: ieee802154 {
compatible = "nordic,nrf-ieee802154";
Expand Down
270 changes: 266 additions & 4 deletions include/zephyr/bluetooth/conn.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,237 @@ struct bt_conn_le_cs_fae_table {
uint8_t *remote_fae_table;
};

/** Channel sounding main mode */
enum bt_conn_le_cs_main_mode {
/** Mode-1 (RTT) */
BT_CONN_LE_CS_MAIN_MODE_1 = BT_HCI_OP_LE_CS_MAIN_MODE_1,
/** Mode-2 (PBR) */
BT_CONN_LE_CS_MAIN_MODE_2 = BT_HCI_OP_LE_CS_MAIN_MODE_2,
/** Mode-3 (RTT and PBR) */
BT_CONN_LE_CS_MAIN_MODE_3 = BT_HCI_OP_LE_CS_MAIN_MODE_3,
};

/** Channel sounding sub mode */
enum bt_conn_le_cs_sub_mode {
/** Unused */
BT_CONN_LE_CS_SUB_MODE_UNUSED = BT_HCI_OP_LE_CS_SUB_MODE_UNUSED,
/** Mode-1 (RTT) */
BT_CONN_LE_CS_SUB_MODE_1 = BT_HCI_OP_LE_CS_SUB_MODE_1,
/** Mode-2 (PBR) */
BT_CONN_LE_CS_SUB_MODE_2 = BT_HCI_OP_LE_CS_SUB_MODE_2,
/** Mode-3 (RTT and PBR) */
BT_CONN_LE_CS_SUB_MODE_3 = BT_HCI_OP_LE_CS_SUB_MODE_3,
};

/** Channel sounding role */
enum bt_conn_le_cs_role {
/** CS initiator role */
BT_CONN_LE_CS_ROLE_INITIATOR,
/** CS reflector role */
BT_CONN_LE_CS_ROLE_REFLECTOR,
};

/** Channel sounding RTT type */
enum bt_conn_le_cs_rtt_type {
/** RTT AA only */
BT_CONN_LE_CS_RTT_TYPE_AA_ONLY = BT_HCI_OP_LE_CS_RTT_TYPE_AA_ONLY,
/** RTT with 32-bit sounding sequence */
BT_CONN_LE_CS_RTT_TYPE_32_BIT_SOUNDING = BT_HCI_OP_LE_CS_RTT_TYPE_32BIT_SOUND,
/** RTT with 96-bit sounding sequence */
BT_CONN_LE_CS_RTT_TYPE_96_BIT_SOUNDING = BT_HCI_OP_LE_CS_RTT_TYPE_96BIT_SOUND,
/** RTT with 32-bit random sequence */
BT_CONN_LE_CS_RTT_TYPE_32_BIT_RANDOM = BT_HCI_OP_LE_CS_RTT_TYPE_32BIT_RAND,
/** RTT with 64-bit random sequence */
BT_CONN_LE_CS_RTT_TYPE_64_BIT_RANDOM = BT_HCI_OP_LE_CS_RTT_TYPE_64BIT_RAND,
/** RTT with 96-bit random sequence */
BT_CONN_LE_CS_RTT_TYPE_96_BIT_RANDOM = BT_HCI_OP_LE_CS_RTT_TYPE_96BIT_RAND,
/** RTT with 128-bit random sequence */
BT_CONN_LE_CS_RTT_TYPE_128_BIT_RANDOM = BT_HCI_OP_LE_CS_RTT_TYPE_128BIT_RAND,
};

/** Channel sounding PHY used for CS sync */
enum bt_conn_le_cs_sync_phy {
/** LE 1M PHY */
BT_CONN_LE_CS_SYNC_1M_PHY = BT_HCI_OP_LE_CS_CS_SYNC_1M,
/** LE 2M PHY */
BT_CONN_LE_CS_SYNC_2M_PHY = BT_HCI_OP_LE_CS_CS_SYNC_2M,
/** LE 2M 2BT PHY */
BT_CONN_LE_CS_SYNC_2M_2BT_PHY = BT_HCI_OP_LE_CS_CS_SYNC_2M_2BT,
};

/** Channel sounding channel selection type */
enum bt_conn_le_cs_chsel_type {
/** Use Channel Selection Algorithm #3b for non-mode-0 CS steps */
BT_CONN_LE_CS_CHSEL_TYPE_3B = BT_HCI_OP_LE_CS_TEST_CHSEL_TYPE_3B,
/** Use Channel Selection Algorithm #3c for non-mode-0 CS steps */
BT_CONN_LE_CS_CHSEL_TYPE_3C = BT_HCI_OP_LE_CS_TEST_CHSEL_TYPE_3C,
};

/** Channel sounding channel sequence shape */
enum bt_conn_le_cs_ch3c_shape {
/** Use Hat shape for user-specified channel sequence */
BT_CONN_LE_CS_CH3C_SHAPE_HAT = BT_HCI_OP_LE_CS_TEST_CH3C_SHAPE_HAT,
/** Use X shape for user-specified channel sequence */
BT_CONN_LE_CS_CH3C_SHAPE_X = BT_HCI_OP_LE_CS_TEST_CH3C_SHAPE_X,
};

/** Channel sounding configuration */
struct bt_conn_le_cs_config {
/** CS configuration ID */
uint8_t id;
/** Main CS mode type */
enum bt_conn_le_cs_main_mode main_mode_type;
/** Sub CS mode type */
enum bt_conn_le_cs_sub_mode sub_mode_type;
/** Minimum number of CS main mode steps to be executed before a submode step is executed */
uint8_t min_main_mode_steps;
/** Maximum number of CS main mode steps to be executed before a submode step is executed */
uint8_t max_main_mode_steps;
/** Number of main mode steps taken from the end of the last CS subevent to be repeated
* at the beginning of the current CS subevent directly after the last mode-0 step of that
* event
*/
uint8_t main_mode_repetition;
/** Number of CS mode-0 steps to be included at the beginning of each CS subevent */
uint8_t mode_0_steps;
/** CS role */
enum bt_conn_le_cs_role role;
/** RTT type */
enum bt_conn_le_cs_rtt_type rtt_type;
/** CS Sync PHY */
enum bt_conn_le_cs_sync_phy cs_sync_phy;
/** The number of times the Channel_Map field will be cycled through for non-mode-0 steps
* within a CS procedure
*/
uint8_t channel_map_repetition;
/** Channel selection type */
enum bt_conn_le_cs_chsel_type channel_selection_type;
/** User-specified channel sequence shape */
enum bt_conn_le_cs_ch3c_shape ch3c_shape;
/** Number of channels skipped in each rising and falling sequence */
uint8_t ch3c_jump;
/** Interlude time in microseconds between the RTT packets */
uint8_t t_ip1_time_us;
/** Interlude time in microseconds between the CS tones */
uint8_t t_ip2_time_us;
/** Time in microseconds for frequency changes */
uint8_t t_fcs_time_us;
/** Time in microseconds for the phase measurement period of the CS tones */
uint8_t t_pm_time_us;
/** 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];
};

/** Procedure done status */
enum bt_conn_le_cs_procedure_done_status {
BT_CONN_LE_CS_PROCEDURE_COMPLETE = BT_HCI_LE_CS_PROCEDURE_DONE_STATUS_COMPLETE,
BT_CONN_LE_CS_PROCEDURE_INCOMPLETE = BT_HCI_LE_CS_PROCEDURE_DONE_STATUS_PARTIAL,
BT_CONN_LE_CS_PROCEDURE_ABORTED = BT_HCI_LE_CS_PROCEDURE_DONE_STATUS_ABORTED,
};

/** Subevent done status */
enum bt_conn_le_cs_subevent_done_status {
BT_CONN_LE_CS_SUBEVENT_COMPLETE = BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_COMPLETE,
BT_CONN_LE_CS_SUBEVENT_INCOMPLETE = BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_PARTIAL,
BT_CONN_LE_CS_SUBEVENT_ABORTED = BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_ABORTED,
};

/** Procedure abort reason */
enum bt_conn_le_cs_procedure_abort_reason {
BT_CONN_LE_CS_PROCEDURE_NOT_ABORTED = BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_NO_ABORT,
BT_CONN_LE_CS_PROCEDURE_ABORT_REQUESTED =
BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_LOCAL_HOST_OR_REMOTE_REQUEST,
BT_CONN_LE_CS_PROCEDURE_ABORT_TOO_FEW_CHANNELS =
BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_TOO_FEW_CHANNELS,
BT_CONN_LE_CS_PROCEDURE_ABORT_CHMAP_INSTANT_PASSED =
BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_CHMAP_INSTANT_PASSED,
BT_CONN_LE_CS_PROCEDURE_ABORT_UNSPECIFIED = BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_UNSPECIFIED,
};

/** Subevent abort reason */
enum bt_conn_le_cs_subevent_abort_reason {
BT_CONN_LE_CS_SUBEVENT_NOT_ABORTED = BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_NO_ABORT,
BT_CONN_LE_CS_SUBEVENT_ABORT_REQUESTED =
BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_LOCAL_HOST_OR_REMOTE_REQUEST,
BT_CONN_LE_CS_SUBEVENT_ABORT_NO_CS_SYNC =
BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_NO_CS_SYNC_RECEIVED,
BT_CONN_LE_CS_SUBEVENT_ABORT_SCHED_CONFLICT =
BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_SCHED_CONFLICT,
BT_CONN_LE_CS_SUBEVENT_ABORT_UNSPECIFIED = BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_UNSPECIFIED,
};

/** Subevent data for LE connections supporting CS */
struct bt_conn_le_cs_subevent_result {
struct {
/** CS configuration identifier.
*
* Range: 0 to 3
*
* If these results were generated by a CS Test,
* this value will be set to 0 and has no meaning.
*/
uint8_t config_id;
/** Starting ACL connection event counter.
*
* If these results were generated by a CS Test,
* this value will be set to 0 and has no meaning.
*/
uint16_t start_acl_conn_event;
/** CS procedure count associated with these results.
*
* This is the CS procedure count since the completion of
* the Channel Sounding Security Start procedure.
*/
uint16_t procedure_counter;
/** Frequency compensation value in units of 0.01 ppm.
*
* This is a 15-bit signed integer in the range [-100, 100] ppm.
*
* A value of @ref BT_HCI_LE_CS_SUBEVENT_RESULT_FREQ_COMPENSATION_NOT_AVAILABLE
* indicates that the role is not the initiator, or that the
* frequency compensation value is unavailable.
*/
uint16_t frequency_compensation;
/** Reference power level in dBm.
*
* Range: -127 to 20
*
* A value of @ref BT_HCI_LE_CS_REF_POWER_LEVEL_UNAVAILABLE indicates
* that the reference power level was not available during a subevent.
*/
int8_t reference_power_level;
/** Procedure status. */
enum bt_conn_le_cs_procedure_done_status procedure_done_status;
/** Subevent status. */
enum bt_conn_le_cs_subevent_done_status subevent_done_status;
/** Abort reason.
*
* If the procedure status is
* @ref BT_CONN_LE_CS_PROCEDURE_ABORTED, this field will
* specify the reason for the abortion.
*/
enum bt_conn_le_cs_procedure_abort_reason procedure_abort_reason;
/** Abort reason.
*
* If the subevent status is
* @ref BT_CONN_LE_CS_SUBEVENT_ABORTED, this field will
* specify the reason for the abortion.
*/
enum bt_conn_le_cs_subevent_abort_reason subevent_abort_reason;
/** Number of antenna paths used during the phase measurement stage.
*/
uint8_t num_antenna_paths;
/** Number of CS steps in the subevent.
*/
uint8_t num_steps_reported;
} header;
struct net_buf_simple *step_data_buf;
};

/** @brief Increment a connection's reference count.
*
* Increment the reference count of a connection object.
Expand Down Expand Up @@ -1519,8 +1750,8 @@ struct bt_conn_cb {
* @param conn Connection object.
* @param remote_cs_capabilities Remote Channel Sounding Capabilities.
*/
void (*remote_cs_capabilities_available)(struct bt_conn *conn,
struct bt_conn_le_cs_capabilities *params);
void (*le_cs_remote_capabilities_available)(struct bt_conn *conn,
struct bt_conn_le_cs_capabilities *params);

/** @brief LE CS Read Remote FAE Table Complete event.
*
Expand All @@ -1530,8 +1761,39 @@ struct bt_conn_cb {
* @param conn Connection object.
* @param params FAE Table.
*/
void (*remote_cs_fae_table_available)(struct bt_conn *conn,
struct bt_conn_le_cs_fae_table *params);
void (*le_cs_remote_fae_table_available)(struct bt_conn *conn,
struct bt_conn_le_cs_fae_table *params);

/** @brief LE CS Config created.
*
* This callback notifies the application that a Channel Sounding
* Configuration procedure has completed and a new CS config is created
*
* @param conn Connection object.
* @param config CS configuration.
*/
void (*le_cs_config_created)(struct bt_conn *conn, struct bt_conn_le_cs_config *config);

/** @brief LE CS Config removed.
*
* This callback notifies the application that a Channel Sounding
* Configuration procedure has completed and a CS config is removed
*
* @param conn Connection object.
* @param config_id ID of the CS configuration that was removed.
*/
void (*le_cs_config_removed)(struct bt_conn *conn, uint8_t config_id);

/** @brief Subevent Results from a CS procedure are available.
*
* This callback notifies the user that CS subevent results are
* available for the given connection object.
*
* @param conn Connection objects.
* @param result Subevent results
*/
void (*le_cs_subevent_data_available)(struct bt_conn *conn,
struct bt_conn_le_cs_subevent_result *result);
#endif

/** @internal Internally used field for list handling */
Expand Down
Loading
Loading