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.
Fork of mbed-cloud-workshop-connect-HTS221 by
arm_uc_trace.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 ARM_UPDATE_TRACE_H 00020 #define ARM_UPDATE_TRACE_H 00021 00022 #ifndef __STDC_FORMAT_MACROS 00023 #define __STDC_FORMAT_MACROS 00024 #endif 00025 00026 #include <stdio.h> 00027 #include <inttypes.h> 00028 #include <string.h> 00029 00030 /* 00031 Available update client trace flags: 00032 ARM_UC_ALL_TRACE_ENABLE 00033 ARM_UC_HUB_TRACE_ENABLE 00034 ARM_UC_COMMON_TRACE_ENABLE 00035 ARM_UC_FIRMWARE_MANAGER_TRACE_ENABLE 00036 ARM_UC_CONTROL_CENTER_TRACE_ENABLE 00037 ARM_UC_MANIFEST_MANAGER_TRACE_ENABLE 00038 ARM_UC_SOURCE_MANAGER_TRACE_ENABLE 00039 ARM_UC_PAAL_TRACE_ENABLE 00040 */ 00041 00042 /* if the global trace flag is enabled, enable trace for all hub modules */ 00043 #if defined(MBED_CONF_MBED_TRACE_ENABLE) && MBED_CONF_MBED_TRACE_ENABLE == 1 00044 #include "mbed-trace/mbed_trace.h" 00045 #undef ARM_UC_ALL_TRACE_ENABLE 00046 #define ARM_UC_ALL_TRACE_ENABLE 1 00047 #endif // if MBED_CONF_MBED_TRACE_ENABLE 00048 00049 #if defined(ARM_UC_ALL_TRACE_ENABLE) && ARM_UC_ALL_TRACE_ENABLE == 1 00050 #undef ARM_UC_HUB_TRACE_ENABLE 00051 #define ARM_UC_HUB_TRACE_ENABLE 1 00052 #undef ARM_UC_FIRMWARE_MANAGER_TRACE_ENABLE 00053 #define ARM_UC_FIRMWARE_MANAGER_TRACE_ENABLE 1 00054 #undef ARM_UC_MANIFEST_MANAGER_TRACE_ENABLE 00055 #define ARM_UC_MANIFEST_MANAGER_TRACE_ENABLE 1 00056 #undef ARM_UC_SOURCE_MANAGER_TRACE_ENABLE 00057 #define ARM_UC_SOURCE_MANAGER_TRACE_ENABLE 1 00058 #undef ARM_UC_CONTROL_CENTER_TRACE_ENABLE 00059 #define ARM_UC_CONTROL_CENTER_TRACE_ENABLE 1 00060 #undef ARM_UC_COMMON_TRACE_ENABLE 00061 #define ARM_UC_COMMON_TRACE_ENABLE 1 00062 #undef ARM_UC_PAAL_TRACE_ENABLE 00063 #define ARM_UC_PAAL_TRACE_ENABLE 1 00064 #endif // if ARM_UC_ALL_TRACE_ENABLE 00065 00066 #if ARM_UC_HUB_TRACE_ENABLE 00067 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) 00068 #if MBED_CONF_MBED_TRACE_ENABLE 00069 #define UC_HUB_TRACE(fmt, ...) mbed_tracef(TRACE_LEVEL_DEBUG, "HUB ", "%s:%d: " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__) 00070 #define UC_HUB_ERR_MSG(fmt, ...) mbed_tracef(TRACE_LEVEL_ERROR, "HUB ", "%s:%d: " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__) 00071 #else 00072 #define UC_HUB_TRACE(fmt, ...) printf("[TRACE][HUB]" "%s:%d: " fmt "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__) 00073 #define UC_HUB_ERR_MSG(fmt, ...) printf("[ERROR][HUB]" "%s:%d: " fmt "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__) 00074 #endif // if MBED_CONF_MBED_TRACE_ENABLE 00075 #else 00076 #define UC_HUB_TRACE(...) 00077 #define UC_HUB_ERR_MSG(...) 00078 #endif // if ARM_UC_FIRMWARE_MANAGER_TRACE_ENABLE 00079 00080 #if ARM_UC_FIRMWARE_MANAGER_TRACE_ENABLE 00081 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) 00082 #if MBED_CONF_MBED_TRACE_ENABLE 00083 #define UC_FIRM_TRACE(fmt, ...) mbed_tracef(TRACE_LEVEL_DEBUG, "FIRM", "%s:%d: " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__) 00084 #define UC_FIRM_ERR_MSG(fmt, ...) mbed_tracef(TRACE_LEVEL_ERROR, "FIRM", "%s:%d: " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__) 00085 #else 00086 #define UC_FIRM_TRACE(fmt, ...) printf("[TRACE][FIRM]" "%s:%d: " fmt "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__) 00087 #define UC_FIRM_ERR_MSG(fmt, ...) printf("[ERROR][FIRM]" "%s:%d: " fmt "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__) 00088 #endif // if MBED_CONF_MBED_TRACE_ENABLE 00089 #else 00090 #define UC_FIRM_TRACE(fmt, ...) 00091 #define UC_FIRM_ERR_MSG(fmt, ...) 00092 #endif // if ARM_UC_FIRMWARE_MANAGER_TRACE_ENABLE 00093 00094 #if ARM_UC_MANIFEST_MANAGER_TRACE_ENABLE 00095 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) 00096 #if MBED_CONF_MBED_TRACE_ENABLE 00097 #define UC_MMGR_TRACE(fmt, ...) mbed_tracef(TRACE_LEVEL_DEBUG, "MMGR", "%s:%d: " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__) 00098 #define UC_MMGR_ERR_MSG(fmt, ...) mbed_tracef(TRACE_LEVEL_ERROR, "MMGR", "%s:%d: " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__) 00099 #else 00100 #define UC_MMGR_TRACE(fmt, ...) printf("[TRACE][MMGR]" "%s:%d: " fmt "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__) 00101 #define UC_MMGR_ERR_MSG(fmt, ...) printf("[ERROR][MMGR]" "%s:%d: " fmt "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__) 00102 #endif // if MBED_CONF_MBED_TRACE_ENABLE 00103 #else 00104 #define UC_MMGR_TRACE(fmt, ...) 00105 #define UC_MMGR_ERR_MSG(fmt, ...) 00106 #endif // if ARM_UC_MANIFEST_MANAGER_TRACE_ENABLE 00107 00108 #if ARM_UC_SOURCE_MANAGER_TRACE_ENABLE 00109 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) 00110 #if MBED_CONF_MBED_TRACE_ENABLE 00111 #define UC_SRCE_TRACE(fmt, ...) mbed_tracef(TRACE_LEVEL_DEBUG, "SRCE", "%s:%d: " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__) 00112 #define UC_SRCE_ERR_MSG(fmt, ...) mbed_tracef(TRACE_LEVEL_ERROR, "SRCE", "%s:%d: " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__) 00113 #else 00114 #define UC_SRCE_TRACE(fmt, ...) printf("[TRACE][SRCE]" "%s:%d: " fmt "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__) 00115 #define UC_SRCE_ERR_MSG(fmt, ...) printf("[ERROR][SRCE]" "%s:%d: " fmt "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__) 00116 #endif // if MBED_CONF_MBED_TRACE_ENABLE 00117 #else 00118 #define UC_SRCE_TRACE(fmt, ...) 00119 #define UC_SRCE_ERR_MSG(fmt, ...) 00120 #endif // if ARM_UC_SOURCE_MANAGER_TRACE_ENABLE 00121 00122 #if ARM_UC_CONTROL_CENTER_TRACE_ENABLE 00123 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) 00124 #if MBED_CONF_MBED_TRACE_ENABLE 00125 #define UC_CONT_TRACE(fmt, ...) mbed_tracef(TRACE_LEVEL_DEBUG, "CTRL", "%s:%d: " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__) 00126 #define UC_CONT_ERR_MSG(fmt, ...) mbed_tracef(TRACE_LEVEL_ERROR, "CTRL", "%s:%d: " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__) 00127 #else 00128 #define UC_CONT_TRACE(fmt, ...) printf("[TRACE][CTRL]" "%s:%d: " fmt "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__) 00129 #define UC_CONT_ERR_MSG(fmt, ...) printf("[ERROR][CTRL]" "%s:%d: " fmt "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__) 00130 #endif // if MBED_CONF_MBED_TRACE_ENABLE 00131 #else 00132 #define UC_CONT_TRACE(fmt, ...) 00133 #define UC_CONT_ERR_MSG(fmt, ...) 00134 #endif // if ARM_UC_FIRMWARE_MANAGER_TRACE_ENABLE 00135 00136 #if ARM_UC_COMMON_TRACE_ENABLE 00137 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) 00138 #if MBED_CONF_MBED_TRACE_ENABLE 00139 #define UC_COMM_TRACE(fmt, ...) mbed_tracef(TRACE_LEVEL_DEBUG, "COMM", "%s:%d: " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__) 00140 #define UC_COMM_ERR_MSG(fmt, ...) mbed_tracef(TRACE_LEVEL_ERROR, "COMM", "%s:%d: " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__) 00141 #else 00142 #define UC_COMM_TRACE(fmt, ...) printf("[TRACE][COMM]" "%s:%d: " fmt "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__) 00143 #define UC_COMM_ERR_MSG(fmt, ...) printf("[ERROR][COMM]" "%s:%d: " fmt "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__) 00144 #endif // if MBED_CONF_MBED_TRACE_ENABLE 00145 #else 00146 #define UC_COMM_TRACE(fmt, ...) 00147 #define UC_COMM_ERR_MSG(fmt, ...) 00148 #endif // if ARM_UC_COMMON_TRACE_ENABLE 00149 00150 #if ARM_UC_PAAL_TRACE_ENABLE 00151 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) 00152 #if MBED_CONF_MBED_TRACE_ENABLE 00153 #define UC_PAAL_TRACE(fmt, ...) mbed_tracef(TRACE_LEVEL_DEBUG, "PAAL", "%s:%d: " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__) 00154 #define UC_PAAL_ERR_MSG(fmt, ...) mbed_tracef(TRACE_LEVEL_ERROR, "PAAL", "%s:%d: " fmt, __FILENAME__, __LINE__, ##__VA_ARGS__) 00155 #else 00156 #define UC_PAAL_TRACE(fmt, ...) printf("[TRACE][PAAL]" "%s:%d: " fmt "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__) 00157 #define UC_PAAL_ERR_MSG(fmt, ...) printf("[ERROR][PAAL]" "%s:%d: " fmt "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__) 00158 #endif // if MBED_CONF_MBED_TRACE_ENABLE 00159 #else 00160 #define UC_PAAL_TRACE(fmt, ...) 00161 #define UC_PAAL_ERR_MSG(fmt, ...) 00162 #endif // if ARM_UC_COMMON_TRACE_ENABLE 00163 00164 #endif // ARM_UPDATE_TRACE_H
Generated on Tue Jul 12 2022 19:12:11 by
1.7.2
