MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / FGmac_ErrorCheck

Function FGmac_ErrorCheck

bsp/ft2004/libraries/bsp/ft_gmac/ft_gmac_intr.c:62–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60
61
62__STATIC_INLINE u32 FGmac_ErrorCheck(Ft_Gmac_t *Gmac)
63{
64 u32 RegValue = 0;
65 u32 ErrIsr_RegValue = 0;
66 u32 RetValue = 0;
67 RegValue = Ft_in32(Gmac->Config.BaseAddress + DMA_STATUS_OFFSET);
68 ErrIsr_RegValue = Ft_in32(Gmac->Config.BaseAddress + DMA_INTR_ENA_OFFSET);
69
70 if (((RegValue & DMA_STATUS_TPS) == DMA_STATUS_TPS) && ((ErrIsr_RegValue & DMA_INTR_ENA_TSE) == DMA_INTR_ENA_TSE))
71 {
72 RetValue |= GMAC_ERROR_TRANSMIT_PROCESS_STOPPED;
73 }
74
75 if (((RegValue & DMA_STATUS_TU) == DMA_STATUS_TU) && ((ErrIsr_RegValue & DMA_INTR_ENA_TUE) == DMA_INTR_ENA_TUE))
76 {
77 RetValue |= GMAC_ERROR_TRANSMIT_UNAVAILABLE_STATUS;
78 }
79
80 if (((RegValue & DMA_STATUS_TJT) == DMA_STATUS_TJT) && ((ErrIsr_RegValue & DMA_INTR_ENA_THE) == DMA_INTR_ENA_THE))
81 {
82 RetValue |= GMAC_ERROR_TRANSMIT_JABBER_TIMEOUT;
83 }
84
85 if (((RegValue & DMA_STATUS_OVF) == DMA_STATUS_OVF) && ((ErrIsr_RegValue & DMA_INTR_ENA_OVE) == DMA_INTR_ENA_OVE))
86 {
87 RetValue |= GMAC_ERROR_RECEIVE_FIFO_OVERFLOW;
88 }
89
90 if (((RegValue & DMA_STATUS_UNF) == DMA_STATUS_UNF) && ((ErrIsr_RegValue & DMA_INTR_ENA_UNE) == DMA_INTR_ENA_UNE))
91 {
92 RetValue |= GMAC_ERROR_TRANSMIT_UNDERFLOW;
93 }
94
95 if (((RegValue & DMA_STATUS_RU) == DMA_STATUS_RU) && ((ErrIsr_RegValue & DMA_INTR_ENA_RUE) == DMA_INTR_ENA_RUE))
96 {
97 RetValue |= GMAC_ERROR_RECEIVE_BUFFER_UNAVAILABLE;
98 }
99
100 if (((RegValue & DMA_STATUS_RPS) == DMA_STATUS_RPS) && ((ErrIsr_RegValue & DMA_INTR_ENA_RSE) == DMA_INTR_ENA_RSE))
101 {
102 RetValue |= GMAC_ERROR_RECEIVE_PROCESS_STOPPED;
103 }
104
105 if (((RegValue & DMA_STATUS_RWT) == DMA_STATUS_RWT) && ((ErrIsr_RegValue & DMA_INTR_ENA_RWE) == DMA_INTR_ENA_RWE))
106 {
107 RetValue |= GMAC_ERROR_RECEIVE_WATCHDOG_TIMEOUT;
108 }
109
110 if (((RegValue & DMA_STATUS_ETI) == DMA_STATUS_ETI) && ((ErrIsr_RegValue & DMA_INTR_ENA_ETE) == DMA_INTR_ENA_ETE))
111 {
112 RetValue |= GMAC_ERROR_EARLY_TRANSMIT_INTERRUPT;
113 }
114
115 if (((RegValue & DMA_STATUS_FBI) == DMA_STATUS_FBI) && ((ErrIsr_RegValue & DMA_INTR_ENA_FBE) == DMA_INTR_ENA_FBE))
116 {
117 RetValue |= GMAC_ERROR_FATAL_BUS_ERROR;
118 }
119

Callers 1

FGmac_IntrHandlerFunction · 0.85

Calls 2

Ft_in32Function · 0.85
Ft_printfFunction · 0.85

Tested by

no test coverage detected