Skip to content

Commit

Permalink
Add some more TODOs
Browse files Browse the repository at this point in the history
Panic on FBE
  • Loading branch information
datdenkikniet committed Feb 10, 2023
1 parent 7de9731 commit 9478597
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
6 changes: 6 additions & 0 deletions src/dma/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,12 @@ fn eth_interrupt_handler_impl(eth_dma: &ETHERNET_DMA) -> InterruptReasonSummary
.set_bit()
});

if status.fbe().bit_is_set() {
// TODO: add a link to a/the github issue describing this problem,
// and how to solve it.
panic!("Fatal bus error! Is the descriptor and buffer memory accessible by the Ethernet MAC/DMA?");
}

(
status.ri().bit_is_set(),
status.ti().bit_is_set(),
Expand Down
15 changes: 7 additions & 8 deletions src/dma/rx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,15 @@ impl<'data> RxRing<'data, NotRunning> {

#[cfg(feature = "stm32h7xx-hal")]
{
// TODO: assert that ethernet DMA can access
// the memory in these rings
assert!(self.ring.descriptors().count() >= 4);
let rx_ring_descriptors = self.ring.descriptors().count();
assert!(rx_ring_descriptors >= 4);

// Assert that the descriptors are properly aligned.
assert!(ring_ptr as u32 & !0b11 == ring_ptr as u32);
assert!(
self.ring.last_descriptor_mut() as *const _ as u32 & !0b11
== self.ring.last_descriptor_mut() as *const _ as u32
);
//
// FIXME: these require different alignment if the data is stored
// in AXI SRAM
assert!(ring_ptr as u32 % 4 == 0);
assert!(self.ring.last_descriptor_mut() as *const _ as u32 % 4 == 0);

// Set the start pointer.
eth_dma
Expand Down
10 changes: 6 additions & 4 deletions src/dma/tx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,14 @@ impl<'data> TxRing<'data, NotRunning> {

#[cfg(feature = "stm32h7xx-hal")]
{
// TODO: assert that ethernet DMA can access
// the memory in these rings
assert!(self.ring.descriptors().count() >= 4);
let tx_descriptor_count = self.ring.descriptors().count();
assert!(tx_descriptor_count >= 4);

// Assert that the descriptors are properly aligned.
assert!(ring_ptr as u32 & !0b11 == ring_ptr as u32);
//
// FIXME: these require different alignment if the data is stored
// in AXI SRAM
assert!(ring_ptr as u32 % 4 == 0);
assert!(self.ring.last_descriptor() as *const _ as u32 % 4 == 0);

// Set the start pointer.
Expand Down
1 change: 0 additions & 1 deletion src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ use crate::{
};

#[cfg(feature = "stm32h7xx-hal")]
// TODO: implement all allowed GPIO pins.
#[allow(unused_imports)]
use crate::{
dma::EthernetDMA,
Expand Down

0 comments on commit 9478597

Please sign in to comment.