Properly reset descriptors in DmaRxStreamBuf::prepare (#2890)
Co-authored-by: Dominic Fischer <git@dominicfischer.me>
This commit is contained in:
parent
05b5bac027
commit
7319458dd2
@ -99,6 +99,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- `spi::master::Spi::{into_async, into_blocking}` are now correctly available on the typed driver, to. (#2674)
|
- `spi::master::Spi::{into_async, into_blocking}` are now correctly available on the typed driver, to. (#2674)
|
||||||
- It is no longer possible to safely conjure `GpioPin` instances (#2688)
|
- It is no longer possible to safely conjure `GpioPin` instances (#2688)
|
||||||
- UART: Public API follows `C-WORD_ORDER` Rust API standard (`VerbObject` order) (#2851)
|
- UART: Public API follows `C-WORD_ORDER` Rust API standard (`VerbObject` order) (#2851)
|
||||||
|
- `DmaRxStreamBuf` now correctly resets the descriptors the next time it's used (#2890)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
|||||||
@ -1137,13 +1137,6 @@ impl DmaRxStreamBuf {
|
|||||||
return Err(DmaBufError::InsufficientDescriptors);
|
return Err(DmaBufError::InsufficientDescriptors);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link up all the descriptors (but not in a circle).
|
|
||||||
let mut next = null_mut();
|
|
||||||
for desc in descriptors.iter_mut().rev() {
|
|
||||||
desc.next = next;
|
|
||||||
next = desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut chunks = buffer.chunks_exact_mut(chunk_size);
|
let mut chunks = buffer.chunks_exact_mut(chunk_size);
|
||||||
for (desc, chunk) in descriptors.iter_mut().zip(chunks.by_ref()) {
|
for (desc, chunk) in descriptors.iter_mut().zip(chunks.by_ref()) {
|
||||||
desc.buffer = chunk.as_mut_ptr();
|
desc.buffer = chunk.as_mut_ptr();
|
||||||
@ -1176,7 +1169,12 @@ unsafe impl DmaRxBuffer for DmaRxStreamBuf {
|
|||||||
type View = DmaRxStreamBufView;
|
type View = DmaRxStreamBufView;
|
||||||
|
|
||||||
fn prepare(&mut self) -> Preparation {
|
fn prepare(&mut self) -> Preparation {
|
||||||
for desc in self.descriptors.iter_mut() {
|
// Link up all the descriptors (but not in a circle).
|
||||||
|
let mut next = null_mut();
|
||||||
|
for desc in self.descriptors.iter_mut().rev() {
|
||||||
|
desc.next = next;
|
||||||
|
next = desc;
|
||||||
|
|
||||||
desc.reset_for_rx();
|
desc.reset_for_rx();
|
||||||
}
|
}
|
||||||
Preparation {
|
Preparation {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user