From e0ac62d798ce60ec5d43125d4786e58b0d881836 Mon Sep 17 00:00:00 2001 From: wdenk Date: Sun, 17 Aug 2003 18:55:18 +0000 Subject: * Make Ethernet autonegotiation on INCA-IP work for all clock rates; allow selection of clock frequency as "make" target * Implement memory autosizing code for IceCube boards * Configure network port on INCA-IP for autonegotiation * Fix overflow problem in network timeout code * Patch by Richard Woodruff, 8 Aug 2003: Allow crc32 to be used at address 0x000 (crc32_no_comp, too). --- net/net.c | 8 +++++--- net/tftp.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'net') diff --git a/net/net.c b/net/net.c index ce7934180..dafcc561e 100644 --- a/net/net.c +++ b/net/net.c @@ -125,7 +125,8 @@ volatile uchar *NetRxPackets[PKTBUFSRX]; /* Receive packets */ static rxhand_f *packetHandler; /* Current RX packet handler */ static thand_f *timeHandler; /* Current timeout handler */ -static ulong timeValue; /* Current timeout value */ +static ulong timeStart; /* Time base value */ +static ulong timeDelta; /* Current timeout value */ volatile uchar *NetTxPacket = 0; /* THE transmit packet */ static int net_check_prereq (proto_t protocol); @@ -391,7 +392,7 @@ restart: * Check for a timeout, and run the timeout handler * if we have one. */ - if (timeHandler && (get_timer(0) > timeValue)) { + if (timeHandler && ((get_timer(0) - timeStart) > timeDelta)) { thand_f *x; x = timeHandler; @@ -491,7 +492,8 @@ NetSetTimeout(int iv, thand_f * f) timeHandler = (thand_f *)0; } else { timeHandler = f; - timeValue = get_timer(0) + iv; + timeStart = get_timer(0); + timeDelta = iv; } } diff --git a/net/tftp.c b/net/tftp.c index 5598be32f..1154cb912 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -240,7 +240,7 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len) static void TftpTimeout (void) { - if (++TftpTimeoutCount >= TIMEOUT_COUNT) { + if (++TftpTimeoutCount > TIMEOUT_COUNT) { puts ("\nRetry count exceeded; starting again\n"); NetStartAgain (); } else { -- cgit v1.2.3