[U-Boot] [PATCH 4/8] Add a poll function to monitor events

Hatim Ali hatim.rv at samsung.com
Tue Dec 11 11:54:45 CET 2012


From: Akshay Saraswat <akshay.s at samsung.com>

Adding a generic polling function to continuously monitor events and
trigger actions corresponding to them.

Signed-off-by: Akshay Saraswat <akshay.s at samsung.com>
Acked-by: Simon Glass <sjg at chromium.org>

diff --git a/README b/README
index 037513a..0e4083c 100644
--- a/README
+++ b/README
@@ -2841,6 +2841,13 @@ Configuration Settings:
 		the application (usually a Linux kernel) when it is
 		booted
 
+- CONFIG_BOARD_POLL
+	There are various scenarios in which parallel-thread like
+	polling is required to monitor status of variety of devices.
+	For such situations CONFIG_BOARD_POLL shall be enabled
+	and funtion call board_poll_devices() from console_tstc()
+	will then poll for the device status as defined inside function.
+
 - CONFIG_SYS_BAUDRATE_TABLE:
 		List of legal baudrate settings for this board.
 
diff --git a/common/console.c b/common/console.c
index 1177f7d..d320b9b 100644
--- a/common/console.c
+++ b/common/console.c
@@ -117,6 +117,11 @@ static int console_tstc(int file)
 	int i, ret;
 	struct stdio_dev *dev;
 
+#if defined CONFIG_BOARD_POLL
+	/* Generic polling function */
+	board_poll_devices();
+#endif
+
 	disable_ctrlc(1);
 	for (i = 0; i < cd_count[file]; i++) {
 		dev = console_devices[file][i];
diff --git a/include/common.h b/include/common.h
index 5e3c5ee..b6f563b 100644
--- a/include/common.h
+++ b/include/common.h
@@ -778,6 +778,12 @@ void	clear_ctrlc (void);	/* clear the Control-C condition */
 int	disable_ctrlc (int);	/* 1 to disable, 0 to enable Control-C detect */
 
 /*
+ * A generic polling function.
+ * This will be called form console_tstc() to poll for various events.
+ */
+void board_poll_devices(void);
+
+/*
  * STDIO based functions (can always be used)
  */
 /* serial stuff */
-- 
1.7.2.3



More information about the U-Boot mailing list