2017-04-17 16:07:34 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2017-10-27 04:01:22 +00:00
|
|
|
#include <unistd.h>
|
2017-04-17 16:07:34 +00:00
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
2017-10-11 22:32:46 +00:00
|
|
|
void __attribute__((noreturn)) __fatal_error(const char *expr, const char *msg, const char *file, int line, const char *func)
|
|
|
|
{
|
|
|
|
printf("\nFATAL ERROR:\n");
|
|
|
|
if (expr) {
|
|
|
|
printf("expr: %s\n", expr);
|
|
|
|
}
|
|
|
|
if (msg) {
|
|
|
|
printf("msg : %s\n", msg);
|
|
|
|
}
|
2017-04-28 13:39:22 +00:00
|
|
|
if (file) {
|
2017-10-11 22:32:46 +00:00
|
|
|
printf("file: %s:%d\n", file, line);
|
2017-04-28 13:39:22 +00:00
|
|
|
}
|
|
|
|
if (func) {
|
2017-10-11 22:32:46 +00:00
|
|
|
printf("func: %s\n", func);
|
2017-04-28 13:39:22 +00:00
|
|
|
}
|
2017-10-12 14:02:40 +00:00
|
|
|
#ifdef GITREV
|
|
|
|
#define XSTR(s) STR(s)
|
|
|
|
#define STR(s) #s
|
|
|
|
printf("rev : %s\n", XSTR(GITREV));
|
|
|
|
#endif
|
2017-04-17 16:07:34 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
2017-10-27 04:01:22 +00:00
|
|
|
|
|
|
|
void hal_delay(uint32_t ms)
|
|
|
|
{
|
|
|
|
usleep(1000 * ms);
|
|
|
|
}
|