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  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may 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,
13  * WITHOUT 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 /** @file fsfat_debug.h
19  *
20  * component debug header file.
21  */
22 
23 
24 #ifndef __FSFAT_DEBUG
25 #define __FSFAT_DEBUG
26 
27 #include <stdint.h>
28 #include <assert.h>
29 #include <stdio.h>
30 
31 
32 /* Debug Support */
33 
34 #define FSFAT_LOG_NONE 0
35 #define FSFAT_LOG_ERR 1
36 #define FSFAT_LOG_WARN 2
37 #define FSFAT_LOG_NOTICE 3
38 #define FSFAT_LOG_INFO 4
39 #define FSFAT_LOG_DEBUG 5
40 #define FSFAT_LOG_FENTRY 6
41 
42 #define FSFAT_LOG(_fmt, ...) \
43  do \
44  { \
45  printf(_fmt, __VA_ARGS__); \
46  }while(0);
47 
48 #define noFSFAT_DEBUG
49 #ifdef FSFAT_DEBUG
50 
51 extern uint32_t fsfat_optDebug_g;
52 extern uint32_t fsfat_optLogLevel_g;
53 
54 
55 /* uncomment for asserts to work */
56 /* #undef NDEBUG */
57 // todo: port to mbedOSV3++ #include <core-util/assert.h>
58 
59 #define FSFAT_INLINE
60 // todo: port to mbedOSV3++ #define FSFAT_ASSERT CORE_UTIL_ASSERT
61 #define FSFAT_ASSERT(...)
62 
63 #define FSFAT_DBGLOG(_fmt, ...) \
64  do \
65  { \
66  if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_DEBUG)) \
67  { \
68  printf(_fmt, __VA_ARGS__); \
69  } \
70  }while(0);
71 
72 
73 #define FSFAT_ERRLOG(_fmt, ...) \
74  do \
75  { \
76  if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_ERR)) \
77  { \
78  printf(_fmt, __VA_ARGS__); \
79  } \
80  }while(0);
81 
82 
83 #define FSFAT_FENTRYLOG(_fmt, ...) \
84  do \
85  { \
86  if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_FENTRY)) \
87  { \
88  printf(_fmt, __VA_ARGS__); \
89  } \
90  }while(0);
91 
92 
93 
94 
95 
96 #else
97 #define FSFAT_ASSERT(_x) do { } while(0)
98 #define FSFAT_INLINE inline
99 #define FSFAT_DBGLOG(_fmt, ...) do { } while(0)
100 #define FSFAT_ERRLOG(_fmt, ...) do { } while(0)
101 #define FSFAT_FENTRYLOG(_fmt, ...) do { } while(0)
102 #endif /* FSFAT_DEBUG */
103 
104 
105 #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.