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

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