diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-06-13 12:34:00 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-06-13 13:17:33 -0700 |
commit | 3e14c8f8be4481cad51b1fea7d4d4da535292a69 (patch) | |
tree | 8600e492dd4a1fd31749752622729238d70d34e0 /common/console.c | |
parent | 3aacc3a9183b91639d03eed4573c1a15a5ad5f28 (diff) | |
download | chrome-ec-3e14c8f8be4481cad51b1fea7d4d4da535292a69.tar.gz |
Split console output into its own module
No code changes, just rearranging source in preparation for an
experiment to see how much the binary shrinks if we disable the
interactive console.
BUG=none
TEST=none
Change-Id: Ie21f1b3dcd04272e80fd40b2ed54d1eaf7fb1cdf
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/25232
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'common/console.c')
-rw-r--r-- | common/console.c | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/common/console.c b/common/console.c index eae942444b..8e580b6a50 100644 --- a/common/console.c +++ b/common/console.c @@ -15,78 +15,8 @@ #define PROMPT "> " -/* Default to all channels active */ -#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 */ -/* List of channel names; must match enum console_channel. */ -/* TODO: move this to board.c */ -static const char *channel_names[CC_CHANNEL_COUNT] = { - "command", - "charger", - "chipset", - "dma", - "gpio", - "hostcmd", - "i2c", - "i8042", - "keyboard", - "keyscan", - "lightbar", - "lpc", - "port80", - "powerbtn", - "pwm", - "spi", - "system", - "task", - "usbcharge", - "vboot", -}; - -/*****************************************************************************/ -/* Channel-based console output */ - -int cputs(enum console_channel channel, const char *outstr) -{ - /* Filter out inactive channels */ - if (!(CC_MASK(channel) & channel_mask)) - return EC_SUCCESS; - - return uart_puts(outstr); -} - - -int cprintf(enum console_channel channel, const char *format, ...) -{ - int rv; - va_list args; - - /* Filter out inactive channels */ - if (!(CC_MASK(channel) & channel_mask)) - return EC_SUCCESS; - - va_start(args, format); - rv = uart_vprintf(format, args); - va_end(args); - return rv; -} - - -void cflush(void) -{ - uart_flush_output(); -} - - - -/*****************************************************************************/ -/* Console input */ - /* Splits a line of input into words. Stores the count of words in * <argc>. Stores pointers to the words in <argv>, which must be at * least <max_argc> long. If more than <max_argc> words are found, @@ -298,40 +228,3 @@ DECLARE_CONSOLE_COMMAND(help, command_help, "[ list | <name> ]", "Print command help", NULL); - - -/* Set active channels */ -static int command_ch(int argc, char **argv) -{ - int i; - char *e; - - /* If one arg, set the mask */ - if (argc == 2) { - int m = strtoi(argv[1], &e, 0); - if (*e) - return EC_ERROR_PARAM1; - - /* No disabling the command output channel */ - channel_mask = m | CC_MASK(CC_COMMAND); - - /* TODO: save channel list to EEPROM */ - - return EC_SUCCESS; - } - - /* Print the list of channels */ - ccputs(" # Mask E Channel\n"); - for (i = 0; i < CC_CHANNEL_COUNT; i++) { - ccprintf("%2d %08x %c %s\n", - i, CC_MASK(i), - (channel_mask & CC_MASK(i)) ? '*' : ' ', - channel_names[i]); - cflush(); - } - return EC_SUCCESS; -}; -DECLARE_CONSOLE_COMMAND(chan, command_ch, - "[mask]", - "Get or set console channel mask", - NULL); |