Opt-out for USB Test-Mode

This commit is contained in:
Rocky04 2024-02-19 17:44:18 +00:00
parent e0ebece2c7
commit d0373f4749
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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