#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

menuconfig SUIT_CACHE
	bool "Enable SUIT cache support library"
	depends on ZCBOR
	imply SUIT_STREAM_SINK_RAM
	imply SUIT_STREAM

if SUIT_CACHE

config SUIT_CACHE_MAX_CACHES
	int "The maximum number of caches that will be handled"
	range 1 16
	help
	  The maximum number of user-defined caches is limited to 15.
	  User defined cache partitions names start at index 1 as suit_cache_0 is predefined.
	  The default value is 8, and the minimum is 1.
	default 8

config APP_LINK_WITH_SUIT_CACHE_INTERFACE
	bool
	default y

config SUIT_MAX_URI_LENGTH
	int "The maximum number of characters in uri used in fetch operations"
	range 1 512
	default 128
	help
		This option determines the longest URI that can be read or written from
		the cache.

config SUIT_CACHE_RW
	bool "Enable write mode for SUIT cache"
	depends on FLASH
	depends on SUIT_UTILS
	depends on !SUIT_PLATFORM_VARIANT_SDFW

config SUIT_CACHE0_ERASE_ON_ENVELOPE_STORED
	bool "Always erase the DFU cache partition 0 after the envelope is stored"
	help
		If this option is set then after the SUIT envelope is stored (more
		precisely: when calling the suit_dfu_cache_rw_initialize function)
		then Cache0 will be erased and reinitialized regardless of its previous
		state. If this option is not set, the SUIT subsystem will check the
		partition and only erase it if its broken and needs recovery.
		If this option is not set it is up to the user to ensure that the
		contents of cache0 are appropriate after the envelope is stored.
	depends on SUIT_CACHE_RW
	default y

config SUIT_CACHEX_ERASE_ON_INIT
	bool "Always erase the DFU cache partition 1 .. n on initialization"
	help
	  If this option is set the SUIT caches with ID 1 .. n will be erased
	  during cache initialization, if the cache partition is not already erased.

config SUIT_CACHEX_ERASE_BLOCK_SIZE
	int "Erase block size"
	default 4096
	help
		Erase block size of cache partitions 1 .. n.
		This configuration does not affect cache partition 0.

endif # SUIT_CACHE
