diff options
author | Anton Staaf <robotboy@chromium.org> | 2014-11-05 14:45:37 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-11-11 00:10:47 +0000 |
commit | dac8f1632139f21c96f55f3bcfdab7264f761559 (patch) | |
tree | c74bf24a07807cf330b2c242fe04802b57e07216 /chip/stm32/usb_console.c | |
parent | 60b27813b82835127e4a18d625f6d95fd5d1ee2b (diff) | |
download | chrome-ec-dac8f1632139f21c96f55f3bcfdab7264f761559.tar.gz |
USB: Fix console code to work with old and new USB peripherals
The console code never worked with the old style STM32 USB
peripherals because no chips with that version of the peripheral
were being used. The STM32F373 uses the older USB peripheral.
Signed-off-by: Anton Staaf <robotboy@chromium.org>
BRANCH=None
BUG=None
TEST=make buildall -j
Enable console on ryu_p2 and discovery-stm32f072 board
Verify that it works on both
Change-Id: I77d36c33712521d7840b4e3ca02ebbea5de3d5df
Reviewed-on: https://chromium-review.googlesource.com/227741
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'chip/stm32/usb_console.c')
-rw-r--r-- | chip/stm32/usb_console.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/chip/stm32/usb_console.c b/chip/stm32/usb_console.c index a4a25315fc..1e3dc30fd4 100644 --- a/chip/stm32/usb_console.c +++ b/chip/stm32/usb_console.c @@ -73,8 +73,9 @@ static void con_ep_rx(void) for (i = 0; i < (btable_ep[USB_EP_CONSOLE].rx_count & 0x3ff); i++) { int rx_buf_next = RX_BUF_NEXT(rx_buf_head); if (rx_buf_next != rx_buf_tail) { - /* Not working on old STM32 ... */ - rx_buf[rx_buf_head] = ((uint8_t *)ep_buf_rx)[i]; + rx_buf[rx_buf_head] = ((i & 1) ? + (ep_buf_rx[i >> 1] >> 8) : + (ep_buf_rx[i >> 1] & 0xff)); rx_buf_head = rx_buf_next; } } @@ -107,7 +108,7 @@ USB_DECLARE_EP(USB_EP_CONSOLE, con_ep_tx, con_ep_rx, ep_reset); static int __tx_char(void *context, int c) { - uint16_t *buf = (uint16_t *)ep_buf_tx; + usb_uint *buf = (usb_uint *)ep_buf_tx; int *tx_idx = context; /* Do newline to CRLF translation */ |