mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 14:53:03 +00:00
Add separate work-around specific flag for DMA errata on NRF52832
This commit is contained in:
parent
2b7b7a917d
commit
6f83acc010
@ -51,7 +51,7 @@ nrf52805 = ["nrf52805-pac", "_nrf52"]
|
||||
nrf52810 = ["nrf52810-pac", "_nrf52"]
|
||||
nrf52811 = ["nrf52811-pac", "_nrf52"]
|
||||
nrf52820 = ["nrf52820-pac", "_nrf52"]
|
||||
nrf52832 = ["nrf52832-pac", "_nrf52"]
|
||||
nrf52832 = ["nrf52832-pac", "_nrf52", "_nrf52832_anomaly_109"]
|
||||
nrf52833 = ["nrf52833-pac", "_nrf52", "_gpio-p1"]
|
||||
nrf52840 = ["nrf52840-pac", "_nrf52", "_gpio-p1"]
|
||||
nrf5340-app-s = ["_nrf5340-app", "_s"]
|
||||
@ -90,6 +90,9 @@ _ppi = []
|
||||
_dppi = []
|
||||
_gpio-p1 = []
|
||||
|
||||
# Errata workarounds
|
||||
_nrf52832_anomaly_109 = []
|
||||
|
||||
[dependencies]
|
||||
embassy-time = { version = "0.1.3", path = "../embassy-time", optional = true }
|
||||
embassy-sync = { version = "0.3.0", path = "../embassy-sync" }
|
||||
|
@ -68,7 +68,7 @@ impl<T: Instance> interrupt::typelevel::Handler<T::Interrupt> for InterruptHandl
|
||||
let r = T::regs();
|
||||
let s = T::state();
|
||||
|
||||
#[cfg(feature = "nrf52832")]
|
||||
#[cfg(feature = "_nrf52832_anomaly_109")]
|
||||
if r.events_started.read().bits() != 0 {
|
||||
s.waker.wake();
|
||||
r.intenclr.write(|w| w.started().clear());
|
||||
@ -206,8 +206,7 @@ impl<'d, T: Instance> Spim<'d, T> {
|
||||
r.rxd.ptr.write(|w| unsafe { w.ptr().bits(ptr as _) });
|
||||
r.rxd.maxcnt.write(|w| unsafe { w.maxcnt().bits(rx_len as _) });
|
||||
|
||||
// ANOMALY 109 workaround
|
||||
#[cfg(feature = "nrf52832")]
|
||||
#[cfg(feature = "_nrf52832_anomaly_109")]
|
||||
{
|
||||
let s = T::state();
|
||||
|
||||
@ -238,7 +237,7 @@ impl<'d, T: Instance> Spim<'d, T> {
|
||||
fn blocking_inner_from_ram(&mut self, rx: *mut [u8], tx: *const [u8]) -> Result<(), Error> {
|
||||
self.prepare(rx, tx)?;
|
||||
|
||||
#[cfg(feature = "nrf52832")]
|
||||
#[cfg(feature = "_nrf52832_anomaly_109")]
|
||||
while let Poll::Pending = self.nrf52832_dma_workaround_status() {}
|
||||
|
||||
// Wait for 'end' event.
|
||||
@ -265,7 +264,7 @@ impl<'d, T: Instance> Spim<'d, T> {
|
||||
async fn async_inner_from_ram(&mut self, rx: *mut [u8], tx: *const [u8]) -> Result<(), Error> {
|
||||
self.prepare(rx, tx)?;
|
||||
|
||||
#[cfg(feature = "nrf52832")]
|
||||
#[cfg(feature = "_nrf52832_anomaly_109")]
|
||||
poll_fn(|cx| {
|
||||
let s = T::state();
|
||||
|
||||
@ -369,7 +368,7 @@ impl<'d, T: Instance> Spim<'d, T> {
|
||||
self.async_inner_from_ram(&mut [], data).await
|
||||
}
|
||||
|
||||
#[cfg(feature = "nrf52832")]
|
||||
#[cfg(feature = "_nrf52832_anomaly_109")]
|
||||
fn nrf52832_dma_workaround_status(&mut self) -> Poll<()> {
|
||||
let r = T::regs();
|
||||
if r.events_started.read().bits() != 0 {
|
||||
@ -418,7 +417,7 @@ impl<'d, T: Instance> Drop for Spim<'d, T> {
|
||||
}
|
||||
|
||||
pub(crate) mod sealed {
|
||||
#[cfg(feature = "nrf52832")]
|
||||
#[cfg(feature = "_nrf52832_anomaly_109")]
|
||||
use core::sync::atomic::AtomicU8;
|
||||
|
||||
use embassy_sync::waitqueue::AtomicWaker;
|
||||
@ -427,9 +426,9 @@ pub(crate) mod sealed {
|
||||
|
||||
pub struct State {
|
||||
pub waker: AtomicWaker,
|
||||
#[cfg(feature = "nrf52832")]
|
||||
#[cfg(feature = "_nrf52832_anomaly_109")]
|
||||
pub rx: AtomicU8,
|
||||
#[cfg(feature = "nrf52832")]
|
||||
#[cfg(feature = "_nrf52832_anomaly_109")]
|
||||
pub tx: AtomicU8,
|
||||
}
|
||||
|
||||
@ -437,9 +436,9 @@ pub(crate) mod sealed {
|
||||
pub const fn new() -> Self {
|
||||
Self {
|
||||
waker: AtomicWaker::new(),
|
||||
#[cfg(feature = "nrf52832")]
|
||||
#[cfg(feature = "_nrf52832_anomaly_109")]
|
||||
rx: AtomicU8::new(0),
|
||||
#[cfg(feature = "nrf52832")]
|
||||
#[cfg(feature = "_nrf52832_anomaly_109")]
|
||||
tx: AtomicU8::new(0),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user