diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2007-07-05 18:01:15 +0200 |
---|---|---|
committer | Sascha Hauer <sha@octopus.labnet.pengutronix.de> | 2007-07-05 18:01:15 +0200 |
commit | 363266d818c3504458fe005ef0308ea48f71e7ca (patch) | |
tree | fa11b8ab9cb69096d9482eda32d2d0be400810ee /net | |
parent | fecf0fd93e63938080c6a86c7e0918ab9f310908 (diff) | |
download | barebox-363266d818c3504458fe005ef0308ea48f71e7ca.tar.gz barebox-363266d818c3504458fe005ef0308ea48f71e7ca.tar.xz |
svn_rev_033
change to clocksource api
Diffstat (limited to 'net')
-rw-r--r-- | net/bootp.c | 9 | ||||
-rw-r--r-- | net/net.c | 21 | ||||
-rw-r--r-- | net/tftp.c | 3 |
3 files changed, 17 insertions, 16 deletions
diff --git a/net/bootp.c b/net/bootp.c index 6aef0d4f92..cded61ce1d 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -17,6 +17,7 @@ #include <common.h> #include <command.h> +#include <clock.h> #include <net.h> #include "bootp.h" #include "tftp.h" @@ -650,7 +651,8 @@ BootpRequest (void) bp->bp_htype = HWT_ETHER; bp->bp_hlen = HWL_ETHER; bp->bp_hops = 0; - bp->bp_secs = htons(get_timer(0) / CFG_HZ); + /* FIXME what is this? */ +// bp->bp_secs = htons(get_timer(0) / CFG_HZ); NetWriteIP(&bp->bp_ciaddr, 0); NetWriteIP(&bp->bp_yiaddr, 0); NetWriteIP(&bp->bp_siaddr, 0); @@ -673,7 +675,7 @@ BootpRequest (void) | ((ulong)NetOurEther[3] << 16) | ((ulong)NetOurEther[4] << 8) | (ulong)NetOurEther[5]; - BootpID += get_timer(0); + BootpID += (uint32_t)get_time_ns(); BootpID = htonl(BootpID); NetCopyLong(&bp->bp_id, &BootpID); @@ -828,7 +830,8 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer) bp->bp_htype = HWT_ETHER; bp->bp_hlen = HWL_ETHER; bp->bp_hops = 0; - bp->bp_secs = htons(get_timer(0) / CFG_HZ); + /* FIXME what is this? */ +// bp->bp_secs = htons(get_timer(0) / CFG_HZ); NetCopyIP(&bp->bp_ciaddr, &bp_offer->bp_ciaddr); /* both in network byte order */ NetCopyIP(&bp->bp_yiaddr, &bp_offer->bp_yiaddr); NetCopyIP(&bp->bp_siaddr, &bp_offer->bp_siaddr); @@ -75,6 +75,7 @@ #include <common.h> +#include <clock.h> #include <watchdog.h> #include <command.h> #include <net.h> @@ -94,7 +95,7 @@ DECLARE_GLOBAL_DATA_PTR; -#define ARP_TIMEOUT 5 /* Seconds before trying ARP again */ +#define ARP_TIMEOUT (5 * SECOND) /* Seconds before trying ARP again */ #ifndef CONFIG_NET_RETRY_COUNT # define ARP_TIMEOUT_COUNT 5 /* # of timeouts before giving up */ #else @@ -235,15 +236,11 @@ void ArpRequest (void) void ArpTimeoutCheck(void) { - ulong t; - if (!NetArpWaitPacketIP) return; - t = get_timer(0); - /* check for arp timeout */ - if ((t - NetArpWaitTimerStart) > ARP_TIMEOUT * CFG_HZ) { + if (is_timeout(NetArpWaitTimerStart, ARP_TIMEOUT)) { NetArpWaitTry++; if (NetArpWaitTry >= ARP_TIMEOUT_COUNT) { @@ -251,7 +248,7 @@ void ArpTimeoutCheck(void) NetArpWaitTry = 0; NetStartAgain(); } else { - NetArpWaitTimerStart = t; + NetArpWaitTimerStart = get_time_ns(); ArpRequest(); } } @@ -501,7 +498,7 @@ restart: * Check for a timeout, and run the timeout handler * if we have one. */ - if (timeHandler && ((get_timer(0) - timeStart) > timeDelta)) { + if (timeHandler && ((get_time_ns() - timeStart) > timeDelta)) { thand_f *x; #if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII) @@ -615,13 +612,13 @@ NetSetHandler(rxhand_f * f) void -NetSetTimeout(ulong iv, thand_f * f) +NetSetTimeout(uint64_t iv, thand_f * f) { if (iv == 0) { timeHandler = (thand_f *)0; } else { timeHandler = f; - timeStart = get_timer(0); + timeStart = get_time_ns(); timeDelta = iv; } } @@ -666,7 +663,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len) /* and do the ARP request */ NetArpWaitTry = 1; - NetArpWaitTimerStart = get_timer(0); + NetArpWaitTimerStart = get_time_ns(); ArpRequest(); return 1; /* waiting */ } @@ -737,7 +734,7 @@ int PingSend(void) /* and do the ARP request */ NetArpWaitTry = 1; - NetArpWaitTimerStart = get_timer(0); + NetArpWaitTimerStart = get_time_ns(); ArpRequest(); return 1; /* waiting */ } diff --git a/net/tftp.c b/net/tftp.c index f3a5471483..055fc49a43 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -7,6 +7,7 @@ #include <common.h> #include <command.h> #include <net.h> +#include <clock.h> #include "tftp.h" #include "bootp.h" @@ -369,7 +370,7 @@ TftpStart (void) TftpTimeoutCount = 0; TftpState = STATE_RRQ; /* Use a pseudo-random port unless a specific port is set */ - TftpOurPort = 1024 + (get_timer(0) % 3072); + TftpOurPort = 1024 + (get_time_ns() % 3072); #ifdef CONFIG_TFTP_PORT if ((ep = getenv("tftpdstp")) != NULL) { TftpServerPort = simple_strtol(ep, NULL, 10); |