summaryrefslogtreecommitdiff
path: root/common/console.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2012-05-08 10:44:57 -0700
committerSimon Glass <sjg@chromium.org>2012-05-10 14:16:07 -0700
commitf8f55991783f28f09f7ff2424198d61ffd3f9496 (patch)
tree52bb350383c07f1d462af67409d7743d2b4ad2f0 /common/console.c
parentee12df8c283466d69066945353d2a14a41e089ea (diff)
downloadchrome-ec-f8f55991783f28f09f7ff2424198d61ffd3f9496.tar.gz
Allow boards to set the default console mask
Some boards don't like to have every keyboard scan printed, but some devs find this info comforting. Add a way for boards to select the require console mask. BUG=none TEST=manual: build and boot on daisy, see that key scan messages are suppressed. build on all platforms Change-Id: I8e6e640eaabc0a08e5427cd97f7089dda1238025 Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/console.c')
-rw-r--r--common/console.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/common/console.c b/common/console.c
index da309b5936..50ca6da2d4 100644
--- a/common/console.c
+++ b/common/console.c
@@ -16,7 +16,10 @@
#define PROMPT "> "
/* Default to all channels active */
-static uint32_t channel_mask = 0xffffffff;
+#ifndef CC_DEFAULT
+#define CC_DEFAULT CC_ALL
+#endif
+static uint32_t channel_mask = CC_DEFAULT;
static char input_buf[80]; /* Current console command line */
@@ -50,7 +53,7 @@ static const char *channel_names[CC_CHANNEL_COUNT] = {
int cputs(enum console_channel channel, const char *outstr)
{
/* Filter out inactive channels */
- if (!((1 << channel) & channel_mask))
+ if (!(CC_MASK(channel) & channel_mask))
return EC_SUCCESS;
return uart_puts(outstr);
@@ -63,7 +66,7 @@ int cprintf(enum console_channel channel, const char *format, ...)
va_list args;
/* Filter out inactive channels */
- if (!((1 << channel) & channel_mask))
+ if (!(CC_MASK(channel) & channel_mask))
return EC_SUCCESS;
va_start(args, format);
@@ -266,8 +269,8 @@ static int command_ch(int argc, char **argv)
ccputs(" # Mask Enabled Channel\n");
for (i = 0; i < CC_CHANNEL_COUNT; i++) {
ccprintf("%2d %08x %c %s\n",
- i, 1 << i,
- (channel_mask & (1 << i) ? '*' : ' '),
+ i, CC_MASK(i),
+ (channel_mask & CC_MASK(i)) ? '*' : ' ',
channel_names[i]);
cflush();
}
@@ -282,7 +285,7 @@ static int command_ch(int argc, char **argv)
return EC_ERROR_INVAL;
}
/* No disabling the command output channel */
- channel_mask = m | (1 << CC_COMMAND);
+ channel_mask = m | CC_MASK(CC_COMMAND);
/* TODO: save channel list to EEPROM */