1 /* 2 * Copyright (c) 2018-2021 Arm Limited 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __BOOT_RECORD_H__ 18 #define __BOOT_RECORD_H__ 19 20 #include <stdint.h> 21 #include "bootutil/image.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /** 28 * @brief Add a data item to the shared data area between bootloader and 29 * runtime SW 30 * 31 * @param[in] major_type TLV major type, identify consumer 32 * @param[in] minor_type TLV minor type, identify TLV type 33 * @param[in] size length of added data 34 * @param[in] data pointer to data 35 * 36 * @return 0 on success; nonzero on failure. 37 */ 38 int boot_add_data_to_shared_area(uint8_t major_type, 39 uint16_t minor_type, 40 size_t size, 41 const uint8_t *data); 42 43 /** 44 * Add an image's all boot status information to the shared memory area 45 * between the bootloader and runtime SW. 46 * 47 * @param[in] sw_module Identifier of the SW component. 48 * @param[in] hdr Pointer to the image header stored in RAM. 49 * @param[in] fap Pointer to the flash area where image is stored. 50 * 51 * @return 0 on success; nonzero on failure. 52 */ 53 int boot_save_boot_status(uint8_t sw_module, 54 const struct image_header *hdr, 55 const struct flash_area *fap); 56 57 /** 58 * Add application specific data to the shared memory area between the 59 * bootloader and runtime SW. 60 * 61 * @param[in] hdr Pointer to the image header stored in RAM. 62 * @param[in] fap Pointer to the flash area where image is stored. 63 * 64 * @return 0 on success; nonzero on failure. 65 */ 66 int boot_save_shared_data(const struct image_header *hdr, 67 const struct flash_area *fap); 68 69 #ifdef __cplusplus 70 } 71 #endif 72 73 #endif /* __BOOT_RECORD_H__ */ 74