From patchwork Sat Oct 22 04:51:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 121137 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id CAC7C1007D3 for ; Sat, 22 Oct 2011 15:52:33 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1688D2959E; Sat, 22 Oct 2011 06:52:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Iq86Q-uF1euC; Sat, 22 Oct 2011 06:52:29 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 55377295A3; Sat, 22 Oct 2011 06:52:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8D40F29565 for ; Sat, 22 Oct 2011 06:52:18 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IMABkXPljFew for ; Sat, 22 Oct 2011 06:52:17 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp-out.google.com (smtp-out.google.com [216.239.44.51]) by theia.denx.de (Postfix) with ESMTPS id 9BF892945F for ; Sat, 22 Oct 2011 06:52:17 +0200 (CEST) Received: from wpaz9.hot.corp.google.com (wpaz9.hot.corp.google.com [172.24.198.73]) by smtp-out.google.com with ESMTP id p9M4qFiW007302; Fri, 21 Oct 2011 21:52:15 -0700 Received: from glucid-laptop-imager.hot.corp.google.com ([172.19.240.38]) by wpaz9.hot.corp.google.com with ESMTP id p9M4qDji026990; Fri, 21 Oct 2011 21:52:14 -0700 Received: by glucid-laptop-imager.hot.corp.google.com (Postfix, from userid 121222) id 8D1C734E6C6; Fri, 21 Oct 2011 21:52:13 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 21 Oct 2011 21:51:37 -0700 Message-Id: <1319259100-11376-6-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1319259100-11376-1-git-send-email-sjg@chromium.org> References: <1319259100-11376-1-git-send-email-sjg@chromium.org> X-System-Of-Record: true Subject: [U-Boot] [PATCH 5/8] tftpput: support selecting get/put for tftp X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de TftpStart should support starting either a get or a put. Signed-off-by: Simon Glass --- 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 */