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; }