W5200(WIZ820io) network interface
Diff: WIZ820ioNetIf.cpp
- Revision:
- 0:61831b843b44
- Child:
- 1:803123933c5a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WIZ820ioNetIf.cpp Sat Apr 14 17:21:11 2012 +0000 @@ -0,0 +1,22 @@ +// WIZ820ioNetIf.cpp 2012/4/13 +#include "WIZ820ioNetIf.h" +#include "w5100.h" + +bool wait_linkup(int timeout = 5000) { + Timer link_t; + link_t.start(); + while(link_t.read_ms() < timeout) { + if (0x20 & W5100.readPHYSTATUS()) { + return true; + } + wait_ms(50); + } + return false; +} + +int WIZ820ioNetIf::setup(int timeout_ms) { + W5100.hardware_reset(); + W5100.init(); + wait_linkup(); + return w5200NetIf::setup(timeout_ms); +}