From 6e011f88d9c9fac534958ca83e3f460de7fa1497 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 7 Sep 2010 03:07:40 +0000 Subject: [PATCH] Must save and restore the endpoint/pipe interrupt enable flags during reconfiguration of all endpoints/pipes in the Endpoint_ConfigureEndpoint() and Pipe_ConfigurePipe() routines. --- LUFA/Drivers/USB/LowLevel/Endpoint.c | 4 ++++ LUFA/Drivers/USB/LowLevel/Pipe.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.c b/LUFA/Drivers/USB/LowLevel/Endpoint.c index fdb6c7469e..d4f10db044 100644 --- a/LUFA/Drivers/USB/LowLevel/Endpoint.c +++ b/LUFA/Drivers/USB/LowLevel/Endpoint.c @@ -55,16 +55,19 @@ bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, #else uint8_t UECFG0XTemp[ENDPOINT_TOTAL_ENDPOINTS]; uint8_t UECFG1XTemp[ENDPOINT_TOTAL_ENDPOINTS]; + uint8_t UEIENXTemp[ENDPOINT_TOTAL_ENDPOINTS]; for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++) { Endpoint_SelectEndpoint(EPNum); UECFG0XTemp[EPNum] = UECFG0X; UECFG1XTemp[EPNum] = UECFG1X; + UEIENXTemp[EPNum] = UEIENX; } UECFG0XTemp[Number] = UECFG0XData; UECFG1XTemp[Number] = UECFG1XData; + UEIENXTemp[Number] = 0; for (uint8_t EPNum = 1; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++) { @@ -85,6 +88,7 @@ bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, UECFG0X = UECFG0XTemp[EPNum]; UECFG1X = UECFG1XTemp[EPNum]; + UEIENX = UEIENXTemp[EPNum]; if (!(Endpoint_IsConfigured())) return false; diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.c b/LUFA/Drivers/USB/LowLevel/Pipe.c index 79c21f24ed..748ed0b561 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.c +++ b/LUFA/Drivers/USB/LowLevel/Pipe.c @@ -49,6 +49,7 @@ bool Pipe_ConfigurePipe(const uint8_t Number, uint8_t UPCFG2XTemp[PIPE_TOTAL_PIPES]; uint8_t UPCONXTemp[PIPE_TOTAL_PIPES]; uint8_t UPINRQXTemp[PIPE_TOTAL_PIPES]; + uint8_t UPIENXTemp[PIPE_TOTAL_PIPES]; for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++) { @@ -58,6 +59,7 @@ bool Pipe_ConfigurePipe(const uint8_t Number, UPCFG2XTemp[PNum] = UPCFG2X; UPCONXTemp[PNum] = UPCONX; UPINRQXTemp[PNum] = UPINRQX; + UPIENXTemp[PNum] = UPIENX; } UPCFG0XTemp[Number] = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0)); @@ -65,6 +67,7 @@ bool Pipe_ConfigurePipe(const uint8_t Number, UPCFG2XTemp[Number] = 0; UPCONXTemp[Number] = (1 << INMODE); UPINRQXTemp[Number] = 0; + UPIENXTemp[Number] = 0; for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++) { @@ -88,6 +91,7 @@ bool Pipe_ConfigurePipe(const uint8_t Number, UPCFG2X = UPCFG2XTemp[PNum]; UPCONX |= UPCONXTemp[PNum]; UPINRQX = UPINRQXTemp[PNum]; + UPIENX = UPIENXTemp[PNum]; if (!(Pipe_IsConfigured())) return false;