mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 15:03:41 +00:00
runtime: update to avoid //go:volatile
There was exactly one change in the output of the smoke tests: examples/test. However, it still runs just fine on a PCA10040.
This commit is contained in:
committed by
Ron Evans
parent
9673ad3774
commit
c84c625585
@@ -6,6 +6,7 @@ import (
|
||||
"device/arm"
|
||||
"device/sam"
|
||||
"machine"
|
||||
"runtime/volatile"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
@@ -230,10 +231,7 @@ var (
|
||||
timerLastCounter uint64
|
||||
)
|
||||
|
||||
//go:volatile
|
||||
type isrFlag bool
|
||||
|
||||
var timerWakeup isrFlag
|
||||
var timerWakeup volatile.Register8
|
||||
|
||||
const asyncScheduler = false
|
||||
|
||||
@@ -262,7 +260,7 @@ func ticks() timeUnit {
|
||||
|
||||
// ticks are in microseconds
|
||||
func timerSleep(ticks uint32) {
|
||||
timerWakeup = false
|
||||
timerWakeup.Set(0)
|
||||
if ticks < 30 {
|
||||
// have to have at least one clock count
|
||||
ticks = 30
|
||||
@@ -280,7 +278,7 @@ func timerSleep(ticks uint32) {
|
||||
// enable IRQ for CMP0 compare
|
||||
sam.RTC_MODE0.INTENSET.SetBits(sam.RTC_MODE0_INTENSET_CMP0)
|
||||
|
||||
for !timerWakeup {
|
||||
for timerWakeup.Get() == 0 {
|
||||
arm.Asm("wfi")
|
||||
}
|
||||
}
|
||||
@@ -290,7 +288,7 @@ func handleRTC() {
|
||||
// disable IRQ for CMP0 compare
|
||||
sam.RTC_MODE0.INTFLAG.Set(sam.RTC_MODE0_INTENSET_CMP0)
|
||||
|
||||
timerWakeup = true
|
||||
timerWakeup.Set(1)
|
||||
}
|
||||
|
||||
func initUSBClock() {
|
||||
|
||||
Reference in New Issue
Block a user