53 __attribute__((always_inline))
76 void fatal(
const char* file,
int line,
str_P expr)
77 __attribute__((noreturn));
105 #define LOG_MASK(prio) (1 << (prio)) 106 #define LOG_UPTO(prio) (LOG_MASK((prio) + 1) - 1) 116 trace.fatal(__FILE__, \ 127 # define ASSERT(expr) \ 129 if (UNLIKELY(!(expr))) FATAL("assert:" #expr); \ 136 # define TRACE_P(str) trace.print(PSTR(str)) 143 # if defined(TRACE_NO_VERBOSE) || defined(BOARD_ATTINY) 144 # define TRACE(expr) \ 146 trace.print(__PSTR(#expr " = ")); \ 151 # define TRACE(expr) \ 153 trace.printf(__PSTR("%d:%s:trace:" #expr " = "), \ 155 __PRETTY_FUNCTION__); \ 166 # define TRACE_LOG(msg, ...) \ 167 trace.printf(__PSTR("%d:%s:" msg "\r\n"), \ 169 __PRETTY_FUNCTION__, \ 171 # define IS_LOG_PRIO(prio) (trace_log_mask & LOG_MASK(prio)) 172 # define EMERG(msg, ...) \ 173 if (IS_LOG_PRIO(LOG_EMERG)) TRACE_LOG("emerg:" msg, __VA_ARGS__) 174 # define ALERT(msg, ...) \ 175 if (IS_LOG_PRIO(LOG_ALERT)) TRACE_LOG("alert:" msg, __VA_ARGS__) 176 # define CRIT(msg, ...) \ 177 if (IS_LOG_PRIO(LOG_CRIT)) TRACE_LOG("crit:" msg, __VA_ARGS__) 178 # define ERR(msg, ...) \ 179 if (IS_LOG_PRIO(LOG_ERR)) TRACE_LOG("err:" msg, __VA_ARGS__) 180 # define WARNING(msg, ...) \ 181 if (IS_LOG_PRIO(LOG_WARNING)) TRACE_LOG("warning:" msg, __VA_ARGS__) 182 # define NOTICE(msg, ...) \ 183 if (IS_LOG_PRIO(LOG_NOTICE)) TRACE_LOG("notice:" msg, __VA_ARGS__) 184 # define INFO(msg, ...) \ 185 if (IS_LOG_PRIO(LOG_INFO)) TRACE_LOG("info:" msg, __VA_ARGS__) 186 # define DEBUG(msg, ...) \ 187 if (IS_LOG_PRIO(LOG_DEBUG)) TRACE_LOG("debug:" msg, __VA_ARGS__) 189 # define ASSERT(expr) 190 # define TRACE_P(str) 192 # define TRACE_LOG(msg, ...) 193 # define EMERG(msg, ...) 194 # define ALERT(msg, ...) 195 # define CRIT(msg, ...) 196 # define ERR(msg, ...) 197 # define WARNING(msg, ...) 198 # define NOTICE(msg, ...) 199 # define INFO(msg, ...) 200 # define DEBUG(msg, ...) 217 # if defined(TRACE_NO_VERBOSE) || defined(BOARD_ATTINY) 218 # define MEASURE(msg,cnt) \ 220 for (uint32_t __stop, __start = RTT::micros(), __i = 1; \ 223 __stop = RTT::micros(), \ 224 trace.measure = (__stop - __start) / cnt, \ 225 trace << PSTR(msg) << trace.measure, \ 226 trace << PSTR(" us") << endl, \ 228 for (uint16_t __j = cnt; __j != 0; __j--) 229 # define measure(msg,cnt) \ 231 for (uint32_t __stop, __start = RTT::millis(), __i = 1; \ 234 __stop = RTT::millis(), \ 235 trace.measure = (__stop - __start) / cnt, \ 236 trace << PSTR(msg) << trace.measure, \ 237 trace << PSTR(" ms") << endl, \ 239 for (uint16_t __j = cnt; __j != 0; __j--) 241 # define MEASURE(msg,cnt) \ 243 for (uint32_t __stop, __start = RTT::micros(), __i = 1; \ 246 __stop = RTT::micros(), \ 247 trace.measure = (__stop - __start) / cnt, \ 248 trace << __LINE__ << ':' << __PRETTY_FUNCTION__, \ 249 trace << PSTR(":measure:") << PSTR(msg) << trace.measure, \ 250 trace << PSTR(" us") << endl, \ 252 for (uint16_t __j = cnt; __j != 0; __j--) 253 # define measure(msg,cnt) \ 255 for (uint32_t __stop, __start = RTT::millis(), __i = 1; \ 258 __stop = RTT::millis(), \ 259 trace.measure = (__stop - __start) / cnt, \ 260 trace << __LINE__ << ':' << __PRETTY_FUNCTION__, \ 261 trace << PSTR(":measure:") << PSTR(msg) << trace.measure, \ 262 trace << PSTR(" ms") << endl, \ 264 for (uint16_t __j = cnt; __j != 0; __j--)
void fatal(const char *file, int line, str_P expr)
const class prog_str * str_P
bool begin(IOStream::Device *dev, str_P banner=NULL)
void exitcharacter(char c)