summaryrefslogtreecommitdiff
path: root/include/console.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-01-27 08:49:54 -0700
committerSimon Glass <sjg@chromium.org>2020-02-05 19:33:46 -0700
commitb612312816ffe41a3a7616aa00394ffb248cf91e (patch)
tree25f3590d5b57a8d974eecbb63ce9006f98a14e14 /include/console.h
parenteb7387ae14ef88ecba85d569de978da776ea4f09 (diff)
downloadu-boot-b612312816ffe41a3a7616aa00394ffb248cf91e.tar.gz
console: Add a function to read a line of the output / eof
When recording the console output for testing it is useful to be able to read the output a line at a time to check that the output is correct. Also we need to check that we get to the end of the output. Add a console function to return the next line and another to see how must data is left. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/console.h')
-rw-r--r--include/console.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/console.h b/include/console.h
index e935c601f1..74afe22b7e 100644
--- a/include/console.h
+++ b/include/console.h
@@ -42,6 +42,25 @@ void console_record_reset(void);
void console_record_reset_enable(void);
/**
+ * console_record_readline() - Read a line from the console output
+ *
+ * This reads the next available line from the console output previously
+ * recorded.
+ *
+ * @str: Place to put string
+ * @maxlen: Maximum length of @str including nul terminator
+ * @return length of string returned
+ */
+int console_record_readline(char *str, int maxlen);
+
+/**
+ * console_record_avail() - Get the number of available bytes in console output
+ *
+ * @return available bytes (0 if empty)
+ */
+int console_record_avail(void);
+
+/**
* console_announce_r() - print a U-Boot console on non-serial consoles
*
* When U-Boot starts up with a display it generally does not announce itself