Mistake on this page?
Report an issue in GitHub or email us
fslittle_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 fslittle_debug.h
18  *
19  * component debug header file.
20  */
21 
22 
23 #ifndef __FSLITTLE_DEBUG
24 #define __FSLITTLE_DEBUG
25 
26 #include <stdint.h>
27 #include <assert.h>
28 #include <stdio.h>
29 
30 
31 /* Debug Support */
32 
33 #define FSLITTLE_LOG_NONE 0
34 #define FSLITTLE_LOG_ERR 1
35 #define FSLITTLE_LOG_WARN 2
36 #define FSLITTLE_LOG_NOTICE 3
37 #define FSLITTLE_LOG_INFO 4
38 #define FSLITTLE_LOG_DEBUG 5
39 #define FSLITTLE_LOG_FENTRY 6
40 
41 #define FSLITTLE_LOG(_fmt, ...) \
42  do \
43  { \
44  printf(_fmt, __VA_ARGS__); \
45  }while(0);
46 
47 #define noFSLITTLE_DEBUG
48 #ifdef FSLITTLE_DEBUG
49 
50 extern uint32_t fslittle_optDebug_g;
51 extern uint32_t fslittle_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 FSLITTLE_INLINE
59 // todo: port to mbedOSV3++ #define FSLITTLE_ASSERT CORE_UTIL_ASSERT
60 #define FSLITTLE_ASSERT(...)
61 
62 #define FSLITTLE_DBGLOG(_fmt, ...) \
63  do \
64  { \
65  if(fslittle_optDebug_g && (fslittle_optLogLevel_g >= FSLITTLE_LOG_DEBUG)) \
66  { \
67  printf(_fmt, __VA_ARGS__); \
68  } \
69  }while(0);
70 
71 
72 #define FSLITTLE_ERRLOG(_fmt, ...) \
73  do \
74  { \
75  if(fslittle_optDebug_g && (fslittle_optLogLevel_g >= FSLITTLE_LOG_ERR)) \
76  { \
77  printf(_fmt, __VA_ARGS__); \
78  } \
79  }while(0);
80 
81 
82 #define FSLITTLE_FENTRYLOG(_fmt, ...) \
83  do \
84  { \
85  if(fslittle_optDebug_g && (fslittle_optLogLevel_g >= FSLITTLE_LOG_FENTRY)) \
86  { \
87  printf(_fmt, __VA_ARGS__); \
88  } \
89  }while(0);
90 
91 
92 
93 
94 
95 #else
96 #define FSLITTLE_ASSERT(_x) do { } while(0)
97 #define FSLITTLE_INLINE inline
98 #define FSLITTLE_DBGLOG(_fmt, ...) do { } while(0)
99 #define FSLITTLE_ERRLOG(_fmt, ...) do { } while(0)
100 #define FSLITTLE_FENTRYLOG(_fmt, ...) do { } while(0)
101 #endif /* FSLITTLE_DEBUG */
102 
103 
104 #endif /*__FSLITTLE_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.