Merge pull request #1381 from hathach/add-sof-isr

Add SOF IRQ Handler
This commit is contained in:
Ha Thach
2022-05-31 22:25:14 +07:00
committed by GitHub
38 changed files with 631 additions and 2821 deletions

View File

@@ -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