X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/37b2130fb2767a39f3d95414c6aca75a67c26298..76d5e99bb8765030a7f99e7b5adf9bae7f92e0ba:/Demos/Device/MassStorage/MassStorage.c?ds=inline diff --git a/Demos/Device/MassStorage/MassStorage.c b/Demos/Device/MassStorage/MassStorage.c index 7ddb8f05a..c50ca3dde 100644 --- a/Demos/Device/MassStorage/MassStorage.c +++ b/Demos/Device/MassStorage/MassStorage.c @@ -85,19 +85,6 @@ int main(void) Scheduler_Start(); } -/** Event handler for the USB_Reset event. This fires when the USB interface is reset by the USB host, before the - * enumeration process begins, and enables the control endpoint interrupt so that control requests can be handled - * asynchronously when they arrive rather than when the control endpoint is polled manually. - */ -EVENT_HANDLER(USB_Reset) -{ - /* Select the control endpoint */ - Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); - - /* Enable the endpoint SETUP interrupt ISR for the control endpoint */ - USB_INT_Enable(ENDPOINT_INT_SETUP); -} - /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */ EVENT_HANDLER(USB_Connect) { @@ -148,35 +135,35 @@ EVENT_HANDLER(USB_ConfigurationChanged) EVENT_HANDLER(USB_UnhandledControlPacket) { /* Process UFI specific control requests */ - switch (bRequest) + switch (USB_ControlRequest.bRequest) { case REQ_MassStorageReset: - if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { - Endpoint_ClearControlSETUP(); + Endpoint_ClearSETUP(); /* Indicate that the current transfer should be aborted */ IsMassStoreReset = true; /* Acknowledge status stage */ while (!(Endpoint_IsINReady())); - Endpoint_ClearControlIN(); + Endpoint_ClearIN(); } break; case REQ_GetMaxLUN: - if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) + if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { - Endpoint_ClearControlSETUP(); + Endpoint_ClearSETUP(); /* Indicate to the host the number of supported LUNs (virtual disks) on the device */ Endpoint_Write_Byte(TOTAL_LUNS - 1); - Endpoint_ClearControlIN(); + Endpoint_ClearIN(); /* Acknowledge status stage */ while (!(Endpoint_IsOUTReceived())); - Endpoint_ClearControlOUT(); + Endpoint_ClearOUT(); } break; @@ -376,24 +363,3 @@ STREAM_CALLBACK(AbortOnMassStoreReset) /* Continue with the current stream operation */ return STREAMCALLBACK_Continue; } - -/** ISR for the general Pipe/Endpoint interrupt vector. This ISR fires when a control request has been issued to the control endpoint, - * so that the request can be processed. As several elements of the Mass Storage implementation require asynchronous control requests - * (such as endpoint stall clearing and Mass Storage Reset requests during data transfers) this is done via interrupts rather than - * polling so that they can be processed regardless of the rest of the application's state. - */ -ISR(ENDPOINT_PIPE_vect, ISR_BLOCK) -{ - /* Check if the control endpoint has received a request */ - if (Endpoint_HasEndpointInterrupted(ENDPOINT_CONTROLEP)) - { - /* Clear the endpoint interrupt */ - Endpoint_ClearEndpointInterrupt(ENDPOINT_CONTROLEP); - - /* Process the control request */ - USB_USBTask(); - - /* Handshake the endpoint setup interrupt - must be after the call to USB_USBTask() */ - USB_INT_Clear(ENDPOINT_INT_SETUP); - } -}