Simulated product dispenser

Dependencies:   HTS221

Fork of mbed-cloud-workshop-connect-HTS221 by Jim Carver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm_uc_pal_realtek_rtl8195am.h Source File

arm_uc_pal_realtek_rtl8195am.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_RTL8195AM_IMPLEMENTATION_H
00020 #define ARM_UC_PAL_RTL8195AM_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 extern ARM_UC_PAAL_UPDATE ARM_UCP_REALTEK_RTL8195AM;
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 arm_uc_error_t ARM_UC_PAL_RTL8195AM_Initialize(ARM_UC_PAAL_UPDATE_SignalEvent_t callback);
00033 
00034 /**
00035  * @brief Get maximum number of supported storage locations.
00036  *
00037  * @return Number of storage locations.
00038  */
00039 uint32_t ARM_UC_PAL_RTL8195AM_GetMaxID(void);
00040 
00041 /**
00042  * @brief Prepare the storage layer for a new firmware image.
00043  * @details The storage location is set up to receive an image with
00044  *          the details passed in the details struct.
00045  *
00046  * @param location Storage location ID.
00047  * @param details Pointer to a struct with firmware details.
00048  * @param buffer Temporary buffer for formatting and storing metadata.
00049  * @return Returns ERR_NONE on accept, and signals the event handler with
00050  *         either DONE or ERROR when complete.
00051  *         Returns ERR_INVALID_PARAMETER on reject, and no signal is sent.
00052  */
00053 arm_uc_error_t ARM_UC_PAL_RTL8195AM_Prepare(uint32_t location,
00054                                             const arm_uc_firmware_details_t* details,
00055                                             arm_uc_buffer_t* buffer);
00056 
00057 /**
00058  * @brief Write a fragment to the indicated storage location.
00059  * @details The storage location must have been allocated using the Prepare
00060  *          call. The call is expected to write the entire fragment before
00061  *          signaling completion.
00062  *
00063  * @param location Storage location ID.
00064  * @param offset Offset in bytes to where the fragment should be written.
00065  * @param buffer Pointer to buffer struct with fragment.
00066  * @return Returns ERR_NONE on accept, and signals the event handler with
00067  *         either DONE or ERROR when complete.
00068  *         Returns ERR_INVALID_PARAMETER on reject, and no signal is sent.
00069  */
00070 arm_uc_error_t ARM_UC_PAL_RTL8195AM_Write(uint32_t location,
00071                                           uint32_t offset,
00072                                           const arm_uc_buffer_t* buffer);
00073 
00074 /**
00075  * @brief Close storage location for writing and flush pending data.
00076  *
00077  * @param location Storage location ID.
00078  * @return Returns ERR_NONE on accept, and signals the event handler with
00079  *         either DONE or ERROR when complete.
00080  *         Returns ERR_INVALID_PARAMETER on reject, and no signal is sent.
00081  */
00082 arm_uc_error_t ARM_UC_PAL_RTL8195AM_Finalize(uint32_t location);
00083 
00084 /**
00085  * @brief Read a fragment from the indicated storage location.
00086  * @details The function will read until the buffer is full or the end of
00087  *          the storage location has been reached. The actual amount of
00088  *          bytes read is set in the buffer struct.
00089  *
00090  * @param location Storage location ID.
00091  * @param offset Offset in bytes to read from.
00092  * @param buffer Pointer to buffer struct to store fragment. buffer->size
00093  *        contains the intended read size.
00094  * @return Returns ERR_NONE on accept, and signals the event handler with
00095  *         either DONE or ERROR when complete.
00096  *         Returns ERR_INVALID_PARAMETER on reject, and no signal is sent.
00097  *         buffer->size contains actual bytes read on return.
00098  */
00099 arm_uc_error_t ARM_UC_PAL_RTL8195AM_Read(uint32_t location,
00100                                          uint32_t offset,
00101                                          arm_uc_buffer_t* buffer);
00102 
00103 /**
00104  * @brief Set the firmware image in the slot to be the new active image.
00105  * @details This call is responsible for initiating the process for
00106  *          applying a new/different image. Depending on the platform this
00107  *          could be:
00108  *           * An empty call, if the installer can deduce which slot to
00109  *             choose from based on the firmware details.
00110  *           * Setting a flag to indicate which slot to use next.
00111  *           * Decompressing/decrypting/installing the firmware image on
00112  *             top of another.
00113  *
00114  * @param location Storage location ID.
00115  * @return Returns ERR_NONE on accept, and signals the event handler with
00116  *         either DONE or ERROR when complete.
00117  *         Returns ERR_INVALID_PARAMETER on reject, and no signal is sent.
00118  */
00119 arm_uc_error_t ARM_UC_PAL_RTL8195AM_Activate(uint32_t location);
00120 
00121 /**
00122  * @brief Get firmware details for the firmware image in the slot passed.
00123  * @details This call populates the passed details struct with information
00124  *          about the firmware image in the slot passed. Only the fields
00125  *          marked as supported in the capabilities bitmap will have valid
00126  *          values.
00127  *
00128  * @param details Pointer to firmware details struct to be populated.
00129  * @return Returns ERR_NONE on accept, and signals the event handler with
00130  *         either DONE or ERROR when complete.
00131  *         Returns ERR_INVALID_PARAMETER on reject, and no signal is sent.
00132  */
00133 arm_uc_error_t ARM_UC_PAL_RTL8195AM_GetFirmwareDetails(
00134                                         uint32_t location,
00135                                         arm_uc_firmware_details_t* details);
00136 
00137 /*****************************************************************************/
00138 
00139 arm_uc_error_t ARM_UC_PAL_RTL8195AM_GetActiveDetails(arm_uc_firmware_details_t* details);
00140 
00141 arm_uc_error_t ARM_UC_PAL_RTL8195AM_GetInstallerDetails(arm_uc_installer_details_t* details);
00142 
00143 #ifdef __cplusplus
00144 }
00145 #endif
00146 
00147 #endif // ARM_UC_PAL_RTL8195AM_IMPLEMENTATION_H