From dc53e4db7fb2586ca3429ffb30d223de769e0c57 Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Tue, 23 Oct 2012 16:18:32 -0700 Subject: Clean up console module Code cleanup and reformatting. No functional changes. BUG=chrome-os-partner:15579 BRANCH=none TEST=compile code; type a debug command like 'help list'. Change-Id: I641215ba3333628f658eec86d9d99718c43b111f Signed-off-by: Randall Spangler Reviewed-on: https://gerrit.chromium.org/gerrit/36387 --- include/console.h | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) (limited to 'include/console.h') diff --git a/include/console.h b/include/console.h index 0fb8b48771..f037b252ae 100644 --- a/include/console.h +++ b/include/console.h @@ -8,7 +8,6 @@ #ifndef __CROS_EC_CONSOLE_H #define __CROS_EC_CONSOLE_H -#include "board.h" #include "common.h" /* Console command; used by DECLARE_CONSOLE_COMMAND macro. */ @@ -25,7 +24,6 @@ struct console_command { #endif }; - /* Console channels */ enum console_channel { CC_COMMAND = 0, /* Console command (interactive I/O). Use this only @@ -61,16 +59,29 @@ enum console_channel { /* Mask to use to enable all channels */ #define CC_ALL 0xffffffffUL - -/* Put a string to the console channel. */ +/** + * Put a string to the console channel. + * + * @param channel Output chanel + * @param outstr String to write + * + * @return non-zero if output was truncated. + */ int cputs(enum console_channel channel, const char *outstr); -/* Print formatted output to the console channel. +/** + * Print formatted output to the console channel. + * + * @param channel Output chanel + * @param format Format string; see printf.h for valid formatting codes * - * See printf.h for valid formatting codes. */ + * @return non-zero if output was truncated. + */ int cprintf(enum console_channel channel, const char *format, ...); -/* Flush the console output for all channels. */ +/** + * Flush the console output for all channels. + */ void cflush(void); /* Convenience macros for printing to the command channel. @@ -82,14 +93,22 @@ void cflush(void); * http://gcc.gnu.org/onlinedocs/gcc/Variadic-Macros.html */ #define ccprintf(format, args...) cprintf(CC_COMMAND, format, ## args) - -/* Called by UART when a line of input is pending. */ +/** + * Called by UART when a line of input is pending. + */ void console_has_input(void); - -/* - * Register a console command handler. Note that `name' must never be a - * beginning of another existing command name. +/** + * Register a console command handler. + * + * @param name Command name; must not be the beginning of another + * existing command name. Note this is NOT in quotes + * so it can be concatenated to form a struct name. + * @param routine Command handling routine, of the form + * int handler(int argc, char **argv) + * @param argdesc String describing arguments to command; NULL if none. + * @param shorthelp String with one-line description of command. + * @param longhelp String with long description of command. */ #ifdef CONFIG_CONSOLE_CMDHELP #define DECLARE_CONSOLE_COMMAND(name, routine, argdesc, shorthelp, longhelp) \ -- cgit v1.2.1