From patchwork Sun Jan 15 07:53:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Schocher X-Patchwork-Id: 136162 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 5C533B6EFE for ; Sun, 15 Jan 2012 18:54:11 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8947C28246; Sun, 15 Jan 2012 08:54:04 +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 yPNlQxA7zYKm; Sun, 15 Jan 2012 08:54:04 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D05CC28228; Sun, 15 Jan 2012 08:53:51 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3C40C281F4 for ; Sun, 15 Jan 2012 08:53:47 +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 npQ5xn5CX7Ab for ; Sun, 15 Jan 2012 08:53:46 +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 pollux.denx.de (host-82-135-33-74.customer.m-online.net [82.135.33.74]) by theia.denx.de (Postfix) with ESMTP id 1AF6E281FE for ; Sun, 15 Jan 2012 08:53:44 +0100 (CET) Received: by pollux.denx.de (Postfix, from userid 515) id 4B89E322570; Sun, 15 Jan 2012 08:53:44 +0100 (CET) From: Heiko Schocher To: u-boot@lists.denx.de Date: Sun, 15 Jan 2012 08:53:42 +0100 Message-Id: <1326614022-24014-4-git-send-email-hs@denx.de> X-Mailer: git-send-email 1.7.7.4 In-Reply-To: <1326614022-24014-1-git-send-email-hs@denx.de> References: <1326614022-24014-1-git-send-email-hs@denx.de> Cc: Heiko Schocher Subject: [U-Boot] [PATCH 3/3] common, menu: show menu on startup if CONFIG_MENU_SHOW is defined 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de show a menu on startup instead running the shell. Signed-off-by: Heiko Schocher Cc: Jason Hobbs --- common/main.c | 4 ++++ doc/README.menu | 5 +++++ include/menu.h | 3 +++ 3 files changed, 12 insertions(+), 0 deletions(-) diff --git a/common/main.c b/common/main.c index 08070f3..2199ae7 100644 --- a/common/main.c +++ b/common/main.c @@ -41,6 +41,7 @@ #include #include +#include #if defined(CONFIG_SILENT_CONSOLE) || defined(CONFIG_POST) || defined(CONFIG_CMDLINE_EDITING) DECLARE_GLOBAL_DATA_PTR; @@ -372,6 +373,9 @@ void main_loop (void) debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay); +#if defined(CONFIG_MENU_SHOW) + bootdelay = menu_show(); +#endif # ifdef CONFIG_BOOT_RETRY_TIME init_cmd_timeout (); # endif /* CONFIG_BOOT_RETRY_TIME */ diff --git a/doc/README.menu b/doc/README.menu index 0dad6a2..ba7dcad 100644 --- a/doc/README.menu +++ b/doc/README.menu @@ -25,6 +25,11 @@ the interfaces should be available. Menus are composed of items. Each item has a key used to identify it in the menu, and an opaque pointer to data controlled by the consumer. +If you want to show a menu, instead starting the shell, define +CONFIG_MENU_SHOW. You have to code the int menu_show(void) function, +which handle your menu. This function returns the remaining +bootdelay. + Interfaces ---------- #include "menu.h" diff --git a/include/menu.h b/include/menu.h index cf14a9c..4cda33d 100644 --- a/include/menu.h +++ b/include/menu.h @@ -27,4 +27,7 @@ int menu_get_choice(struct menu *m, void **choice); int menu_item_add(struct menu *m, char *item_key, void *item_data); int menu_destroy(struct menu *m); +#if defined(CONFIG_MENU_SHOW) +int menu_show(void); +#endif #endif /* __MENU_H__ */