Fix race condition in calculate_now (#860)

* Fix race condition in calculate_now

* Add changelog

* Update changelog

* Refine comment

* More comment fixes
This commit is contained in:
Finomnis 2023-12-06 19:36:09 +01:00 committed by GitHub
parent f377471e44
commit bbed945285
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 27 additions and 15 deletions

View file

@ -13,6 +13,7 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!
- Fix race condition in `nrf::rtc`.
- Fix errata in `nrf::rtc`.
- Add internal counter integrity check to all half-period based monotonics.
- Apply race condition fixes from `rtic-time`.
## v1.4.0 - 2023-12-04

View file

@ -212,7 +212,7 @@ macro_rules! make_timer {
let gpt = unsafe{ $timer::instance() };
Self::Instant::from_ticks(calculate_now(
$period.load(Ordering::Relaxed),
|| $period.load(Ordering::Relaxed),
|| ral::read_reg!(ral::gpt, gpt, CNT)
))
}

View file

@ -224,7 +224,7 @@ macro_rules! make_rtc {
fn now() -> Self::Instant {
let rtc = unsafe { &*$rtc::PTR };
Self::Instant::from_ticks(calculate_now(
$overflow.load(Ordering::Relaxed),
|| $overflow.load(Ordering::Relaxed),
|| TimerValueU24(rtc.counter.read().bits())
))
}

View file

@ -242,7 +242,7 @@ macro_rules! make_timer {
let timer = unsafe { &*$timer::PTR };
Self::Instant::from_ticks(calculate_now(
$overflow.load(Ordering::Relaxed),
|| $overflow.load(Ordering::Relaxed),
|| {
timer.tasks_capture[3].write(|w| unsafe { w.bits(1) });
timer.cc[3].read().bits()

View file

@ -234,7 +234,7 @@ macro_rules! make_timer {
fn now() -> Self::Instant {
Self::Instant::from_ticks(calculate_now(
$overflow.load(Ordering::Relaxed),
|| $overflow.load(Ordering::Relaxed),
|| $timer.cnt().read().cnt()
))
}