summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRocky04 <[email protected]>2024-02-19 17:44:18 +0000
committerRocky04 <[email protected]>2024-02-19 17:44:18 +0000
commitd0373f4749e320c7cb3fac9cce068b4398e60f2f (patch)
tree04993752c5e5c57c65e0b094236913d6a8b04481 /src
parente0ebece2c76a77457ea67d66065d08750ae77eaa (diff)
Opt-out for USB Test-Mode
Diffstat (limited to 'src')
-rw-r--r--src/device/usbd.c4
-rw-r--r--src/portable/synopsys/dwc2/dcd_dwc2.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index 83217a869..1da6f0b53 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -731,6 +731,7 @@ static bool process_control_request(uint8_t rhport, tusb_control_request_t const
tud_control_status(rhport, p_request);
break;
+ #if !defined(TUSB_NO_TEST_MODE_SUPPORT)
// Support for TEST_MODE
case TUSB_REQ_FEATURE_TEST_MODE:
// Only handle the test mode if supported and valid
@@ -753,6 +754,7 @@ static bool process_control_request(uint8_t rhport, tusb_control_request_t const
usbd_control_set_complete_callback(process_test_mode_cb);
break;
+ #endif /* !TUSB_NO_TEST_MODE_SUPPORT */
// Stall unsupported feature selector
default: return false;
@@ -1098,6 +1100,7 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
}
}
+#if !defined(TUSB_NO_TEST_MODE_SUPPORT)
static bool process_test_mode_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request)
{
// At this point it should already be ensured that dcd_enter_test_mode() is defined
@@ -1109,6 +1112,7 @@ static bool process_test_mode_cb(uint8_t rhport, uint8_t stage, tusb_control_req
return true;
}
+#endif /* !TUSB_NO_TEST_MODE_SUPPORT */
//--------------------------------------------------------------------+
// DCD Event Handler
diff --git a/src/portable/synopsys/dwc2/dcd_dwc2.c b/src/portable/synopsys/dwc2/dcd_dwc2.c
index 381aeca71..8163ba8e1 100644
--- a/src/portable/synopsys/dwc2/dcd_dwc2.c
+++ b/src/portable/synopsys/dwc2/dcd_dwc2.c
@@ -1186,7 +1186,7 @@ void dcd_int_handler(uint8_t rhport) {
// }
}
-#if defined(TUP_USBIP_DWC2_TEST_MODE_SUPPORT)
+#if defined(TUP_USBIP_DWC2_TEST_MODE_SUPPORT) && !defined(TUSB_NO_TEST_MODE_SUPPORT)
bool dcd_check_test_mode_support(test_mode_t test_selector) {
// Check if test mode selector is unsupported
@@ -1209,6 +1209,6 @@ void dcd_enter_test_mode(uint8_t rhport, test_mode_t test_selector) {
dwc2->dctl = (dwc2->dctl & ~DCTL_TCTL_Msk) | (test_selector << DCTL_TCTL_Pos);
}
-#endif /* TUP_USBIP_DWC2_TEST_MODE_SUPPORT */
+#endif /* TUP_USBIP_DWC2_TEST_MODE_SUPPORT && !TUSB_NO_TEST_MODE_SUPPORT */
#endif