Toyomasa Watarai
/
Mbed-example-WS-W27
Mbed Cloud example program for workshop in W27 2018.
Embed:
(wiki syntax)
Show/hide line numbers
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 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_OpenWRT(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 = "/usr/sbin/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 }; 00059 00060 arm_ucp_worker_t arm_uc_worker_parameters_activate = { 00061 .command = "/usr/sbin/arm_update_activate.sh", 00062 .header = 1, 00063 .firmware = 1, 00064 .location = 0, 00065 .offset = 0, 00066 .size = 0, 00067 .success_event = ARM_UC_PAAL_EVENT_ACTIVATE_DONE, 00068 .failure_event = ARM_UC_PAAL_EVENT_ACTIVATE_ERROR 00069 }; 00070 00071 arm_uc_error_t ARM_UC_PAL_Linux_Initialize_OpenWRT(ARM_UC_PAAL_UPDATE_SignalEvent_t callback) 00072 { 00073 extern arm_ucp_worker_config_t arm_uc_worker_parameters; 00074 00075 arm_uc_worker_parameters.activate = &arm_uc_worker_parameters_activate; 00076 arm_uc_worker_parameters.active_details = &arm_uc_worker_parameters_active_details; 00077 arm_uc_worker_parameters.details = NULL; 00078 arm_uc_worker_parameters.finalize = NULL; 00079 arm_uc_worker_parameters.initialize = NULL; 00080 arm_uc_worker_parameters.installer = NULL; 00081 arm_uc_worker_parameters.prepare = NULL; 00082 arm_uc_worker_parameters.read = NULL; 00083 arm_uc_worker_parameters.write = NULL; 00084 00085 return ARM_UC_PAL_Linux_Initialize(callback); 00086 } 00087 00088 const ARM_UC_PAAL_UPDATE ARM_UCP_LINUX_OPENWRT = 00089 { 00090 .Initialize = ARM_UC_PAL_Linux_Initialize_OpenWRT, 00091 .GetCapabilities = ARM_UC_PAL_Linux_GetCapabilities_OpenWRT, 00092 .GetMaxID = ARM_UC_PAL_Linux_GetMaxID, 00093 .Prepare = ARM_UC_PAL_Linux_Prepare, 00094 .Write = ARM_UC_PAL_Linux_Write, 00095 .Finalize = ARM_UC_PAL_Linux_Finalize, 00096 .Read = ARM_UC_PAL_Linux_Read, 00097 .Activate = ARM_UC_PAL_Linux_Activate, 00098 .GetActiveFirmwareDetails = ARM_UC_PAL_Linux_GetActiveFirmwareDetails, 00099 .GetFirmwareDetails = ARM_UC_PAL_Linux_GetFirmwareDetails, 00100 .GetInstallerDetails = ARM_UC_PAL_Linux_GetInstallerDetails 00101 }; 00102 00103 #endif
Generated on Tue Jul 12 2022 16:22:03 by 1.7.2