Simple interface for Mbed Cloud Client
Embed:
(wiki syntax)
Show/hide line numbers
arm_uc_pal_linux_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_LINUX_IMPLEMENTATION_H 00020 #define ARM_UC_PAL_LINUX_IMPLEMENTATION_H 00021 00022 #include "update-client-paal/arm_uc_paal_update_api.h" 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 /** 00029 * @brief Initialize the underlying storage and set the callback handler. 00030 * 00031 * @param callback Function pointer to event handler. 00032 * @return Returns ERR_NONE on accept, and signals the event handler with 00033 * either DONE or ERROR when complete. 00034 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00035 */ 00036 arm_uc_error_t ARM_UC_PAL_Linux_Initialize(ARM_UC_PAAL_UPDATE_SignalEvent_t callback); 00037 00038 /** 00039 * @brief Get maximum number of supported storage locations. 00040 * 00041 * @return Number of storage locations. 00042 */ 00043 uint32_t ARM_UC_PAL_Linux_GetMaxID(void); 00044 00045 /** 00046 * @brief Prepare the storage layer for a new firmware image. 00047 * @details The storage location is set up to receive an image with 00048 * the details passed in the details struct. 00049 * 00050 * @param location Storage location ID. 00051 * @param details Pointer to a struct with firmware details. 00052 * @param buffer Temporary buffer for formatting and storing metadata. 00053 * @return Returns ERR_NONE on accept, and signals the event handler with 00054 * either DONE or ERROR when complete. 00055 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00056 */ 00057 arm_uc_error_t ARM_UC_PAL_Linux_Prepare(uint32_t location, 00058 const arm_uc_firmware_details_t* details, 00059 arm_uc_buffer_t* buffer); 00060 00061 /** 00062 * @brief Write a fragment to the indicated storage location. 00063 * @details The storage location must have been allocated using the Prepare 00064 * call. The call is expected to write the entire fragment before 00065 * signaling completion. 00066 * 00067 * @param location Storage location ID. 00068 * @param offset Offset in bytes to where the fragment should be written. 00069 * @param buffer Pointer to buffer struct with fragment. 00070 * @return Returns ERR_NONE on accept, and signals the event handler with 00071 * either DONE or ERROR when complete. 00072 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00073 */ 00074 arm_uc_error_t ARM_UC_PAL_Linux_Write(uint32_t location, 00075 uint32_t offset, 00076 const arm_uc_buffer_t* buffer); 00077 00078 /** 00079 * @brief Close storage location for writing and flush pending data. 00080 * 00081 * @param location Storage location ID. 00082 * @return Returns ERR_NONE on accept, and signals the event handler with 00083 * either DONE or ERROR when complete. 00084 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00085 */ 00086 arm_uc_error_t ARM_UC_PAL_Linux_Finalize(uint32_t location); 00087 00088 /** 00089 * @brief Read a fragment from the indicated storage location. 00090 * @details The function will read until the buffer is full or the end of 00091 * the storage location has been reached. The actual amount of 00092 * bytes read is set in the buffer struct. 00093 * 00094 * @param location Storage location ID. 00095 * @param offset Offset in bytes to read from. 00096 * @param buffer Pointer to buffer struct to store fragment. buffer->size 00097 * contains the intended read size. 00098 * @return Returns ERR_NONE on accept, and signals the event handler with 00099 * either DONE or ERROR when complete. 00100 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00101 * buffer->size contains actual bytes read on return. 00102 */ 00103 arm_uc_error_t ARM_UC_PAL_Linux_Read(uint32_t location, 00104 uint32_t offset, 00105 arm_uc_buffer_t* buffer); 00106 00107 /** 00108 * @brief Set the firmware image in the slot to be the new active image. 00109 * @details This call is responsible for initiating the process for 00110 * applying a new/different image. Depending on the platform this 00111 * could be: 00112 * * An empty call, if the installer can deduce which slot to 00113 * choose from based on the firmware details. 00114 * * Setting a flag to indicate which slot to use next. 00115 * * Decompressing/decrypting/installing the firmware image on 00116 * top of another. 00117 * 00118 * @param location Storage location ID. 00119 * @return Returns ERR_NONE on accept, and signals the event handler with 00120 * either DONE or ERROR when complete. 00121 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00122 */ 00123 arm_uc_error_t ARM_UC_PAL_Linux_Activate(uint32_t location); 00124 00125 /** 00126 * @brief Get firmware details for the firmware image in the slot passed. 00127 * @details This call populates the passed details struct with information 00128 * about the firmware image in the slot passed. Only the fields 00129 * marked as supported in the capabilities bitmap will have valid 00130 * values. 00131 * 00132 * @param details Pointer to firmware details struct to be populated. 00133 * @return Returns ERR_NONE on accept, and signals the event handler with 00134 * either DONE or ERROR when complete. 00135 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00136 */ 00137 arm_uc_error_t ARM_UC_PAL_Linux_GetFirmwareDetails(uint32_t location, 00138 arm_uc_firmware_details_t* details); 00139 00140 /** 00141 * @brief Get firmware details for the actively running firmware. 00142 * @details This call populates the passed details struct with information 00143 * about the currently active firmware image. Only the fields 00144 * marked as supported in the capabilities bitmap will have valid 00145 * values. 00146 * 00147 * @param details Pointer to firmware details struct to be populated. 00148 * @return Returns ERR_NONE on accept, and signals the event handler with 00149 * either DONE or ERROR when complete. 00150 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00151 */ 00152 arm_uc_error_t ARM_UC_PAL_Linux_GetActiveFirmwareDetails(arm_uc_firmware_details_t* details); 00153 00154 /** 00155 * @brief Get details for the component responsible for installation. 00156 * @details This call populates the passed details struct with information 00157 * about the local installer. Only the fields marked as supported 00158 * in the capabilities bitmap will have valid values. The 00159 * installer could be the bootloader, a recovery image, or some 00160 * other component responsible for applying the new firmware 00161 * image. 00162 * 00163 * @param details Pointer to installer details struct to be populated. 00164 * @return Returns ERR_NONE on accept, and signals the event handler with 00165 * either DONE or ERROR when complete. 00166 * Returns ERR_INVALID_PARAMETER on reject, and no signal is sent. 00167 */ 00168 arm_uc_error_t ARM_UC_PAL_Linux_GetInstallerDetails(arm_uc_installer_details_t* details); 00169 00170 #ifdef __cplusplus 00171 } 00172 #endif 00173 00174 #endif /* ARM_UC_PAL_Linux_H */
Generated on Tue Jul 12 2022 19:01:33 by 1.7.2