Skip to content

Commit b29b3e2

Browse files
cvinayakAnas Nashif
authored and
Anas Nashif
committed
Bluetooth: controller: Rename ll_address_* to ll_addr_*
Rename ll_address_* to ll_addr_*. Also, update ll_addr_get to return reference to stored public or random address. Change-id: I22cb0135d2223f679c4d9321f4724f8b7de0aede Signed-off-by: Vinayak Chettimada <[email protected]>
1 parent c8cb20a commit b29b3e2

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

subsys/bluetooth/controller/hci/hci.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static void read_bd_addr(struct net_buf *buf, struct net_buf **evt)
273273
rp = cmd_complete(evt, sizeof(*rp));
274274

275275
rp->status = 0x00;
276-
ll_address_get(0, &rp->bdaddr.val[0]);
276+
ll_addr_get(0, &rp->bdaddr.val[0]);
277277
}
278278

279279
static int info_cmd_handle(u8_t ocf, struct net_buf *cmd,
@@ -345,7 +345,7 @@ static void le_set_random_address(struct net_buf *buf, struct net_buf **evt)
345345
struct bt_hci_cp_le_set_random_address *cmd = (void *)buf->data;
346346
struct bt_hci_evt_cc_status *ccst;
347347

348-
ll_address_set(1, &cmd->bdaddr.val[0]);
348+
ll_addr_set(1, &cmd->bdaddr.val[0]);
349349

350350
ccst = cmd_complete(evt, sizeof(*ccst));
351351
ccst->status = 0x00;

subsys/bluetooth/controller/include/ll.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
int ll_init(struct k_sem *sem_rx);
1212
void ll_reset(void);
13-
void ll_address_get(u8_t addr_type, u8_t *p_bdaddr);
14-
void ll_address_set(u8_t addr_type, u8_t const *const p_bdaddr);
13+
u8_t *ll_addr_get(u8_t addr_type, u8_t *p_bdaddr);
14+
void ll_addr_set(u8_t addr_type, u8_t const *const p_bdaddr);
1515
void ll_adv_params_set(u16_t interval, u8_t adv_type,
1616
u8_t own_addr_type, u8_t direct_addr_type,
1717
u8_t const *const p_direct_addr, u8_t chl_map,

subsys/bluetooth/controller/ll_sw/ll.c

+15-7
Original file line numberDiff line numberDiff line change
@@ -246,21 +246,29 @@ int ll_init(struct k_sem *sem_rx)
246246
return 0;
247247
}
248248

249-
void ll_address_get(u8_t addr_type, u8_t *bdaddr)
249+
u8_t *ll_addr_get(u8_t addr_type, u8_t *bdaddr)
250250
{
251251
if (addr_type) {
252-
memcpy(bdaddr, &_ll_context.rnd_addr[0], BDADDR_SIZE);
253-
} else {
254-
memcpy(bdaddr, &_ll_context.pub_addr[0], BDADDR_SIZE);
252+
if (bdaddr) {
253+
memcpy(bdaddr, _ll_context.rnd_addr, BDADDR_SIZE);
254+
}
255+
256+
return _ll_context.rnd_addr;
255257
}
258+
259+
if (bdaddr) {
260+
memcpy(bdaddr, _ll_context.pub_addr, BDADDR_SIZE);
261+
}
262+
263+
return _ll_context.pub_addr;
256264
}
257265

258-
void ll_address_set(u8_t addr_type, u8_t const *const bdaddr)
266+
void ll_addr_set(u8_t addr_type, u8_t const *const bdaddr)
259267
{
260268
if (addr_type) {
261-
memcpy(&_ll_context.rnd_addr[0], bdaddr, BDADDR_SIZE);
269+
memcpy(_ll_context.rnd_addr, bdaddr, BDADDR_SIZE);
262270
} else {
263-
memcpy(&_ll_context.pub_addr[0], bdaddr, BDADDR_SIZE);
271+
memcpy(_ll_context.pub_addr, bdaddr, BDADDR_SIZE);
264272
}
265273
}
266274

0 commit comments

Comments
 (0)