runtime/esp32c3: use TIMG0 alarm interrupt for sleepTicks instead of busy-waiting

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2026-03-22 20:34:44 +01:00
parent d2f60c02bb
commit a71f776203
5 changed files with 89 additions and 9 deletions
@@ -55,6 +55,9 @@ func (i Interrupt) Enable() error {
//go:linkname callHandlers runtime/interrupt.callHandlers
func callHandlers(num int)
//go:linkname signalInterrupt runtime.signalInterrupt
func signalInterrupt()
const (
IRQNUM_1 = 1 + iota
IRQNUM_2
@@ -203,6 +206,9 @@ func handleInterrupt() {
// Call registered interrupt handler(s)
callHandler(int(interruptNumber))
// Signal to sleepTicks that an interrupt has occurred.
signalInterrupt()
// disable CPU interrupts
riscv.MSTATUS.ClearBits(riscv.MSTATUS_MIE)