1# Flash simulator config
2
3# Copyright (c) 2018 Nordic Semiconductor ASA
4# SPDX-License-Identifier: Apache-2.0
5
6menuconfig FLASH_SIMULATOR
7	bool "Flash simulator"
8	select FLASH_HAS_PAGE_LAYOUT
9	select FLASH_HAS_DRIVER_ENABLED
10	help
11	  Enable the flash simulator.
12
13if FLASH_SIMULATOR
14
15config FLASH_SIMULATOR_UNALIGNED_READ
16	bool "Allow read access to be unaligned"
17	default y
18	help
19	 If selected, the reading operation does not check if access is aligned.
20	 Disable this option only if you want to simulate
21	 a specific FLASH interface that requires aligned read access.
22
23config FLASH_SIMULATOR_DOUBLE_WRITES
24	bool "Allow program units to be programmed more than once"
25	help
26	 If selected, writing to a non-erased program unit will succeed, otherwise, it will return an error.
27	 Keep in mind that write operations can only pull bits to zero, regardless.
28
29config FLASH_SIMULATOR_SIMULATE_TIMING
30	bool "Enable hardware timing simulation"
31
32if FLASH_SIMULATOR_SIMULATE_TIMING
33
34config FLASH_SIMULATOR_MIN_READ_TIME_US
35	int "Minimum read time (µS)"
36	default 2
37	range 1 1000000
38
39config FLASH_SIMULATOR_MIN_WRITE_TIME_US
40	int "Minimum write time (µS)"
41	default 100
42	range 1 1000000
43
44config FLASH_SIMULATOR_MIN_ERASE_TIME_US
45	int "Minimum erase time (µS)"
46	default 2000
47	range 1 1000000
48
49endif
50
51config FLASH_SIMULATOR_STATS
52	bool "flash operations statistic"
53	default y
54	select STATS
55	select STATS_NAMES
56	help
57	  Gather statistic measurement for flash simulator operations using the
58	  statistic subsystem.
59
60config FLASH_SIMULATOR_STAT_PAGE_COUNT
61	int "Pages under statistic"
62	depends on FLASH_SIMULATOR_STATS
63	range 1 256
64	default 256
65	help
66	  Only up to this number of beginning pages will be tracked
67	  while catching dedicated flash operations and thresholds.
68	  This number is not automatic because implementation uses
69	  UNTIL_REPEAT() macro, which is limited to take explicitly
70	  number of iterations.
71	  This is why it's not possible to calculate the number of pages with
72	  preprocessor using DT properties.
73
74endif # FLASH_SIMULATOR
75