1 /*
2  * Copyright (c) 2023 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @file
9  * @brief Public API for boot mode interface
10  */
11 
12 #ifndef ZEPHYR_INCLUDE_RETENTION_BLINFO_
13 #define ZEPHYR_INCLUDE_RETENTION_BLINFO_
14 
15 #include <stdint.h>
16 #include <stddef.h>
17 #include <zephyr/kernel.h>
18 
19 #if defined(CONFIG_RETENTION_BOOTLOADER_INFO_TYPE_MCUBOOT)
20 #include <bootutil/boot_status.h>
21 #endif
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /**
28  * @brief Bootloader info interface
29  * @defgroup bootloader_info_interface Bootloader info interface
30  * @since 3.5
31  * @version 0.1.0
32  * @ingroup retention_api
33  * @{
34  */
35 
36 #if defined(CONFIG_RETENTION_BOOTLOADER_INFO_OUTPUT_FUNCTION) || defined(__DOXYGEN__)
37 /**
38  * @brief		Returns bootinfo information.
39  *
40  * @param key		The information to return (for MCUboot: minor TLV).
41  * @param val		Where the return information will be placed.
42  * @param val_len_max	The maximum size of the provided buffer.
43  *
44  * @retval >= 0		If successful (contains length of read value)
45  * @retval -EOVERFLOW	If the data is too large to fit the supplied buffer.
46  * @retval -EIO		If the requested key was not found.
47  * @retval -errno	Error code.
48  */
49 int blinfo_lookup(uint16_t key, char *val, int val_len_max);
50 #endif
51 
52 /**
53  * @}
54  */
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif /* ZEPHYR_INCLUDE_RETENTION_BLINFO_ */
61