Commit 0deda175 authored by Tristan Gingold's avatar Tristan Gingold

Remove netif link_state and netif task

link_state was only used by monitor,
netif task is replaced by wrc_check_link.
parent f6a899e3
......@@ -30,7 +30,6 @@ int netif_register_device(struct wr_endpoint_device* ep)
struct wrc_netif_device *ndev = &netif_devs[netif_n_count];
ndev->ep = ep;
ndev->link_state = NETIF_LINK_DOWN;
dev_dbg("Registered network interface %u @ %p\n", netif_n_count, ndev->ep->base );
......@@ -44,54 +43,7 @@ int netif_get_device_count(void)
return netif_n_count;
}
static int netif_update_task(void)
{
int i;
for( i = 0; i < netif_n_count; i++ )
{
struct wrc_netif_device *ndev = &netif_devs[ i ];
int up = ep_link_up( ndev->ep, NULL );
//pp_printf("%s link %d\n", ndev->name, up );
switch(ndev->link_state)
{
case NETIF_LINK_DOWN:
if( up )
ndev->link_state = NETIF_LINK_WENT_UP;
break;
case NETIF_LINK_UP:
if( !up )
ndev->link_state = NETIF_LINK_WENT_DOWN;
break;
case NETIF_LINK_WENT_UP:
if( up )
ndev->link_state = NETIF_LINK_UP;
else
ndev->link_state = NETIF_LINK_WENT_DOWN;
break;
case NETIF_LINK_WENT_DOWN:
if( up )
ndev->link_state = NETIF_LINK_WENT_UP;
else
ndev->link_state = NETIF_LINK_DOWN;
break;
default:
break;
}
}
return 0;
}
struct wrc_netif_device* netif_get_device(int idx)
{
return &netif_devs[idx];
}
int netif_init(void)
{
wrc_task_create("netif", NULL, netif_update_task);
return 0;
}
......@@ -18,12 +18,10 @@
struct wrc_netif_device
{
struct wr_endpoint_device* ep;
unsigned char link_state;
};
int netif_register_device(struct wr_endpoint_device* ep);
int netif_get_device_count(void);
struct wrc_netif_device* netif_get_device(int idx);
int netif_init(void);
#endif
......@@ -276,7 +276,7 @@ static void print_time_pll(void)
static void print_port(unsigned i)
{
struct wrc_netif_device *ndev = netif_get_device(i);
int port_up = ndev->link_state == NETIF_LINK_UP;
int port_up = ep_link_up(ndev->ep, NULL);
int tx, rx, rx_err;
char buf[20];
......@@ -320,7 +320,7 @@ static void print_port(unsigned i)
static void print_state(unsigned i)
{
struct wrc_netif_device *ndev = netif_get_device(i);
int port_up = ndev->link_state == NETIF_LINK_UP;
int port_up = ep_link_up(ndev->ep, NULL);
int locked = spll_check_lock(0);
int color;
......
......@@ -99,7 +99,6 @@ static void wrc_initialize(void)
timer_init(1);
spll_very_init();
usleep_init();
netif_init();
/* Initialize W1 before board, in case mac address is read from it. */
if (HAS_W1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment