Commit 073e627e authored by Vinayak Kariappa Chettimada's avatar Vinayak Kariappa Chettimada Committed by Fabio Baltieri
Browse files

Bluetooth: Controller: Fix ENTROPY_NRF5_RNG conditional compile



Fix ENTROPY_NRF5_RNG conditional compile when not enabled.

Signed-off-by: default avatarVinayak Kariappa Chettimada <vich@nordicsemi.no>
parent e1246ccb
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -122,7 +122,6 @@ choice BT_LL_CHOICE

config BT_LL_SW_SPLIT
	bool "Software-based BLE Link Layer"
	select ENTROPY_GENERATOR
	help
	  Use Zephyr software BLE Link Layer ULL LLL split implementation.

+2 −2
Original line number Diff line number Diff line
@@ -11,8 +11,8 @@ config BT_LLL_VENDOR_NORDIC
	depends on !$(dt_nodelabel_enabled,timer0)
	depends on !$(dt_nodelabel_enabled,rtc0)

	select ENTROPY_NRF5_RNG
	select ENTROPY_NRF5_BIAS_CORRECTION
	select ENTROPY_NRF5_RNG if BT_CTLR_CRYPTO
	select ENTROPY_NRF5_BIAS_CORRECTION if ENTROPY_NRF5_RNG

	select BT_HAS_HCI_VS
	select BT_CTLR_LE_ENC_SUPPORT if !BT_CTLR_DATA_LENGTH_CLEAR && \
+36 −0
Original line number Diff line number Diff line
@@ -59,7 +59,9 @@ static struct {
} event;

/* Entropy device */
#if defined(CONFIG_ENTROPY_NRF5_RNG)
static const struct device *const dev_entropy = DEVICE_DT_GET(DT_NODELABEL(rng));
#endif /* CONFIG_ENTROPY_NRF5_RNG */

static int init_reset(void);
#if defined(CONFIG_BT_CTLR_LOW_LAT_ULL_DONE)
@@ -173,10 +175,12 @@ int lll_init(void)
{
	int err;

#if defined(CONFIG_ENTROPY_NRF5_RNG)
	/* Get reference to entropy device */
	if (!device_is_ready(dev_entropy)) {
		return -ENODEV;
	}
#endif /* CONFIG_ENTROPY_NRF5_RNG */

	/* Initialise LLL internals */
	event.curr.abort_cb = NULL;
@@ -319,22 +323,54 @@ int lll_deinit(void)

int lll_csrand_get(void *buf, size_t len)
{
#if defined(CONFIG_ENTROPY_NRF5_RNG)
	return entropy_get_entropy(dev_entropy, buf, len);
#else
	/* FIXME: No suitable entropy device available yet.
	 *        It is required by Controller to use random numbers.
	 *        Hence, return uninitialized buf contents, for now.
	 */
	return 0;
#endif
}

int lll_csrand_isr_get(void *buf, size_t len)
{
#if defined(CONFIG_ENTROPY_NRF5_RNG)
	return entropy_get_entropy_isr(dev_entropy, buf, len, 0);
#else
	/* FIXME: No suitable entropy device available yet.
	 *        It is required by Controller to use random numbers.
	 *        Hence, return uninitialized buf contents, for now.
	 */
	return 0;
#endif
}

int lll_rand_get(void *buf, size_t len)
{
#if defined(CONFIG_ENTROPY_NRF5_RNG)
	return entropy_get_entropy(dev_entropy, buf, len);
#else
	/* FIXME: No suitable entropy device available yet.
	 *        It is required by Controller to use random numbers.
	 *        Hence, return uninitialized buf contents, for now.
	 */
	return 0;
#endif
}

int lll_rand_isr_get(void *buf, size_t len)
{
#if defined(CONFIG_ENTROPY_NRF5_RNG)
	return entropy_get_entropy_isr(dev_entropy, buf, len, 0);
#else
	/* FIXME: No suitable entropy device available yet.
	 *        It is required by Controller to use random numbers.
	 *        Hence, return uninitialized buf contents, for now.
	 */
	return 0;
#endif
}

int lll_reset(void)