diff options
| author | Felipe Balbi <[email protected]> | 2025-05-20 08:49:34 -0700 |
|---|---|---|
| committer | Felipe Balbi <[email protected]> | 2025-05-21 08:11:18 -0700 |
| commit | 7a600fe9256a4c7c25501320da1de1fce8e1b39e (patch) | |
| tree | 5917df65062d4228ec9fd4fe07132f843ed41015 /embassy-imxrt | |
| parent | 7134e1a3a5b858958e2b4c6911036e4a86dcb095 (diff) | |
timer: ostimer: wait for match write ready
Before writing to MATCH_L/MATCH_H registers, wait for permission to do
so by pollinmg MATCH_WR_RDY bit in CTRL register.
Diffstat (limited to 'embassy-imxrt')
| -rw-r--r-- | embassy-imxrt/src/time_driver.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/embassy-imxrt/src/time_driver.rs b/embassy-imxrt/src/time_driver.rs index c68679d3e..f127609c8 100644 --- a/embassy-imxrt/src/time_driver.rs +++ b/embassy-imxrt/src/time_driver.rs | |||
| @@ -336,6 +336,10 @@ impl OsTimer { | |||
| 336 | let alarm = self.alarms.borrow(cs); | 336 | let alarm = self.alarms.borrow(cs); |
| 337 | alarm.timestamp.set(timestamp); | 337 | alarm.timestamp.set(timestamp); |
| 338 | 338 | ||
| 339 | // Wait until we're allowed to write to MATCH_L/MATCH_H | ||
| 340 | // registers | ||
| 341 | while os().osevent_ctrl().read().match_wr_rdy().bit_is_set() {} | ||
| 342 | |||
| 339 | let t = self.now(); | 343 | let t = self.now(); |
| 340 | if timestamp <= t { | 344 | if timestamp <= t { |
| 341 | os().osevent_ctrl().modify(|_, w| w.ostimer_intena().clear_bit()); | 345 | os().osevent_ctrl().modify(|_, w| w.ostimer_intena().clear_bit()); |
| @@ -366,7 +370,8 @@ impl OsTimer { | |||
| 366 | fn on_interrupt(&self) { | 370 | fn on_interrupt(&self) { |
| 367 | critical_section::with(|cs| { | 371 | critical_section::with(|cs| { |
| 368 | if os().osevent_ctrl().read().ostimer_intrflag().bit_is_set() { | 372 | if os().osevent_ctrl().read().ostimer_intrflag().bit_is_set() { |
| 369 | os().osevent_ctrl().modify(|_, w| w.ostimer_intena().clear_bit()); | 373 | os().osevent_ctrl() |
| 374 | .modify(|_, w| w.ostimer_intena().clear_bit().ostimer_intrflag().set_bit()); | ||
| 370 | self.trigger_alarm(cs); | 375 | self.trigger_alarm(cs); |
| 371 | } | 376 | } |
| 372 | }); | 377 | }); |
