1# STM32 entropy generator driver configuration
2
3# Copyright (c) 2017 Erwin Rol <erwin@erwinrol.com>
4# SPDX-License-Identifier: Apache-2.0
5
6DT_COMPAT_ST_STM32_RNG := st,stm32-rng
7
8menuconfig ENTROPY_STM32_RNG
9	bool "STM32 RNG driver"
10	depends on SOC_FAMILY_STM32
11	select ENTROPY_HAS_DRIVER
12	select USE_STM32_LL_RNG
13	default $(dt_compat_enabled,$(DT_COMPAT_ST_STM32_RNG))
14	help
15	  This option enables the RNG processor, which is a entropy number
16	  generator, based on a continuous analog noise, that provides
17	  a entropy 32-bit value to the host when read. It is available for
18	  F4 (except STM32F401 & STM32F411), L4, F7, H7 and G4 series.
19
20if ENTROPY_STM32_RNG
21
22config ENTROPY_STM32_THR_POOL_SIZE
23	int "Thread-mode random number pool size"
24	range ENTROPY_STM32_THR_THRESHOLD 256
25	default 8
26	help
27	  Buffer length in bytes used to store entropy bytes generated by the
28	  hardware to make them ready for thread mode consumers.
29	  Please note, that size of the pool must be a power of 2.
30
31config ENTROPY_STM32_THR_THRESHOLD
32	int "Thread-mode random number pool low-water threshold"
33	range 4 255
34	help
35	  Low water-mark threshold in bytes to trigger entropy generation for
36	  thread mode consumers. As soon as the number of available bytes in the
37	  buffer goes below this number hardware entropy generation will be
38	  started.
39
40config ENTROPY_STM32_ISR_POOL_SIZE
41	int "ISR-mode random number pool size"
42	range ENTROPY_STM32_ISR_THRESHOLD 256
43	default 16
44	help
45	  Buffer length in bytes used to store entropy bytes generated by the
46	  hardware to make them ready for ISR consumers.
47	  Please note, that size of the pool must be a power of 2.
48
49config ENTROPY_STM32_ISR_THRESHOLD
50	int "ISR-mode random number pool low-water threshold"
51	range 12 255
52	help
53	  Low water-mark threshold in bytes to trigger entropy generation for
54	  ISR consumers. As soon as the number of available bytes in the
55	  buffer goes below this number hardware entropy generation will be
56	  started.
57
58endif # ENTROPY_STM32_RNG
59