Simulated product dispenser
Fork of mbed-cloud-workshop-connect-HTS221 by
arm_uc_pal_flashiap_implementation.h
00001 // ---------------------------------------------------------------------------- 00002 // Copyright 2016-2017 ARM Ltd. 00003 // 00004 // SPDX-License-Identifier: Apache-2.0 00005 // 00006 // Licensed under the Apache License, Version 2.0 (the "License"); 00007 // you may not use this file except in compliance with the License. 00008 // You may obtain a copy of the License at 00009 // 00010 // http://www.apache.org/licenses/LICENSE-2.0 00011 // 00012 // Unless required by applicable law or agreed to in writing, software 00013 // distributed under the License is distributed on an "AS IS" BASIS, 00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 // See the License for the specific language governing permissions and 00016 // limitations under the License. 00017 // ---------------------------------------------------------------------------- 00018 00019 #ifndef ARM_UC_PAL_FLASHIAP_IMPLEMENTATION_H 00020 #define ARM_UC_PAL_FLASHIAP_IMPLEMENTATION_H 00021 00022 #include "update-client-common/arm_uc_error.h" 00023 #include "update-client-common/arm_uc_types.h" 00024 #include "update-client-paal/arm_uc_paal_update_api.h" 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00030 arm_uc_error_t ARM_UC_PAL_FlashIAP_Initialize(ARM_UC_PAAL_UPDATE_SignalEvent_t callback); 00031 00032 /** 00033 * @brief Get maximum number of supported storage locations. 00034 * 00035 * @return Number of storage locations. 00036 */ 00037 uint32_t ARM_UC_PAL_FlashIAP_GetMaxID(void); 00038 00039 /** 00040 * @brief Prepare the storage layer for a new firmware image. 00041 * @details The storage location is set up to receive an image with 00042 * the details passed in the details struct. 00043 * 00044 * @param location Storage location ID. 00045 * @param details Pointer to a struct with firmware details. 00046 * @param buffer Temporary buffer for formatting and storing metadata. 00047 * @return Returns ERR_NONE on accept, and signals the event handler with 00048 * either DONE or ERROR when complete. 00049 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00050 */ 00051 arm_uc_error_t ARM_UC_PAL_FlashIAP_Prepare(uint32_t location, 00052 const arm_uc_firmware_details_t* details, 00053 arm_uc_buffer_t* buffer); 00054 00055 /** 00056 * @brief Write a fragment to the indicated storage location. 00057 * @details The storage location must have been allocated using the Prepare 00058 * call. The call is expected to write the entire fragment before 00059 * signaling completion. 00060 * 00061 * @param location Storage location ID. 00062 * @param offset Offset in bytes to where the fragment should be written. 00063 * @param buffer Pointer to buffer struct with fragment. 00064 * @return Returns ERR_NONE on accept, and signals the event handler with 00065 * either DONE or ERROR when complete. 00066 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00067 */ 00068 arm_uc_error_t ARM_UC_PAL_FlashIAP_Write(uint32_t location, 00069 uint32_t offset, 00070 const arm_uc_buffer_t* buffer); 00071 00072 /** 00073 * @brief Close storage location for writing and flush pending data. 00074 * 00075 * @param location Storage location ID. 00076 * @return Returns ERR_NONE on accept, and signals the event handler with 00077 * either DONE or ERROR when complete. 00078 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00079 */ 00080 arm_uc_error_t ARM_UC_PAL_FlashIAP_Finalize(uint32_t location); 00081 00082 /** 00083 * @brief Read a fragment from the indicated storage location. 00084 * @details The function will read until the buffer is full or the end of 00085 * the storage location has been reached. The actual amount of 00086 * bytes read is set in the buffer struct. 00087 * 00088 * @param location Storage location ID. 00089 * @param offset Offset in bytes to read from. 00090 * @param buffer Pointer to buffer struct to store fragment. buffer->size 00091 * contains the intended read size. 00092 * @return Returns ERR_NONE on accept, and signals the event handler with 00093 * either DONE or ERROR when complete. 00094 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00095 * buffer->size contains actual bytes read on return. 00096 */ 00097 arm_uc_error_t ARM_UC_PAL_FlashIAP_Read(uint32_t location, 00098 uint32_t offset, 00099 arm_uc_buffer_t* buffer); 00100 00101 /** 00102 * @brief Set the firmware image in the slot to be the new active image. 00103 * @details This call is responsible for initiating the process for 00104 * applying a new/different image. Depending on the platform this 00105 * could be: 00106 * * An empty call, if the installer can deduce which slot to 00107 * choose from based on the firmware details. 00108 * * Setting a flag to indicate which slot to use next. 00109 * * Decompressing/decrypting/installing the firmware image on 00110 * top of another. 00111 * 00112 * @param location Storage location ID. 00113 * @return Returns ERR_NONE on accept, and signals the event handler with 00114 * either DONE or ERROR when complete. 00115 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00116 */ 00117 arm_uc_error_t ARM_UC_PAL_FlashIAP_Activate(uint32_t location); 00118 00119 /** 00120 * @brief Get firmware details for the firmware image in the slot passed. 00121 * @details This call populates the passed details struct with information 00122 * about the firmware image in the slot passed. Only the fields 00123 * marked as supported in the capabilities bitmap will have valid 00124 * values. 00125 * 00126 * @param details Pointer to firmware details struct to be populated. 00127 * @return Returns ERR_NONE on accept, and signals the event handler with 00128 * either DONE or ERROR when complete. 00129 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00130 */ 00131 arm_uc_error_t ARM_UC_PAL_FlashIAP_GetFirmwareDetails( 00132 uint32_t location, 00133 arm_uc_firmware_details_t* details); 00134 00135 /*****************************************************************************/ 00136 00137 arm_uc_error_t ARM_UC_PAL_FlashIAP_GetActiveDetails(arm_uc_firmware_details_t* details); 00138 00139 arm_uc_error_t ARM_UC_PAL_FlashIAP_GetInstallerDetails(arm_uc_installer_details_t* details); 00140 00141 #ifdef __cplusplus 00142 } 00143 #endif 00144 00145 #endif // ARM_UC_PAL_FLASHIAP_IMPLEMENTATION_H
Generated on Tue Jul 12 2022 19:12:11 by 1.7.2