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