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_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 <inttypes.h> 00027 #include <string.h> 00028 00029 /* 00030 Available update client trace flags: 00031 ARM_UC_ALL_TRACE_ENABLE 00032 ARM_UC_HUB_TRACE_ENABLE 00033 ARM_UC_ERROR_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_RESUME_TRACE_ENABLE 00038 ARM_UC_MANIFEST_MANAGER_TRACE_ENABLE 00039 ARM_UC_SOURCE_MANAGER_TRACE_ENABLE 00040 ARM_UC_PAAL_TRACE_ENABLE 00041 ARM_UC_QA_TRACE_ENABLE 00042 ARM_UC_SDLR_TRACE_ENABLE 00043 */ 00044 00045 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) 00046 00047 /* if the global trace flag is enabled, enable trace for all hub modules */ 00048 #if defined(MBED_CONF_MBED_TRACE_ENABLE) && MBED_CONF_MBED_TRACE_ENABLE == 1 00049 00050 #include "mbed-trace/mbed_trace.h" 00051 #ifndef TRACE_GROUP 00052 #define TRACE_GROUP "UC" 00053 #endif 00054 00055 #define ARM_UC_TRACE_DEBUG_PRINTF(module, fmt, ...) tr_debug("[%-4s] %s:%d: " fmt, module, __FILENAME__, __LINE__, ##__VA_ARGS__) 00056 #define ARM_UC_TRACE_ERROR_PRINTF(module, fmt, ...) tr_error("[%-4s] %s:%d: " fmt, module, __FILENAME__, __LINE__, ##__VA_ARGS__) 00057 00058 #undef ARM_UC_ALL_TRACE_ENABLE 00059 #define ARM_UC_ALL_TRACE_ENABLE 1 00060 00061 #else // if defined(MBED_CONF_MBED_TRACE_ENABLE) && MBED_CONF_MBED_TRACE_ENABLE == 1 00062 00063 #include <stdio.h> 00064 00065 #define ARM_UC_TRACE_DEBUG_PRINTF(module, fmt, ...) printf("[TRACE][%-4s] %s:%d: " fmt "\r\n", module, __FILENAME__, __LINE__, ##__VA_ARGS__) 00066 #define ARM_UC_TRACE_ERROR_PRINTF(module, fmt, ...) printf("[ERROR][%-4s] %s:%d: " fmt "\r\n", module, __FILENAME__, __LINE__, ##__VA_ARGS__) 00067 00068 #endif // if defined(MBED_CONF_MBED_TRACE_ENABLE) && MBED_CONF_MBED_TRACE_ENABLE == 1 00069 00070 #if defined(ARM_UC_ALL_TRACE_ENABLE) && ARM_UC_ALL_TRACE_ENABLE == 1 00071 #undef ARM_UC_ERROR_TRACE_ENABLE 00072 #define ARM_UC_ERROR_TRACE_ENABLE 1 00073 #undef ARM_UC_HUB_TRACE_ENABLE 00074 #define ARM_UC_HUB_TRACE_ENABLE 1 00075 #undef ARM_UC_FIRMWARE_MANAGER_TRACE_ENABLE 00076 #define ARM_UC_FIRMWARE_MANAGER_TRACE_ENABLE 1 00077 #undef ARM_UC_MANIFEST_MANAGER_TRACE_ENABLE 00078 #define ARM_UC_MANIFEST_MANAGER_TRACE_ENABLE 1 00079 #undef ARM_UC_SOURCE_MANAGER_TRACE_ENABLE 00080 #define ARM_UC_SOURCE_MANAGER_TRACE_ENABLE 1 00081 #undef ARM_UC_CONTROL_CENTER_TRACE_ENABLE 00082 #define ARM_UC_CONTROL_CENTER_TRACE_ENABLE 1 00083 #undef ARM_UC_COMMON_TRACE_ENABLE 00084 #define ARM_UC_COMMON_TRACE_ENABLE 1 00085 #undef ARM_UC_PAAL_TRACE_ENABLE 00086 #define ARM_UC_PAAL_TRACE_ENABLE 1 00087 #undef ARM_UC_QA_TRACE_ENABLE 00088 #define ARM_UC_QA_TRACE_ENABLE 1 00089 #ifndef ARM_UC_SDLR_TRACE_ENABLE 00090 #define ARM_UC_SDLR_TRACE_ENABLE 0 00091 #endif 00092 #ifndef ARM_UC_RESUME_TRACE_ENABLE 00093 #define ARM_UC_RESUME_TRACE_ENABLE 1 00094 #endif 00095 #endif // if ARM_UC_ALL_TRACE_ENABLE 00096 00097 #if ARM_UC_ERROR_TRACE_ENABLE 00098 #define UC_ERROR_TRACE(fmt, ...) ARM_UC_TRACE_DEBUG_PRINTF("ERR", fmt, ##__VA_ARGS__) 00099 #define UC_ERROR_ERR_MSG(fmt, ...) ARM_UC_TRACE_ERROR_PRINTF("ERR", fmt, ##__VA_ARGS__) 00100 #else 00101 #define UC_ERROR_TRACE(fmt, ...) 00102 #define UC_ERROR_ERR_MSG(fmt, ...) 00103 #endif // if ARM_UC_ERROR_TRACE_ENABLE 00104 00105 #if ARM_UC_HUB_TRACE_ENABLE 00106 #define UC_HUB_TRACE(fmt, ...) ARM_UC_TRACE_DEBUG_PRINTF("HUB", fmt, ##__VA_ARGS__) 00107 #define UC_HUB_ERR_MSG(fmt, ...) ARM_UC_TRACE_ERROR_PRINTF("HUB", fmt, ##__VA_ARGS__) 00108 #else 00109 #define UC_HUB_TRACE(...) 00110 #define UC_HUB_ERR_MSG(...) 00111 #endif // if ARM_UC_FIRMWARE_MANAGER_TRACE_ENABLE 00112 00113 #if ARM_UC_FIRMWARE_MANAGER_TRACE_ENABLE 00114 #define UC_FIRM_TRACE(fmt, ...) ARM_UC_TRACE_DEBUG_PRINTF("FIRM", fmt, ##__VA_ARGS__) 00115 #define UC_FIRM_ERR_MSG(fmt, ...) ARM_UC_TRACE_ERROR_PRINTF("FIRM", fmt, ##__VA_ARGS__) 00116 #else 00117 #define UC_FIRM_TRACE(fmt, ...) 00118 #define UC_FIRM_ERR_MSG(fmt, ...) 00119 #endif // if ARM_UC_FIRMWARE_MANAGER_TRACE_ENABLE 00120 00121 #if ARM_UC_MANIFEST_MANAGER_TRACE_ENABLE 00122 #define UC_MMGR_TRACE(fmt, ...) ARM_UC_TRACE_DEBUG_PRINTF("MMGR", fmt, ##__VA_ARGS__) 00123 #define UC_MMGR_ERR_MSG(fmt, ...) ARM_UC_TRACE_ERROR_PRINTF("MMGR", fmt, ##__VA_ARGS__) 00124 #else 00125 #define UC_MMGR_TRACE(fmt, ...) 00126 #define UC_MMGR_ERR_MSG(fmt, ...) 00127 #endif // if ARM_UC_MANIFEST_MANAGER_TRACE_ENABLE 00128 00129 #if ARM_UC_SOURCE_MANAGER_TRACE_ENABLE 00130 #define UC_SRCE_TRACE(fmt, ...) ARM_UC_TRACE_DEBUG_PRINTF("SRCE", fmt, ##__VA_ARGS__) 00131 #define UC_SRCE_ERR_MSG(fmt, ...) ARM_UC_TRACE_ERROR_PRINTF("SRCE", fmt, ##__VA_ARGS__) 00132 #else 00133 #define UC_SRCE_TRACE(fmt, ...) 00134 #define UC_SRCE_ERR_MSG(fmt, ...) 00135 #endif // if ARM_UC_SOURCE_MANAGER_TRACE_ENABLE 00136 00137 #if ARM_UC_CONTROL_CENTER_TRACE_ENABLE 00138 #define UC_CONT_TRACE(fmt, ...) ARM_UC_TRACE_DEBUG_PRINTF("CTRL", fmt, ##__VA_ARGS__) 00139 #define UC_CONT_ERR_MSG(fmt, ...) ARM_UC_TRACE_ERROR_PRINTF("CTRL", fmt, ##__VA_ARGS__) 00140 #else 00141 #define UC_CONT_TRACE(fmt, ...) 00142 #define UC_CONT_ERR_MSG(fmt, ...) 00143 #endif // if ARM_UC_FIRMWARE_MANAGER_TRACE_ENABLE 00144 00145 #if ARM_UC_RESUME_TRACE_ENABLE 00146 #define UC_RESUME_TRACE(fmt, ...) ARM_UC_TRACE_DEBUG_PRINTF("RESM", fmt, ##__VA_ARGS__) 00147 #define UC_RESUME_ERR_MSG(fmt, ...) ARM_UC_TRACE_ERROR_PRINTF("RESM", fmt, ##__VA_ARGS__) 00148 #else 00149 #define UC_RESUME_TRACE(fmt, ...) 00150 #define UC_RESUME_ERR_MSG(fmt, ...) 00151 #endif // if ARM_UC_RESUME_TRACE_ENABLE 00152 00153 #if ARM_UC_COMMON_TRACE_ENABLE 00154 #define UC_COMM_TRACE(fmt, ...) ARM_UC_TRACE_DEBUG_PRINTF("COMM", fmt, ##__VA_ARGS__) 00155 #define UC_COMM_ERR_MSG(fmt, ...) ARM_UC_TRACE_ERROR_PRINTF("COMM", fmt, ##__VA_ARGS__) 00156 #else 00157 #define UC_COMM_TRACE(fmt, ...) 00158 #define UC_COMM_ERR_MSG(fmt, ...) 00159 #endif // if ARM_UC_COMMON_TRACE_ENABLE 00160 00161 #if ARM_UC_PAAL_TRACE_ENABLE 00162 #define UC_PAAL_TRACE(fmt, ...) ARM_UC_TRACE_DEBUG_PRINTF("PAAL", fmt, ##__VA_ARGS__) 00163 #define UC_PAAL_ERR_MSG(fmt, ...) ARM_UC_TRACE_ERROR_PRINTF("PAAL", fmt, ##__VA_ARGS__) 00164 #else 00165 #define UC_PAAL_TRACE(fmt, ...) 00166 #define UC_PAAL_ERR_MSG(fmt, ...) 00167 #endif // if ARM_UC_COMMON_TRACE_ENABLE 00168 00169 #if ARM_UC_QA_TRACE_ENABLE 00170 #define UC_QA_TRACE(fmt, ...) ARM_UC_TRACE_DEBUG_PRINTF("QA", fmt, ##__VA_ARGS__) 00171 #define UC_QA_ERR_MSG(fmt, ...) ARM_UC_TRACE_ERROR_PRINTF("QA", fmt, ##__VA_ARGS__) 00172 #else 00173 #define UC_QA_TRACE(fmt, ...) 00174 #define UC_QA_ERR_MSG(fmt, ...) 00175 #endif // if ARM_UC_COMMON_TRACE_ENABLE 00176 00177 #if ARM_UC_SDLR_TRACE_ENABLE 00178 #define UC_SDLR_TRACE(fmt, ...) ARM_UC_TRACE_DEBUG_PRINTF("SDLR", fmt, ##__VA_ARGS__) 00179 #define UC_SDLR_ERR_MSG(fmt, ...) ARM_UC_TRACE_ERROR_PRINTF("SDLR", fmt, ##__VA_ARGS__) 00180 #else 00181 #define UC_SDLR_TRACE(fmt, ...) 00182 #define UC_SDLR_ERR_MSG(fmt, ...) 00183 #endif // if ARM_UC_SDLR_TRACE_ENABLE 00184 00185 #endif // ARM_UPDATE_TRACE_H
Generated on Tue Jul 12 2022 20:20:57 by
