diff options
| author | pennae <[email protected]> | 2023-05-04 11:55:11 +0200 |
|---|---|---|
| committer | pennae <[email protected]> | 2023-05-05 19:08:16 +0200 |
| commit | 5f7ef8bed0d665c2f59351194fbc155203321d24 (patch) | |
| tree | 3b1c192252979fafd55a7c9eebbf4fd3e813e79d | |
| parent | ed843b519b1cfdcc69f9022e3e14fbb9f62972bb (diff) | |
rp/pio: only clear diag bits if they're set
otherwise we may lose a bit being raised after it was read, but before
it was cleared.
| -rw-r--r-- | embassy-rp/src/pio.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/embassy-rp/src/pio.rs b/embassy-rp/src/pio.rs index d2eedc72a..ea6814fb8 100644 --- a/embassy-rp/src/pio.rs +++ b/embassy-rp/src/pio.rs | |||
| @@ -307,7 +307,9 @@ impl<'d, PIO: Instance, const SM: usize> StateMachineRx<'d, PIO, SM> { | |||
| 307 | unsafe { | 307 | unsafe { |
| 308 | let fdebug = PIO::PIO.fdebug(); | 308 | let fdebug = PIO::PIO.fdebug(); |
| 309 | let ret = fdebug.read().rxstall() & (1 << SM) != 0; | 309 | let ret = fdebug.read().rxstall() & (1 << SM) != 0; |
| 310 | fdebug.write(|w| w.set_rxstall(1 << SM)); | 310 | if ret { |
| 311 | fdebug.write(|w| w.set_rxstall(1 << SM)); | ||
| 312 | } | ||
| 311 | ret | 313 | ret |
| 312 | } | 314 | } |
| 313 | } | 315 | } |
| @@ -316,7 +318,9 @@ impl<'d, PIO: Instance, const SM: usize> StateMachineRx<'d, PIO, SM> { | |||
| 316 | unsafe { | 318 | unsafe { |
| 317 | let fdebug = PIO::PIO.fdebug(); | 319 | let fdebug = PIO::PIO.fdebug(); |
| 318 | let ret = fdebug.read().rxunder() & (1 << SM) != 0; | 320 | let ret = fdebug.read().rxunder() & (1 << SM) != 0; |
| 319 | fdebug.write(|w| w.set_rxunder(1 << SM)); | 321 | if ret { |
| 322 | fdebug.write(|w| w.set_rxunder(1 << SM)); | ||
| 323 | } | ||
| 320 | ret | 324 | ret |
| 321 | } | 325 | } |
| 322 | } | 326 | } |
| @@ -383,7 +387,9 @@ impl<'d, PIO: Instance, const SM: usize> StateMachineTx<'d, PIO, SM> { | |||
| 383 | unsafe { | 387 | unsafe { |
| 384 | let fdebug = PIO::PIO.fdebug(); | 388 | let fdebug = PIO::PIO.fdebug(); |
| 385 | let ret = fdebug.read().txstall() & (1 << SM) != 0; | 389 | let ret = fdebug.read().txstall() & (1 << SM) != 0; |
| 386 | fdebug.write(|w| w.set_txstall(1 << SM)); | 390 | if ret { |
| 391 | fdebug.write(|w| w.set_txstall(1 << SM)); | ||
| 392 | } | ||
| 387 | ret | 393 | ret |
| 388 | } | 394 | } |
| 389 | } | 395 | } |
| @@ -392,7 +398,9 @@ impl<'d, PIO: Instance, const SM: usize> StateMachineTx<'d, PIO, SM> { | |||
| 392 | unsafe { | 398 | unsafe { |
| 393 | let fdebug = PIO::PIO.fdebug(); | 399 | let fdebug = PIO::PIO.fdebug(); |
| 394 | let ret = fdebug.read().txover() & (1 << SM) != 0; | 400 | let ret = fdebug.read().txover() & (1 << SM) != 0; |
| 395 | fdebug.write(|w| w.set_txover(1 << SM)); | 401 | if ret { |
| 402 | fdebug.write(|w| w.set_txover(1 << SM)); | ||
| 403 | } | ||
| 396 | ret | 404 | ret |
| 397 | } | 405 | } |
| 398 | } | 406 | } |
