* fix system reboot after poweroff

This commit is contained in:
lxowalle
2025-11-07 14:28:50 +08:00
parent 20c9be31d9
commit ea00850a59
4 changed files with 28 additions and 10 deletions

View File

@@ -17,6 +17,15 @@ namespace maix::sys
}
}
void poweroff()
{
int ret = system("poweroff");
if (ret != 0)
{
throw err::Exception(err::Err::ERR_RUNTIME, "power off failed");
}
}
void register_default_signal_handle() {
signal(SIGINT, signal_handle);
}

View File

@@ -12,7 +12,6 @@ namespace maix::sys
raise(SIGINT);
#endif
util::do_exit_function();
signal(SIGINT, nullptr);
signal(SIGILL, nullptr);
signal(SIGTRAP, nullptr);
@@ -23,6 +22,19 @@ namespace maix::sys
signal(SIGSEGV, nullptr);
}
void poweroff()
{
util::do_exit_function();
system("devmem 0x4840000 32 0x0"); // disable wdt0
// system("devmem 0x2230000 32 0x0"); // disable wdt1
system("devmem 0x6040000 32 0x0"); // disable wdt2
int ret = system("poweroff");
if (ret != 0)
{
throw err::Exception(err::Err::ERR_RUNTIME, "power off failed");
}
}
void register_default_signal_handle() {
signal(SIGILL, signal_handle);
signal(SIGTRAP, signal_handle);