summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam D. Jones <[email protected]>2019-11-03 12:52:34 -0500
committerGitHub <[email protected]>2019-11-03 12:52:34 -0500
commit965f3a8f1dcaa557fc79191d1a345b10e65488a7 (patch)
treeab7187b5627774f6e82e2cceaced4f09f6692306
parent130d7ea530a04d6f6683fee72ba36232dc8f5e7e (diff)
parent65e96e5d525ea02e0ca7f265a4d62b4f428cc821 (diff)
Merge pull request #2 from hathach/cr1901-msp430f5529
added void dcd_control_status_complete(uint8_t rhport)
-rw-r--r--examples/device/dfu_rt/src/tusb_config.h2
-rw-r--r--src/device/dcd.h4
-rw-r--r--src/device/usbd_control.c1
-rw-r--r--test/test/device/usbd/test_usbd.c2
4 files changed, 9 insertions, 0 deletions
diff --git a/examples/device/dfu_rt/src/tusb_config.h b/examples/device/dfu_rt/src/tusb_config.h
index b4f7a5562..7e79995d9 100644
--- a/examples/device/dfu_rt/src/tusb_config.h
+++ b/examples/device/dfu_rt/src/tusb_config.h
@@ -51,7 +51,9 @@
// DEVICE CONFIGURATION
//--------------------------------------------------------------------
+#ifndef CFG_TUD_ENDPOINT0_SIZE
#define CFG_TUD_ENDPOINT0_SIZE 64
+#endif
//------------- CLASS -------------//
diff --git a/src/device/dcd.h b/src/device/dcd.h
index 9fa98c669..c88465cbb 100644
--- a/src/device/dcd.h
+++ b/src/device/dcd.h
@@ -119,6 +119,10 @@ void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr);
// clear stall, data toggle is also reset to DATA0
void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr);
+// Invoked when a control transfer's status stage is complete.
+// May help DCD to prepare for next control transfer, this API is optional.
+void dcd_control_status_complete(uint8_t rhport) TU_ATTR_WEAK;
+
//--------------------------------------------------------------------+
// Event API
//--------------------------------------------------------------------+
diff --git a/src/device/usbd_control.c b/src/device/usbd_control.c
index f41614ef1..d37e9ec2a 100644
--- a/src/device/usbd_control.c
+++ b/src/device/usbd_control.c
@@ -129,6 +129,7 @@ bool usbd_control_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t result
if ( tu_edpt_dir(ep_addr) != _ctrl_xfer.request.bmRequestType_bit.direction )
{
TU_ASSERT(0 == xferred_bytes);
+ if (dcd_control_status_complete) dcd_control_status_complete(rhport);
return true;
}
diff --git a/test/test/device/usbd/test_usbd.c b/test/test/device/usbd/test_usbd.c
index add947b3d..a4063a488 100644
--- a/test/test/device/usbd/test_usbd.c
+++ b/test/test/device/usbd/test_usbd.c
@@ -231,5 +231,7 @@ void test_usbd_control_in_zlp(void)
dcd_edpt_xfer_ExpectAndReturn(rhport, EDPT_CTRL_OUT, NULL, 0, true);
dcd_event_xfer_complete(rhport, EDPT_CTRL_OUT, 0, 0, false);
+ dcd_control_status_complete_Expect(rhport);
+
tud_task();
}