
The CLINT is implemented both on the fe310-g002 chip and in the sifive_e QEMU machine type. Therefore, use that peripheral for consistency. The only difference is the clock speed, which runs at 10MHz in QEMU for some reason instead of 32.768kHz as on the physical HiFive1 boards.
20 строки
376 Б
Go
20 строки
376 Б
Go
// +build fe310,qemu
|
|
|
|
package runtime
|
|
|
|
import (
|
|
"runtime/volatile"
|
|
"unsafe"
|
|
)
|
|
|
|
const tickMicros = 100 // CLINT.MTIME increments every 100ns
|
|
|
|
// Special memory-mapped device to exit tests, created by SiFive.
|
|
var testExit = (*volatile.Register32)(unsafe.Pointer(uintptr(0x100000)))
|
|
|
|
var timestamp timeUnit
|
|
|
|
func abort() {
|
|
// Signal a successful exit.
|
|
testExit.Set(0x5555)
|
|
}
|