Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers nfc_debug.h Source File

nfc_debug.h

00001 /*
00002  * Copyright (c) 2018, ARM Limited, All Rights Reserved
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00006  * not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  * http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00013  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef MBED_NFC_DEBUG_H
00019 #define MBED_NFC_DEBUG_H
00020 
00021 #if NFC_DEBUG && !defined(NDEBUG) && __DEBUG__
00022 #ifdef __MODULE__
00023 #define __NFC_MODULE__ __MODULE__
00024 #else
00025 #define __NFC_MODULE__ __FILE__
00026 #endif
00027 
00028 #include "stdio.h"
00029 #include "stdarg.h"
00030 static inline void nfc_dbg_print(const char *type, const char *module, unsigned int line, const char *fmt, ...)
00031 {
00032 #if !defined(NDEBUG)
00033     printf("NFC [%s] %s:%u ", type, module, line);
00034     va_list args;
00035     va_start(args, fmt);
00036     vprintf(fmt, args);
00037     va_end(args);
00038     printf("\r\n");
00039 #endif
00040 }
00041 
00042 #if !defined(NFC_DBG)
00043 #define NFC_DBG(...) nfc_dbg_print("DBG", __NFC_MODULE__, __LINE__, __VA_ARGS__)
00044 #endif
00045 
00046 #if !defined(NFC_WARN)
00047 #define NFC_WARN(...) nfc_dbg_print("WARN", __NFC_MODULE__, __LINE__, __VA_ARGS__)
00048 #endif
00049 
00050 #if !defined(NFC_ERR)
00051 #define NFC_ERR(...) nfc_dbg_print("ERR", __NFC_MODULE__, __LINE__, __VA_ARGS__)
00052 #endif
00053 
00054 #define NFC_DBG_BLOCK(x) x
00055 
00056 #else
00057 
00058 #if !defined(NFC_DBG)
00059 #define NFC_DBG(...)
00060 #endif
00061 
00062 #if !defined(NFC_WARN)
00063 #define NFC_WARN(...)
00064 #endif
00065 
00066 #if !defined(NFC_ERR)
00067 #define NFC_ERR(...)
00068 #endif
00069 
00070 #define NFC_DBG_BLOCK(x)
00071 
00072 #endif
00073 
00074 #endif