From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Diekema Date: Tue, 14 Oct 2003 20:27:55 -0400 Subject: [U-Boot-Users] Adding is_console_quiet() to support runtime changes in console output Message-ID: <1066177675.8112.7.camel@smoke.cideas.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Product: - u-boot Version: - 1.0.0-pre CHANGELOG: - Adding is_console_quiet() to support runtime changes in console output CVS Comments: - Adding the CFG_CONSOLE_IS_QUIET option to support runtime changes in console output. The is_console_quiet() function is used to determine the status of quiet mode. Quiet mode is based on the value of the "quiet" environment variable. Non-zero values indicate that quiet mode is active. Patched files: - README - include/console.h - common/console.c - common/cmd_nvedit.c -- ------------------\\----------------------\\---------------------------- Jon Diekema | | Smiths Aerospace (616) 241-8310 | | 3290 Patterson Avenue, SE jon.diekema at smiths-aerospace.com \\ Grand Rapids, MI 49512 ****************************************** The information contained in, or attached to, this e-mail, may contain confidential information and is intended solely for the use of the individual or entity to whom they are addressed and may be subject to legal privilege. If you have received this e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your system and notify your system manager. Please do not copy it for any purpose, or disclose its contents to any other person. The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company. The recipient should check this e-mail and any attachments for the presence of viruses. The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email. ****************************************** -------------- next part -------------- Product: - u-boot Version: - 1.0.0-pre CHANGELOG: - Adding is_console_quiet() to support runtime changes in console output CVS Comments: - Adding the CFG_CONSOLE_IS_QUIET option to support runtime changes in console output. The is_console_quiet() function is used to determine the status of quiet mode. Quiet mode is based on the value of the "quiet" environment variable. Non-zero values indicate that quiet mode is active. Patched files: - README - include/console.h - common/console.c - common/cmd_nvedit.c --- README 2003-10-14 20:13:16.000000000 -0400 +++ README 2003-10-14 20:17:08.000000000 -0400 @@ -1765,6 +1765,13 @@ use the "saveenv" command to store a val - CFG_FAULT_MII_ADDR: MII address of the PHY to check for the Ethernet link state. +- CFG_CONSOLE_IS_QUIET: + To support runtime changes in console output, + is_console_quiet() is used to determine the status of + quiet mode. Quiet mode is based on the value of the + "quiet" environment variable. Non-zero values + indicate that quiet mode is active. + Low Level (hardware related) configuration options: --------------------------------------------------- --- include/console.h 2000-11-12 18:38:42.000000000 -0500 +++ include/console.h 2003-09-19 07:11:59.000000000 -0400 @@ -33,6 +33,16 @@ extern device_t *stdio_devices[] ; extern char *stdio_names[MAX_FILES] ; +/* +** ROUTINES +*/ + int console_realloc(int top); -#endif +#ifdef CFG_CONSOLE_IS_QUIET + +extern void updated_quiet_in_env(int quiet); +extern int is_console_quiet(void); + +#endif /* CFG_CONSOLE_IS_QUIET */ +#endif /* _CONSOLE_H_ */ --- common/console.c 2003-10-14 07:12:10.000000000 -0400 +++ common/console.c 2003-10-14 07:10:41.000000000 -0400 @@ -573,3 +573,52 @@ int console_init_r (void) } #endif /* CFG_CONSOLE_IS_IN_ENV */ + +#ifdef CFG_CONSOLE_IS_QUIET + +#define QUIET_LEVEL_OFF 1 +#define QUIET_LEVEL_ON 2 + +static int quiet_level = 0; + +void updated_quiet_in_env(int quiet) + +{ + if (quiet) { + quiet_level = QUIET_LEVEL_ON; + } + else { + quiet_level = QUIET_LEVEL_OFF; + } +} + +int is_console_quiet(void) + +{ + int quiet; /* Quiet or minimal output mode */ + char *ep; /* Environment pointer */ + + if ((quiet_level != QUIET_LEVEL_OFF) && (quiet_level != QUIET_LEVEL_ON)) { + /* + * The quiet_level isn't defined yet. Read the quiet environment + * variable to determine what is should be set to. + */ + quiet = 0; + if ((ep = getenv("quiet")) != NULL) { + quiet = simple_strtol(ep, NULL, 10); + } + else { + setenv("quiet", "0"); + } + updated_quiet_in_env(quiet); + } + + if (quiet_level == QUIET_LEVEL_ON) { + return (1); + } + else { + return (0); + } +} + +#endif /* CFG_CONSOLE_IS_QUIET */ --- common/cmd_nvedit.c 2003-07-11 04:03:18.000000000 -0400 +++ common/cmd_nvedit.c 2003-09-19 07:14:45.000000000 -0400 @@ -48,6 +48,7 @@ #if (CONFIG_COMMANDS & CFG_CMD_NET) #include #endif +#include #if !defined(CFG_ENV_IS_IN_NVRAM) && !defined(CFG_ENV_IS_IN_EEPROM) && !defined(CFG_ENV_IS_IN_FLASH) && !defined(CFG_ENV_IS_NOWHERE) # error Define one of CFG_ENV_IS_IN_NVRAM, CFG_ENV_IS_IN_EEPROM, CFG_ENV_IS_IN_FLASH, CFG_ENV_IS_NOWHERE @@ -369,6 +370,13 @@ int _do_setenv (int flag, int argc, char } #endif /* CONFIG_AMIGAONEG3SE */ +#ifdef CFG_CONSOLE_IS_QUIET + if (strcmp(argv[1], "quiet") == 0 ) { + updated_quiet_in_env(simple_strtoul(argv[2], NULL, 16)); + return 0; + } +#endif /* CFG_CONSOLE_IS_QUIET */ + return 0; }