summaryrefslogtreecommitdiffstats
path: root/net/net.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2005-04-01 00:25:43 +0000
committerwdenk <wdenk>2005-04-01 00:25:43 +0000
commitea287debe1980182adbe8c63b71bb82193dad5b7 (patch)
tree34044b91763e6e85704b7a54acd34c042931461d /net/net.c
parentef2807c667a91135fbb91b805b852ccfbff03587 (diff)
downloadbarebox-ea287debe1980182adbe8c63b71bb82193dad5b7.tar.gz
barebox-ea287debe1980182adbe8c63b71bb82193dad5b7.tar.xz
* Patch by Masami Komiya, 30 Mar 2005:
add SNTP support and expand time server and time offset fields of DHCP support. See doc/README.SNTP * Patch by Steven Scholz, 13 Dec 2004: Fix bug in at91rm920 ethernet driver
Diffstat (limited to 'net/net.c')
-rw-r--r--net/net.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/net/net.c b/net/net.c
index d7523fd100..11a286b578 100644
--- a/net/net.c
+++ b/net/net.c
@@ -64,6 +64,13 @@
* derived from our own IP address)
* We want: - load the boot file
* Next step: none
+ *
+ * SNTP:
+ *
+ * Prerequisites: - own ethernet address
+ * - own IP address
+ * We want: - network time
+ * Next step: none
*/
@@ -79,6 +86,9 @@
#include <status_led.h>
#include <miiphy.h>
#endif
+#if (CONFIG_COMMANDS & CFG_CMD_SNTP)
+#include "sntp.h"
+#endif
#if (CONFIG_COMMANDS & CFG_CMD_NET)
@@ -148,6 +158,11 @@ static void PingStart(void);
static void CDPStart(void);
#endif
+#if (CONFIG_COMMANDS & CFG_CMD_SNTP)
+IPaddr_t NetNtpServerIP; /* NTP server IP address */
+int NetTimeOffset=0; /* offset time from UTC */
+#endif
+
#ifdef CONFIG_NETCONSOLE
void NcStart(void);
int nc_input_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len);
@@ -313,6 +328,9 @@ restart:
#if (CONFIG_COMMANDS & CFG_CMD_PING)
case PING:
#endif
+#if (CONFIG_COMMANDS & CFG_CMD_SNTP)
+ case SNTP:
+#endif
case NETCONS:
case TFTP:
NetCopyIP(&NetOurIP, &bd->bi_ip_addr);
@@ -334,6 +352,11 @@ restart:
/* nothing */
break;
#endif
+#if (CONFIG_COMMANDS & CFG_CMD_SNTP)
+ case SNTP:
+ /* nothing */
+ break;
+#endif
default:
break;
}
@@ -417,6 +440,11 @@ restart:
NcStart();
break;
#endif
+#if (CONFIG_COMMANDS & CFG_CMD_SNTP)
+ case SNTP:
+ SntpStart();
+ break;
+#endif
default:
break;
}
@@ -1426,6 +1454,14 @@ static int net_check_prereq (proto_t protocol)
}
goto common;
#endif
+#if (CONFIG_COMMANDS & CFG_CMD_SNTP)
+ case SNTP:
+ if (NetNtpServerIP == 0) {
+ puts ("*** ERROR: NTP server address not given\n");
+ return (1);
+ }
+ goto common;
+#endif
#if (CONFIG_COMMANDS & CFG_CMD_NFS)
case NFS:
#endif
@@ -1435,7 +1471,7 @@ static int net_check_prereq (proto_t protocol)
puts ("*** ERROR: `serverip' not set\n");
return (1);
}
-#if (CONFIG_COMMANDS & CFG_CMD_PING)
+#if (CONFIG_COMMANDS & (CFG_CMD_PING | CFG_CMD_SNTP))
common:
#endif