summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2021-08-20 01:07:57 +0700
committerGitHub <[email protected]>2021-08-20 01:07:57 +0700
commitaab133ac69aaf371b5270850588e5d1cd6fb6de1 (patch)
treeeb528e239af86ed3825c21648059efcebd6d1a1b /src
parent219d186c4d6fd386310fd7aae441d919e41b4219 (diff)
parentff59e98a6ab29c70cdf743db7412ddb609e32730 (diff)
Merge pull request #1027 from kkitayam/remove_redundant_from_renesas
Remove redundant SOF processing from the Renesas RX family.
Diffstat (limited to 'src')
-rw-r--r--src/portable/renesas/usba/dcd_usba.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/portable/renesas/usba/dcd_usba.c b/src/portable/renesas/usba/dcd_usba.c
index 1db1fdb32..095dcc136 100644
--- a/src/portable/renesas/usba/dcd_usba.c
+++ b/src/portable/renesas/usba/dcd_usba.c
@@ -27,6 +27,10 @@
#include "tusb_option.h"
+// Since TinyUSB doesn't use SOF for now, and this interrupt too often (1ms interval)
+// We disable SOF for now until needed later on
+#define USE_SOF 0
+
#if TUSB_OPT_DEVICE_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_RX63X || \
CFG_TUSB_MCU == OPT_MCU_RX65X || \
CFG_TUSB_MCU == OPT_MCU_RX72N )
@@ -139,7 +143,6 @@ typedef struct
{
pipe_state_t pipe[10];
uint8_t ep[2][16]; /* a lookup table for a pipe index from an endpoint address */
- uint8_t suspended;
} dcd_data_t;
//--------------------------------------------------------------------+
@@ -627,7 +630,7 @@ void dcd_init(uint8_t rhport)
/* Setup default control pipe */
USB0.DCPMAXP.BIT.MXPS = 64;
USB0.INTENB0.WORD = USB_IS0_VBINT | USB_IS0_BRDY | USB_IS0_BEMP |
- USB_IS0_DVST | USB_IS0_CTRT | USB_IS0_SOFR | USB_IS0_RESM;
+ USB_IS0_DVST | USB_IS0_CTRT | (USE_SOF ? USB_IS0_SOFR: 0) | USB_IS0_RESM;
USB0.BEMPENB.WORD = 1;
USB0.BRDYENB.WORD = 1;
@@ -815,21 +818,16 @@ void dcd_int_handler(uint8_t rhport)
}
if (is0 & USB_IS0_RESM) {
dcd_event_bus_signal(rhport, DCD_EVENT_RESUME, true);
- _dcd.suspended = 0;
+#if (0==USE_SOF)
+ USB0.INTENB0.BIT.SOFE = 0;
+#endif
}
- if (is0 & USB_IS0_SOFR) {
- if (_dcd.suspended) {
- /* When USB host resumes caused by `dcd_remote_wakeup()`,
- * RESM interrupt does not rise.
- * Therefore we need to manually send resume event.
- * Of course, when USB host resumes on its own,
- * RESM interrupt rise properly, then this statements are ignored. */
- // TODO can be dropped since this logic is implemented by usbd
- // USBD will exit suspended mode when SOF event is received
- dcd_event_bus_signal(rhport, DCD_EVENT_RESUME, true);
- _dcd.suspended = 0;
- }
+ if ((is0 & USB_IS0_SOFR) && USB0.INTENB0.BIT.SOFE) {
+ // USBD will exit suspended mode when SOF event is received
dcd_event_bus_signal(rhport, DCD_EVENT_SOF, true);
+#if (0==USE_SOF)
+ USB0.INTENB0.BIT.SOFE = 0;
+#endif
}
if (is0 & USB_IS0_DVST) {
switch (is0 & USB_IS0_DVSQ) {
@@ -844,7 +842,9 @@ void dcd_int_handler(uint8_t rhport)
case USB_IS0_DVSQ_SUSP2:
case USB_IS0_DVSQ_SUSP3:
dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true);
- _dcd.suspended = 1;
+#if (0==USE_SOF)
+ USB0.INTENB0.BIT.SOFE = 1;
+#endif
default:
break;
}