diff options
| author | hathach <[email protected]> | 2022-03-07 23:03:37 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2022-03-07 23:03:51 +0700 |
| commit | 707a633de3b4f47cf00396e16adb7946fa127880 (patch) | |
| tree | 4f92b00c28037ea3f6e5b1f2a5a99b146f3ee9d4 /src/device/dcd.h | |
| parent | ce60e98f6da2030f8fe8c8b6c63a7a33019e6c74 (diff) | |
added dcd_sof_enable(), tud_sof_isr_set()
make number of interface configurable (default to 8)
CFG_TUD_INTERFACE_MAX
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 8efbc90ef..3eac6711f 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 //--------------------------------------------------------------------+ @@ -185,6 +193,13 @@ extern void dcd_event_setup_received(uint8_t rhport, uint8_t const * setup, bool // helper to send transfer complete event extern void dcd_event_xfer_complete (uint8_t rhport, uint8_t ep_addr, uint32_t xferred_bytes, uint8_t result, bool 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 |
