diff options
| author | Ha Thach <[email protected]> | 2022-05-31 22:25:14 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-05-31 22:25:14 +0700 |
| commit | fdeac8508be5cdd95966422d1e776604efbc9b3f (patch) | |
| tree | e3e1ddf37ebd5500145ac610239f2d5baeceb6fa /src/device/dcd.h | |
| parent | ab7c23a787a024dcaadb698c9d7533ad85209cd7 (diff) | |
| parent | e384d16d576089daa3a5c993ead06cffb7a50cbe (diff) | |
Merge pull request #1381 from hathach/add-sof-isr
Add SOF IRQ Handler
Diffstat (limited to 'src/device/dcd.h')
| -rw-r--r-- | src/device/dcd.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/device/dcd.h b/src/device/dcd.h index bc68c9be6..6b99734fe 100644 --- a/src/device/dcd.h +++ b/src/device/dcd.h @@ -77,6 +77,11 @@ typedef struct TU_ATTR_ALIGNED(4) tusb_speed_t speed; } bus_reset; + // SOF + struct { + uint32_t frame_count; + }sof; + // SETUP_RECEIVED tusb_control_request_t setup_received; @@ -132,6 +137,9 @@ void dcd_connect(uint8_t rhport) TU_ATTR_WEAK; // Disconnect by disabling internal pull-up resistor on D+/D- void dcd_disconnect(uint8_t rhport) TU_ATTR_WEAK; +// Enable/Disable Start-of-frame interrupt. Default is disabled +void dcd_sof_enable(uint8_t rhport, bool en); + //--------------------------------------------------------------------+ // Endpoint API //--------------------------------------------------------------------+ @@ -209,6 +217,13 @@ TU_ATTR_ALWAYS_INLINE static inline void dcd_event_xfer_complete (uint8_t rhport dcd_event_handler(&event, in_isr); } +static inline void dcd_event_sof(uint8_t rhport, uint32_t frame_count, bool in_isr) +{ + dcd_event_t event = { .rhport = rhport, .event_id = DCD_EVENT_SOF }; + event.sof.frame_count = frame_count; + dcd_event_handler(&event, in_isr); +} + #ifdef __cplusplus } #endif |
