W5200(WIZ820io) network interface

WIZ820ioNetIf.cpp

Committer:
va009039
Date:
2012-04-14
Revision:
0:61831b843b44
Child:
1:803123933c5a

File content as of revision 0:61831b843b44:

// 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);
}