1
0
Fork 0
This commit is contained in:
Astro 2020-06-18 18:07:50 +02:00
parent b4bcc6cf5c
commit b33ccf83ba
2 changed files with 8 additions and 3 deletions

View File

@ -81,6 +81,8 @@ impl DescList {
entry.word1.write( entry.word1.write(
DescWord1::zeroed() DescWord1::zeroed()
); );
// Flush buffer from cache, to be filled by the peripheral
// before next read
dcci_slice(&buffer[..]); dcci_slice(&buffer[..]);
} }
@ -129,6 +131,8 @@ pub struct PktRef<'a> {
impl<'a> Drop for PktRef<'a> { impl<'a> Drop for PktRef<'a> {
fn drop(&mut self) { fn drop(&mut self) {
// Flush buffer from cache, to be filled by the peripheral
// before next read
dcci_slice(self.buffer); dcci_slice(self.buffer);
self.entry.word0.modify(|_, w| w.used(false)); self.entry.word0.modify(|_, w| w.used(false));

View File

@ -124,12 +124,13 @@ pub struct PktRef<'a> {
impl<'a> Drop for PktRef<'a> { impl<'a> Drop for PktRef<'a> {
fn drop(&mut self) { fn drop(&mut self) {
// Write back all dirty cachelines of this buffer
dcc_slice(self.buffer); dcc_slice(self.buffer);
self.entry.word1.modify(|_, w| w.used(false)); self.entry.word1.modify(|_, w| w.used(false));
if ! self.regs.tx_status.read().tx_go() { if ! self.regs.tx_status.read().tx_go() {
self.regs.net_ctrl.modify(|_, w| // Start TX if not already running
w.start_tx(true) self.regs.net_ctrl.modify(|_, w| w.start_tx(true));
);
} }
} }
} }