GMAC initialization function */
| 205 | |
| 206 | /* GMAC initialization function */ |
| 207 | static 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 | |
| 241 | static rt_err_t rt_ft2004_gmac_open(rt_device_t dev, rt_uint16_t oflag) |
| 242 | { |
nothing calls this directly
no test coverage detected