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  * @ingroup retention_api
31  * @{
32  */
33 
34 #if IS_ENABLED(CONFIG_RETENTION_BOOTLOADER_INFO_OUTPUT_FUNCTION) || defined(__DOXYGEN__)
35 /**
36  * @brief		Returns bootinfo information.
37  *
38  * @param key		The information to return (for MCUboot: minor TLV).
39  * @param val		Where the return information will be placed.
40  * @param val_len_max	The maximum size of the provided buffer.
41  *
42  * @retval 0		If successful.
43  * @retval -EOVERFLOW	If the data is too large to fit the supplied buffer.
44  * @retval -EIO		If the requested key was not found.
45  * @retval -errno	Error code.
46  */
47 int blinfo_lookup(uint16_t key, char *val, int val_len_max);
48 #endif
49 
50 /**
51  * @}
52  */
53 
54 #ifdef __cplusplus
55 }
56 #endif
57 
58 #endif /* ZEPHYR_INCLUDE_RETENTION_BLINFO_ */
59