Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fsfat_debug.h Source File

fsfat_debug.h

Go to the documentation of this file.
00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2016 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /** @file fsfat_debug.h
00018  *
00019  * component debug header file.
00020  */
00021 
00022 
00023 #ifndef __FSFAT_DEBUG
00024 #define __FSFAT_DEBUG
00025 
00026 #include <stdint.h>
00027 #include <assert.h>
00028 #include <stdio.h>
00029 
00030 
00031 /* Debug Support */
00032 
00033 #define FSFAT_LOG_NONE        0
00034 #define FSFAT_LOG_ERR         1
00035 #define FSFAT_LOG_WARN        2
00036 #define FSFAT_LOG_NOTICE      3
00037 #define FSFAT_LOG_INFO        4
00038 #define FSFAT_LOG_DEBUG       5
00039 #define FSFAT_LOG_FENTRY      6
00040 
00041 #define FSFAT_LOG(_fmt, ...)                          \
00042   do                                                    \
00043   {                                                     \
00044         printf(_fmt, __VA_ARGS__);                      \
00045   }while(0);
00046 
00047 #define noFSFAT_DEBUG
00048 #ifdef FSFAT_DEBUG
00049 
00050 extern uint32_t fsfat_optDebug_g;
00051 extern uint32_t fsfat_optLogLevel_g;
00052 
00053 
00054 /* uncomment for asserts to work */
00055 /* #undef NDEBUG */
00056 // todo: port to mbedOSV3++ #include <core-util/assert.h>
00057 
00058 #define FSFAT_INLINE
00059 // todo: port to mbedOSV3++ #define FSFAT_ASSERT  CORE_UTIL_ASSERT
00060 #define FSFAT_ASSERT(...)
00061 
00062 #define FSFAT_DBGLOG(_fmt, ...)                       \
00063   do                                                    \
00064   {                                                     \
00065     if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_DEBUG))  \
00066     {                                                   \
00067         printf(_fmt, __VA_ARGS__);                      \
00068     }                                                   \
00069   }while(0);
00070 
00071 
00072 #define FSFAT_ERRLOG(_fmt, ...)                       \
00073   do                                                    \
00074   {                                                     \
00075     if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_ERR))  \
00076     {                                                   \
00077         printf(_fmt, __VA_ARGS__);                      \
00078     }                                                   \
00079   }while(0);
00080 
00081 
00082 #define FSFAT_FENTRYLOG(_fmt, ...)                       \
00083   do                                                    \
00084   {                                                     \
00085     if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_FENTRY))  \
00086     {                                                   \
00087         printf(_fmt, __VA_ARGS__);                      \
00088     }                                                   \
00089   }while(0);
00090 
00091 
00092 
00093 
00094 
00095 #else
00096 #define FSFAT_ASSERT(_x)                   do { } while(0)
00097 #define FSFAT_INLINE                       inline
00098 #define FSFAT_DBGLOG(_fmt, ...)            do { } while(0)
00099 #define FSFAT_ERRLOG(_fmt, ...)            do { } while(0)
00100 #define FSFAT_FENTRYLOG(_fmt, ...)         do { } while(0)
00101 #endif /* FSFAT_DEBUG */
00102 
00103 
00104 #endif /*__FSFAT_DEBUG*/