21 lines
405 B
C
21 lines
405 B
C
#include <bcm.h>
|
|
#include <mem.h>
|
|
|
|
#define PM_RSTC_WRCFG_FULL_RESET 0x20
|
|
|
|
void reboot(void) {
|
|
write32(ARM_PM_WDOG, ARM_PM_PASSWD | 1);
|
|
write32(ARM_PM_RSTC, ARM_PM_PASSWD | PM_RSTC_WRCFG_FULL_RESET);
|
|
|
|
for (;;)
|
|
; // wait for reset
|
|
}
|
|
|
|
void poweroff(void) {
|
|
__asm__ __volatile("mov x0, %0\n"
|
|
"smc #0\n" ::"r"(0x84000008UL) // function code SYSTEM_OFF
|
|
);
|
|
|
|
for (;;)
|
|
;
|
|
}
|