|
|
@ -149,14 +149,14 @@ void network_service_init() { |
|
|
|
IP4_ADDR(&gw, GATEWAY_ADDRESS[0], GATEWAY_ADDRESS[1], GATEWAY_ADDRESS[2], GATEWAY_ADDRESS[3]); |
|
|
|
netif_add(&gnetif, &ipaddr, &netmask, &gw, NULL, ðernetif_init, &tcpip_input); |
|
|
|
netif_set_default(&gnetif); |
|
|
|
netif_set_link_callback(&gnetif, ethernet_link_status_updated); |
|
|
|
netif_set_status_callback(&gnetif, ethernet_status_updated); |
|
|
|
netif_add_ext_callback(&extcb, netif_ext_callback); |
|
|
|
if (netif_is_link_up(&gnetif)) { |
|
|
|
netif_set_up(&gnetif); |
|
|
|
} else { |
|
|
|
netif_set_down(&gnetif); |
|
|
|
} |
|
|
|
netif_set_link_callback(&gnetif, ethernet_link_status_updated); |
|
|
|
netif_set_status_callback(&gnetif, ethernet_status_updated); |
|
|
|
netif_add_ext_callback(&extcb, netif_ext_callback); |
|
|
|
osThreadDef(EthLink, ethernet_link_thread, NETWORK_REPORT_TASK_LEVEL, 0, 512); |
|
|
|
osThreadCreate(osThread(EthLink), &gnetif); |
|
|
|
} else { |
|
|
@ -169,21 +169,18 @@ void network_service_init() { |
|
|
|
|
|
|
|
netif_add(&gnetif, &ipaddr, &netmask, &gw, NULL, ðernetif_init, &tcpip_input); |
|
|
|
netif_set_default(&gnetif); |
|
|
|
netif_set_link_callback(&gnetif, ethernet_link_status_updated); |
|
|
|
netif_set_status_callback(&gnetif, ethernet_status_updated); |
|
|
|
netif_add_ext_callback(&extcb, netif_ext_callback); |
|
|
|
if (netif_is_link_up(&gnetif)) { |
|
|
|
netif_set_up(&gnetif); |
|
|
|
} else { |
|
|
|
netif_set_down(&gnetif); |
|
|
|
} |
|
|
|
netif_set_link_callback(&gnetif, ethernet_link_status_updated); |
|
|
|
netif_set_status_callback(&gnetif, ethernet_status_updated); |
|
|
|
netif_add_ext_callback(&extcb, netif_ext_callback); |
|
|
|
osThreadDef(EthLink, ethernet_link_thread, NETWORK_REPORT_TASK_LEVEL, 0, 1024); |
|
|
|
osThreadCreate(osThread(EthLink), &gnetif); |
|
|
|
|
|
|
|
// while (!netif_is_up(&gnetif)) { |
|
|
|
// ZLOGI(TAG, "waiting for dhcp"); |
|
|
|
// osDelay(100); |
|
|
|
// } |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|