Skip to content

Commit c5e7550

Browse files
cvinayakcarlescufi
authored andcommitted
Bluetooth: controller: Add function to calculate channel identifier
Added function to calculate channel identifier value required for Channel Selection Algorithm #2. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent b813616 commit c5e7550

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

subsys/bluetooth/controller/ll_sw/lll_chan.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ uint8_t lll_chan_sel_1(uint8_t *chan_use, uint8_t hop, uint16_t latency, uint8_t
4444
#endif /* CONFIG_BT_CONN */
4545

4646
#if defined(CONFIG_BT_CTLR_CHAN_SEL_2)
47+
uint16_t lll_chan_id(uint8_t *access_addr)
48+
{
49+
uint16_t aa_ls = ((uint16_t)access_addr[1] << 8) | access_addr[0];
50+
uint16_t aa_ms = ((uint16_t)access_addr[3] << 8) | access_addr[2];
51+
52+
return aa_ms ^ aa_ls;
53+
}
54+
4755
uint8_t lll_chan_sel_2(uint16_t counter, uint16_t chan_id, uint8_t *chan_map,
4856
uint8_t chan_count)
4957
{

subsys/bluetooth/controller/ll_sw/lll_chan.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66

77
uint8_t lll_chan_sel_1(uint8_t *chan_use, uint8_t hop, uint16_t latency, uint8_t *chan_map,
88
uint8_t chan_count);
9+
uint16_t lll_chan_id(uint8_t *access_addr);
910
uint8_t lll_chan_sel_2(uint16_t counter, uint16_t chan_id, uint8_t *chan_map,
1011
uint8_t chan_count);

0 commit comments

Comments
 (0)