[U-Boot] [PATCH 4/8 v3] Add a poll function to monitor events
Hatim Ali
hatim.rv at samsung.com
Thu Nov 8 10:14:56 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>
---
Changes since v2:
- None
README | 7 +++++++
common/console.c | 5 +++++
include/common.h | 6 ++++++
3 files changed, 18 insertions(+), 0 deletions(-)
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..70a348d 100644
--- a/include/common.h
+++ b/include/common.h
@@ -782,6 +782,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