Julian Hall | 51a3fb3 | 2022-11-07 16:25:56 +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 FWU_RAW_INSTALLER_H |
| 9 | #define FWU_RAW_INSTALLER_H |
| 10 | |
| 11 | #include <stdbool.h> |
| 12 | #include <stddef.h> |
| 13 | #include <stdint.h> |
Gyorgy Szing | 3c44624 | 2023-03-31 01:53:15 +0200 | [diff] [blame] | 14 | |
| 15 | #include "common/uuid/uuid.h" |
| 16 | #include "media/volume/volume.h" |
| 17 | #include "service/fwu/installer/installer.h" |
Julian Hall | 51a3fb3 | 2022-11-07 16:25:56 +0000 | [diff] [blame] | 18 | |
| 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
| 23 | /** |
| 24 | * \brief raw_installer structure definition |
| 25 | * |
| 26 | * A raw_installer is an installer that takes the raw input image and writes |
| 27 | * it directly to the target storage volume with no intermediate processing. |
| 28 | * The raw_installer can be used for say installing a complete firmware image |
| 29 | * into a single volume. Because the raw_installer has no knowledge of the |
| 30 | * format of images that it installs, the assigned location_uuid is used |
| 31 | * by the enumerate method to advertise a single updatable image that |
| 32 | * corresponds to the entire raw contents of the associated target |
| 33 | * volume. Other sub-volume installers may advertise additional updatable |
| 34 | * images that reside within the same target volume. |
| 35 | */ |
| 36 | struct raw_installer { |
| 37 | struct installer base_installer; |
| 38 | struct volume *target_volume; |
| 39 | unsigned int commit_count; |
| 40 | size_t bytes_written; |
| 41 | bool is_open; |
| 42 | }; |
| 43 | |
| 44 | /** |
| 45 | * \brief Initialize a raw_installer |
| 46 | * |
| 47 | * \param[in] subject The subject raw_installer |
| 48 | * \param[in] location_uuid The associated location UUID |
| 49 | * \param[in] location_id Identifies where to install qualifying images |
| 50 | */ |
Gyorgy Szing | 3c44624 | 2023-03-31 01:53:15 +0200 | [diff] [blame] | 51 | void raw_installer_init(struct raw_installer *subject, const struct uuid_octets *location_uuid, |
| 52 | uint32_t location_id); |
Julian Hall | 51a3fb3 | 2022-11-07 16:25:56 +0000 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * \brief De-initialize a raw_installer |
| 56 | * |
| 57 | * \param[in] subject The subject raw_installer |
| 58 | */ |
| 59 | void raw_installer_deinit(struct raw_installer *subject); |
| 60 | |
| 61 | #ifdef __cplusplus |
| 62 | } |
| 63 | #endif |
| 64 | |
| 65 | #endif /* FWU_RAW_INSTALLER_H */ |