summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-05-13 16:11:24 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2009-05-13 16:11:24 +0200
commit2e8254e387ba898132ca80f80bc7ae7d918ba312 (patch)
treec0e4d66119df10f333ca519fa9afb12598c019ee
parenta3c3f66abc2b9a3a8636468097fe7afd22360974 (diff)
downloadbarebox-2e8254e387ba898132ca80f80bc7ae7d918ba312.tar.gz
barebox-2e8254e387ba898132ca80f80bc7ae7d918ba312.tar.xz
console: rename console_buffer to console_input_buffer
...as we want to add an output buffer, too Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/console.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/common/console.c b/common/console.c
index 68ef80ea95..9f0524f834 100644
--- a/common/console.c
+++ b/common/console.c
@@ -168,11 +168,11 @@ int getc_raw(void)
}
}
-static struct kfifo *console_buffer;
+static struct kfifo *console_input_buffer;
int getc_buffer_flush(void)
{
- console_buffer = kfifo_alloc(1024);
+ console_input_buffer = kfifo_alloc(1024);
return 0;
}
@@ -183,18 +183,24 @@ int getc(void)
unsigned char ch;
uint64_t start;
+ /*
+ * For 100us we read the characters from the serial driver
+ * into a kfifo. This helps us not to lose characters
+ * in small hardware fifos.
+ */
start = get_time_ns();
while (1) {
if (tstc()) {
- kfifo_putc(console_buffer, getc_raw());
+ kfifo_putc(console_input_buffer, getc_raw());
start = get_time_ns();
}
- if (is_timeout(start, 100 * USECOND) && kfifo_len(console_buffer))
+ if (is_timeout(start, 100 * USECOND) &&
+ kfifo_len(console_input_buffer))
break;
}
- kfifo_getc(console_buffer, &ch);
+ kfifo_getc(console_input_buffer, &ch);
return ch;
}
EXPORT_SYMBOL(getc);