mbed IP library over Ethernet

Dependencies:   Socket lwip-eth lwip-sys lwip

Dependents:   iot_gateway

Fork of EthernetInterface by mbed official

Revision:
21:8cd2de462559
Parent:
15:fd9597f1b81b
Child:
22:2a797ba9babe
--- a/EthernetInterface.cpp	Wed Aug 01 13:02:38 2012 +0000
+++ b/EthernetInterface.cpp	Fri Aug 03 14:43:57 2012 +0000
@@ -72,7 +72,7 @@
     return 0;
 }
 
-int EthernetInterface::connect() {
+int EthernetInterface::connect(unsigned int timeout_ms) {
     NVIC_SetPriority(ENET_IRQn, ((0x01 << 3) | 0x01));
     NVIC_EnableIRQ(ENET_IRQn);
     
@@ -82,9 +82,9 @@
         netif_set_up(&lpcNetif);
     }
     
-    netif_inited.wait();
-    
-    return 0;
+    // -1: error, 0: timeout
+    int inited = netif_inited.wait(timeout_ms);
+    return (inited > 0) ? (0) : (-1);
 }
 
 int EthernetInterface::disconnect() {