zephyr/drivers/entropy/Kconfig.nrf5
Thomas Stenersen db90e24326 drivers: nrf: add support for forcing driver implementation
An external project extending the Zephyr RTOS and its drivers may have
subsystems that must use its own specific driver(s) when active. One
example is the nRF5x NVMC that must be scheduled in between radio
operations. A subsystem may also be dependent on its own drivers for
security, real-time and/or because of hardware constrains.

In order to not introduce non-Zephyr specific code into the Zephyr tree,
an option is added to disable the in-tree drivers in Zephyr. Because
Kconfig does not support a good way of de-selecting other symbols, a
variable on the form `<DRIVER>_FORCE_ALT` is added as a
dependency for each `<DRIVER>`. For example, the out-of-tree subsystem
will select `FLASH_NRF_FORCE_ALT` to disable the in-tree driver. A
solution for issue #8181 would open up for a more general solution,
however #8181 requires significant effort.

Support for out-of-tree drivers is added to Nordic drivers for
clock_control, entropy and flash.

A generic solution for this is desired. Issue #14527 is tracking that
progress.

Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2019-03-20 10:27:28 -05:00

84 lines
2.5 KiB
Plaintext

# Kconfig.nrf5 - nRF5 entropy generator driver configuration
#
# Copyright (c) 2018 Nordic Semiconductor ASA
# Copyright (c) 2017 Exati Tecnologia Ltda.
#
# SPDX-License-Identifier: Apache-2.0
config ENTROPY_NRF_FORCE_ALT
bool
depends on SOC_COMPATIBLE_NRF
help
This option can be enabled to force an alternative implementation
of the entropy driver.
if !ENTROPY_NRF_FORCE_ALT
menuconfig ENTROPY_NRF5_RNG
bool "nRF5 RNG driver"
depends on SOC_COMPATIBLE_NRF
select ENTROPY_HAS_DRIVER
default y
help
This option enables the RNG peripheral, which is a random number
generator, based on internal thermal noise, that provides a
random 8-bit value to the host when read.
if ENTROPY_NRF5_RNG
config ENTROPY_NRF5_BIAS_CORRECTION
bool "Enable bias correction (uniform distribution)"
help
This option enables the RNG bias correction, which guarantees a
uniform distribution of 0 and 1. When this option is enabled, the time
to generate a byte cannot be guaranteed.
config ENTROPY_NRF5_THR_POOL_SIZE
int "Thread-mode random number pool size"
range ENTROPY_NRF5_THR_THRESHOLD 256
default 8
help
Buffer length in bytes used to store entropy bytes generated by the
hardware to make them ready for thread mode consumers.
Please note, that size of the pool must be a power of 2.
config ENTROPY_NRF5_THR_THRESHOLD
int "Thread-mode random number pool low-water threshold"
range 4 255
help
Low water-mark threshold in bytes to trigger entropy generation for
thread mode consumers. As soon as the number of available bytes in the
buffer goes below this number hardware entropy generation will be
started.
config ENTROPY_NRF5_ISR_POOL_SIZE
int "ISR-mode random number pool size"
range ENTROPY_NRF5_ISR_THRESHOLD 256
default 16
help
Buffer length in bytes used to store entropy bytes generated by the
hardware to make them ready for ISR consumers.
Please note, that size of the pool must be a power of 2.
config ENTROPY_NRF5_ISR_THRESHOLD
int "ISR-mode random number pool low-water threshold"
range 12 255
help
Low water-mark threshold in bytes to trigger entropy generation for
ISR consumers. As soon as the number of available bytes in the
buffer goes below this number hardware entropy generation will be
started.
config ENTROPY_NRF5_PRI
int "RNG interrupt priority"
range 0 2 if SOC_SERIES_NRF51X
range 0 5 if SOC_COMPATIBLE_NRF52X
default 2 if SOC_SERIES_NRF51X
default 5 if SOC_COMPATIBLE_NRF52X
help
nRF5X RNG IRQ priority.
endif # ENTROPY_NRF5_RNG
endif # !ENTROPY_NRF_FORCE_ALT