Skip to content

Commit bfe3c43

Browse files
bugo-nordicnashif
authored andcommitted
bluetooth: host Accommodate platform endianness for CS types
Modifies the CS bitfields that are used for accessing HCI event data to take platform endiannes into consideration. Signed-off-by: Burak Gorduk <[email protected]>
1 parent c5a126c commit bfe3c43

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

include/zephyr/bluetooth/hci_types.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3524,25 +3524,40 @@ struct bt_hci_evt_le_cs_config_complete {
35243524
#define BT_HCI_EVT_LE_CS_SUBEVENT_RESULT 0x31
35253525
/** Subevent result step data format: Mode 0 Initiator */
35263526
struct bt_hci_le_cs_step_data_mode_0_initiator {
3527+
#ifdef CONFIG_LITTLE_ENDIAN
35273528
uint8_t packet_quality_aa_check: 4;
35283529
uint8_t packet_quality_bit_errors: 4;
3530+
#else
3531+
uint8_t packet_quality_bit_errors: 4;
3532+
uint8_t packet_quality_aa_check: 4;
3533+
#endif /* CONFIG_LITTLE_ENDIAN */
35293534
uint8_t packet_rssi;
35303535
uint8_t packet_antenna;
35313536
uint16_t measured_freq_offset;
35323537
} __packed;
35333538

35343539
/** Subevent result step data format: Mode 0 Reflector */
35353540
struct bt_hci_le_cs_step_data_mode_0_reflector {
3541+
#ifdef CONFIG_LITTLE_ENDIAN
35363542
uint8_t packet_quality_aa_check: 4;
35373543
uint8_t packet_quality_bit_errors: 4;
3544+
#else
3545+
uint8_t packet_quality_bit_errors: 4;
3546+
uint8_t packet_quality_aa_check: 4;
3547+
#endif /* CONFIG_LITTLE_ENDIAN */
35383548
uint8_t packet_rssi;
35393549
uint8_t packet_antenna;
35403550
} __packed;
35413551

35423552
/** Subevent result step data format: Mode 1 */
35433553
struct bt_hci_le_cs_step_data_mode_1 {
3554+
#ifdef CONFIG_LITTLE_ENDIAN
35443555
uint8_t packet_quality_aa_check: 4;
35453556
uint8_t packet_quality_bit_errors: 4;
3557+
#else
3558+
uint8_t packet_quality_bit_errors: 4;
3559+
uint8_t packet_quality_aa_check: 4;
3560+
#endif /* CONFIG_LITTLE_ENDIAN */
35463561
uint8_t packet_nadm;
35473562
uint8_t packet_rssi;
35483563
union {
@@ -3554,8 +3569,13 @@ struct bt_hci_le_cs_step_data_mode_1 {
35543569

35553570
/** Subevent result step data format: Mode 1 with sounding sequence RTT support */
35563571
struct bt_hci_le_cs_step_data_mode_1_ss_rtt {
3572+
#ifdef CONFIG_LITTLE_ENDIAN
35573573
uint8_t packet_quality_aa_check: 4;
35583574
uint8_t packet_quality_bit_errors: 4;
3575+
#else
3576+
uint8_t packet_quality_bit_errors: 4;
3577+
uint8_t packet_quality_aa_check: 4;
3578+
#endif /* CONFIG_LITTLE_ENDIAN */
35593579
uint8_t packet_nadm;
35603580
uint8_t packet_rssi;
35613581
union {
@@ -3571,8 +3591,13 @@ struct bt_hci_le_cs_step_data_mode_1_ss_rtt {
35713591
/** Format for per-antenna path step data in modes 2 and 3 */
35723592
struct bt_hci_le_cs_step_data_tone_info {
35733593
uint8_t phase_correction_term[3];
3594+
#ifdef CONFIG_LITTLE_ENDIAN
35743595
uint8_t quality_indicator: 4;
35753596
uint8_t extension_indicator: 4;
3597+
#else
3598+
uint8_t extension_indicator: 4;
3599+
uint8_t quality_indicator: 4;
3600+
#endif /* CONFIG_LITTLE_ENDIAN */
35763601
} __packed;
35773602

35783603
/** Subevent result step data format: Mode 2 */
@@ -3583,8 +3608,13 @@ struct bt_hci_le_cs_step_data_mode_2 {
35833608

35843609
/** Subevent result step data format: Mode 3 */
35853610
struct bt_hci_le_cs_step_data_mode_3 {
3611+
#ifdef CONFIG_LITTLE_ENDIAN
35863612
uint8_t packet_quality_aa_check: 4;
35873613
uint8_t packet_quality_bit_errors: 4;
3614+
#else
3615+
uint8_t packet_quality_bit_errors: 4;
3616+
uint8_t packet_quality_aa_check: 4;
3617+
#endif /* CONFIG_LITTLE_ENDIAN */
35883618
uint8_t packet_nadm;
35893619
uint8_t packet_rssi;
35903620
union {
@@ -3598,8 +3628,13 @@ struct bt_hci_le_cs_step_data_mode_3 {
35983628

35993629
/** Subevent result step data format: Mode 3 with sounding sequence RTT support */
36003630
struct bt_hci_le_cs_step_data_mode_3_ss_rtt {
3631+
#ifdef CONFIG_LITTLE_ENDIAN
36013632
uint8_t packet_quality_aa_check: 4;
36023633
uint8_t packet_quality_bit_errors: 4;
3634+
#else
3635+
uint8_t packet_quality_bit_errors: 4;
3636+
uint8_t packet_quality_aa_check: 4;
3637+
#endif /* CONFIG_LITTLE_ENDIAN */
36033638
uint8_t packet_nadm;
36043639
uint8_t packet_rssi;
36053640
union {
@@ -3629,8 +3664,13 @@ struct bt_hci_evt_le_cs_subevent_result {
36293664
uint8_t reference_power_level;
36303665
uint8_t procedure_done_status;
36313666
uint8_t subevent_done_status;
3667+
#ifdef CONFIG_LITTLE_ENDIAN
36323668
uint8_t procedure_abort_reason: 4;
36333669
uint8_t subevent_abort_reason: 4;
3670+
#else
3671+
uint8_t subevent_abort_reason: 4;
3672+
uint8_t procedure_abort_reason: 4;
3673+
#endif /* CONFIG_LITTLE_ENDIAN */
36343674
uint8_t num_antenna_paths;
36353675
uint8_t num_steps_reported;
36363676
uint8_t steps[];

0 commit comments

Comments
 (0)