diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index 4dd97e746fed98..4709057d9218da 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -273,7 +273,7 @@ static void read_bd_addr(struct net_buf *buf, struct net_buf **evt) rp = cmd_complete(evt, sizeof(*rp)); rp->status = 0x00; - ll_address_get(0, &rp->bdaddr.val[0]); + ll_addr_get(0, &rp->bdaddr.val[0]); } 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) struct bt_hci_cp_le_set_random_address *cmd = (void *)buf->data; struct bt_hci_evt_cc_status *ccst; - ll_address_set(1, &cmd->bdaddr.val[0]); + ll_addr_set(1, &cmd->bdaddr.val[0]); ccst = cmd_complete(evt, sizeof(*ccst)); ccst->status = 0x00; diff --git a/subsys/bluetooth/controller/include/ll.h b/subsys/bluetooth/controller/include/ll.h index b1bf0584dc3673..e67f0cec140b7a 100644 --- a/subsys/bluetooth/controller/include/ll.h +++ b/subsys/bluetooth/controller/include/ll.h @@ -10,8 +10,8 @@ int ll_init(struct k_sem *sem_rx); void ll_reset(void); -void ll_address_get(u8_t addr_type, u8_t *p_bdaddr); -void ll_address_set(u8_t addr_type, u8_t const *const p_bdaddr); +u8_t *ll_addr_get(u8_t addr_type, u8_t *p_bdaddr); +void ll_addr_set(u8_t addr_type, u8_t const *const p_bdaddr); void ll_adv_params_set(u16_t interval, u8_t adv_type, u8_t own_addr_type, u8_t direct_addr_type, u8_t const *const p_direct_addr, u8_t chl_map, diff --git a/subsys/bluetooth/controller/ll_sw/ll.c b/subsys/bluetooth/controller/ll_sw/ll.c index a529a93eff9e97..203149056dc2d6 100644 --- a/subsys/bluetooth/controller/ll_sw/ll.c +++ b/subsys/bluetooth/controller/ll_sw/ll.c @@ -246,21 +246,29 @@ int ll_init(struct k_sem *sem_rx) return 0; } -void ll_address_get(u8_t addr_type, u8_t *bdaddr) +u8_t *ll_addr_get(u8_t addr_type, u8_t *bdaddr) { if (addr_type) { - memcpy(bdaddr, &_ll_context.rnd_addr[0], BDADDR_SIZE); - } else { - memcpy(bdaddr, &_ll_context.pub_addr[0], BDADDR_SIZE); + if (bdaddr) { + memcpy(bdaddr, _ll_context.rnd_addr, BDADDR_SIZE); + } + + return _ll_context.rnd_addr; } + + if (bdaddr) { + memcpy(bdaddr, _ll_context.pub_addr, BDADDR_SIZE); + } + + return _ll_context.pub_addr; } -void ll_address_set(u8_t addr_type, u8_t const *const bdaddr) +void ll_addr_set(u8_t addr_type, u8_t const *const bdaddr) { if (addr_type) { - memcpy(&_ll_context.rnd_addr[0], bdaddr, BDADDR_SIZE); + memcpy(_ll_context.rnd_addr, bdaddr, BDADDR_SIZE); } else { - memcpy(&_ll_context.pub_addr[0], bdaddr, BDADDR_SIZE); + memcpy(_ll_context.pub_addr, bdaddr, BDADDR_SIZE); } }