GroupU - 05012018 1543

Fork of 352 by Elec351 MMB

Committer:
mslade
Date:
Tue Jan 09 14:53:07 2018 +0000
Revision:
1:84581acd1333
Final Version - Group U

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mslade 1:84581acd1333 1 /** @file fsfat_debug.h
mslade 1:84581acd1333 2 *
mslade 1:84581acd1333 3 * component debug header file.
mslade 1:84581acd1333 4 */
mslade 1:84581acd1333 5
mslade 1:84581acd1333 6
mslade 1:84581acd1333 7 #ifndef __FSFAT_DEBUG
mslade 1:84581acd1333 8 #define __FSFAT_DEBUG
mslade 1:84581acd1333 9
mslade 1:84581acd1333 10 #include <stdint.h>
mslade 1:84581acd1333 11 #include <assert.h>
mslade 1:84581acd1333 12 #include <stdio.h>
mslade 1:84581acd1333 13
mslade 1:84581acd1333 14
mslade 1:84581acd1333 15 /* Debug Support */
mslade 1:84581acd1333 16
mslade 1:84581acd1333 17 #define FSFAT_LOG_NONE 0
mslade 1:84581acd1333 18 #define FSFAT_LOG_ERR 1
mslade 1:84581acd1333 19 #define FSFAT_LOG_WARN 2
mslade 1:84581acd1333 20 #define FSFAT_LOG_NOTICE 3
mslade 1:84581acd1333 21 #define FSFAT_LOG_INFO 4
mslade 1:84581acd1333 22 #define FSFAT_LOG_DEBUG 5
mslade 1:84581acd1333 23 #define FSFAT_LOG_FENTRY 6
mslade 1:84581acd1333 24
mslade 1:84581acd1333 25 #define FSFAT_LOG(_fmt, ...) \
mslade 1:84581acd1333 26 do \
mslade 1:84581acd1333 27 { \
mslade 1:84581acd1333 28 printf(_fmt, __VA_ARGS__); \
mslade 1:84581acd1333 29 }while(0);
mslade 1:84581acd1333 30
mslade 1:84581acd1333 31 #define noFSFAT_DEBUG
mslade 1:84581acd1333 32 #ifdef FSFAT_DEBUG
mslade 1:84581acd1333 33
mslade 1:84581acd1333 34 extern uint32_t fsfat_optDebug_g;
mslade 1:84581acd1333 35 extern uint32_t fsfat_optLogLevel_g;
mslade 1:84581acd1333 36
mslade 1:84581acd1333 37
mslade 1:84581acd1333 38 /* uncomment for asserts to work */
mslade 1:84581acd1333 39 /* #undef NDEBUG */
mslade 1:84581acd1333 40 // todo: port to mbedOSV3++ #include <core-util/assert.h>
mslade 1:84581acd1333 41
mslade 1:84581acd1333 42 #define FSFAT_INLINE
mslade 1:84581acd1333 43 // todo: port to mbedOSV3++ #define FSFAT_ASSERT CORE_UTIL_ASSERT
mslade 1:84581acd1333 44 #define FSFAT_ASSERT(...)
mslade 1:84581acd1333 45
mslade 1:84581acd1333 46 #define FSFAT_DBGLOG(_fmt, ...) \
mslade 1:84581acd1333 47 do \
mslade 1:84581acd1333 48 { \
mslade 1:84581acd1333 49 if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_DEBUG)) \
mslade 1:84581acd1333 50 { \
mslade 1:84581acd1333 51 printf(_fmt, __VA_ARGS__); \
mslade 1:84581acd1333 52 } \
mslade 1:84581acd1333 53 }while(0);
mslade 1:84581acd1333 54
mslade 1:84581acd1333 55
mslade 1:84581acd1333 56 #define FSFAT_ERRLOG(_fmt, ...) \
mslade 1:84581acd1333 57 do \
mslade 1:84581acd1333 58 { \
mslade 1:84581acd1333 59 if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_ERR)) \
mslade 1:84581acd1333 60 { \
mslade 1:84581acd1333 61 printf(_fmt, __VA_ARGS__); \
mslade 1:84581acd1333 62 } \
mslade 1:84581acd1333 63 }while(0);
mslade 1:84581acd1333 64
mslade 1:84581acd1333 65
mslade 1:84581acd1333 66 #define FSFAT_FENTRYLOG(_fmt, ...) \
mslade 1:84581acd1333 67 do \
mslade 1:84581acd1333 68 { \
mslade 1:84581acd1333 69 if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_FENTRY)) \
mslade 1:84581acd1333 70 { \
mslade 1:84581acd1333 71 printf(_fmt, __VA_ARGS__); \
mslade 1:84581acd1333 72 } \
mslade 1:84581acd1333 73 }while(0);
mslade 1:84581acd1333 74
mslade 1:84581acd1333 75
mslade 1:84581acd1333 76
mslade 1:84581acd1333 77
mslade 1:84581acd1333 78
mslade 1:84581acd1333 79 #else
mslade 1:84581acd1333 80 #define FSFAT_ASSERT(_x) do { } while(0)
mslade 1:84581acd1333 81 #define FSFAT_INLINE inline
mslade 1:84581acd1333 82 #define FSFAT_DBGLOG(_fmt, ...) do { } while(0)
mslade 1:84581acd1333 83 #define FSFAT_ERRLOG(_fmt, ...) do { } while(0)
mslade 1:84581acd1333 84 #define FSFAT_FENTRYLOG(_fmt, ...) do { } while(0)
mslade 1:84581acd1333 85 #endif /* FSFAT_DEBUG */
mslade 1:84581acd1333 86
mslade 1:84581acd1333 87
mslade 1:84581acd1333 88 #endif /*__FSFAT_DEBUG*/