@@ -428,6 +428,12 @@ pub fn new<'a, const TD: usize, const RD: usize>(
428
428
/// [StationManagement](super::StationManagement) trait. This can be used to
429
429
/// communicate with the external PHY.
430
430
///
431
+ /// All the documented interrupts in the `MMC_TX_INTERRUPT_MASK` and
432
+ /// `MMC_RX_INTERRUPT_MASK` registers are masked, since these cause unexpected
433
+ /// interrupts after a number of days of heavy ethernet traffic. If these
434
+ /// interrupts are desired, you can be unmask them in your own code after this
435
+ /// method.
436
+ ///
431
437
/// # Safety
432
438
///
433
439
/// `EthernetDMA` shall not be moved as it is initialised here
@@ -572,6 +578,46 @@ pub unsafe fn new_unchecked<'a, const TD: usize, const RD: usize>(
572
578
w. pt ( ) . bits ( 0x100 )
573
579
} ) ;
574
580
eth_mac. macrx_fcr . modify ( |_, w| w) ;
581
+
582
+ // Mask away Ethernet MAC MMC RX/TX interrupts. These are statistics
583
+ // counter interrupts and are enabled by default. We need to manually
584
+ // disable various ethernet interrupts so they don't unintentionally
585
+ // hang the device. The user is free to re-enable them later to provide
586
+ // ethernet MAC-related statistics
587
+ eth_mac. mmc_rx_interrupt_mask . modify ( |_, w| {
588
+ w. rxlpiuscim ( )
589
+ . set_bit ( )
590
+ . rxucgpim ( )
591
+ . set_bit ( )
592
+ . rxalgnerpim ( )
593
+ . set_bit ( )
594
+ . rxcrcerpim ( )
595
+ . set_bit ( )
596
+ } ) ;
597
+
598
+ eth_mac. mmc_tx_interrupt_mask . modify ( |_, w| {
599
+ w. txlpiuscim ( )
600
+ . set_bit ( )
601
+ . txgpktim ( )
602
+ . set_bit ( )
603
+ . txmcolgpim ( )
604
+ . set_bit ( )
605
+ . txscolgpim ( )
606
+ . set_bit ( )
607
+ } ) ;
608
+ // TODO: The MMC_TX/RX_INTERRUPT_MASK registers incorrectly mark
609
+ // LPITRCIM as read-only, so svd2rust doens't generate bindings to
610
+ // modify them. Instead, as a workaround, we manually manipulate the
611
+ // bits
612
+ unsafe {
613
+ eth_mac
614
+ . mmc_tx_interrupt_mask
615
+ . modify ( |r, w| w. bits ( r. bits ( ) | ( 1 << 27 ) ) ) ;
616
+ eth_mac
617
+ . mmc_rx_interrupt_mask
618
+ . modify ( |r, w| w. bits ( r. bits ( ) | ( 1 << 27 ) ) ) ;
619
+ }
620
+
575
621
eth_mtl. mtlrx_qomr . modify ( |_, w| {
576
622
w
577
623
// Receive store and forward
0 commit comments