To: wd@denx.de,u-boot-users@lists.sourceforge.net Product: - u-boot Version: - 1.0.2 CHANGELOG: * Patch by Jon Diekema, 24 Jeb 2004: - 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 2004-02-23 23:27:21.000000000 -0500 +++ README 2004-02-24 09:25:03.000000000 -0500 @@ -1803,6 +1803,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 2004-02-24 09:25:03.000000000 -0500 @@ -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 2004-02-09 07:26:41.000000000 -0500 +++ common/console.c 2004-02-24 09:25:03.000000000 -0500 @@ -583,3 +583,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-12-07 21:56:32.000000000 -0500 +++ common/cmd_nvedit.c 2004-02-24 09:25:03.000000000 -0500 @@ -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) && \ @@ -373,6 +374,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; }