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