Skip to content

Commit d7cfb54

Browse files
cvinayakcfriedt
authored andcommitted
Bluetooth: Controller: Use defines for aux pointer offset unit value
Use defines for aux pointer offset unit value. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 651137e commit d7cfb54

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,10 +438,10 @@ static void pdu_b2b_aux_ptr_update(struct pdu_adv *pdu, uint8_t phy, uint8_t fla
438438
offset_us = offset_us / OFFS_UNIT_30_US;
439439
if ((offset_us >> 13) != 0) {
440440
aux_ptr->offs = offset_us / (OFFS_UNIT_300_US / OFFS_UNIT_30_US);
441-
aux_ptr->offs_units = 1U;
441+
aux_ptr->offs_units = OFFS_UNIT_VALUE_300_US;
442442
} else {
443443
aux_ptr->offs = offset_us;
444-
aux_ptr->offs_units = 0U;
444+
aux_ptr->offs_units = OFFS_UNIT_VALUE_30_US;
445445
}
446446
aux_ptr->chan_idx = chan_idx;
447447
aux_ptr->ca = (lll_clock_ppm_local_get() <= SCA_50_PPM) ?

subsys/bluetooth/controller/ll_sw/pdu.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,12 @@
103103
#define EVENT_INSTANT_LATENCY_MAX 0x7fff
104104

105105
/* Offset Units field encoding */
106-
#define OFFS_UNIT_30_US 30
107-
#define OFFS_UNIT_300_US 300
106+
#define OFFS_UNIT_30_US 30
107+
#define OFFS_UNIT_300_US 300
108+
#define OFFS_UNIT_VALUE_30_US 0
109+
#define OFFS_UNIT_VALUE_300_US 1
108110
/* Value specified in BT Spec. Vol 6, Part B, section 2.3.4.6 */
109-
#define OFFS_ADJUST_US 245760
111+
#define OFFS_ADJUST_US 245760
110112

111113
/* Advertiser's Sleep Clock Accuracy Value */
112114
#define SCA_500_PPM 500 /* 51 ppm to 500 ppm */

subsys/bluetooth/controller/ll_sw/ull_adv_aux.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ void ull_adv_aux_ptr_fill(uint8_t **dptr, uint8_t phy_s)
954954
aux_ptr->ca = (lll_clock_ppm_local_get() <= SCA_50_PPM) ?
955955
SCA_VALUE_50_PPM : SCA_VALUE_500_PPM;
956956

957-
aux_ptr->offs_units = 0U;
957+
aux_ptr->offs_units = OFFS_UNIT_VALUE_30_US;
958958
aux_ptr->offs = 0U;
959959

960960
aux_ptr->phy = find_lsb_set(phy_s) - 1;
@@ -1143,10 +1143,10 @@ struct pdu_adv_aux_ptr *ull_adv_aux_lll_offset_fill(struct pdu_adv *pdu,
11431143
offs = offs / OFFS_UNIT_30_US;
11441144
if (!!(offs >> 13)) {
11451145
aux_ptr->offs = offs / (OFFS_UNIT_300_US / OFFS_UNIT_30_US);
1146-
aux_ptr->offs_units = 1U;
1146+
aux_ptr->offs_units = OFFS_UNIT_VALUE_300_US;
11471147
} else {
11481148
aux_ptr->offs = offs;
1149-
aux_ptr->offs_units = 0U;
1149+
aux_ptr->offs_units = OFFS_UNIT_VALUE_30_US;
11501150
}
11511151

11521152
return aux_ptr;

subsys/bluetooth/controller/ll_sw/ull_adv_sync.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ void ull_adv_sync_info_fill(struct ll_adv_sync_set *sync,
903903
* If sync_info is part of ADV PDU the offs_adjust field
904904
* is always set to 0.
905905
*/
906-
si->offs_units = 0U;
906+
si->offs_units = OFFS_UNIT_VALUE_30_US;
907907
si->offs_adjust = 0U;
908908
si->offs = 0U;
909909

@@ -1610,10 +1610,10 @@ static inline void sync_info_offset_fill(struct pdu_adv_sync_info *si,
16101610
offs = offs / OFFS_UNIT_30_US;
16111611
if (!!(offs >> 13)) {
16121612
si->offs = offs / (OFFS_UNIT_300_US / OFFS_UNIT_30_US);
1613-
si->offs_units = 1U;
1613+
si->offs_units = OFFS_UNIT_VALUE_300_US;
16141614
} else {
16151615
si->offs = offs;
1616-
si->offs_units = 0U;
1616+
si->offs_units = OFFS_UNIT_VALUE_30_US;
16171617
}
16181618
}
16191619

0 commit comments

Comments
 (0)