From patchwork Fri Jan 25 07:03:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Lin X-Patchwork-Id: 215564 X-Patchwork-Delegate: wd@denx.de 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 F07772C0080 for ; Fri, 25 Jan 2013 18:04:39 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6081E4A109; Fri, 25 Jan 2013 08:04:38 +0100 (CET) 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 AVgr1laCfoXM; Fri, 25 Jan 2013 08:04:38 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D96E94A10A; Fri, 25 Jan 2013 08:04:35 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D41CB4A10A for ; Fri, 25 Jan 2013 08:04:33 +0100 (CET) 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 YzalLcHmE9VV for ; Fri, 25 Jan 2013 08:04:32 +0100 (CET) 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 hqemgate03.nvidia.com (hqemgate03.nvidia.com [216.228.121.140]) by theia.denx.de (Postfix) with ESMTPS id 128124A11B for ; Fri, 25 Jan 2013 08:04:16 +0100 (CET) Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate03.nvidia.com id ; Thu, 24 Jan 2013 23:08:25 -0800 Received: from hqemhub02.nvidia.com ([172.17.108.22]) by hqnvupgp08.nvidia.com (PGP Universal service); Thu, 24 Jan 2013 23:02:25 -0800 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Thu, 24 Jan 2013 23:02:25 -0800 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by hqemhub02.nvidia.com (172.20.150.31) with Microsoft SMTP Server id 8.3.297.1; Thu, 24 Jan 2013 23:04:06 -0800 Received: from daphne.nvidia.com (Not Verified[172.16.212.96]) by hqnvemgw01.nvidia.com with MailMarshal (v6,7,2,8378) id ; Thu, 24 Jan 2013 23:05:09 -0800 Received: from jilin-desktop.nvidia.com (dhcp-10-19-108-200.nvidia.com [10.19.108.200]) by daphne.nvidia.com (8.13.8+Sun/8.8.8) with ESMTP id r0P744bI000253; Thu, 24 Jan 2013 23:04:05 -0800 (PST) From: Jim Lin To: Date: Fri, 25 Jan 2013 15:03:45 +0800 Message-ID: <1359097425-20517-1-git-send-email-jilin@nvidia.com> X-Mailer: git-send-email 1.7.3 MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 1/1] console: Improve TFTP booting performance X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de TFTP booting is observed a little bit slow, especially when a USB keyboard is installed. The fix is to check whether Ctrl-C key is pressed every CONFIG_CTRLC_POLL_MS ms. If CONFIG_CTRLC_POLL_MS is not defined in configuration file, we define it as 1000. Signed-off-by: Jim Lin --- common/console.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/common/console.c b/common/console.c index bf73178..3339a93 100644 --- a/common/console.c +++ b/common/console.c @@ -524,9 +524,21 @@ int vprintf(const char *fmt, va_list args) /* test if ctrl-c was pressed */ static int ctrlc_disabled = 0; /* see disable_ctrl() */ static int ctrlc_was_pressed = 0; +#ifndef CONFIG_CTRLC_POLL_MS +/* + * Process Ctrl-C every 1000 ms by default to improve performance + * (like TFTP boot) when interlaced with other tasks. + */ +#define CONFIG_CTRLC_POLL_MS 1000 +#endif +static unsigned long ctrlc_ts = CONFIG_CTRLC_POLL_MS; int ctrlc(void) { if (!ctrlc_disabled && gd->have_console) { + if (get_timer(ctrlc_ts) < CONFIG_CTRLC_POLL_MS) + return 0; + else + ctrlc_ts = get_timer(0); if (tstc()) { switch (getc()) { case 0x03: /* ^C - Control C */