diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2017-08-10 14:36:30 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-08-16 04:03:24 -0700 |
commit | 9e33d6ce3c6c0a8de24dd6afa71f2adc255a156b (patch) | |
tree | 081b226e96525148b389e76681e41b502edd5eb4 /chip/stm32/usb_dwc_hw.h | |
parent | a1abf686c3174c6b18d20e8fc250cc4d5a045d97 (diff) | |
download | chrome-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_dwc_hw.h')
-rw-r--r-- | chip/stm32/usb_dwc_hw.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/chip/stm32/usb_dwc_hw.h b/chip/stm32/usb_dwc_hw.h index 81637c3f17..d1fe07cb87 100644 --- a/chip/stm32/usb_dwc_hw.h +++ b/chip/stm32/usb_dwc_hw.h @@ -12,20 +12,31 @@ #define _EP_HANDLER2(num, suffix) CONCAT3(ep_, num, suffix) #define _EP_TX_HANDLER(num) _EP_HANDLER2(num, _tx) #define _EP_RX_HANDLER(num) _EP_HANDLER2(num, _rx) -#define _EP_RESET_HANDLER(num) _EP_HANDLER2(num, _rst) +#define _EP_EVENT_HANDLER(num) _EP_HANDLER2(num, _evt) +/* Used to check function types are correct (attribute alias does not do it) */ +#define _EP_TX_HANDLER_TYPECHECK(num) _EP_HANDLER2(num, _tx_typecheck) +#define _EP_RX_HANDLER_TYPECHECK(num) _EP_HANDLER2(num, _rx_typecheck) +#define _EP_EVENT_HANDLER_TYPECHECK(num) _EP_HANDLER2(num, _evt_typecheck) -#define USB_DECLARE_EP(num, tx_handler, rx_handler, rst_handler) \ +#define USB_DECLARE_EP(num, tx_handler, rx_handler, evt_handler) \ void _EP_TX_HANDLER(num)(void) \ __attribute__ ((alias(STRINGIFY(tx_handler)))); \ void _EP_RX_HANDLER(num)(void) \ __attribute__ ((alias(STRINGIFY(rx_handler)))); \ - void _EP_RESET_HANDLER(num)(void) \ - __attribute__ ((alias(STRINGIFY(rst_handler)))) + void _EP_EVENT_HANDLER(num)(enum usb_ep_event evt) \ + __attribute__ ((alias(STRINGIFY(evt_handler)))); \ + static __unused void \ + (*_EP_TX_HANDLER_TYPECHECK(num))(void) = tx_handler; \ + static __unused void \ + (*_EP_RX_HANDLER_TYPECHECK(num))(void) = rx_handler; \ + static __unused void \ + (*_EP_EVENT_HANDLER_TYPECHECK(num))(enum usb_ep_event evt)\ + = evt_handler /* Endpoint callbacks */ extern void (*usb_ep_tx[]) (void); extern void (*usb_ep_rx[]) (void); -extern void (*usb_ep_reset[]) (void); +extern void (*usb_ep_event[]) (enum usb_ep_event evt); struct usb_setup_packet; /* EP0 Interface handler callbacks */ extern int (*usb_iface_request[]) (struct usb_setup_packet *req); |