Revision f3ac1c96 core/inc/aos_debug.h
| core/inc/aos_debug.h | ||
|---|---|---|
| 30 | 30 |
#include <aosconf.h> |
| 31 | 31 |
#include <hal.h> |
| 32 | 32 |
#include <chprintf.h> |
| 33 |
/******************************************************************************/ |
|
| 34 |
/* CONSTANTS */ |
|
| 35 |
/******************************************************************************/ |
|
| 36 |
|
|
| 37 |
/******************************************************************************/ |
|
| 38 |
/* SETTINGS */ |
|
| 39 |
/******************************************************************************/ |
|
| 40 |
|
|
| 41 |
/******************************************************************************/ |
|
| 42 |
/* CHECKS */ |
|
| 43 |
/******************************************************************************/ |
|
| 44 |
|
|
| 45 |
/******************************************************************************/ |
|
| 46 |
/* DATA STRUCTURES AND TYPES */ |
|
| 47 |
/******************************************************************************/ |
|
| 48 |
|
|
| 49 |
/******************************************************************************/ |
|
| 50 |
/* MACROS */ |
|
| 51 |
/******************************************************************************/ |
|
| 33 | 52 |
|
| 34 | 53 |
#if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__) |
| 35 | 54 |
|
| 36 | 55 |
/** |
| 56 |
* @brief Printf function for messages only printed in debug builds. |
|
| 57 |
* |
|
| 58 |
* @param[in] fmt Formatted string to print. |
|
| 59 |
*/ |
|
| 60 |
#define aosDbgPrintf(fmt, ...) aosprintf(fmt, ##__VA_ARGS__) |
|
| 61 |
|
|
| 62 |
/** |
|
| 37 | 63 |
* @brief Function parameters check. |
| 38 | 64 |
* @details If the condition check fails, the kernel panics and halts. |
| 39 | 65 |
* |
| ... | ... | |
| 63 | 89 |
chDbgAssert(c, r); \ |
| 64 | 90 |
} |
| 65 | 91 |
|
| 66 |
/** |
|
| 67 |
* @brief Printf function for messages only printed in debug builds. |
|
| 68 |
* |
|
| 69 |
* @param[in] fmt Formatted string to print. |
|
| 70 |
*/ |
|
| 71 |
#define aosDbgPrintf(fmt, ...) chprintf((BaseSequentialStream*)&aos.iostream, fmt, ##__VA_ARGS__) |
|
| 72 |
|
|
| 73 | 92 |
#else /* (AMIROOS_CFG_DBG != true) */ |
| 74 | 93 |
|
| 94 |
#define aosDbgPrintf(fmt, ...) { \
|
|
| 95 |
(void)(fmt); \ |
|
| 96 |
} |
|
| 97 |
|
|
| 75 | 98 |
#define aosDbgCheck(c) { \
|
| 76 | 99 |
(void)(c); \ |
| 77 | 100 |
} |
| ... | ... | |
| 85 | 108 |
(void)(r); \ |
| 86 | 109 |
} |
| 87 | 110 |
|
| 88 |
#define aosDbgPrintf(fmt, ...) { \
|
|
| 89 |
(void)(fmt); \ |
|
| 90 |
} |
|
| 111 |
#endif /* AMIROOS_CFG_DBG */ |
|
| 112 |
|
|
| 113 |
/******************************************************************************/ |
|
| 114 |
/* EXTERN DECLARATIONS */ |
|
| 115 |
/******************************************************************************/ |
|
| 91 | 116 |
|
| 92 |
#endif |
|
| 117 |
/******************************************************************************/ |
|
| 118 |
/* INLINE FUNCTIONS */ |
|
| 119 |
/******************************************************************************/ |
|
| 93 | 120 |
|
| 94 | 121 |
#endif /* AMIROOS_DEBUG_H */ |
| 95 | 122 |
|
Also available in: Unified diff