diff options
author | Anton Staaf <robotboy@chromium.org> | 2015-01-06 09:21:40 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-01-08 00:38:09 +0000 |
commit | 18d3bde7f89cb0bf62e3703d1954791dbb2a0df3 (patch) | |
tree | a0f34ab79e78d60d7d27ef0132a78d7007caa817 /chip/stm32/usb_hid.c | |
parent | 5062e5a1714f9a90ffc3227a280bf8d793cdfc83 (diff) | |
download | chrome-ec-18d3bde7f89cb0bf62e3703d1954791dbb2a0df3.tar.gz |
USB: Add memcpy_from_usbram and update existing memcpy
Previously there was just a memcpy_usbram that copied to
USB packet memory, and no routine to copy out. This adds
the "from" version and renames and improves to "to" version.
The improvement is that the new "to" version correctly
handles unaligned beginning and endings of the region to
be copied. These need to be read/modify/write accesses since
the USB packet ram has to be manipulated in 16-bit chunks.
Signed-off-by: Anton Staaf <robotboy@chromium.org>
BRANCH=None
BUG=None
TEST=make buildall -j
Verify that discovery-stm32f072 still enumerates and communicates
correctly over USB.
Change-Id: I94353e66ad0248d4e674abb29f9a88e979767655
Reviewed-on: https://chromium-review.googlesource.com/238764
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Trybot-Ready: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'chip/stm32/usb_hid.c')
-rw-r--r-- | chip/stm32/usb_hid.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/chip/stm32/usb_hid.c b/chip/stm32/usb_hid.c index bdcf09c3f8..8b39778202 100644 --- a/chip/stm32/usb_hid.c +++ b/chip/stm32/usb_hid.c @@ -88,7 +88,7 @@ static usb_uint hid_ep_buf[HID_REPORT_SIZE / 2] __usb_ram; void set_keyboard_report(uint64_t rpt) { - memcpy_usbram(hid_ep_buf, (const uint8_t *)&rpt, sizeof(rpt)); + memcpy_to_usbram(hid_ep_buf, &rpt, sizeof(rpt)); /* enable TX */ STM32_TOGGLE_EP(USB_EP_HID, EP_TX_MASK, EP_TX_VALID, 0); } @@ -124,7 +124,7 @@ static int hid_iface_request(usb_uint *ep0_buf_rx, usb_uint *ep0_buf_tx) (USB_REQ_GET_DESCRIPTOR << 8))) && (ep0_buf_rx[1] == (USB_HID_DT_REPORT << 8))) { /* Setup : HID specific : Get Report descriptor */ - memcpy_usbram(ep0_buf_tx, report_desc, + memcpy_to_usbram(ep0_buf_tx, report_desc, sizeof(report_desc)); btable_ep[0].tx_count = MIN(ep0_buf_rx[3], sizeof(report_desc)); |