Allow console input to be disabled
authorMark Jackson <mpfj@mimc.co.uk>
Mon, 25 Aug 2008 18:21:30 +0000 (19:21 +0100)
committerWolfgang Denk <wd@denx.de>
Sat, 6 Sep 2008 20:36:54 +0000 (22:36 +0200)
Added new CONFIG_DISABLE_CONSOLE define and GD_FLG_DISABLE_CONSOLE.

When CONFIG_DISABLE_CONSOLE is defined, setting
GD_FLG_DISABLE_CONSOLE disables all console input and output.

Signed-off-by: Mark Jackson <mpfj@mimc.co.uk>
13 files changed:
common/console.c
include/asm-arm/global_data.h
include/asm-avr32/global_data.h
include/asm-blackfin/global_data.h
include/asm-i386/global_data.h
include/asm-m68k/global_data.h
include/asm-microblaze/global_data.h
include/asm-mips/global_data.h
include/asm-nios/global_data.h
include/asm-nios2/global_data.h
include/asm-ppc/global_data.h
include/asm-sh/global_data.h
include/asm-sparc/global_data.h

index cfcaeb8..56d9118 100644 (file)
@@ -162,6 +162,11 @@ void fprintf (int file, const char *fmt, ...)
 
 int getc (void)
 {
+#ifdef CONFIG_DISABLE_CONSOLE
+       if (gd->flags & GD_FLG_DISABLE_CONSOLE)
+               return 0;
+#endif
+
        if (gd->flags & GD_FLG_DEVINIT) {
                /* Get from the standard input */
                return fgetc (stdin);
@@ -173,6 +178,11 @@ int getc (void)
 
 int tstc (void)
 {
+#ifdef CONFIG_DISABLE_CONSOLE
+       if (gd->flags & GD_FLG_DISABLE_CONSOLE)
+               return 0;
+#endif
+
        if (gd->flags & GD_FLG_DEVINIT) {
                /* Test the standard input */
                return ftstc (stdin);
@@ -189,6 +199,11 @@ void putc (const char c)
                return;
 #endif
 
+#ifdef CONFIG_DISABLE_CONSOLE
+       if (gd->flags & GD_FLG_DISABLE_CONSOLE)
+               return;
+#endif
+
        if (gd->flags & GD_FLG_DEVINIT) {
                /* Send to the standard output */
                fputc (stdout, c);
@@ -205,6 +220,11 @@ void puts (const char *s)
                return;
 #endif
 
+#ifdef CONFIG_DISABLE_CONSOLE
+       if (gd->flags & GD_FLG_DISABLE_CONSOLE)
+               return;
+#endif
+
        if (gd->flags & GD_FLG_DEVINIT) {
                /* Send to the standard output */
                fputs (stdout, s);
index 7e2a53a..f419b42 100644 (file)
@@ -63,6 +63,7 @@ typedef       struct  global_data {
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
 #define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 #define        GD_FLG_LOGINIT  0x00020         /* Log Buffer has been initialized      */
+#define GD_FLG_DISABLE_CONSOLE 0x00040         /* Disable console (in & out)    */
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r8")
 
index 007cfe4..75e75cc 100644 (file)
@@ -54,6 +54,7 @@ typedef       struct  global_data {
 #define GD_FLG_POSTFAIL        0x00008         /* Critical POST test failed     */
 #define GD_FLG_POSTSTOP        0x00010         /* POST seqeunce aborted         */
 #define GD_FLG_LOGINIT 0x00020         /* Log Buf has been initialized  */
+#define GD_FLG_DISABLE_CONSOLE 0x00040         /* Disable console (in & out)    */
 
 #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm("r5")
 
index b0b01e4..2f40870 100644 (file)
@@ -64,6 +64,7 @@ typedef struct global_data {
 #define        GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed     */
 #define        GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted         */
 #define        GD_FLG_LOGINIT  0x00020 /* Log Buf has been initialized  */
+#define GD_FLG_DISABLE_CONSOLE 0x00040         /* Disable console (in & out)    */
 
 #define DECLARE_GLOBAL_DATA_PTR     register gd_t * volatile gd asm ("P5")
 
index 5dfb595..35bad23 100644 (file)
@@ -57,6 +57,7 @@ typedef       struct {
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
 #define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 #define        GD_FLG_LOGINIT  0x00020         /* Log Buffer has been initialized      */
+#define GD_FLG_DISABLE_CONSOLE 0x00040         /* Disable console (in & out)    */
 
 extern gd_t *global_data;
 
index 10c6931..187618d 100644 (file)
@@ -75,6 +75,7 @@ typedef       struct  global_data {
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
 #define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 #define        GD_FLG_LOGINIT  0x00020         /* Log Buffer has been initialized      */
+#define GD_FLG_DISABLE_CONSOLE 0x00040         /* Disable console (in & out)    */
 
 #if 0
 extern gd_t *global_data;
index 376786f..013c56a 100644 (file)
@@ -55,6 +55,7 @@ typedef       struct  global_data {
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
 #define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 #define        GD_FLG_LOGINIT  0x00020         /* Log Buffer has been initialized      */
+#define GD_FLG_DISABLE_CONSOLE 0x00040         /* Disable console (in & out)    */
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r31")
 
index ecee6de..7cf2a00 100644 (file)
@@ -57,6 +57,7 @@ typedef       struct  global_data {
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed     */
 #define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted         */
 #define        GD_FLG_LOGINIT  0x00020         /* Log Buf has been initialized  */
+#define GD_FLG_DISABLE_CONSOLE 0x00040         /* Disable console (in & out)    */
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("k0")
 
index a56f939..4929a5b 100644 (file)
@@ -48,6 +48,7 @@ typedef       struct  global_data {
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
 #define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 #define        GD_FLG_LOGINIT  0x00020         /* Log Buffer has been initialized      */
+#define GD_FLG_DISABLE_CONSOLE 0x00040         /* Disable console (in & out)    */
 
 #define DECLARE_GLOBAL_DATA_PTR     register gd_t *gd asm ("%g7")
 
index cd17e08..db71324 100644 (file)
@@ -47,6 +47,7 @@ typedef       struct  global_data {
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
 #define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 #define        GD_FLG_LOGINIT  0x00020         /* Log Buffer has been initialized      */
+#define GD_FLG_DISABLE_CONSOLE 0x00040         /* Disable console (in & out)    */
 
 #define DECLARE_GLOBAL_DATA_PTR     register gd_t *gd asm ("r15")
 
index a9366c3..4331a15 100644 (file)
@@ -180,6 +180,7 @@ typedef     struct  global_data {
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
 #define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 #define        GD_FLG_LOGINIT  0x00020         /* Log Buffer has been initialized      */
+#define GD_FLG_DISABLE_CONSOLE 0x00040         /* Disable console (in & out)    */
 
 #if 1
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r2")
index d61421b..f8ade5c 100644 (file)
@@ -47,6 +47,7 @@ typedef       struct global_data
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
 #define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 #define        GD_FLG_LOGINIT  0x00020         /* Log Buffer has been initialized      */
+#define GD_FLG_DISABLE_CONSOLE 0x00040         /* Disable console (in & out)    */
 
 #define DECLARE_GLOBAL_DATA_PTR        register gd_t *gd asm ("r13")
 
index a8d85f1..eeb35d0 100644 (file)
@@ -82,6 +82,7 @@ typedef struct global_data {
 #define        GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed            */
 #define        GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted                */
 #define        GD_FLG_LOGINIT  0x00020 /* Log Buffer has been initialized      */
+#define GD_FLG_DISABLE_CONSOLE 0x00040         /* Disable console (in & out)    */
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("%g7")