1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-12 18:49:07 +00:00
trezor-firmware/embed/unix/common.c
2017-10-27 06:01:22 +02:00

34 lines
653 B
C

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "common.h"
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);
}
if (file) {
printf("file: %s:%d\n", file, line);
}
if (func) {
printf("func: %s\n", func);
}
#ifdef GITREV
#define XSTR(s) STR(s)
#define STR(s) #s
printf("rev : %s\n", XSTR(GITREV));
#endif
exit(1);
}
void hal_delay(uint32_t ms)
{
usleep(1000 * ms);
}