video: Add a way to write a partial string to the console
When writing multiple lines of text we need to be able to control which
text goes on each line. Add a new vidconsole_put_stringn() function to
help with this.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/include/video_console.h b/include/video_console.h
index 1bb265d..e4fc776 100644
--- a/include/video_console.h
+++ b/include/video_console.h
@@ -500,6 +500,23 @@
int vidconsole_put_char(struct udevice *dev, char ch);
/**
+ * vidconsole_put_stringn() - Output part of a string to the current console pos
+ *
+ * Outputs part of a string to the console and advances the cursor. This
+ * function handles wrapping to new lines and scrolling the console. Special
+ * characters are handled also: \n, \r, \b and \t.
+ *
+ * The device always starts with the cursor at position 0,0 (top left). It
+ * can be adjusted manually using vidconsole_position_cursor().
+ *
+ * @dev: Device to adjust
+ * @str: String to write
+ * @maxlen: Maximum chars to output, or -1 for all
+ * Return: 0 if OK, -ve on error
+ */
+int vidconsole_put_stringn(struct udevice *dev, const char *str, int maxlen);
+
+/**
* vidconsole_put_string() - Output a string to the current console position
*
* Outputs a string to the console and advances the cursor. This function