Julian Hall | e35efa5 | 2022-10-31 16:34:58 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef IMG_DIR_SERIALIZER_H |
| 9 | #define IMG_DIR_SERIALIZER_H |
| 10 | |
| 11 | #include <stddef.h> |
| 12 | #include <stdint.h> |
| 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
| 18 | /** |
| 19 | * Interface dependencies |
| 20 | */ |
| 21 | struct fw_directory; |
| 22 | struct fw_store; |
| 23 | |
| 24 | /** |
| 25 | * \brief Serialize the public image directory |
| 26 | * |
| 27 | * Using content from the internal fw_directory and fw_store, create |
| 28 | * a serialized image_directory that conforms to the FWU-A specification |
| 29 | * format. |
| 30 | * |
| 31 | * \param[in] fw_dir Source fw_directory |
| 32 | * \param[in] fw_store Source fw_store |
| 33 | * \param[in] buf Serialize into this buffer |
| 34 | * \param[in] buf_size Size of buffer |
| 35 | * \param[out] data_len Length of serialized data |
| 36 | * |
| 37 | * \return Status |
| 38 | */ |
| 39 | int img_dir_serializer_serialize( |
| 40 | const struct fw_directory *fw_dir, |
| 41 | const struct fw_store *fw_store, |
| 42 | uint8_t *buf, |
| 43 | size_t buf_size, |
| 44 | size_t *data_len); |
| 45 | |
| 46 | /** |
| 47 | * \brief Return the length in bytes of the serialized image directory |
| 48 | * |
| 49 | * \param[in] fw_dir Source fw_directory |
| 50 | * |
| 51 | * \return Size in bytes |
| 52 | */ |
| 53 | size_t img_dir_serializer_get_len( |
| 54 | const struct fw_directory *fw_dir); |
| 55 | |
| 56 | #ifdef __cplusplus |
| 57 | } |
| 58 | #endif |
| 59 | |
| 60 | #endif /* IMG_DIR_SERIALIZER_H */ |