mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
Opt-out for USB Test-Mode
This commit is contained in:
parent
e0ebece2c7
commit
d0373f4749
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user