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