TftpStart should support starting either a get or a put.

Signed-off-by: Simon Glass <s...@chromium.org>
---
 include/net.h |    4 ++--
 net/bootp.c   |    2 +-
 net/tftp.c    |    5 +++--
 net/tftp.h    |    2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/net.h b/include/net.h
index 3dfe073..2e5a898 100644
--- a/include/net.h
+++ b/include/net.h
@@ -349,8 +349,8 @@ extern int          NetRestartWrap;         /* Tried all 
network devices    */
 
 enum {
        BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
-       TFTPSRV
-};
+       TFTPSRV, TFTPPUT
+} proto_t;
 
 /* from net/net.c */
 extern char    BootFile[128];                  /* Boot File name               
*/
diff --git a/net/bootp.c b/net/bootp.c
index a003c42..068b037 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -165,7 +165,7 @@ static void auto_load(void)
                }
 #endif
        }
-       TftpStart();
+       TftpStart(TFTPGET);
 }
 
 #if !defined(CONFIG_CMD_DHCP)
diff --git a/net/tftp.c b/net/tftp.c
index 4ad85a5..3a58e32 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -81,6 +81,7 @@ static int    TftpTsize;
 /* The number of hashes we printed */
 static short   TftpNumchars;
 #endif
+static int     TftpWriting;    /* 1 if writing, else 0 */
 
 #define STATE_SEND_RRQ 1
 #define STATE_DATA     2
@@ -572,8 +573,7 @@ TftpTimeout(void)
 }
 
 
-void
-TftpStart(void)
+void TftpStart(proto_t protocol)
 {
        char *ep;             /* Environment pointer */
 
@@ -648,6 +648,7 @@ TftpStart(void)
        }
 
        putc('\n');
+       TftpWriting = (protocol == TFTPPUT);
 
        printf("Load address: 0x%lx\n", load_addr);
 
diff --git a/net/tftp.h b/net/tftp.h
index 3abdf7b..2d5d594 100644
--- a/net/tftp.h
+++ b/net/tftp.h
@@ -16,7 +16,7 @@
  */
 
 /* tftp.c */
-extern void    TftpStart (void);       /* Begin TFTP get */
+void TftpStart(proto_t protocol);      /* Begin TFTP get/put */
 
 #ifdef CONFIG_CMD_TFTPSRV
 extern void    TftpStartServer(void);  /* Wait for incoming TFTP put */
-- 
1.7.3.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to