From 1e403a4e31a138eb5d47f8ff8738b088ea9d051a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 17 Aug 2014 16:51:56 -0600 Subject: Change the way PHY interrupts work: disable automatically. Then we have to re-subscribe each time after the interrupt fires --- apps/nshlib/nsh_netinit.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'apps') diff --git a/apps/nshlib/nsh_netinit.c b/apps/nshlib/nsh_netinit.c index 2e49bbbc8..704419308 100644 --- a/apps/nshlib/nsh_netinit.c +++ b/apps/nshlib/nsh_netinit.c @@ -327,31 +327,30 @@ static int nsh_netinit_monitor(void) goto errout_with_socket; } - /* Configure to receive a signal on changes in link status */ - - strncpy(ifr.ifr_name, NET_DEVNAME, IFNAMSIZ); - ifr.ifr_mii_notify_pid = 0; /* PID=0 means this task */ - ifr.ifr_mii_notify_signo = CONFIG_NSH_NETINIT_SIGNO; - ifr.ifr_mii_notify_arg = NULL; - - ret = ioctl(sd, SIOCMIINOTIFY, (unsigned long)&ifr); - if (ret < 0) - { - ret = -errno; - DEBUGASSERT(ret < 0); - - ndbg("ERROR: ioctl(SIOCMIINOTIFY) failed: %d\n", ret); - goto errout_with_sigaction; - } - /* Now loop, waiting for changes in link status */ for (;;) { - /* Does the driver think that the link is up or down? */ + /* Configure to receive a signal on changes in link status */ strncpy(ifr.ifr_name, NET_DEVNAME, IFNAMSIZ); + ifr.ifr_mii_notify_pid = 0; /* PID=0 means this task */ + ifr.ifr_mii_notify_signo = CONFIG_NSH_NETINIT_SIGNO; + ifr.ifr_mii_notify_arg = NULL; + + ret = ioctl(sd, SIOCMIINOTIFY, (unsigned long)&ifr); + if (ret < 0) + { + ret = -errno; + DEBUGASSERT(ret < 0); + + ndbg("ERROR: ioctl(SIOCMIINOTIFY) failed: %d\n", ret); + goto errout_with_sigaction; + } + + /* Does the driver think that the link is up or down? */ + ret = ioctl(sd, SIOCGIFFLAGS, (unsigned long)&ifr); if (ret < 0) { @@ -483,7 +482,7 @@ static int nsh_netinit_monitor(void) abstime.tv_nsec -= 1000000000; } - DEBUGVERIFY(sem_timedwait(&g_notify_sem, &abstime)); + (void)sem_timedwait(&g_notify_sem, &abstime); sched_unlock(); } -- cgit v1.2.3