summaryrefslogtreecommitdiff
path: root/chip/g
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2020-03-18 19:03:58 -0700
committerCommit Bot <commit-bot@chromium.org>2020-03-31 23:24:38 +0000
commitddbada80f6561cf721fc967ffab965e77b3ae5c3 (patch)
tree8f30a78ba10ef8cc5847f167b7319675f1f1c580 /chip/g
parenta795c626a156a92813e7992bc14c764b1ae1f994 (diff)
downloadchrome-ec-ddbada80f6561cf721fc967ffab965e77b3ae5c3.tar.gz
Prepare for transitioning to packet mode console
A very few changes are needed to support the packet mode: - provide functions to report how much room is left in USB/UART transmit buffers; - compile out cprintf/cprints/cputs just in case to be able to catch cases where util_precompile.py fails to convert them for whatever reason; - do not add CR to every LF, this messes up packet transmissions, and the terminal is doing the right thing anyways - there is a problem with the USB channel in packet mode: the device reboots as soon as an attempt to send something to the host is undertaken. The problem can be rectified by disabling the deferred function path in the Cr50 console USB channel. A bug was open to track it down, but in packet mode using deferred function in this path is less critical, as the amount of sent data always is at least as much as the packet header size BUG=b:149964350, b:152116489 TEST=with the rest of the patches applied packet mode console works fine. When packet mode is disabled the conventional mode console works fine. Change-Id: Ib010cede36adc87cf80f49e5d76ec9e274d9e608 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2114238 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Namyoon Woo <namyoon@chromium.org>
Diffstat (limited to 'chip/g')
-rw-r--r--chip/g/usb-stream.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/chip/g/usb-stream.h b/chip/g/usb-stream.h
index 49048a6d9c..f051e0c093 100644
--- a/chip/g/usb-stream.h
+++ b/chip/g/usb-stream.h
@@ -75,6 +75,20 @@ extern struct producer_ops const usb_stream_producer_ops;
#endif
/*
+ * When in packet mode, the terminal application (Acroterm) constantly times
+ * out if the deferred function is used in the USB transmit path.
+ *
+ * The below allows to exclude the console channel from the set using the
+ * deferred function when in packet console mode.
+ */
+#ifdef CONFIG_EXTRACT_PRINTF_STRINGS
+#define UART_CONSOLE_CHANNEL(x) (((x) == USB_EP_AP) || ((x) == USB_EP_EC))
+#else
+#define UART_CONSOLE_CHANNEL(x) (((x) == USB_EP_AP) || ((x) == USB_EP_EC) || \
+ ((x) == USB_EP_CONSOLE))
+#endif
+
+/*
* Convenience macro for defining USB streams and their associated state and
* buffers.
*
@@ -136,9 +150,7 @@ extern struct producer_ops const usb_stream_producer_ops;
static size_t CONCAT2(NAME, _tx_handled); \
struct usb_stream_config const NAME = { \
.endpoint = ENDPOINT, \
- .is_uart_console = ((ENDPOINT == USB_EP_EC) || \
- (ENDPOINT == USB_EP_CONSOLE) || \
- (ENDPOINT == USB_EP_AP)), \
+ .is_uart_console = UART_CONSOLE_CHANNEL(ENDPOINT), \
.tx_in_progress = &CONCAT2(NAME, _tx_in_progress_), \
.kicker_running = &CONCAT2(NAME, _kicker_running_), \
.is_reset = &CONCAT2(NAME, _is_reset_), \