summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-05-09 23:31:18 +0700
committerhathach <[email protected]>2019-05-09 23:31:18 +0700
commit77bc421359845c2fe4591b0ae19e513b9a84c05b (patch)
treee5d54acbfcd594025edf7b107ddfc0066fff0919
parent81cb1c9510e4b4ccb03d165b4248fdf5688dd8ba (diff)
fix clear stall usage, fix reset data toggle with dcd_clear_stall for nrf52
-rw-r--r--src/device/dcd.h2
-rw-r--r--src/device/usbd.c2
-rw-r--r--src/portable/nordic/nrf5x/dcd_nrf5x.c5
-rw-r--r--src/tusb_option.h9
4 files changed, 15 insertions, 3 deletions
diff --git a/src/device/dcd.h b/src/device/dcd.h
index 63f923faa..18678f15b 100644
--- a/src/device/dcd.h
+++ b/src/device/dcd.h
@@ -107,7 +107,7 @@ void dcd_remote_wakeup(uint8_t rhport);
* must be called to notify the stack
* - busy : Check if endpoint transferring is complete (TODO remove)
* - stall : stall endpoint
- * - clear_stall : clear stall
+ * - clear_stall : clear stall, data toggle is also reset to DATA0
*------------------------------------------------------------------*/
bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc);
bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes);
diff --git a/src/device/usbd.c b/src/device/usbd.c
index d811c471a..434a2c3d8 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -456,7 +456,7 @@ static bool process_control_request(uint8_t rhport, tusb_control_request_t const
case TUSB_REQ_CLEAR_FEATURE:
if ( TUSB_REQ_FEATURE_EDPT_HALT == p_request->wValue )
{
- dcd_edpt_clear_stall(rhport, tu_u16_low(p_request->wIndex));
+ usbd_edpt_clear_stall(rhport, tu_u16_low(p_request->wIndex));
}
usbd_control_status(rhport, p_request);
break;
diff --git a/src/portable/nordic/nrf5x/dcd_nrf5x.c b/src/portable/nordic/nrf5x/dcd_nrf5x.c
index 3e5f69f79..53f92bb19 100644
--- a/src/portable/nordic/nrf5x/dcd_nrf5x.c
+++ b/src/portable/nordic/nrf5x/dcd_nrf5x.c
@@ -322,7 +322,12 @@ void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr)
if ( tu_edpt_number(ep_addr) )
{
+ // clear stall
NRF_USBD->EPSTALL = (USBD_EPSTALL_STALL_UnStall << USBD_EPSTALL_STALL_Pos) | ep_addr;
+
+ // reset data toggle to DATA0
+ NRF_USBD->DTOGGLE = (USBD_DTOGGLE_VALUE_Data0 << USBD_DTOGGLE_VALUE_Pos) | ep_addr;
+
__ISB(); __DSB();
}
}
diff --git a/src/tusb_option.h b/src/tusb_option.h
index cb6d573ea..4e55132b1 100644
--- a/src/tusb_option.h
+++ b/src/tusb_option.h
@@ -128,7 +128,6 @@
*/
#ifndef CFG_TUSB_DEBUG
#define CFG_TUSB_DEBUG 0
- #warning CFG_TUSB_DEBUG is not defined, default value is 0
#endif
// place data in accessible RAM for usb controller
@@ -165,6 +164,14 @@
#define CFG_TUD_MSC 0
#endif
+#ifndef CFG_TUD_MIDI
+ #define CFG_TUD_MIDI 0
+#endif
+
+#ifndef CFG_TUD_CUSTOM_CLASS
+ #define CFG_TUD_CUSTOM_CLASS 0
+#endif
+
#endif // TUSB_OPT_DEVICE_ENABLED
//--------------------------------------------------------------------