remove magic numbers for syscon
This commit is contained in:
parent
8cd08165e0
commit
fae2e42f8f
2 changed files with 9 additions and 6 deletions
|
|
@ -4,11 +4,11 @@
|
|||
#include "drivers/uart.h"
|
||||
|
||||
void poweroff(void) {
|
||||
kputs("Poweroff requested");
|
||||
*(uint32_t *)SYSCON_ADDR = 0x5555;
|
||||
kputs("Poweroff requested");
|
||||
*(volatile uint32_t *)SYSCON_ADDR = SYSCON_POWEROFF;
|
||||
}
|
||||
|
||||
void reboot(void) {
|
||||
kputs("Reboot requested");
|
||||
*(uint32_t *)SYSCON_ADDR = 0x7777;
|
||||
kputs("Reboot requested");
|
||||
*(volatile uint32_t *)SYSCON_ADDR = SYSCON_REBOOT;
|
||||
}
|
||||
|
|
@ -1,10 +1,13 @@
|
|||
#ifndef SYSCON_H
|
||||
#define SYSCON_H
|
||||
|
||||
// "test" syscon-compatible device is at memory-mapped address 0x100000
|
||||
// according to our device tree
|
||||
// QEMU Sifive Test device address
|
||||
#define SYSCON_ADDR 0x100000
|
||||
|
||||
// Magic values for the Sifive Test device
|
||||
#define SYSCON_POWEROFF 0x5555
|
||||
#define SYSCON_REBOOT 0x7777
|
||||
|
||||
void poweroff(void);
|
||||
void reboot(void);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue