mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
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>
This commit is contained in:
@@ -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 */
|
||||
|
||||
|
||||
@@ -45,6 +45,13 @@ enum console_channel {
|
||||
CC_CHANNEL_COUNT
|
||||
};
|
||||
|
||||
/* Mask in channel_mask for a particular channel */
|
||||
#define CC_MASK(channel) (1UL << (channel))
|
||||
|
||||
/* Mask to use to enable all channels */
|
||||
#define CC_ALL 0xffffffffUL
|
||||
|
||||
|
||||
/* Put a string to the console channel. */
|
||||
int cputs(enum console_channel channel, const char *outstr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user