maixbit: add board definition and dummy runtime

This commit is contained in:
Yannis Huber
2020-06-15 08:56:11 +02:00
committed by Ron Evans
parent 2fe4a9be71
commit 7814964693
6 changed files with 284 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
// +build k210,!qemu
package runtime
import (
"device/kendryte"
"device/riscv"
)
var clockFrequency uint32 = kendryte.SYSCTL.CLK_FREQ.Get()
// ticksToNanoseconds converts RTC ticks to nanoseconds.
func ticksToNanoseconds(ticks timeUnit) int64 {
return int64(ticks) * 1e9 / clockFrequency
}
// nanosecondsToTicks converts nanoseconds to RTC ticks.
func nanosecondsToTicks(ns int64) timeUnit {
return timeUnit(ns * 64 / 1953125)
}
func abort() {
// lock up forever
for {
riscv.Asm("wfi")
}
}