Merge pull request #3145 from embassy-rs/nrf-radio-fixes

fix cancellation hanging on event never occuring
This commit is contained in:
Ulf Lilleengen 2024-07-03 07:45:14 +00:00 committed by GitHub
commit 8c54df1042
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -335,8 +335,6 @@ impl<'d, T: Instance> Radio<'d, T> {
} }
async fn trigger_and_wait_end(&mut self, trigger: impl FnOnce()) { async fn trigger_and_wait_end(&mut self, trigger: impl FnOnce()) {
//self.trace_state();
let r = T::regs(); let r = T::regs();
let s = T::state(); let s = T::state();
@ -347,12 +345,10 @@ impl<'d, T: Instance> Radio<'d, T> {
trace!("radio drop: stopping"); trace!("radio drop: stopping");
r.intenclr.write(|w| w.end().clear()); r.intenclr.write(|w| w.end().clear());
r.events_end.reset();
r.tasks_stop.write(|w| unsafe { w.bits(1) }); r.tasks_stop.write(|w| unsafe { w.bits(1) });
// The docs don't explicitly mention any event to acknowledge the stop task r.events_end.reset();
while r.events_end.read().bits() == 0 {}
trace!("radio drop: stopped"); trace!("radio drop: stopped");
}); });
@ -368,7 +364,6 @@ impl<'d, T: Instance> Radio<'d, T> {
// Trigger the transmission // Trigger the transmission
trigger(); trigger();
// self.trace_state();
// On poll check if interrupt happen // On poll check if interrupt happen
poll_fn(|cx| { poll_fn(|cx| {
@ -382,7 +377,7 @@ impl<'d, T: Instance> Radio<'d, T> {
.await; .await;
compiler_fence(Ordering::SeqCst); compiler_fence(Ordering::SeqCst);
r.events_disabled.reset(); // ACK r.events_end.reset(); // ACK
// Everthing ends fine, so it disable the drop // Everthing ends fine, so it disable the drop
drop.defuse(); drop.defuse();