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

Function rt_ft2004_gmac_init

bsp/ft2004/drivers/drv_eth.c:207–239  ·  view source on GitHub ↗

GMAC initialization function */

Source from the content-addressed store, hash-verified

205
206/* GMAC initialization function */
207static rt_err_t rt_ft2004_gmac_init(rt_device_t dev)
208{
209 struct drv_gmac *pOsMac;
210 struct eth_device *pGmacParent;
211 FGmac_Config_t *pConfig;
212
213 pGmacParent = rt_container_of(dev, struct eth_device, parent);
214 if (NULL == pGmacParent)
215 {
216 return -RT_ENOMEM;
217 }
218
219 pOsMac = rt_container_of(pGmacParent, struct drv_gmac, parent);
220 if (NULL == pOsMac)
221 {
222 return -RT_ENOMEM;
223 }
224
225 pConfig = Ft_Gmac_LookupConfig(pOsMac->Gmac.Config.InstanceId);
226 if (NULL == pConfig)
227 {
228 return -RT_ENOMEM;
229 }
230
231 Ft_Gmac_UseDefaultMacAddr(&pOsMac->Gmac, pOsMac->Gmac.Config.MacAddr);
232
233 if (FST_SUCCESS != Ft_GmacCfgInitialize(&pOsMac->Gmac, pConfig))
234 {
235 return -RT_ERROR;
236 }
237
238 return rt_ft2004_gmac_start(pOsMac);
239}
240
241static rt_err_t rt_ft2004_gmac_open(rt_device_t dev, rt_uint16_t oflag)
242{

Callers

nothing calls this directly

Calls 4

Ft_Gmac_LookupConfigFunction · 0.85
Ft_GmacCfgInitializeFunction · 0.85
rt_ft2004_gmac_startFunction · 0.85

Tested by

no test coverage detected