Revision 9487b4cd core/inc/aos_debug.h
core/inc/aos_debug.h | ||
---|---|---|
60 | 60 |
|
61 | 61 |
/** |
62 | 62 |
* @brief Function parameters check. |
63 |
* @details If the condition check fails, the kernel panics and halts.
|
|
63 |
* @details If the condition check fails, the thread complains and exits.
|
|
64 | 64 |
* |
65 | 65 |
* @param[in] c The condition to be verified to be true. |
66 | 66 |
*/ |
67 |
#define aosDbgCheck(c) chDbgCheck(c) |
|
67 |
#define aosDbgCheck(c) { \ |
|
68 |
if (!(c)) { \ |
|
69 |
aosDbgPrintf("%s(%u): aosDbgCheck failed", __FILE__, __LINE__); \ |
|
70 |
chThdExit(MSG_RESET); \ |
|
71 |
} \ |
|
72 |
} |
|
68 | 73 |
|
69 | 74 |
/** |
70 | 75 |
* @brief Condition assertion. |
71 |
* @details If the condition check fails, the kernel panics with a message and halts. |
|
72 |
* @note As a limitation of ChibiOS, the remark string is not currently used. |
|
76 |
* @details If the condition check fails, the thread complains and exits. |
|
73 | 77 |
* |
74 | 78 |
* @param[in] c The condition to be verified to be true. |
75 | 79 |
*/ |
76 |
#define aosDbgAssert(c) chDbgAssert(c, "__FILE__(__LINE__): aosDbgAssert failed") |
|
80 |
#define aosDbgAssert(c) { \ |
|
81 |
if (!(c)) { \ |
|
82 |
aosDbgPrintf("%s(%u): aosDbgAssert failed", __FILE__, __LINE__); \ |
|
83 |
chThdExit(MSG_RESET); \ |
|
84 |
} \ |
|
85 |
} |
|
77 | 86 |
|
78 | 87 |
/** |
79 | 88 |
* @brief Condition assertion. |
80 |
* @details If the condition check fails, the kernel panics with a message and halts. |
|
81 |
* @note As a limitation of ChibiOS, the remark string is not currently used. |
|
89 |
* @details If the condition check fails, the thread complains and exits. |
|
82 | 90 |
* |
83 | 91 |
* @param[in] c The condition to be verified to be true. |
84 | 92 |
* @param[in] r A custom remark string. |
85 | 93 |
*/ |
86 |
#define aosDbgAssertMsg(c, r) { \ |
|
87 |
(void)r; \ |
|
88 |
chDbgAssert(c, r); \ |
|
94 |
#define aosDbgAssertMsg(c, fmt, ...) { \ |
|
95 |
if (!(c)) { \ |
|
96 |
aosDbgPrintf(fmt, ##__VA_ARGS__); \ |
|
97 |
chThdExit(MSG_RESET); \ |
|
98 |
} \ |
|
89 | 99 |
} |
90 | 100 |
|
91 | 101 |
#else /* (AMIROOS_CFG_DBG != true) */ |
Also available in: Unified diff