Mistake on this page?
Report an issue in GitHub or email us
fsfat_debug.h
Go to the documentation of this file.
1 /* mbed Microcontroller Library
2  * Copyright (c) 2016 ARM Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /** @file fsfat_debug.h
18  *
19  * component debug header file.
20  */
21 
22 
23 #ifndef __FSFAT_DEBUG
24 #define __FSFAT_DEBUG
25 
26 #include <stdint.h>
27 #include <assert.h>
28 #include <stdio.h>
29 
30 
31 /* Debug Support */
32 
33 #define FSFAT_LOG_NONE 0
34 #define FSFAT_LOG_ERR 1
35 #define FSFAT_LOG_WARN 2
36 #define FSFAT_LOG_NOTICE 3
37 #define FSFAT_LOG_INFO 4
38 #define FSFAT_LOG_DEBUG 5
39 #define FSFAT_LOG_FENTRY 6
40 
41 #define FSFAT_LOG(_fmt, ...) \
42  do \
43  { \
44  printf(_fmt, __VA_ARGS__); \
45  }while(0);
46 
47 #define noFSFAT_DEBUG
48 #ifdef FSFAT_DEBUG
49 
50 extern uint32_t fsfat_optDebug_g;
51 extern uint32_t fsfat_optLogLevel_g;
52 
53 
54 /* uncomment for asserts to work */
55 /* #undef NDEBUG */
56 // todo: port to mbedOSV3++ #include <core-util/assert.h>
57 
58 #define FSFAT_INLINE
59 // todo: port to mbedOSV3++ #define FSFAT_ASSERT CORE_UTIL_ASSERT
60 #define FSFAT_ASSERT(...)
61 
62 #define FSFAT_DBGLOG(_fmt, ...) \
63  do \
64  { \
65  if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_DEBUG)) \
66  { \
67  printf(_fmt, __VA_ARGS__); \
68  } \
69  }while(0);
70 
71 
72 #define FSFAT_ERRLOG(_fmt, ...) \
73  do \
74  { \
75  if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_ERR)) \
76  { \
77  printf(_fmt, __VA_ARGS__); \
78  } \
79  }while(0);
80 
81 
82 #define FSFAT_FENTRYLOG(_fmt, ...) \
83  do \
84  { \
85  if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_FENTRY)) \
86  { \
87  printf(_fmt, __VA_ARGS__); \
88  } \
89  }while(0);
90 
91 
92 
93 
94 
95 #else
96 #define FSFAT_ASSERT(_x) do { } while(0)
97 #define FSFAT_INLINE inline
98 #define FSFAT_DBGLOG(_fmt, ...) do { } while(0)
99 #define FSFAT_ERRLOG(_fmt, ...) do { } while(0)
100 #define FSFAT_FENTRYLOG(_fmt, ...) do { } while(0)
101 #endif /* FSFAT_DEBUG */
102 
103 
104 #endif /*__FSFAT_DEBUG*/
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.