Bluetooth: Controller: Fix endianness issues for SyncInfo

Fix bitfield crossing byte boundary - replaced with macros for
setting/getting the values

Fix missing endianness conversion for evt_cntr

Changed aa from uint32_t to uint8_t[4] to align with the rest of
the code and avoid any potential endianness issues

Signed-off-by: Troels Nilsson <trnn@demant.com>
This commit is contained in:
Troels Nilsson 2023-10-10 16:01:47 +02:00 committed by Carles Cufí
commit 7d96c997e2
4 changed files with 43 additions and 34 deletions

View file

@ -7053,10 +7053,10 @@ static void le_ext_adv_report(struct pdu_data *pdu_data,
LOG_DBG(" SyncInfo offs = %u, offs_unit = 0x%x, "
"interval = 0x%x, sca = 0x%x, "
"chan map = 0x%x 0x%x 0x%x 0x%x 0x%x, "
"AA = 0x%x, CRC = 0x%x 0x%x 0x%x, "
"AA = 0x%x%x%x%x, CRC = 0x%x 0x%x 0x%x, "
"evt cntr = 0x%x",
sys_le16_to_cpu(si->offs),
si->offs_units,
PDU_ADV_SYNC_INFO_OFFSET_GET(si),
PDU_ADV_SYNC_INFO_OFFS_UNITS_GET(si),
sys_le16_to_cpu(si->interval),
((si->sca_chm[PDU_SYNC_INFO_SCA_CHM_SCA_BYTE_OFFSET] &
PDU_SYNC_INFO_SCA_CHM_SCA_BIT_MASK) >>
@ -7065,7 +7065,7 @@ static void le_ext_adv_report(struct pdu_data *pdu_data,
si->sca_chm[3],
(si->sca_chm[PDU_SYNC_INFO_SCA_CHM_SCA_BYTE_OFFSET] &
~PDU_SYNC_INFO_SCA_CHM_SCA_BIT_MASK),
sys_le32_to_cpu(si->aa),
si->aa[3], si->aa[2], si->aa[1], si->aa[0],
si->crc_init[0], si->crc_init[1],
si->crc_init[2], sys_le16_to_cpu(si->evt_cntr));
}