void USBDEV_Reset(void) { g_USBDEV_ConfigurationValue = 0; USBDEV_SetState(USBDEV_STATE_DEFAULT); g_pUSBDEV_IO_Driver->Reset(); g_pUSBDEV_ClassDriver->Event(USBDEV_EVENT_RESET); }
unsigned int FASTBOOT_USB_Setup(USB_DEVICE_REQUEST_T *pDeviceRequest) { unsigned int retVal = FALSE; if( (pDeviceRequest->bmRequestType&USB_DEVREQ_TYPE_MASK) == USB_DEVREQ_TYPE_STANDARD ) { switch(pDeviceRequest->bRequest) { case USB_REQUEST_SET_CONFIGURATION: { unsigned char configurationValue = (unsigned char)pDeviceRequest->wValue; if( configurationValue == 0 ) { USBDEV_SetState(USBDEV_STATE_ADDRESS); } else { const FASTBOOT_CONFIG_DESCRIPTOR_T *pConfigDescriptor = FASTBOOT_USB_GetCurrentConfigDscr(); if( configurationValue == pConfigDescriptor->Configuration.bConfigurationValue ) { FASTBOOT_USB_Enable(); USBDEV_SetState(USBDEV_STATE_CONFIGURED); } } USBDEV_EP0_Write(NULL,0); udc_notify(UDC_EVENT_ONLINE); //fastboot_event_configured(); retVal = TRUE; break; } case USB_REQUEST_SET_INTERFACE: FASTBOOT_USB_Enable(); USBDEV_SetState(USBDEV_STATE_CONFIGURED); USBDEV_EP0_Write(NULL,0); retVal = TRUE; break; } } return retVal; }