From 32f0f605efa293430a47d60bb857695ff6937d21 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Thu, 14 May 2009 10:07:08 +0000 Subject: Removed all user pipe/endpoint interrupt APIs, added internal library support for interrupt driven control endpoints when in device mode by defining INTERRUPT_CONTROL_ENDPOINT token and passing it to the compiler via the -D switch. --- Demos/Device/MassStorage/MassStorage.c | 31 ------------------------------- Demos/Device/MassStorage/MassStorage.h | 3 --- Demos/Device/MassStorage/MassStorage.txt | 5 +++++ Demos/Device/MassStorage/makefile | 1 + 4 files changed, 6 insertions(+), 34 deletions(-) (limited to 'Demos/Device/MassStorage') diff --git a/Demos/Device/MassStorage/MassStorage.c b/Demos/Device/MassStorage/MassStorage.c index b24018a10..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) { @@ -376,21 +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)) - { - /* 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); - } -} diff --git a/Demos/Device/MassStorage/MassStorage.h b/Demos/Device/MassStorage/MassStorage.h index 17acca6b7..f0baf1461 100644 --- a/Demos/Device/MassStorage/MassStorage.h +++ b/Demos/Device/MassStorage/MassStorage.h @@ -134,9 +134,6 @@ STREAM_CALLBACK(AbortOnMassStoreReset); /* Event Handlers: */ - /** Indicates that this module will catch the USB_Reset event when thrown by the library. */ - HANDLES_EVENT(USB_Reset); - /** Indicates that this module will catch the USB_Connect event when thrown by the library. */ HANDLES_EVENT(USB_Connect); diff --git a/Demos/Device/MassStorage/MassStorage.txt b/Demos/Device/MassStorage/MassStorage.txt index 9db731c31..1d06cb66d 100644 --- a/Demos/Device/MassStorage/MassStorage.txt +++ b/Demos/Device/MassStorage/MassStorage.txt @@ -58,6 +58,11 @@ * 255), with each LUN being allocated an equal portion of the available * Dataflash memory. * + * The USB control endpoint is managed entirely by the library using endpoint + * interrupts, as the INTERRUPT_CONTROL_ENDPOINT option is enabled. This allows for + * the host to reset the Mass Storage device state during long transfers without + * the need for complicated polling logic. + * * \section SSec_Options Project Options * * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value. diff --git a/Demos/Device/MassStorage/makefile b/Demos/Device/MassStorage/makefile index 3115aae16..65a22c6a3 100644 --- a/Demos/Device/MassStorage/makefile +++ b/Demos/Device/MassStorage/makefile @@ -189,6 +189,7 @@ CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DUSB_DEVICE_ONLY CDEFS += -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DUSE_SINGLE_DEVICE_CONFIGURATION CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" +CDEFS += -DINTERRUPT_CONTROL_ENDPOINT # Place -D or -U options here for ASM sources -- cgit v1.2.3