diff --git a/embed/extmod/modtrezorio/unix-msg-mock.h b/embed/extmod/modtrezorio/unix-msg-mock.h index 31adc5b6..5bf7a38f 100644 --- a/embed/extmod/modtrezorio/unix-msg-mock.h +++ b/embed/extmod/modtrezorio/unix-msg-mock.h @@ -13,10 +13,13 @@ #include #include -#include "../../unix/common.h" #include "../../trezorhal/usb.h" #include "../../trezorhal/touch.h" +void __attribute__((noreturn)) __fatal_error(const char *expr, const char *msg, const char *file, int line, const char *func); + +#define ensure(expr, msg) (((expr) == sectrue) ? (void)0 : __fatal_error(#expr, msg, __FILE__, __LINE__, __func__)) + #define TREZOR_UDP_IFACE 0 #define TREZOR_UDP_PORT 21324 diff --git a/embed/unix/common.c b/embed/unix/common.c index d4085810..1d848b2d 100644 --- a/embed/unix/common.c +++ b/embed/unix/common.c @@ -31,3 +31,8 @@ void hal_delay(uint32_t ms) { usleep(1000 * ms); } + +void shutdown(void) +{ + exit(1); +} diff --git a/embed/unix/common.h b/embed/unix/common.h index fde45ec8..d1daf8a1 100644 --- a/embed/unix/common.h +++ b/embed/unix/common.h @@ -9,4 +9,6 @@ void __attribute__((noreturn)) __fatal_error(const char *expr, const char *msg, void hal_delay(uint32_t ms); +void shutdown(void); + #endif