summaryrefslogtreecommitdiff
path: root/chip/stm32/usb_spi.h
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2017-08-10 14:36:30 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-08-16 04:03:24 -0700
commit9e33d6ce3c6c0a8de24dd6afa71f2adc255a156b (patch)
tree081b226e96525148b389e76681e41b502edd5eb4 /chip/stm32/usb_spi.h
parenta1abf686c3174c6b18d20e8fc250cc4d5a045d97 (diff)
downloadchrome-ec-9e33d6ce3c6c0a8de24dd6afa71f2adc255a156b.tar.gz
chip/stm32/usb: Replace reset handler by generic event handler
Some USB interface handlers need to know when USB has been successfully resumed after a wake event. For example, this is useful so that HID keyboard can send the events at the right time. BRANCH=none BUG=b:35775048 TEST=Using USB HID keyboard patches to queue keys in a FIFO: After USB autosuspends, press a single key and hold it. Without this patch the endpoint data only gets reloaded on the _next_ event. TEST=On hammer, I2C passthrough still works. Change-Id: I9b52b9de16767c8a66c702a5ae70369334a3d590 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/569547 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip/stm32/usb_spi.h')
-rw-r--r--chip/stm32/usb_spi.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/chip/stm32/usb_spi.h b/chip/stm32/usb_spi.h
index 3c71fd4bc6..5aaa92e2df 100644
--- a/chip/stm32/usb_spi.h
+++ b/chip/stm32/usb_spi.h
@@ -188,11 +188,14 @@ struct usb_spi_config {
}; \
static void CONCAT2(NAME, _ep_tx_) (void) { usb_spi_tx (&NAME); } \
static void CONCAT2(NAME, _ep_rx_) (void) { usb_spi_rx (&NAME); } \
- static void CONCAT2(NAME, _ep_reset_)(void) { usb_spi_reset(&NAME); } \
+ static void CONCAT2(NAME, _ep_event_)(enum usb_ep_event evt) \
+ { \
+ usb_spi_event(&NAME, evt); \
+ } \
USB_DECLARE_EP(ENDPOINT, \
CONCAT2(NAME, _ep_tx_), \
CONCAT2(NAME, _ep_rx_), \
- CONCAT2(NAME, _ep_reset_)); \
+ CONCAT2(NAME, _ep_event_)); \
static int CONCAT2(NAME, _interface_)(usb_uint *rx_buf, \
usb_uint *tx_buf) \
{ return usb_spi_interface(&NAME, rx_buf, tx_buf); } \
@@ -222,7 +225,7 @@ void usb_spi_enable(struct usb_spi_config const *config, int enabled);
*/
void usb_spi_tx(struct usb_spi_config const *config);
void usb_spi_rx(struct usb_spi_config const *config);
-void usb_spi_reset(struct usb_spi_config const *config);
+void usb_spi_event(struct usb_spi_config const *config, enum usb_ep_event evt);
int usb_spi_interface(struct usb_spi_config const *config,
usb_uint *rx_buf,
usb_uint *tx_buf);