Skip to content

Commit a44422f

Browse files
committed
Properly clear/initialize TX descriptors.
Unclear why, but this value does not seem to be zeroed correctly on startup, which can cause TX to start without the descriptors being written correctly.
1 parent f811713 commit a44422f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/dma/desc.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ impl Descriptor {
3535
}
3636
}
3737

38+
pub unsafe fn clear(&mut self) {
39+
(0..DESC_SIZE).for_each(|i| self.write(i, 0));
40+
}
41+
3842
fn r(&self, n: usize) -> &RO<u32> {
3943
let ro = &self.desc.deref()[n] as *const _ as *const RO<u32>;
4044
unsafe { &*ro }

src/dma/tx/descriptor.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ impl RingDescriptor for TxDescriptor {
171171

172172
self.buffer1 = buffer as u32;
173173
self.next_descriptor = next_desc_addr;
174+
unsafe {
175+
self.desc.clear();
176+
}
174177
}
175178
}
176179

0 commit comments

Comments
 (0)