mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-12 19:04:59 +00:00
This option will cause usb console output to block and also compute a crc32. Signed-off-by: mschilder@google.com TEST=make buildall -j BRANCH=none BUG=none Change-Id: Icf66d5ddbea52008a9c97094e7c83194caa7db79 Reviewed-on: https://chromium-review.googlesource.com/936281 Commit-Ready: Marius Schilder <mschilder@chromium.org> Tested-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
77 lines
1.8 KiB
C
77 lines
1.8 KiB
C
/* 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 __CROS_EC_USB_CONSOLE_H
|
|
#define __CROS_EC_USB_CONSOLE_H
|
|
|
|
#ifdef CONFIG_USB_CONSOLE
|
|
|
|
#include <stdarg.h>
|
|
|
|
/**
|
|
* 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);
|
|
|
|
/**
|
|
* Reset the usb console output crc32 accumulator.
|
|
*/
|
|
void usb_console_crc_init(void);
|
|
|
|
/**
|
|
* Get the current usb console output crc32 accumulator.
|
|
*/
|
|
uint32_t usb_console_crc(void);
|
|
|
|
/**
|
|
* Enable and Disable the USB console.
|
|
*
|
|
* By default the console is enabled, this should not be a problem since it
|
|
* is not accessible until the USB peripheral is also initialized, which can
|
|
* be delayed.
|
|
*/
|
|
void usb_console_enable(int enabled, int readonly);
|
|
|
|
#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 /* __CROS_EC_USB_CONSOLE_H */
|