Patchwork [U-Boot,4/8,v3] Add a poll function to monitor events

login
register
mail settings
Submitter Hatim RV
Date Nov. 8, 2012, 9:14 a.m.
Message ID <1352366100-18727-5-git-send-email-hatim.rv@samsung.com>
Download mbox | patch
Permalink /patch/197812/
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Comments

Hatim RV - Nov. 8, 2012, 9:14 a.m.
From: Akshay Saraswat <akshay.s@samsung.com>

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

Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
---
Changes since v2:
	- None

 README           |    7 +++++++
 common/console.c |    5 +++++
 include/common.h |    6 ++++++
 3 files changed, 18 insertions(+), 0 deletions(-)

Patch

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 */