Wait for update before reading timer count (#1183)

* Wait for update before reading timer count

* CHANGELOG.md entry

* Wait for update before reading timer count (ESP32)

* Use latest PACs

* CHANGELOG.md fix
This commit is contained in:
Björn Quentin 2024-02-19 15:51:58 +01:00 committed by GitHub
parent 09fef6acc4
commit 6712aa55f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 18 deletions

View File

@ -31,8 +31,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix docs.rs documentation builds (#1129)
- Fix circular DMA (#1144)
- Fix `hello_rgb` example for ESP32 (#1173)
- Fix timer `now` for esp32c3 and esp32c6
- Fixed the multicore critical section on Xtensa (#1175)
- Fix timer `now` for esp32c3 and esp32c6 (#1178)
- Wait for registers to get synced before reading the timer count for all chips (#1183)
### Changed

View File

@ -61,14 +61,14 @@ ufmt-write = { version = "0.1.0", optional = true }
# IMPORTANT:
# Each supported device MUST have its PAC included below along with a
# corresponding feature.
esp32 = { git = "https://github.com/esp-rs/esp-pacs", rev = "55f9f6c", features = ["critical-section"], optional = true }
esp32c2 = { git = "https://github.com/esp-rs/esp-pacs", rev = "55f9f6c", features = ["critical-section"], optional = true }
esp32c3 = { git = "https://github.com/esp-rs/esp-pacs", rev = "55f9f6c", features = ["critical-section"], optional = true }
esp32c6 = { git = "https://github.com/esp-rs/esp-pacs", rev = "55f9f6c", features = ["critical-section"], optional = true }
esp32h2 = { git = "https://github.com/esp-rs/esp-pacs", rev = "55f9f6c", features = ["critical-section"], optional = true }
esp32p4 = { git = "https://github.com/esp-rs/esp-pacs", rev = "55f9f6c", features = ["critical-section"], optional = true }
esp32s2 = { git = "https://github.com/esp-rs/esp-pacs", rev = "55f9f6c", features = ["critical-section"], optional = true }
esp32s3 = { git = "https://github.com/esp-rs/esp-pacs", rev = "55f9f6c", features = ["critical-section"], optional = true }
esp32 = { git = "https://github.com/esp-rs/esp-pacs", rev = "8231fea", features = ["critical-section"], optional = true }
esp32c2 = { git = "https://github.com/esp-rs/esp-pacs", rev = "8231fea", features = ["critical-section"], optional = true }
esp32c3 = { git = "https://github.com/esp-rs/esp-pacs", rev = "8231fea", features = ["critical-section"], optional = true }
esp32c6 = { git = "https://github.com/esp-rs/esp-pacs", rev = "8231fea", features = ["critical-section"], optional = true }
esp32h2 = { git = "https://github.com/esp-rs/esp-pacs", rev = "8231fea", features = ["critical-section"], optional = true }
esp32p4 = { git = "https://github.com/esp-rs/esp-pacs", rev = "8231fea", features = ["critical-section"], optional = true }
esp32s2 = { git = "https://github.com/esp-rs/esp-pacs", rev = "8231fea", features = ["critical-section"], optional = true }
esp32s3 = { git = "https://github.com/esp-rs/esp-pacs", rev = "8231fea", features = ["critical-section"], optional = true }
[build-dependencies]
basic-toml = "0.1.8"

View File

@ -420,14 +420,8 @@ where
fn now(&self) -> u64 {
let reg_block = unsafe { &*TG::register_block() };
#[cfg(not(any(esp32c3, esp32c6)))]
reg_block.t0update().write(|w| unsafe { w.bits(0) });
#[cfg(any(esp32c3, esp32c6))]
{
reg_block.t0update().write(|w| w.update().set_bit());
while reg_block.t0update().read().update().bit_is_set() {}
}
reg_block.t0update().write(|w| w.update().set_bit());
while reg_block.t0update().read().update().bit_is_set() {}
let value_lo = reg_block.t0lo().read().bits() as u64;
let value_hi = (reg_block.t0hi().read().bits() as u64) << 32;
@ -597,7 +591,8 @@ where
fn now(&self) -> u64 {
let reg_block = unsafe { &*TG::register_block() };
reg_block.t1update().write(|w| unsafe { w.bits(0) });
reg_block.t1update().write(|w| w.update().set_bit());
while reg_block.t1update().read().update().bit_is_set() {}
let value_lo = reg_block.t1lo().read().bits() as u64;
let value_hi = (reg_block.t1hi().read().bits() as u64) << 32;