mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-17 11:13:27 +00:00
maixbit: add board definition and dummy runtime
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user