summaryrefslogtreecommitdiff
path: root/include/net.h
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2012-05-23 07:59:14 +0000
committerJoe Hershberger <joe.hershberger@ni.com>2012-05-23 17:46:21 -0500
commit22f6e99d5b0c54758646334c1153737a5585bd57 (patch)
treee70b3679ff62e93345fc0f7e3960d37582cea612 /include/net.h
parentadf5d93e441eb3eacd8c0430d6064b35d47ad2a5 (diff)
downloadu-boot-imx-22f6e99d5b0c54758646334c1153737a5585bd57.zip
u-boot-imx-22f6e99d5b0c54758646334c1153737a5585bd57.tar.gz
u-boot-imx-22f6e99d5b0c54758646334c1153737a5585bd57.tar.bz2
net: Refactor to protect access to the NetState variable
Changes to NetState now go through an accessor function called net_set_state() Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'include/net.h')
-rw-r--r--include/net.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/include/net.h b/include/net.h
index 3214830..8dd407e 100644
--- a/include/net.h
+++ b/include/net.h
@@ -391,12 +391,6 @@ extern uchar NetEtherNullAddr[6];
extern ushort NetOurVLAN; /* Our VLAN */
extern ushort NetOurNativeVLAN; /* Our Native VLAN */
-extern int NetState; /* Network loop state */
-#define NETLOOP_CONTINUE 1
-#define NETLOOP_RESTART 2
-#define NETLOOP_SUCCESS 3
-#define NETLOOP_FAIL 4
-
extern int NetRestartWrap; /* Tried all network devices */
enum proto_t {
@@ -471,6 +465,20 @@ extern void NetSetHandler(rxhand_f *); /* Set RX packet handler */
extern void net_set_icmp_handler(rxhand_icmp_f *f); /* Set ICMP RX handler */
extern void NetSetTimeout(ulong, thand_f *);/* Set timeout handler */
+/* Network loop state */
+enum net_loop_state {
+ NETLOOP_CONTINUE,
+ NETLOOP_RESTART,
+ NETLOOP_SUCCESS,
+ NETLOOP_FAIL
+};
+static inline void net_set_state(enum net_loop_state state)
+{
+ extern enum net_loop_state net_state;
+
+ net_state = state;
+}
+
/* Transmit "NetTxPacket" */
static inline void NetSendPacket(uchar *pkt, int len)
{