summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2014-10-22 13:10:25 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-28 22:30:09 +0000
commitf899a3445d037658fd9a3fe5191cb6f17a553e0c (patch)
tree844775fc31dbccf53c4dd36ba7a70b92c578aee0
parentb8e4f1b66a06d556b4443c182de541b187da32ac (diff)
downloadchrome-ec-f899a3445d037658fd9a3fe5191cb6f17a553e0c.tar.gz
USB-console: Don't wait in interrupt contexts
Previously the USB console code would wait for up to 30 ms for the USB packet buffer to become available for transmission, even if it was called from an interrupt context. This doesn't work because, even if we were OK with waiting this long in interrupt contexts, which we are not, we rightly assert that we are not in an interrupt context in task_wait_event, which usleep calls. This solution is a quick fix to only wait when not called from within an interrupt context. The correct solution is likely to decouple the printf code from directly calling the console driver code, instead we should place a queue between the driver and printf logic. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Enable USB console on discovery board and manually test. Change-Id: I5b6f7bbb77f75132c75935f8fda01e652a236ae0 Reviewed-on: https://chromium-review.googlesource.com/225867 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
-rw-r--r--chip/stm32/usb_console.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/chip/stm32/usb_console.c b/chip/stm32/usb_console.c
index a8b219bb87..47e31711e0 100644
--- a/chip/stm32/usb_console.c
+++ b/chip/stm32/usb_console.c
@@ -146,7 +146,8 @@ static int usb_wait_console(void)
*/
if (last_tx_ok) {
while (usb_console_tx_valid() || !is_reset) {
- if (timestamp_expired(deadline, NULL)) {
+ if (timestamp_expired(deadline, NULL) ||
+ in_interrupt_context()) {
last_tx_ok = 0;
return EC_ERROR_TIMEOUT;
}