98 #define abort(n) do { exit(n); } while (0)
104 #define LOG_WARNING 20
114 #if defined(PRODUCTION_CODE) || defined(NDEBUG)
115 #define LOG_LEVEL LOG_INFO
118 #define LOG_LEVEL LOG_DEBUG
122 #if !(defined(PRODUCTION_CODE) || defined(NDEBUG))
127 #define check(condition, message, ...) \
129 if (!(condition)) { \
130 io_printf(IO_BUF, "[CHECK] ", message, ##__VA_ARGS__); \
136 #define sentinel(message, ...) \
138 io_printf(IO_BUF, "[SENTINEL] ", message, ##__VA_ARGS__); \
145 #define assert(assertion) \
147 if (!(assertion)) { \
148 io_printf(IO_BUF, "[ASSERT] ", "assertion check fails!"); \
157 #define assert_info(assertion, message, ...) \
159 if (!(assertion)) { \
160 io_printf(IO_BUF, "[ASSERT] ", message, ##__VA_ARGS__); \
166 #define check(a, s, ...) skip()
167 #define sentinel(s, ...) skip()
168 #define assert(a) skip()
169 #define assert_info(a, m, ...) skip()
178 return (
unsigned int) ptr;
183 #define check_memory(a) check((a), "Out of memory")
185 #ifndef DEBUG_ON_HOST
188 #define check_itcm(a) \
189 check((ITCM_BASE <= __addr__(a) && __addr__(a) < ITCM_TOP), \
190 "%x is not in ITCM", (a))
194 #define check_dtcm(a) \
195 check((DTCM_BASE <= __addr__(a) && __addr__(a) < DTCM_TOP), \
196 "%x is not in DTCM", (a))
200 #define check_sysram(a) \
201 check((SYSRAM_BASE <= __addr__(a) && __addr__(a) < SYSRAM_TOP), \
202 "%x is not in sysRAM", (a))
206 #define check_sdram(a) \
207 check((SDRAM_BASE <= __addr__(a) && __addr__(a) < SDRAM_TOP), \
208 "%x is not in sdram", (a))
211 #define check_itcm(a) skip()
212 #define check_dtcm(a) skip()
213 #define check_sysram(a) skip()
214 #define check_sdram(a) skip()
static unsigned int __addr__(void *ptr)
This function returns the unsigned integer associated with a pointer address.
Definition: assert.h:176
For quick changing between host-side and SpiNNaker side C code printing.