[U-Boot] [PATCH 4/8] GEN: Add a poll function to monitor events
Hatim Ali
hatim.rv at samsung.com
Tue Nov 6 11:18:41 CET 2012
From: Akshay Saraswat <akshay.s at samsung.com>
Add a generic polling function to continuously monitor events and
trigger actions corresponding to them.
Signed-off-by: Akshay Saraswat <akshay.s at samsung.com>
diff --git a/README b/README
index 2572add..72b3b67 100644
--- a/README
+++ b/README
@@ -2814,6 +2814,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 b23e90b..cba2e3b 100644
--- a/include/common.h
+++ b/include/common.h
@@ -782,6 +782,14 @@ 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 to poll for some events,
+ * In this case this will be called form console_tstc() to monitor
+ * temperatur of the SOC
+ */
+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