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