summaryrefslogtreecommitdiff
path: root/common/port80.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-04-24 16:29:28 -0700
committerRandall Spangler <rspangler@chromium.org>2012-04-24 17:46:54 -0700
commit135f14bf498ab19b6e75efc3a0d18ef7c8a8752d (patch)
tree1dd03ec292b5f9f44a24e045e64e0c10ff58b6a6 /common/port80.c
parent0d19c59aba807f915f1ea46d273bfebe1ded1db9 (diff)
downloadchrome-ec-135f14bf498ab19b6e75efc3a0d18ef7c8a8752d.tar.gz
Refactor async console output
This adds a 'ch' command which prints/sets which channels are active This handles all the async output; the remaining debug commands will be refactored to use ccprintf() / ccputs() in a followup CL. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7464 TEST=manual ch --> all channels active ch 0x100 -> just port80 active powerbtn -> system boots; only port 80 codes shown on console Change-Id: I9efc43acec919b62b78c2c82c61946d32380adfe
Diffstat (limited to 'common/port80.c')
-rw-r--r--common/port80.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/common/port80.c b/common/port80.c
index 77ff6fa471..f048a54884 100644
--- a/common/port80.c
+++ b/common/port80.c
@@ -8,9 +8,10 @@
#include "board.h"
#include "console.h"
#include "port80.h"
-#include "uart.h"
#include "util.h"
+#define CPRINTF(format, args...) cprintf(CC_PORT80, format, ## args)
+
#define HISTORY_LEN 16
static uint8_t history[HISTORY_LEN];
@@ -24,7 +25,7 @@ void port_80_write(int data)
* itself. Probably not worth the system overhead to buffer the data
* and print it from a task, because we're printing a small amount of
* data and uart_printf() doesn't block. */
- uart_printf("%c[%T Port 80: 0x%02x]", scroll ? '\n' : '\r', data);
+ CPRINTF("%c[%T Port 80: 0x%02x]", scroll ? '\n' : '\r', data);
history[head] = data;
head = (head + 1) & (HISTORY_LEN - 1);
@@ -42,7 +43,7 @@ static int command_port80(int argc, char **argv)
* (scrolling) or CR (non-scrolling). */
if (argc > 1 && !strcasecmp(argv[1], "scroll")) {
scroll = !scroll;
- uart_printf("port80 scrolling %sabled\n",
+ ccprintf("port80 scrolling %sabled\n",
scroll ? "en" : "dis");
return EC_SUCCESS;
}
@@ -50,10 +51,10 @@ static int command_port80(int argc, char **argv)
/* Technically, if a port 80 write comes in while we're
* printing this, we could print an incorrect history.
* Probably not worth the complexity to work around that. */
- uart_puts("Last port 80 writes:");
+ ccputs("Last port 80 writes:");
for (i = 0; i < HISTORY_LEN; i++)
- uart_printf(" %02x", history[(h + i) & (HISTORY_LEN - 1)]);
- uart_puts(" <--newest\n");
+ ccprintf(" %02x", history[(h + i) & (HISTORY_LEN - 1)]);
+ ccputs(" <--newest\n");
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(port80, command_port80);