libpayload/drivers/video: Add cursor movement support in console

Add support for moving the console cursor horizontally and vertically.

BUG=b:300405745
TEST=Tested using firmware shell on Rex.

Signed-off-by: Eran Mitrani <mitrani@google.com>
Change-Id: I585add120b559396bc0e28aa972b0ae2a33f1fa8
Reviewed-on: https://review.coreboot.org/c/coreboot/+/77900
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
Eran Mitrani 2023-09-14 14:57:10 -07:00 committed by Felix Held
parent 31a0fdd039
commit a63a56d572
2 changed files with 8 additions and 0 deletions

View File

@ -122,6 +122,13 @@ void video_console_putc(u8 row, u8 col, unsigned int ch)
console->putc(row, col, ch); console->putc(row, col, ch);
} }
void video_console_move_cursor(int x, int y)
{
cursorx += x;
cursory += y;
video_console_fixup_cursor();
}
void video_console_putchar(unsigned int ch) void video_console_putchar(unsigned int ch)
{ {
if (!console) if (!console)

View File

@ -279,6 +279,7 @@ void video_console_clear(void);
void video_console_cursor_enable(int state); void video_console_cursor_enable(int state);
void video_console_get_cursor(unsigned int *x, unsigned int *y, unsigned int *en); void video_console_get_cursor(unsigned int *x, unsigned int *y, unsigned int *en);
void video_console_set_cursor(unsigned int cursorx, unsigned int cursory); void video_console_set_cursor(unsigned int cursorx, unsigned int cursory);
void video_console_move_cursor(int x, int y);
/* /*
* print characters on video console with colors. note that there is a size * print characters on video console with colors. note that there is a size
* restriction for the internal buffer. so, output string can be truncated. * restriction for the internal buffer. so, output string can be truncated.