diff options
| author | hathach <[email protected]> | 2018-10-24 00:44:26 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-10-24 00:44:26 +0700 |
| commit | 55427606ef7fbdafa5a9da6b8a0f798dcb619817 (patch) | |
| tree | 0b76127b0de1ae08fa62359f959228b895101f73 /src/device/dcd.h | |
| parent | e7a63324dd02bb8c8193b26631b4b7ef5d08fd0b (diff) | |
replace dcd_xfer_complete by dcd_xfer_complete()
Diffstat (limited to 'src/device/dcd.h')
| -rw-r--r-- | src/device/dcd.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/device/dcd.h b/src/device/dcd.h index 5a28296cd..662496701 100644 --- a/src/device/dcd.h +++ b/src/device/dcd.h @@ -49,6 +49,13 @@ extern "C" {
#endif
+enum
+{
+ DCD_XFER_SUCCESS = 0,
+ DCD_XFER_FAILED,
+ DCD_XFER_STALLED
+};
+
typedef enum
{
DCD_EVENT_BUS_RESET = 1,
@@ -103,15 +110,22 @@ void dcd_disconnect (uint8_t rhport) ATTR_WEAK; /* Event Function
* Called by DCD to notify USBD
*------------------------------------------------------------------*/
-void dcd_xfer_complete (uint8_t rhport, uint8_t ep_addr, uint32_t xferred_bytes, bool succeeded);
+void dcd_event_handler(dcd_event_t const * event, bool in_isr);
-static inline void dcd_control_complete(uint8_t rhport, uint32_t xferred_bytes)
+static inline void dcd_event_xfer_complete(uint8_t rhport, uint8_t ep_addr, uint32_t xferred_bytes, uint8_t result, bool in_isr)
{
- // all control complete is successful !!
- dcd_xfer_complete(rhport, 0, xferred_bytes, true);
-}
+ dcd_event_t event =
+ {
+ .rhport = 0,
+ .event_id = DCD_EVENT_XFER_COMPLETE,
+ };
-void dcd_event_handler(dcd_event_t const * event, bool in_isr);
+ event.xfer_complete.ep_addr = ep_addr;
+ event.xfer_complete.len = xferred_bytes;
+ event.xfer_complete.result = result;
+
+ dcd_event_handler(&event, true);
+}
/*------------------------------------------------------------------*/
/* Endpoint API
|
