Bluetooth: Controller: Rename hci_le_rand to bt_rand

Rename hci_le_rand to bt_rand and make its parameter types compatible.
This also includes updating rand_get() to use size_t instead of
uint32_t & uint8_t.

Change-Id: I4d434dfbbaf339b1bc7b451d358d07a291dd0375
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2017-01-09 13:49:37 +02:00
commit 815e15e3b2
5 changed files with 4 additions and 11 deletions

View file

@ -48,7 +48,7 @@ void rand_init(uint8_t *context, uint8_t context_len)
NRF_RNG->TASKS_START = 1;
}
uint32_t rand_get(uint8_t octets, uint8_t *rand)
size_t rand_get(size_t octets, uint8_t *rand)
{
uint8_t reserved;
uint8_t first;

View file

@ -19,7 +19,7 @@
#define _RAND_H_
void rand_init(uint8_t *context, uint8_t context_len);
uint32_t rand_get(uint8_t octets, uint8_t *rand);
size_t rand_get(size_t octets, uint8_t *rand);
void isr_rand(void *param);
#endif /* _RAND_H_ */

View file

@ -572,7 +572,7 @@ static void le_rand(struct net_buf *buf, struct net_buf *evt)
rp = cmd_complete(evt, sizeof(*rp));
rp->status = 0x00;
hci_le_rand(rp->rand, count);
bt_rand(rp->rand, count);
}
static void le_start_encryption(struct net_buf *buf, struct net_buf *evt)

View file

@ -82,7 +82,7 @@ static BT_STACK_NOINIT(recv_thread_stack, CONFIG_BLUETOOTH_RX_STACK_SIZE);
K_MUTEX_DEFINE(mutex_rand);
void hci_le_rand(void *buf, uint8_t len)
int bt_rand(void *buf, size_t len)
{
while (len) {
k_mutex_lock(&mutex_rand, K_FOREVER);
@ -92,12 +92,6 @@ void hci_le_rand(void *buf, uint8_t len)
cpu_sleep();
}
}
}
int bt_rand(void *buf, size_t len)
{
LL_ASSERT(len < UINT8_MAX);
hci_le_rand(buf, (uint8_t) len);
return 0;
}

View file

@ -23,6 +23,5 @@ int hci_acl_handle(struct net_buf *acl);
void hci_evt_encode(struct radio_pdu_node_rx *node_rx, struct net_buf *buf);
void hci_acl_encode(struct radio_pdu_node_rx *node_rx, struct net_buf *buf);
void hci_num_cmplt_encode(struct net_buf *buf, uint16_t handle, uint8_t num);
void hci_le_rand(void *buf, uint8_t len);
bool hci_evt_is_discardable(struct radio_pdu_node_rx *node_rx);
#endif /* _HCI_CONTROLLER_H_ */