@@ -71,7 +71,7 @@ int at91_video_show_board_info(void)
priv->ctx->y_charsize - 1) /
priv->ctx->y_charsize);
for (s = buf, i = 0; i < len; s++, i++)
- vidconsole_put_char(con, *s);
+ vidconsole_put_char(con, NULL, *s);
return 0;
}
@@ -623,7 +623,7 @@ static void draw_string(struct udevice *cons, const char *str, int len,
int i;
for (i = 0; i < len; i++)
- vidconsole_put_char(cons, '*');
+ vidconsole_put_char(cons, NULL, '*');
} else {
vidconsole_put_stringn(cons, str, len);
}
@@ -79,7 +79,7 @@ int scene_txtin_render_deps(struct scene *scn, struct scene_obj *obj,
/* move cursor back to the correct position */
for (i = cls->num; i < cls->eol_num; i++)
- vidconsole_put_char(cons, '\b');
+ vidconsole_put_char(cons, NULL, '\b');
ret = vidconsole_entry_save(cons, &scn->entry_save);
if (ret)
return log_msg_ret("sav", ret);
@@ -103,7 +103,7 @@ static void scene_txtin_putch(struct cli_line_state *cls, int ch)
{
struct scene *scn = cls->priv;
- vidconsole_put_char(scn->expo->cons, ch);
+ vidconsole_put_char(scn->expo->cons, NULL, ch);
}
void scene_txtin_close(struct scene *scn)
@@ -486,10 +486,10 @@ static int vidconsole_output_glyph(struct udevice *dev,
return 0;
}
-int vidconsole_put_char(struct udevice *dev, char ch)
+int vidconsole_put_char(struct udevice *dev, void *vctx, char ch)
{
struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
- struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(priv);
+ struct vidconsole_ctx *ctx = vctx ?: vidconsole_ctx_from_priv(priv);
struct vidconsole_ansi *ansi = &ctx->ansi;
int cp, ret;
@@ -514,7 +514,7 @@ int vidconsole_put_char(struct udevice *dev, char ch)
break;
case '\n':
vidconsole_newline(dev, ctx);
- vidconsole_entry_start(dev, NULL);
+ vidconsole_entry_start(dev, ctx);
break;
case '\t': /* Tab (8 chars alignment) */
ctx->xcur_frac = ((ctx->xcur_frac / ctx->tab_width_frac)
@@ -552,7 +552,7 @@ int vidconsole_put_stringn(struct udevice *dev, const char *str, int maxlen)
if (maxlen != -1)
end = str + maxlen;
for (s = str; *s && (maxlen == -1 || s < end); s++) {
- ret = vidconsole_put_char(dev, *s);
+ ret = vidconsole_put_char(dev, NULL, *s);
if (ret)
return ret;
}
@@ -573,7 +573,7 @@ static void vidconsole_putc(struct stdio_dev *sdev, const char ch)
if (priv->quiet)
return;
- ret = vidconsole_put_char(dev, ch);
+ ret = vidconsole_put_char(dev, NULL, ch);
if (ret) {
#ifdef DEBUG
console_puts_select_stderr(true, "[vc err: putc]");
@@ -748,10 +748,11 @@ int vidconsole_entry_start(struct udevice *dev, void *ctx);
* can be adjusted manually using vidconsole_position_cursor().
*
* @dev: Device to adjust
+ * @vctx: Vidconsole context to use, or NULL to use default
* @ch: Character to write
* Return: 0 if OK, -ve on error
*/
-int vidconsole_put_char(struct udevice *dev, char ch);
+int vidconsole_put_char(struct udevice *dev, void *vctx, char ch);
/**
* vidconsole_put_stringn() - Output part of a string to the current console pos
@@ -420,21 +420,21 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot,
/* Check display wrap */
for (i = 0; i < 120; i++)
- vidconsole_put_char(con, 'A' + i % 50);
+ vidconsole_put_char(con, NULL, 'A' + i % 50);
ut_asserteq(wrap_size, video_compress_fb(uts, dev, false));
ut_assertok(video_check_copy_fb(uts, dev));
/* Check display scrolling */
for (i = 0; i < SCROLL_LINES; i++) {
- vidconsole_put_char(con, 'A' + i % 50);
- vidconsole_put_char(con, '\n');
+ vidconsole_put_char(con, NULL, 'A' + i % 50);
+ vidconsole_put_char(con, NULL, '\n');
}
ut_asserteq(scroll_size, video_compress_fb(uts, dev, false));
ut_assertok(video_check_copy_fb(uts, dev));
/* If we scroll enough, the screen becomes blank again */
for (i = 0; i < SCROLL_LINES; i++)
- vidconsole_put_char(con, '\n');
+ vidconsole_put_char(con, NULL, '\n');
ut_asserteq(46, video_compress_fb(uts, dev, false));
ut_assertok(video_check_copy_fb(uts, dev));
@@ -1193,8 +1193,8 @@ static int check_cursor_backspace(struct unit_test_state *uts,
ut_assert(!curs->enabled);
ut_assert(!curs->saved);
ut_assert(!curs->height);
- ut_assertok(vidconsole_put_char(con, ' '));
- ut_assertok(vidconsole_put_char(con, 'a'));
+ ut_assertok(vidconsole_put_char(con, NULL, ' '));
+ ut_assertok(vidconsole_put_char(con, NULL, 'a'));
with_a = video_compress_fb(uts, dev, false);
/* Show cursor at current position (after 'a') */
@@ -1208,7 +1208,7 @@ static int check_cursor_backspace(struct unit_test_state *uts,
curs->enabled = true;
/* Do backspace - the cursor will be hidden */
- ut_assertok(vidconsole_put_char(con, '\b'));
+ ut_assertok(vidconsole_put_char(con, NULL, '\b'));
ut_assert(!curs->visible);
ut_assert(!curs->saved);
after_backspace = video_compress_fb(uts, dev, false);