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_mmCommon.h Source File

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 ARM_UC_MM_DEBUG_LOG_LEVEL_NONE 0
00033 #define ARM_UC_MM_DEBUG_LOG_LEVEL_VALS 9
00034 #define ARM_UC_MM_DEBUG_LOG_LEVEL_STATES 10
00035 
00036 #define ARRAY_SIZE(X)\
00037     (sizeof(X)/sizeof((X)[0]))
00038 
00039 #define ARM_UC_MM_SET_BUFFER(BUF,ARRAY)\
00040     do {\
00041         (BUF).ptr = (ARRAY);\
00042         (BUF).size = 0;\
00043         (BUF).size_max = sizeof(ARRAY);\
00044     } while(0)
00045 
00046 #define ARM_UC_MFST_SET_ERROR(VAR, ERROR)\
00047     do {\
00048     VAR.code = ERROR;\
00049     if (VAR.error != ERR_NONE) {\
00050         arm_uc_mmPersistentContext.errorFile = __FILE__;\
00051         arm_uc_mmPersistentContext.errorLine = __LINE__;\
00052     }\
00053     }while (0)
00054 
00055 
00056 #if ARM_UC_MANIFEST_MANAGER_TRACE_ENABLE
00057 extern volatile uint8_t arm_uc_mm_gDebugLevel;
00058 #define ARM_UC_MM_DEBUG_LOG(LEVEL,...) \
00059     if(arm_uc_mm_gDebugLevel >= LEVEL) {printf(__VA_ARGS__);}
00060 #else
00061 #define ARM_UC_MM_DEBUG_LOG(LEVEL,...)
00062 #endif
00063 
00064 #endif //MANIFEST_MANAGER_COMMON_H