summaryrefslogtreecommitdiff
path: root/src/device/dcd.h
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2023-01-07 23:46:46 +0700
committerGitHub <[email protected]>2023-01-07 23:46:46 +0700
commit949950e592d9a23a4b449784b0f8e7e274129318 (patch)
tree9a9df1391a8227395d13a90458d6b56aa93a85ac /src/device/dcd.h
parent2683deb0dd2e049de6c9b15f49d28a2fef4380f6 (diff)
parent83cc71feaf442842e498343b5a3128f4735216bb (diff)
Merge branch 'master' into ch32v307
Diffstat (limited to 'src/device/dcd.h')
-rw-r--r--src/device/dcd.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/device/dcd.h b/src/device/dcd.h
index bc68c9be6..c1780f656 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;
@@ -105,14 +110,7 @@ typedef struct TU_ATTR_ALIGNED(4)
void dcd_init (uint8_t rhport);
// Interrupt Handler
-#if __GNUC__ && !defined(__ARMCC_VERSION)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wredundant-decls"
-#endif
void dcd_int_handler(uint8_t rhport);
-#if __GNUC__ && !defined(__ARMCC_VERSION)
-#pragma GCC diagnostic pop
-#endif
// Enable device interrupt
void dcd_int_enable (uint8_t rhport);
@@ -132,6 +130,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 +210,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