From b33ccf83ba13ea1370d82f309d318d8817f6db58 Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 18 Jun 2020 18:07:50 +0200 Subject: [PATCH] eth: doc --- libboard_zynq/src/eth/rx.rs | 4 ++++ libboard_zynq/src/eth/tx.rs | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libboard_zynq/src/eth/rx.rs b/libboard_zynq/src/eth/rx.rs index 2af040d..4efd0ec 100644 --- a/libboard_zynq/src/eth/rx.rs +++ b/libboard_zynq/src/eth/rx.rs @@ -81,6 +81,8 @@ impl DescList { entry.word1.write( DescWord1::zeroed() ); + // Flush buffer from cache, to be filled by the peripheral + // before next read dcci_slice(&buffer[..]); } @@ -129,6 +131,8 @@ pub struct PktRef<'a> { impl<'a> Drop for PktRef<'a> { fn drop(&mut self) { + // Flush buffer from cache, to be filled by the peripheral + // before next read dcci_slice(self.buffer); self.entry.word0.modify(|_, w| w.used(false)); diff --git a/libboard_zynq/src/eth/tx.rs b/libboard_zynq/src/eth/tx.rs index c4acf7d..b326414 100644 --- a/libboard_zynq/src/eth/tx.rs +++ b/libboard_zynq/src/eth/tx.rs @@ -124,12 +124,13 @@ pub struct PktRef<'a> { impl<'a> Drop for PktRef<'a> { fn drop(&mut self) { + // Write back all dirty cachelines of this buffer dcc_slice(self.buffer); + self.entry.word1.modify(|_, w| w.used(false)); if ! self.regs.tx_status.read().tx_go() { - self.regs.net_ctrl.modify(|_, w| - w.start_tx(true) - ); + // Start TX if not already running + self.regs.net_ctrl.modify(|_, w| w.start_tx(true)); } } }