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_linux_openwrt.c Source File

arm_uc_pal_linux_openwrt.c

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 #if defined(TARGET_IS_PC_LINUX)
00020 
00021 #include "update-client-paal/arm_uc_paal_update_api.h"
00022 #include "update-client-pal-linux/arm_uc_pal_linux_implementation.h"
00023 #include "update-client-pal-linux/arm_uc_pal_linux_implementation_internal.h"
00024 #include "update-client-common/arm_uc_common.h"
00025 #include <unistd.h>
00026 
00027 /**
00028  * @brief Get a bitmap indicating supported features.
00029  * @details The bitmap is used in conjunction with the firmware and
00030  *          installer details struct to indicate what fields are supported
00031  *          and which values are valid.
00032  *
00033  * @return Capability bitmap.
00034  */
00035 ARM_UC_PAAL_UPDATE_CAPABILITIES ARM_UC_PAL_Linux_GetCapabilities_OpenWRT(void)
00036 {
00037     const ARM_UC_PAAL_UPDATE_CAPABILITIES result = {
00038         .installer_arm_hash = 0,
00039         .installer_oem_hash = 0,
00040         .installer_layout   = 0,
00041         .firmware_hash      = 1,
00042         .firmware_hmac      = 0,
00043         .firmware_campaign  = 0,
00044         .firmware_version   = 1,
00045         .firmware_size      = 1
00046     };
00047 
00048     return result;
00049 }
00050 
00051 arm_ucp_worker_t arm_uc_worker_parameters_active_details = {
00052     .command = "/usr/sbin/arm_update_active_details.sh",
00053     .header   = 1,
00054     .firmware = 0,
00055     .location = 0,
00056     .offset   = 0,
00057     .size     = 0,
00058     .success_event = ARM_UC_PAAL_EVENT_GET_ACTIVE_FIRMWARE_DETAILS_DONE,
00059     .failure_event = ARM_UC_PAAL_EVENT_GET_ACTIVE_FIRMWARE_DETAILS_ERROR,
00060     .post_runner = NULL
00061 };
00062 
00063 arm_ucp_worker_t arm_uc_worker_parameters_activate = {
00064     .command = "/usr/sbin/arm_update_activate.sh",
00065     .header   = 1,
00066     .firmware = 1,
00067     .location = 0,
00068     .offset   = 0,
00069     .size     = 0,
00070     .success_event = ARM_UC_PAAL_EVENT_ACTIVATE_DONE,
00071     .failure_event = ARM_UC_PAAL_EVENT_ACTIVATE_ERROR,
00072     .post_runner = NULL
00073 };
00074 
00075 arm_uc_error_t ARM_UC_PAL_Linux_Initialize_OpenWRT(ARM_UC_PAAL_UPDATE_SignalEvent_t callback)
00076 {
00077     extern arm_ucp_worker_config_t arm_uc_worker_parameters;
00078 
00079     arm_uc_worker_parameters.activate       = &arm_uc_worker_parameters_activate;
00080     arm_uc_worker_parameters.active_details = &arm_uc_worker_parameters_active_details;
00081     arm_uc_worker_parameters.details        = NULL;
00082     arm_uc_worker_parameters.finalize       = NULL;
00083     arm_uc_worker_parameters.initialize     = NULL;
00084     arm_uc_worker_parameters.installer      = NULL;
00085     arm_uc_worker_parameters.prepare        = NULL;
00086     arm_uc_worker_parameters.read           = NULL;
00087     arm_uc_worker_parameters.write          = NULL;
00088 
00089     return ARM_UC_PAL_Linux_Initialize(callback);
00090 }
00091 
00092 const ARM_UC_PAAL_UPDATE ARM_UCP_LINUX_OPENWRT =
00093 {
00094     .Initialize                 = ARM_UC_PAL_Linux_Initialize_OpenWRT,
00095     .GetCapabilities            = ARM_UC_PAL_Linux_GetCapabilities_OpenWRT,
00096     .GetMaxID                   = ARM_UC_PAL_Linux_GetMaxID,
00097     .Prepare                    = ARM_UC_PAL_Linux_Prepare,
00098     .Write                      = ARM_UC_PAL_Linux_Write,
00099     .Finalize                   = ARM_UC_PAL_Linux_Finalize,
00100     .Read                       = ARM_UC_PAL_Linux_Read,
00101     .Activate                   = ARM_UC_PAL_Linux_Activate,
00102     .GetActiveFirmwareDetails   = ARM_UC_PAL_Linux_GetActiveFirmwareDetails,
00103     .GetFirmwareDetails         = ARM_UC_PAL_Linux_GetFirmwareDetails,
00104     .GetInstallerDetails        = ARM_UC_PAL_Linux_GetInstallerDetails
00105 };
00106 
00107 #endif