Skip to content

Commit

Permalink
Bluetooth: controller: Rename ll_address_* to ll_addr_*
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
cvinayak authored and Anas Nashif committed Apr 29, 2017
1 parent c8cb20a commit b29b3e2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions subsys/bluetooth/controller/hci/hci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions subsys/bluetooth/controller/include/ll.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
22 changes: 15 additions & 7 deletions subsys/bluetooth/controller/ll_sw/ll.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit b29b3e2

Please sign in to comment.