Skip to content

Commit 61ab7e6

Browse files
bugo-nordicivaniushkov
authored andcommitted
[nrf fromtree] bluetooth: host: HCI support for CS configuration
Adds following HCI support for CS configuration: - LE CS Create Config command - LE CS Remove Config command - LE CS Config Complete event Two callbacks have been added to notify the application when a new CS configuration is created or an existing CS configuration is removed. Signed-off-by: Burak Gorduk <[email protected]> (cherry picked from commit 7b82214)
1 parent 9735986 commit 61ab7e6

File tree

10 files changed

+749
-96
lines changed

10 files changed

+749
-96
lines changed

include/zephyr/bluetooth/conn.h

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,131 @@ struct bt_conn_le_cs_fae_table {
413413
uint8_t *remote_fae_table;
414414
};
415415

416+
/** Channel sounding main mode */
417+
enum bt_conn_le_cs_main_mode {
418+
/** Mode-1 (RTT) */
419+
BT_CONN_LE_CS_MAIN_MODE_1 = BT_HCI_OP_LE_CS_MAIN_MODE_1,
420+
/** Mode-2 (PBR) */
421+
BT_CONN_LE_CS_MAIN_MODE_2 = BT_HCI_OP_LE_CS_MAIN_MODE_2,
422+
/** Mode-3 (RTT and PBR) */
423+
BT_CONN_LE_CS_MAIN_MODE_3 = BT_HCI_OP_LE_CS_MAIN_MODE_3,
424+
};
425+
426+
/** Channel sounding sub mode */
427+
enum bt_conn_le_cs_sub_mode {
428+
/** Unused */
429+
BT_CONN_LE_CS_SUB_MODE_UNUSED = BT_HCI_OP_LE_CS_SUB_MODE_UNUSED,
430+
/** Mode-1 (RTT) */
431+
BT_CONN_LE_CS_SUB_MODE_1 = BT_HCI_OP_LE_CS_SUB_MODE_1,
432+
/** Mode-2 (PBR) */
433+
BT_CONN_LE_CS_SUB_MODE_2 = BT_HCI_OP_LE_CS_SUB_MODE_2,
434+
/** Mode-3 (RTT and PBR) */
435+
BT_CONN_LE_CS_SUB_MODE_3 = BT_HCI_OP_LE_CS_SUB_MODE_3,
436+
};
437+
438+
/** Channel sounding role */
439+
enum bt_conn_le_cs_role {
440+
/** CS initiator role */
441+
BT_CONN_LE_CS_ROLE_INITIATOR,
442+
/** CS reflector role */
443+
BT_CONN_LE_CS_ROLE_REFLECTOR,
444+
};
445+
446+
/** Channel sounding RTT type */
447+
enum bt_conn_le_cs_rtt_type {
448+
/** RTT AA only */
449+
BT_CONN_LE_CS_RTT_TYPE_AA_ONLY = BT_HCI_OP_LE_CS_RTT_TYPE_AA_ONLY,
450+
/** RTT with 32-bit sounding sequence */
451+
BT_CONN_LE_CS_RTT_TYPE_32_BIT_SOUNDING = BT_HCI_OP_LE_CS_RTT_TYPE_32BIT_SOUND,
452+
/** RTT with 96-bit sounding sequence */
453+
BT_CONN_LE_CS_RTT_TYPE_96_BIT_SOUNDING = BT_HCI_OP_LE_CS_RTT_TYPE_96BIT_SOUND,
454+
/** RTT with 32-bit random sequence */
455+
BT_CONN_LE_CS_RTT_TYPE_32_BIT_RANDOM = BT_HCI_OP_LE_CS_RTT_TYPE_32BIT_RAND,
456+
/** RTT with 64-bit random sequence */
457+
BT_CONN_LE_CS_RTT_TYPE_64_BIT_RANDOM = BT_HCI_OP_LE_CS_RTT_TYPE_64BIT_RAND,
458+
/** RTT with 96-bit random sequence */
459+
BT_CONN_LE_CS_RTT_TYPE_96_BIT_RANDOM = BT_HCI_OP_LE_CS_RTT_TYPE_96BIT_RAND,
460+
/** RTT with 128-bit random sequence */
461+
BT_CONN_LE_CS_RTT_TYPE_128_BIT_RANDOM = BT_HCI_OP_LE_CS_RTT_TYPE_128BIT_RAND,
462+
};
463+
464+
/** Channel sounding PHY used for CS sync */
465+
enum bt_conn_le_cs_sync_phy {
466+
/** LE 1M PHY */
467+
BT_CONN_LE_CS_SYNC_1M_PHY = BT_HCI_OP_LE_CS_CS_SYNC_1M,
468+
/** LE 2M PHY */
469+
BT_CONN_LE_CS_SYNC_2M_PHY = BT_HCI_OP_LE_CS_CS_SYNC_2M,
470+
/** LE 2M 2BT PHY */
471+
BT_CONN_LE_CS_SYNC_2M_2BT_PHY = BT_HCI_OP_LE_CS_CS_SYNC_2M_2BT,
472+
};
473+
474+
/** Channel sounding channel selection type */
475+
enum bt_conn_le_cs_chsel_type {
476+
/** Use Channel Selection Algorithm #3b for non-mode-0 CS steps */
477+
BT_CONN_LE_CS_CHSEL_TYPE_3B = BT_HCI_OP_LE_CS_TEST_CHSEL_TYPE_3B,
478+
/** Use Channel Selection Algorithm #3c for non-mode-0 CS steps */
479+
BT_CONN_LE_CS_CHSEL_TYPE_3C = BT_HCI_OP_LE_CS_TEST_CHSEL_TYPE_3C,
480+
};
481+
482+
/** Channel sounding channel sequence shape */
483+
enum bt_conn_le_cs_ch3c_shape {
484+
/** Use Hat shape for user-specified channel sequence */
485+
BT_CONN_LE_CS_CH3C_SHAPE_HAT = BT_HCI_OP_LE_CS_TEST_CH3C_SHAPE_HAT,
486+
/** Use X shape for user-specified channel sequence */
487+
BT_CONN_LE_CS_CH3C_SHAPE_X = BT_HCI_OP_LE_CS_TEST_CH3C_SHAPE_X,
488+
};
489+
490+
/** Channel sounding configuration */
491+
struct bt_conn_le_cs_config {
492+
/** CS configuration ID */
493+
uint8_t id;
494+
/** Main CS mode type */
495+
enum bt_conn_le_cs_main_mode main_mode_type;
496+
/** Sub CS mode type */
497+
enum bt_conn_le_cs_sub_mode sub_mode_type;
498+
/** Minimum number of CS main mode steps to be executed before a submode step is executed */
499+
uint8_t min_main_mode_steps;
500+
/** Maximum number of CS main mode steps to be executed before a submode step is executed */
501+
uint8_t max_main_mode_steps;
502+
/** Number of main mode steps taken from the end of the last CS subevent to be repeated
503+
* at the beginning of the current CS subevent directly after the last mode-0 step of that
504+
* event
505+
*/
506+
uint8_t main_mode_repetition;
507+
/** Number of CS mode-0 steps to be included at the beginning of each CS subevent */
508+
uint8_t mode_0_steps;
509+
/** CS role */
510+
enum bt_conn_le_cs_role role;
511+
/** RTT type */
512+
enum bt_conn_le_cs_rtt_type rtt_type;
513+
/** CS Sync PHY */
514+
enum bt_conn_le_cs_sync_phy cs_sync_phy;
515+
/** The number of times the Channel_Map field will be cycled through for non-mode-0 steps
516+
* within a CS procedure
517+
*/
518+
uint8_t channel_map_repetition;
519+
/** Channel selection type */
520+
enum bt_conn_le_cs_chsel_type channel_selection_type;
521+
/** User-specified channel sequence shape */
522+
enum bt_conn_le_cs_ch3c_shape ch3c_shape;
523+
/** Number of channels skipped in each rising and falling sequence */
524+
uint8_t ch3c_jump;
525+
/** Interlude time in microseconds between the RTT packets */
526+
uint8_t t_ip1_time_us;
527+
/** Interlude time in microseconds between the CS tones */
528+
uint8_t t_ip2_time_us;
529+
/** Time in microseconds for frequency changes */
530+
uint8_t t_fcs_time_us;
531+
/** Time in microseconds for the phase measurement period of the CS tones */
532+
uint8_t t_pm_time_us;
533+
/** Channel map used for CS procedure
534+
* Channels n = 0, 1, 23, 24, 25, 77, and 78 are not allowed and shall be set to zero.
535+
* Channel 79 is reserved for future use and shall be set to zero.
536+
* At least 15 channels shall be enabled.
537+
*/
538+
uint8_t channel_map[10];
539+
};
540+
416541
/** @brief Increment a connection's reference count.
417542
*
418543
* Increment the reference count of a connection object.
@@ -1532,6 +1657,26 @@ struct bt_conn_cb {
15321657
*/
15331658
void (*remote_cs_fae_table_available)(struct bt_conn *conn,
15341659
struct bt_conn_le_cs_fae_table *params);
1660+
1661+
/** @brief LE CS Config created.
1662+
*
1663+
* This callback notifies the application that a Channel Sounding
1664+
* Configuration procedure has completed and a new CS config is created
1665+
*
1666+
* @param conn Connection object.
1667+
* @param config CS configuration.
1668+
*/
1669+
void (*le_cs_config_created)(struct bt_conn *conn, struct bt_conn_le_cs_config *config);
1670+
1671+
/** @brief LE CS Config removed.
1672+
*
1673+
* This callback notifies the application that a Channel Sounding
1674+
* Configuration procedure has completed and a CS config is removed
1675+
*
1676+
* @param conn Connection object.
1677+
* @param config_id ID of the CS configuration that was removed.
1678+
*/
1679+
void (*le_cs_config_removed)(struct bt_conn *conn, uint8_t config_id);
15351680
#endif
15361681

15371682
/** @internal Internally used field for list handling */

0 commit comments

Comments
 (0)