diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2014-06-16 13:46:59 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-07-17 00:40:23 +0000 |
commit | a975c98fb2f378e4fc94cf73c38fe8afa8cb6eeb (patch) | |
tree | 6e12692cd15e1d06892a0cf15333e1e51c6146b0 /include/usb_console.h | |
parent | 7746b32e17571b0e0cbdcbd101787b742d35c825 (diff) | |
download | chrome-ec-a975c98fb2f378e4fc94cf73c38fe8afa8cb6eeb.tar.gz |
usb: add USB console driver
Provide access to the EC console through 2 USB bulk endpoints.
(which can be used through the usbserial driver)
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=none
TEST=run on Fruitpie and use the console over USB
Change-Id: Ia897764f3a030972ee2ed323f293c5fca899765a
Reviewed-on: https://chromium-review.googlesource.com/204167
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Commit-Queue: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Diffstat (limited to 'include/usb_console.h')
-rw-r--r-- | include/usb_console.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/include/usb_console.h b/include/usb_console.h new file mode 100644 index 0000000000..9666fa425a --- /dev/null +++ b/include/usb_console.h @@ -0,0 +1,55 @@ +/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* USB serial console module */ + +#ifndef __USB_CONSOLE_H +#define __USB_CONSOLE_H + +#ifdef CONFIG_USB_CONSOLE + +/** + * Put a null-terminated string to the USB console, like fputs(). + * + * @return EC_SUCCESS, or non-zero if output was truncated. + */ +int usb_puts(const char *outstr); + +/** + * Print formatted output to the USB console, like vprintf(). + * + * See printf.h for valid formatting codes. + * + * @return EC_SUCCESS, or non-zero if output was truncated. + */ +int usb_vprintf(const char *format, va_list args); + +/** + * Put a single character to the USB console, like putchar(). + * + * @param c Character to put + * @return EC_SUCCESS, or non-zero if output was truncated. + */ +int usb_putc(int c); + +/** + * Read a single character of input, similar to fgetc(). + * + * @return the character, or -1 if no input waiting. + */ +int usb_getc(void); + +#define usb_va_start va_start +#define usb_va_end va_end +#else +#define usb_puts(x) EC_SUCCESS +#define usb_vprintf(x, y) EC_SUCCESS +#define usb_putc(x) EC_SUCCESS +#define usb_getc(x) (-1) +#define usb_va_start(x, y) +#define usb_va_end(x) +#endif + +#endif /* __USB_CONSOLE_H */ |