Mistake on this page?
Report an issue in GitHub or email us
nfc_debug.h
1 /*
2  * Copyright (c) 2018, ARM Limited, All Rights Reserved
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may
6  * not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef MBED_NFC_DEBUG_H
19 #define MBED_NFC_DEBUG_H
20 
21 #if NFC_DEBUG && !defined(NDEBUG) && __DEBUG__
22 #ifdef __MODULE__
23 #define __NFC_MODULE__ __MODULE__
24 #else
25 #define __NFC_MODULE__ __FILE__
26 #endif
27 
28 #include "stdio.h"
29 #include "stdarg.h"
30 static inline void nfc_dbg_print(const char *type, const char *module, unsigned int line, const char *fmt, ...)
31 {
32 #if !defined(NDEBUG)
33  printf("NFC [%s] %s:%u ", type, module, line);
34  va_list args;
35  va_start(args, fmt);
36  vprintf(fmt, args);
37  va_end(args);
38  printf("\r\n");
39 #endif
40 }
41 
42 #if !defined(NFC_DBG)
43 #define NFC_DBG(...) nfc_dbg_print("DBG", __NFC_MODULE__, __LINE__, __VA_ARGS__)
44 #endif
45 
46 #if !defined(NFC_WARN)
47 #define NFC_WARN(...) nfc_dbg_print("WARN", __NFC_MODULE__, __LINE__, __VA_ARGS__)
48 #endif
49 
50 #if !defined(NFC_ERR)
51 #define NFC_ERR(...) nfc_dbg_print("ERR", __NFC_MODULE__, __LINE__, __VA_ARGS__)
52 #endif
53 
54 #define NFC_DBG_BLOCK(x) x
55 
56 #else
57 
58 #if !defined(NFC_DBG)
59 #define NFC_DBG(...)
60 #endif
61 
62 #if !defined(NFC_WARN)
63 #define NFC_WARN(...)
64 #endif
65 
66 #if !defined(NFC_ERR)
67 #define NFC_ERR(...)
68 #endif
69 
70 #define NFC_DBG_BLOCK(x)
71 
72 #endif
73 
74 #endif
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.