# 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.

menuconfig ENTROPY_NRF5_RNG
	bool "nRF5 RNG driver"
	default y
	depends on !ENTROPY_NRF_FORCE_ALT
	depends on DT_HAS_NORDIC_NRF_RNG_ENABLED
	select ENTROPY_HAS_DRIVER
	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 "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 $(UINT8_MAX)
	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 $(UINT8_MAX)
	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.

endif # ENTROPY_NRF5_RNG
