From 5d13bf4e98d43f24842b840d07d94db9aac2a833 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 12 May 2020 18:27:16 +0530 Subject: [PATCH] Bluetooth: controller: split: Fix endianness in filling DID Handle endianness when filling the DID value in advertising PDU extended header. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ull_adv_aux.c | 6 +++--- subsys/bluetooth/controller/ll_sw/ull_adv_sync.c | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c b/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c index 003670a5a78..2bb1a23847b 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c @@ -376,7 +376,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, ui memcpy(ps, _ps, sizeof(struct ext_adv_adi)); _adi = (void *)_pp; - did = _adi->did; + did = sys_le16_to_cpu(_adi->did); } else { ap->sid = adv->sid; as->sid = adv->sid; @@ -387,8 +387,8 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, ui did++; } - ap->did = did; - as->did = did; + ap->did = sys_cpu_to_le16(did); + as->did = sys_cpu_to_le16(did); } /* No CTEInfo field in primary channel PDU */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c b/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c index 74055964c24..36aa32c0fd9 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c @@ -5,6 +5,7 @@ */ #include +#include #include #include "hal/ticker.h" @@ -279,7 +280,7 @@ uint8_t ll_adv_sync_param_set(uint8_t handle, uint16_t interval, uint16_t flags) si = (void *)ps; si->offs = 0; /* NOTE: Filled by secondary prepare */ si->offs_units = 0; - si->interval = interval; + si->interval = sys_cpu_to_le16(interval); memcpy(si->sca_chm, lll_sync->data_chan_map, sizeof(si->sca_chm)); memcpy(&si->aa, lll_sync->access_addr, sizeof(si->aa)); @@ -346,7 +347,7 @@ uint8_t ll_adv_sync_param_set(uint8_t handle, uint16_t interval, uint16_t flags) memcpy(ps, _ps, sizeof(struct ext_adv_adi)); _adi = (void *)_pp; - did = _adi->did; + did = sys_le16_to_cpu(_adi->did); } else { ap->sid = adv->sid; as->sid = adv->sid; @@ -354,8 +355,8 @@ uint8_t ll_adv_sync_param_set(uint8_t handle, uint16_t interval, uint16_t flags) did++; - ap->did = did; - as->did = did; + ap->did = sys_cpu_to_le16(did); + as->did = sys_cpu_to_le16(did); } /* No CTEInfo field in primary channel PDU */