Fix nasty bug in USBInterrupt.c which would cause a lockup if the control endpoint was not selected at the point the USB endpoint interrupt fires when INTERRUPT_CONTROL_ENDPOINT is defined.

This commit is contained in:
Dean Camera 2010-05-11 13:45:23 +00:00
parent 53ebb2f21a
commit ee5ea4ce2b
2 changed files with 7 additions and 8 deletions

View file

@ -233,15 +233,15 @@ ISR(USB_GEN_vect, ISR_BLOCK)
#if defined(INTERRUPT_CONTROL_ENDPOINT) && defined(USB_CAN_BE_DEVICE)
ISR(USB_COM_vect, ISR_BLOCK)
{
uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint();
uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint();
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
USB_INT_Disable(USB_INT_RXSTPI);
sei();
USB_USBTask();
USB_INT_Enable(USB_INT_RXSTPI);
USB_INT_Clear(USB_INT_RXSTPI);
USB_USBTask();
USB_INT_Enable(USB_INT_RXSTPI);
Endpoint_SelectEndpoint(PrevSelectedEndpoint);
}
#endif