blob: 217a20684c5207358ab390348fe07e9948a4ecd0 [file] [log] [blame]
Tamas Bana9de4a62018-09-18 08:09:45 +01001/*
Tamas Ban5b647472019-01-05 08:59:30 +00002 * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
Tamas Bana9de4a62018-09-18 08:09:45 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef __BOOT_RECORD_H__
9#define __BOOT_RECORD_H__
10
11#include <stdint.h>
12#include <stddef.h>
13#include <limits.h>
Tamas Ban0e8ab302019-01-17 11:45:31 +000014#include "../ext/mcuboot/bootutil/include/bootutil/image.h"
15#include "../ext/mcuboot/include/flash_map/flash_map.h"
Tamas Bana9de4a62018-09-18 08:09:45 +010016
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/*!
22 * \enum shared_data_err_t
23 *
24 * \brief Return values for adding data entry to shared memory area
25 */
26enum shared_memory_err_t {
27 SHARED_MEMORY_OK = 0,
28 SHARED_MEMORY_OVERFLOW = 1,
29 SHARED_MEMORY_OVERWRITE = 2,
30
31 /* This is used to force the maximum size */
32 TLV_TYPE_MAX = INT_MAX
33};
34
35/*!
Tamas Ban0e8ab302019-01-17 11:45:31 +000036 * \enum boot_status_err_t
37 *
38 * \brief Return values for saving boot status information to shared memory are
39 */
40enum boot_status_err_t {
41 BOOT_STATUS_OK,
42 BOOT_STATUS_ERROR,
43};
44
45/*!
Tamas Bana9de4a62018-09-18 08:09:45 +010046 * \brief Add a data item to the shared data area between bootloader and
47 * runtime SW
48 *
49 * \param[in] major_type TLV major type, identify consumer
50 * \param[in] minor_type TLV minor type, identify TLV type
51 * \param[in] size length of added data
52 * \param[in] data pointer to data
53 *
54 * \return Returns error code as specified in \ref shared_memory_err_t
55 */
56enum shared_memory_err_t
57boot_add_data_to_shared_area(uint8_t major_type,
Tamas Ban5b647472019-01-05 08:59:30 +000058 uint16_t minor_type,
Tamas Bana9de4a62018-09-18 08:09:45 +010059 size_t size,
60 const uint8_t *data);
61
Tamas Ban0e8ab302019-01-17 11:45:31 +000062/*!
63 * \brief Add an image's all boot status information to the shared data area
64 * between bootloader and runtime SW
65 *
66 * \param[in] sw_module Identifier of the SW component
67 * \param[in] hdr Pointer to the image header stored in RAM
68 * \param[in] fap Pointer to the flash area where image is stored
69 *
70 * \return Returns error code as specified in \ref boot_status_err_t
71 */
72enum boot_status_err_t
73boot_save_boot_status(uint8_t sw_module,
74 const struct image_header *hdr,
75 const struct flash_area *fap);
76
Tamas Bana9de4a62018-09-18 08:09:45 +010077#ifdef __cplusplus
78}
79#endif
80
81#endif /* __BOOT_RECORD_H__ */