Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FXAS21002 FXOS8700Q
arm_uc_mmCommon.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 MANIFEST_MANAGER_COMMON_H 00020 #define MANIFEST_MANAGER_COMMON_H 00021 00022 #include "update-client-manifest-manager/update-client-manifest-types.h" 00023 #include "update-client-common/arm_uc_trace.h" 00024 #include <string.h> 00025 #include <stdio.h> 00026 00027 enum arm_uc_mmEvent { 00028 ARM_UC_MM_EVENT_INVALID = 0, 00029 ARM_UC_MM_EVENT_BEGIN, 00030 }; 00031 00032 #define ARRAY_SIZE(X)\ 00033 (sizeof(X)/sizeof((X)[0])) 00034 00035 #define ARM_UC_MM_SET_BUFFER(BUF,ARRAY)\ 00036 do {\ 00037 (BUF).ptr = (ARRAY);\ 00038 (BUF).size = 0;\ 00039 (BUF).size_max = sizeof(ARRAY);\ 00040 } while(0) 00041 00042 #define ARM_UC_MFST_SET_ERROR(VAR, ERROR)\ 00043 do {\ 00044 VAR.code = ERROR;\ 00045 if (VAR.error != ERR_NONE) {\ 00046 arm_uc_mmPersistentContext.errorFile = __FILE__;\ 00047 arm_uc_mmPersistentContext.errorLine = __LINE__;\ 00048 }\ 00049 }while (0) 00050 00051 // Define htobe 00052 #if defined(__ICCARM__) 00053 #include <intrinsics.h> 00054 #endif 00055 00056 #ifndef htobe 00057 static inline uint32_t htobe(uint32_t x) 00058 { 00059 #if BYTE_ORDER == LITTLE_ENDIAN 00060 #if defined(__ICCARM__) 00061 return __REV(x); 00062 #else 00063 return __builtin_bswap32(x); 00064 #endif 00065 #else 00066 return x; 00067 #endif 00068 } 00069 #endif 00070 00071 #endif //MANIFEST_MANAGER_COMMON_H
Generated on Tue Jul 12 2022 20:20:57 by
