Properly initialise refcount

This commit is contained in:
huntc 2021-12-16 18:15:28 +11:00
parent bb03b5cc02
commit 0642eec01e

View File

@ -133,6 +133,10 @@ impl<'d, T: Instance> Uarte<'d, T> {
apply_workaround_for_enable_anomaly(&r);
r.enable.write(|w| w.enable().enabled());
let s = T::state();
s.tx_rx_refcount.store(2, Ordering::Relaxed);
Self {
phantom: PhantomData,
tx: UarteTx::new(),
@ -584,7 +588,7 @@ pub(crate) mod sealed {
Self {
endrx_waker: AtomicWaker::new(),
endtx_waker: AtomicWaker::new(),
tx_rx_refcount: AtomicU8::new(2),
tx_rx_refcount: AtomicU8::new(0),
}
}
}