All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot]  [PATCH v2] Allow console input to be disabled
@ 2016-10-21 12:19 Egor
  0 siblings, 0 replies; 4+ messages in thread
From: Egor @ 2016-10-21 12:19 UTC (permalink / raw)
  To: u-boot

Hi!

I?ve seen your patch from 2008 <http://lists.denx.de/pipermail/u-boot/2008-August/039279.html> and I?m looking for this very functionality. However, I do not understand, what else do I need except the CONFIG_DISABLE_CONSOLE define. How do make the if pass? Is it an environment variable?

Thanks in advance!

-- 
Best regards,
Egor Fedorov
Emlid Ltd
emlid.com <http://www.emlid.com/>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v2] Allow console input to be disabled
  2008-08-25 18:21 Mark Jackson
  2008-08-25 18:32 ` Mark Jackson
@ 2008-09-06 20:37 ` Wolfgang Denk
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2008-09-06 20:37 UTC (permalink / raw)
  To: u-boot

Dear Mark Jackson,

In message <48B2F82A.9050504@mimc.co.uk> you wrote:
> 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.
> 
> ---
> 
>  common/console.c                     |   20 ++++++++++++++++++++
>  include/asm-arm/global_data.h        |    1 +
>  include/asm-avr32/global_data.h      |    1 +
>  include/asm-blackfin/global_data.h   |    1 +
>  include/asm-i386/global_data.h       |    1 +
>  include/asm-m68k/global_data.h       |    1 +
>  include/asm-microblaze/global_data.h |    1 +
>  include/asm-mips/global_data.h       |    1 +
>  include/asm-nios/global_data.h       |    1 +
>  include/asm-nios2/global_data.h      |    1 +
>  include/asm-ppc/global_data.h        |    1 +
>  include/asm-sh/global_data.h         |    1 +
>  include/asm-sparc/global_data.h      |    1 +
>  13 files changed, 32 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
To know how another being, another creature feels -  that  is  impos-
sible.                  - Terry Pratchett, _The Dark Side of the Sun_

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v2] Allow console input to be disabled
  2008-08-25 18:21 Mark Jackson
@ 2008-08-25 18:32 ` Mark Jackson
  2008-09-06 20:37 ` Wolfgang Denk
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Jackson @ 2008-08-25 18:32 UTC (permalink / raw)
  To: u-boot

Mark Jackson wrote:
> 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.

Missing ...

Signed-off-by: Mark Jackson <mpfj@mimc.co.uk>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v2] Allow console input to be disabled
@ 2008-08-25 18:21 Mark Jackson
  2008-08-25 18:32 ` Mark Jackson
  2008-09-06 20:37 ` Wolfgang Denk
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Jackson @ 2008-08-25 18:21 UTC (permalink / raw)
  To: u-boot

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.

---

 common/console.c                     |   20 ++++++++++++++++++++
 include/asm-arm/global_data.h        |    1 +
 include/asm-avr32/global_data.h      |    1 +
 include/asm-blackfin/global_data.h   |    1 +
 include/asm-i386/global_data.h       |    1 +
 include/asm-m68k/global_data.h       |    1 +
 include/asm-microblaze/global_data.h |    1 +
 include/asm-mips/global_data.h       |    1 +
 include/asm-nios/global_data.h       |    1 +
 include/asm-nios2/global_data.h      |    1 +
 include/asm-ppc/global_data.h        |    1 +
 include/asm-sh/global_data.h         |    1 +
 include/asm-sparc/global_data.h      |    1 +
 13 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/include/asm-arm/global_data.h b/include/asm-arm/global_data.h
index 7e2a53a..f419b42 100644
--- a/include/asm-arm/global_data.h
+++ b/include/asm-arm/global_data.h
@@ -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")
 
diff --git a/include/asm-avr32/global_data.h b/include/asm-avr32/global_data.h
index 007cfe4..75e75cc 100644
--- a/include/asm-avr32/global_data.h
+++ b/include/asm-avr32/global_data.h
@@ -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")
 
diff --git a/include/asm-blackfin/global_data.h b/include/asm-blackfin/global_data.h
index b0b01e4..2f40870 100644
--- a/include/asm-blackfin/global_data.h
+++ b/include/asm-blackfin/global_data.h
@@ -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")
 
diff --git a/include/asm-i386/global_data.h b/include/asm-i386/global_data.h
index 5dfb595..35bad23 100644
--- a/include/asm-i386/global_data.h
+++ b/include/asm-i386/global_data.h
@@ -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;
 
diff --git a/include/asm-m68k/global_data.h b/include/asm-m68k/global_data.h
index 10c6931..187618d 100644
--- a/include/asm-m68k/global_data.h
+++ b/include/asm-m68k/global_data.h
@@ -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;
diff --git a/include/asm-microblaze/global_data.h b/include/asm-microblaze/global_data.h
index 376786f..013c56a 100644
--- a/include/asm-microblaze/global_data.h
+++ b/include/asm-microblaze/global_data.h
@@ -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")
 
diff --git a/include/asm-mips/global_data.h b/include/asm-mips/global_data.h
index ecee6de..7cf2a00 100644
--- a/include/asm-mips/global_data.h
+++ b/include/asm-mips/global_data.h
@@ -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")
 
diff --git a/include/asm-nios/global_data.h b/include/asm-nios/global_data.h
index a56f939..4929a5b 100644
--- a/include/asm-nios/global_data.h
+++ b/include/asm-nios/global_data.h
@@ -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")
 
diff --git a/include/asm-nios2/global_data.h b/include/asm-nios2/global_data.h
index cd17e08..db71324 100644
--- a/include/asm-nios2/global_data.h
+++ b/include/asm-nios2/global_data.h
@@ -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")
 
diff --git a/include/asm-ppc/global_data.h b/include/asm-ppc/global_data.h
index be2ce24..bc89d3e 100644
--- a/include/asm-ppc/global_data.h
+++ b/include/asm-ppc/global_data.h
@@ -176,6 +176,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")
diff --git a/include/asm-sh/global_data.h b/include/asm-sh/global_data.h
index d61421b..f8ade5c 100644
--- a/include/asm-sh/global_data.h
+++ b/include/asm-sh/global_data.h
@@ -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")
 
diff --git a/include/asm-sparc/global_data.h b/include/asm-sparc/global_data.h
index a8d85f1..eeb35d0 100644
--- a/include/asm-sparc/global_data.h
+++ b/include/asm-sparc/global_data.h
@@ -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")
 
diff --git a/common/console.c b/common/console.c
index 1b095b1..f3dfc26 100644
--- a/common/console.c
+++ b/common/console.c
@@ -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);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-21 12:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-21 12:19 [U-Boot] [PATCH v2] Allow console input to be disabled Egor
  -- strict thread matches above, loose matches on Subject: below --
2008-08-25 18:21 Mark Jackson
2008-08-25 18:32 ` Mark Jackson
2008-09-06 20:37 ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.