Dependents: TimeZoneDemo EthernetJackTestCode MMEx_Challenge ntp_mem ... more
Revision 4:966a0265edfc, committed 2010-11-21
- Comitter:
- segundo
- Date:
- Sun Nov 21 17:13:44 2010 +0000
- Parent:
- 3:5a6792c147c0
- Child:
- 5:fa27dde97304
- Commit message:
Changed in this revision
--- a/drv/eth/eth_drv.cpp Fri Nov 19 21:01:51 2010 +0000 +++ b/drv/eth/eth_drv.cpp Sun Nov 21 17:13:44 2010 +0000 @@ -185,7 +185,7 @@ netif->output = etharp_output; netif->linkoutput = eth_output; - pEth = new Ethernet(); + if (!pEth) pEth = new Ethernet(); // only create Ethernet object if required return ERR_OK; } @@ -201,6 +201,10 @@ pEth->address(mac); } +Ethernet* eth_interface() { + return pEth; +} + #ifdef __cplusplus }; #endif
--- a/drv/eth/eth_drv.h Fri Nov 19 21:01:51 2010 +0000 +++ b/drv/eth/eth_drv.h Sun Nov 21 17:13:44 2010 +0000 @@ -32,6 +32,7 @@ err_t eth_init(struct netif* netif); void eth_address(char* mac); void eth_free(); +Ethernet* eth_interface(); #ifdef __cplusplus };
--- a/if/eth/EthernetNetIf.cpp Fri Nov 19 21:01:51 2010 +0000 +++ b/if/eth/EthernetNetIf.cpp Sun Nov 21 17:13:44 2010 +0000 @@ -43,6 +43,7 @@ //m_hostname = NULL; m_pNetIf = new netif; m_useDhcp = true; + m_pDhcp = new dhcp; m_setup = false; } @@ -68,6 +69,9 @@ delete m_pNetIf; eth_free(); } + + if (m_pDhcp) + delete m_pDhcp; } EthernetErr EthernetNetIf::setup(int timeout_ms /*= 15000*/) @@ -107,6 +111,7 @@ if(m_useDhcp) { + dhcp_set_struct(m_pNetIf, m_pDhcp); dhcp_start(m_pNetIf); DBG("DHCP Started, waiting for IP...\n"); }
--- a/if/eth/EthernetNetIf.h Fri Nov 19 21:01:51 2010 +0000 +++ b/if/eth/EthernetNetIf.h Sun Nov 21 17:13:44 2010 +0000 @@ -33,6 +33,7 @@ #include "mbed.h" #include "if/lwip/LwipNetIf.h" +#include "lwip/dhcp.h" ///Ethernet network interface return codes enum EthernetErr @@ -97,7 +98,8 @@ IpAddr m_gateway; const char* m_hostname; - bool m_setup; + dhcp* m_pDhcp; + bool m_setup; }; #endif