X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/e071f3897a0946c6be1e1b5e1f78eda8dcbf6fc7..5930f47bf4b9b4490daf80d44595ff14ee7ce165:/LUFA/Drivers/USB/LowLevel/Host.c diff --git a/LUFA/Drivers/USB/LowLevel/Host.c b/LUFA/Drivers/USB/LowLevel/Host.c index ae7525bee..1e22ffcb7 100644 --- a/LUFA/Drivers/USB/LowLevel/Host.c +++ b/LUFA/Drivers/USB/LowLevel/Host.c @@ -67,10 +67,14 @@ void USB_Host_ProcessNextHostState(void) break; case HOST_STATE_Powered_WaitForDeviceSettle: #if HOST_DEVICE_SETTLE_DELAY_MS > 0 - _delay_ms(1); - if (!(WaitMSRemaining--)) { + _delay_ms(1); + break; + } + else + #endif + { USB_Host_VBUS_Manual_Off(); USB_OTGPAD_On(); @@ -79,9 +83,6 @@ void USB_Host_ProcessNextHostState(void) USB_HostState = HOST_STATE_Powered_WaitForConnect; } - #else - USB_HostState = HOST_STATE_Powered_WaitForConnect; - #endif break; case HOST_STATE_Powered_WaitForConnect: @@ -92,8 +93,6 @@ void USB_Host_ProcessNextHostState(void) USB_INT_Clear(USB_INT_VBERRI); USB_INT_Enable(USB_INT_VBERRI); - - EVENT_USB_Connect(); USB_Host_ResumeBus(); Pipe_ClearPipes(); @@ -139,11 +138,7 @@ void USB_Host_ProcessNextHostState(void) break; } - #if defined(USE_NONSTANDARD_DESCRIPTOR_NAMES) USB_ControlPipeSize = DataBuffer[offsetof(USB_Descriptor_Device_t, Endpoint0Size)]; - #else - USB_ControlPipeSize = DataBuffer[offsetof(USB_Descriptor_Device_t, bMaxPacketSize0)]; - #endif USB_Host_ResetDevice(); @@ -185,20 +180,18 @@ void USB_Host_ProcessNextHostState(void) case HOST_STATE_Default_PostAddressSet: USB_Host_SetDeviceAddress(USB_HOST_DEVICEADDRESS); - EVENT_USB_DeviceEnumerationComplete(); + EVENT_USB_Host_DeviceEnumerationComplete(); USB_HostState = HOST_STATE_Addressed; - break; } if ((ErrorCode != HOST_ENUMERROR_NoError) && (USB_HostState != HOST_STATE_Unattached)) { - EVENT_USB_DeviceEnumerationFailed(ErrorCode, SubErrorCode); + EVENT_USB_Host_DeviceEnumerationFailed(ErrorCode, SubErrorCode); USB_Host_VBUS_Auto_Off(); - EVENT_USB_DeviceUnattached(); - EVENT_USB_Disconnect(); + EVENT_USB_Host_DeviceUnattached(); USB_ResetInterface(); } @@ -320,7 +313,7 @@ uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr) uint8_t USB_Host_ClearPipeStall(uint8_t EndpointNum) { if (Pipe_GetPipeToken() == PIPE_TOKEN_IN) - EndpointNum |= (1 << 7); + EndpointNum |= ENDPOINT_DESCRIPTOR_DIR_IN; USB_ControlRequest = (USB_Request_Header_t) {