From 154cc5735cde82677c6d366c2be4eec626d7d907 Mon Sep 17 00:00:00 2001 From: Rahix <rahix@rahix.de> Date: Tue, 20 Aug 2019 18:15:55 +0200 Subject: [PATCH] feat(api): Add API-call for soft-reset Signed-off-by: Rahix <rahix@rahix.de> --- epicardium/epicardium.h | 6 ++++++ epicardium/modules/lifecycle.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/epicardium/epicardium.h b/epicardium/epicardium.h index 6d73b4610..88712b176 100644 --- a/epicardium/epicardium.h +++ b/epicardium/epicardium.h @@ -31,6 +31,7 @@ typedef _Bool bool; /* clang-format off */ #define API_SYSTEM_EXIT 0x1 #define API_SYSTEM_EXEC 0x2 +#define API_SYSTEM_RESET 0x3 #define API_INTERRUPT_ENABLE 0xA #define API_INTERRUPT_DISABLE 0xB @@ -196,6 +197,11 @@ int epic_exec(char *name); */ API(API_SYSTEM_EXEC, int __epic_exec(char *name)); +/** + * Reset/Restart card10 + */ +API(API_SYSTEM_RESET, void epic_system_reset(void)); + /** * UART/Serial Interface * ===================== diff --git a/epicardium/modules/lifecycle.c b/epicardium/modules/lifecycle.c index 992b0d5ff..97360d679 100644 --- a/epicardium/modules/lifecycle.c +++ b/epicardium/modules/lifecycle.c @@ -275,6 +275,14 @@ static void load_menu(bool reset) /* Helpers }}} */ /* API {{{ */ +/* + * Restart the firmware + */ +void epic_system_reset(void) +{ + card10_reset(); +} + /* * This is NOT the epic_exec() called from Pycardium, but an implementation of * the same call for use in Epicardium. This function is synchroneous and will -- GitLab