@@ -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 */
@@ -165,7 +165,7 @@ static void auto_load(void)
}
#endif
}
- TftpStart();
+ TftpStart(TFTPGET);
}
#if !defined(CONFIG_CMD_DHCP)
@@ -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);
@@ -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 */
TftpStart should support starting either a get or a put. Signed-off-by: Simon Glass <sjg@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(-)