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

Function FGmac_IntrHandler

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

Source from the content-addressed store, hash-verified

127
128
129void FGmac_IntrHandler(void *Args)
130{
131 Ft_Gmac_t *Gmac;
132 u32 RegValue;
133 u32 MACRegValue;
134 Ft_assertVoid(Args != NULL);
135 Gmac = (Ft_Gmac_t *)Args;
136
137 RegValue = Ft_in32(Gmac->Config.BaseAddress + DMA_STATUS_OFFSET);
138 if ((RegValue)&DMA_STATUS_GLI)
139 {
140 MACRegValue = Ft_in32(Gmac->Config.BaseAddress + GMAC_MAC_MAC_PHY_STATUS);
141 if (Gmac->StatusHandler)
142 {
143 Gmac->StatusHandler(Gmac->StatusArgs, MACRegValue);
144 }
145 }
146
147 /* Frame received */
148 if ((RegValue & (DMA_STATUS_RI)) != 0)
149 {
150 if (Gmac->RecvHandler)
151 {
152 Gmac->RecvHandler(Gmac->RecvArgs);
153 }
154
155 Ft_out32(Gmac->Config.BaseAddress + DMA_STATUS_OFFSET, DMA_STATUS_RI);
156 }
157 else if ((RegValue & DMA_STATUS_TI) == DMA_STATUS_TI)
158 {
159 Ft_printf("DMA_STATUS_TI %x \r\n", RegValue);
160 Ft_printf("ti debug %x \r\n", Ft_in32(Gmac->Config.BaseAddress + GMAC_INTERNAL_MODULE_STATUS_OFFSET));
161
162 Ft_out32(Gmac->Config.BaseAddress + DMA_STATUS_OFFSET, DMA_STATUS_TI);
163 }
164
165 Ft_out32(Gmac->Config.BaseAddress + DMA_STATUS_OFFSET, DMA_STATUS_NIS);
166
167 /* DMA Error */
168 if ((Ft_in32(Gmac->Config.BaseAddress + DMA_STATUS_OFFSET) & DMA_STATUS_AIS) == DMA_STATUS_AIS)
169 {
170 if (Gmac->ErrorHandler)
171 Gmac->ErrorHandler(Gmac->ErrorArgs, FGmac_ErrorCheck(Gmac));
172 Ft_out32(Gmac->Config.BaseAddress + DMA_STATUS_OFFSET, Ft_in32(Gmac->Config.BaseAddress + DMA_STATUS_OFFSET));
173 }
174}

Callers 1

rt_hw_gmac_isrFunction · 0.85

Calls 4

Ft_in32Function · 0.85
Ft_out32Function · 0.85
Ft_printfFunction · 0.85
FGmac_ErrorCheckFunction · 0.85

Tested by

no test coverage detected