summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/Makefile2
-rw-r--r--net/eth.c22
-rw-r--r--net/net.c2
-rw-r--r--net/sntp.c4
4 files changed, 24 insertions, 6 deletions
diff --git a/net/Makefile b/net/Makefile
index 0eee330cf..d34187425 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -33,7 +33,7 @@ COBJS-y += bootp.o
COBJS-y += rarp.o
COBJS-y += eth.o
COBJS-y += nfs.o
-COBJS-y += sntp.o
+COBJS-$(CONFIG_CMD_SNTP) += sntp.o
COBJS := $(COBJS-y)
SRCS := $(COBJS:.o=.c)
diff --git a/net/eth.c b/net/eth.c
index b7ef09f44..ec2ef1a36 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -80,6 +80,28 @@ struct eth_device *eth_get_dev_by_name(char *devname)
return target_dev;
}
+struct eth_device *eth_get_dev_by_index(int index)
+{
+ struct eth_device *dev, *target_dev;
+ int idx = 0;
+
+ if (!eth_devices)
+ return NULL;
+
+ dev = eth_devices;
+ target_dev = NULL;
+ do {
+ if (idx == index) {
+ target_dev = dev;
+ break;
+ }
+ dev = dev->next;
+ idx++;
+ } while (dev != eth_devices);
+
+ return target_dev;
+}
+
int eth_get_dev_index (void)
{
struct eth_device *dev;
diff --git a/net/net.c b/net/net.c
index e6547f9ed..459baf4ea 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1684,7 +1684,7 @@ NetSetEther(volatile uchar * xet, uchar * addr, uint prot)
void
NetSetIP(volatile uchar * xip, IPaddr_t dest, int dport, int sport, int len)
{
- volatile IP_t *ip = (IP_t *)xip;
+ IP_t *ip = (IP_t *)xip;
/*
* If the data is an odd number of bytes, zero the
diff --git a/net/sntp.c b/net/sntp.c
index 425d35edd..404587e80 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -12,8 +12,6 @@
#include "sntp.h"
-#if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_SNTP)
-
#define SNTP_TIMEOUT 10000UL
static int SntpOurPort;
@@ -88,5 +86,3 @@ SntpStart (void)
SntpSend ();
}
-
-#endif