diff options
author | Philippe Reynes <philippe.reynes@softathome.com> | 2020-09-18 14:13:02 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-09-30 16:55:03 -0400 |
commit | 912ece4c3dd486bcd62f0d0dfee760b9f01caac6 (patch) | |
tree | 4bc13b0c8d593e9012b58ce22c65d52e916e14bf /net/sntp.c | |
parent | 6b981a224e86b77a983438fd90cc90dd511fbb1a (diff) | |
download | u-boot-912ece4c3dd486bcd62f0d0dfee760b9f01caac6.zip u-boot-912ece4c3dd486bcd62f0d0dfee760b9f01caac6.tar.gz u-boot-912ece4c3dd486bcd62f0d0dfee760b9f01caac6.tar.bz2 |
sntp: use udp framework
This commits update the support of sntp to use
the framework udp. This change allows to remove
all the reference to sntp in the main network
file net/net.c.
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'net/sntp.c')
-rw-r--r-- | net/sntp.c | 29 |
1 files changed, 27 insertions, 2 deletions
@@ -12,12 +12,17 @@ #include <net.h> #include <rtc.h> -#include "sntp.h" +#include <net/sntp.h> #define SNTP_TIMEOUT 10000UL static int sntp_our_port; +/* NTP server IP address */ +struct in_addr net_ntp_server; +/* offset time from UTC */ +int net_ntp_time_offset; + static void sntp_send(void) { struct sntp_pkt_t pkt; @@ -93,7 +98,25 @@ static void sntp_handler(uchar *pkt, unsigned dest, struct in_addr sip, net_set_state(NETLOOP_SUCCESS); } -void sntp_start(void) +/* + * SNTP: + * + * Prerequisites: - own ethernet address + * - own IP address + * We want: - network time + * Next step: none + */ +int sntp_prereq(void *data) +{ + if (net_ntp_server.s_addr == 0) { + puts("*** ERROR: NTP server address not given\n"); + return 1; + } + + return 0; +} + +int sntp_start(void *data) { debug("%s\n", __func__); @@ -102,4 +125,6 @@ void sntp_start(void) memset(net_server_ethaddr, 0, sizeof(net_server_ethaddr)); sntp_send(); + + return 0; } |