summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/serial.c
diff options
context:
space:
mode:
authorUlf Jordan <jordan@chalmers.se>2008-08-11 20:34:28 +0000
committerJordan Crouse <jordan.crouse@amd.com>2008-08-11 20:34:28 +0000
commitb4d4bac1c49d7e19dac6f29ea278df8be6e6dcd2 (patch)
tree3421bc45b50018056b0817ccf6d9c36c27e3f0aa /payloads/libpayload/drivers/serial.c
parent42a0c80b9babaaf93ca806dd9bae4a4cc5a8936f (diff)
Add support for line drawing characters and the alternate character set.
This enables using the ACS_ curses macros with libpayload. The translation from ACS_ macros (or characters with attribute A_ALTCHARSET) is done using one acs map for the video console, one for serial console (xterm/vt100/vt220), and one fallback, from which an ASCII substitute is taken if the device specific map doesn't contain an entry (ie NUL). Signed-off-by: Ulf Jordan <jordan@chalmers.se> Acked-by: Jordan Crouse <jordan.crouse@amd.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3499 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload/drivers/serial.c')
-rw-r--r--payloads/libpayload/drivers/serial.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/payloads/libpayload/drivers/serial.c b/payloads/libpayload/drivers/serial.c
index edd031083e..6e46e06581 100644
--- a/payloads/libpayload/drivers/serial.c
+++ b/payloads/libpayload/drivers/serial.c
@@ -2,6 +2,7 @@
* This file is part of the libpayload project.
*
* Copyright (C) 2008 Advanced Micro Devices, Inc.
+ * Copyright (C) 2008 Ulf Jordan <jordan@chalmers.se>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -105,6 +106,10 @@ int serial_getchar(void)
#define VT100_SBOLD "\e[1m"
#define VT100_EBOLD "\e[m"
#define VT100_CURSOR_ADDR "\e[%d;%dH"
+/* The following smacs/rmacs are actually for xterm; a real vt100 has
+ enacs=\E(B\E)0, smacs=^N, rmacs=^O. */
+#define VT100_SMACS "\e(0"
+#define VT100_RMACS "\e(B"
static void serial_putcmd(char *str)
{
@@ -127,6 +132,16 @@ void serial_end_bold(void)
serial_putcmd(VT100_EBOLD);
}
+void serial_start_altcharset(void)
+{
+ serial_putcmd(VT100_SMACS);
+}
+
+void serial_end_altcharset(void)
+{
+ serial_putcmd(VT100_RMACS);
+}
+
void serial_set_cursor(int y, int x)
{
char buffer[32];