summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2014-12-01 13:33:16 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-08 21:51:43 +0000
commit0967049df61384a4f25cdfe46ff1d4a38b1c787a (patch)
tree42a0bfc270e858d157545185b336120d69f8e7e5 /include
parent8bb26a29b04c39a81c4094de9d7fba5f85123f54 (diff)
downloadchrome-ec-0967049df61384a4f25cdfe46ff1d4a38b1c787a.tar.gz
USB: Add setup packet struct and parsing routine
This can be used by interface specific EP0 setup packet callbacks. The USB-SPI bridge will use this to handle enabling and disabling the bridge. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I3f3db65934707243f54bed9e093f376b6978d271 Reviewed-on: https://chromium-review.googlesource.com/232367 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Trybot-Ready: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/usb.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/usb.h b/include/usb.h
index 2b9db32811..0c96b19db1 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -194,6 +194,15 @@ struct usb_endpoint_descriptor {
#define USB_BC12_CHARGE_VOLTAGE 5000 /* mV */
+/* Setup Packet */
+struct usb_setup_packet {
+ uint8_t bmRequestType;
+ uint8_t bRequest;
+ uint16_t wValue;
+ uint16_t wIndex;
+ uint16_t wLength;
+};
+
/* Helpers for descriptors */
#define WIDESTR(quote) WIDESTR2(quote)
@@ -242,6 +251,9 @@ struct stm32_endpoint {
extern struct stm32_endpoint btable_ep[];
+/* Read from USB RAM into a usb_setup_packet struct */
+void usb_read_setup_packet(usb_uint *buffer, struct usb_setup_packet *packet);
+
/* Copy data to the USB dedicated RAM and take care of the weird addressing */
static inline void memcpy_usbram(usb_uint *ebuf, const uint8_t *src, int size)
{