]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - net/sntp.c
imported Ka-Ro specific additions to U-Boot 2009.08 for TX28
[karo-tx-uboot.git] / net / sntp.c
index db8c2c279984c6af7a882bde0a90837338b467fc..76c10ecd3b5d4565c684d155659e5a2036636860 100755 (executable)
@@ -12,9 +12,7 @@
 
 #include "sntp.h"
 
-#if ((CONFIG_COMMANDS & CFG_CMD_NET) && (CONFIG_COMMANDS & CFG_CMD_SNTP))
-
-#define SNTP_TIMEOUT 10
+#define SNTP_TIMEOUT 10000UL
 
 static int SntpOurPort;
 
@@ -25,7 +23,7 @@ SntpSend (void)
        int pktlen = SNTP_PACKET_LEN;
        int sport;
 
-       debug ("%s\n", __FUNCTION__);
+       debug("%s\n", __func__);
 
        memset (&pkt, 0, sizeof(pkt));
 
@@ -56,7 +54,7 @@ SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
        struct rtc_time tm;
        ulong seconds;
 
-       debug ("%s\n", __FUNCTION__);
+       debug("%s\n", __func__);
 
        if (dest != SntpOurPort) return;
 
@@ -67,7 +65,7 @@ SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
        memcpy (&seconds, &rpktp->transmit_timestamp, sizeof(ulong));
 
        to_tm(ntohl(seconds) - 2208988800UL + NetTimeOffset, &tm);
-#if (CONFIG_COMMANDS & CFG_CMD_DATE)
+#if defined(CONFIG_CMD_DATE)
        rtc_set (&tm);
 #endif
        printf ("Date: %4d-%02d-%02d Time: %2d:%02d:%02d\n",
@@ -80,13 +78,11 @@ SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
 void
 SntpStart (void)
 {
-       debug ("%s\n", __FUNCTION__);
+       debug("%s\n", __func__);
 
-       NetSetTimeout (SNTP_TIMEOUT * CFG_HZ, SntpTimeout);
+       NetSetTimeout (SNTP_TIMEOUT, SntpTimeout);
        NetSetHandler(SntpHandler);
        memset (NetServerEther, 0, 6);
 
        SntpSend ();
 }
-
-#endif /* CONFIG_COMMANDS & CFG_CMD_SNTP */