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