From 70284d390f524e84e0539ad1e869366aaf94cf24 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Fri, 8 Apr 2011 04:49:20 +0000 Subject: [PATCH] Add in a new common Delay_MS() function, which provides a blocking delay for all architectures. Remove use of avr-libc specific ATOMIC_BLOCK, replace with a new per-architecture set of inline functions to retrieve and manipulate the global interrupt enable bit for each architecture. Add in documentation for the USB controller common interrupt routine which must be linked to the interrupt controller in the user application on the AVR32 UC3 architecture. --- LUFA.pnproj | 2 +- LUFA/Common/Common.h | 22 +++++++-- LUFA/Drivers/Misc/RingBuffer.h | 49 +++++++++++-------- LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h | 30 ++++++------ LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c | 2 +- .../Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c | 7 ++- .../Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h | 31 ++++++++++++ LUFA/Drivers/USB/Core/DeviceStandardReq.c | 20 ++++---- LUFA/Drivers/USB/Core/UC3/Device_UC3.h | 30 ++++++------ LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h | 14 +++--- LUFA/Drivers/USB/Core/UC3/Host_UC3.c | 2 +- LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h | 2 +- LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c | 2 +- LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h | 49 +++++++++++++++++-- LUFA/Scheduler/Scheduler.c | 10 ++-- LUFA/Scheduler/Scheduler.h | 10 ++-- Projects/Webserver/Lib/uip/clock.c | 7 ++- 17 files changed, 194 insertions(+), 95 deletions(-) diff --git a/LUFA.pnproj b/LUFA.pnproj index c36d9e48c9..42db2052b7 100644 --- a/LUFA.pnproj +++ b/LUFA.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/LUFA/Common/Common.h b/LUFA/Common/Common.h index 42662ef395..a7e88dab58 100644 --- a/LUFA/Common/Common.h +++ b/LUFA/Common/Common.h @@ -75,7 +75,6 @@ #include #include #include - #include #include typedef uint8_t uint_reg_t; @@ -90,12 +89,8 @@ #include // === TODO: Find abstracted way to handle these === - #define ISR(Name) void Name (void) __attribute__((__interrupt__)); void Name (void) #define PROGMEM const - #define ATOMIC_BLOCK(x) if (1) - #define ATOMIC_RESTORESTATE #define pgm_read_byte(x) *x - #define _delay_ms(x) #define memcmp_P(...) memcmp(__VA_ARGS__) #define memcpy_P(...) memcpy(__VA_ARGS__) // ================================================== @@ -238,6 +233,23 @@ return Byte; } + /** Function to perform a blocking delay for a specified number of milliseconds. The actual delay will be + * at a minimum the specified number of milliseconds, however due to loop overhead and internal calculations + * may be slightly higher. + */ + static inline void Delay_MS(uint8_t Milliseconds) + { + while (Milliseconds--) + { + #if (ARCH == ARCH_AVR8) + _delay_ms(1); + #elif (ARCH == ARCH_UC3) + __builtin_mtsr(AVR32_COUNT, 0); + while (__builtin_mfsr(AVR32_COUNT) < (F_CPU / 1000)); + #endif + } + } + #endif /** @} */ diff --git a/LUFA/Drivers/Misc/RingBuffer.h b/LUFA/Drivers/Misc/RingBuffer.h index 1a825ac235..5c8c8403b8 100644 --- a/LUFA/Drivers/Misc/RingBuffer.h +++ b/LUFA/Drivers/Misc/RingBuffer.h @@ -125,15 +125,17 @@ { GCC_FORCE_POINTER_ACCESS(Buffer); - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - Buffer->In = DataPtr; - Buffer->Out = DataPtr; - Buffer->Start = &DataPtr[0]; - Buffer->End = &DataPtr[Size]; - Buffer->Size = Size; - Buffer->Count = 0; - } + uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); + USB_INT_GlobalDisable(); + + Buffer->In = DataPtr; + Buffer->Out = DataPtr; + Buffer->Start = &DataPtr[0]; + Buffer->End = &DataPtr[Size]; + Buffer->Size = Size; + Buffer->Count = 0; + + USB_INT_SetGlobalEnableState(CurrentGlobalInt); } /** Retrieves the minimum number of bytes stored in a particular buffer. This value is computed @@ -153,11 +155,12 @@ { uint16_t Count; - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - Count = Buffer->Count; - } + uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); + USB_INT_GlobalDisable(); + + Count = Buffer->Count; + USB_INT_SetGlobalEnableState(CurrentGlobalInt); return Count; } @@ -210,10 +213,12 @@ if (++Buffer->In == Buffer->End) Buffer->In = Buffer->Start; - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - Buffer->Count++; - } + uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); + USB_INT_GlobalDisable(); + + Buffer->Count++; + + USB_INT_SetGlobalEnableState(CurrentGlobalInt); } /** Removes an element from the ring buffer. @@ -235,10 +240,12 @@ if (++Buffer->Out == Buffer->End) Buffer->Out = Buffer->Start; - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - Buffer->Count--; - } + uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); + USB_INT_GlobalDisable(); + + Buffer->Count--; + + USB_INT_SetGlobalEnableState(CurrentGlobalInt); return Data; } diff --git a/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h index 7a9c3675d8..77af512550 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h @@ -199,26 +199,28 @@ static inline void USB_Device_GetSerialString(uint16_t* UnicodeString) { - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) + uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); + USB_INT_GlobalDisable(); + + uint8_t SigReadAddress = 0x0E; + + for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++) { - uint8_t SigReadAddress = 0x0E; + uint8_t SerialByte = boot_signature_byte_get(SigReadAddress); - for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++) + if (SerialCharNum & 0x01) { - uint8_t SerialByte = boot_signature_byte_get(SigReadAddress); - - if (SerialCharNum & 0x01) - { - SerialByte >>= 4; - SigReadAddress++; - } + SerialByte >>= 4; + SigReadAddress++; + } - SerialByte &= 0x0F; + SerialByte &= 0x0F; - UnicodeString[SerialCharNum] = cpu_to_le16((SerialByte >= 10) ? - (('A' - 10) + SerialByte) : ('0' + SerialByte)); - } + UnicodeString[SerialCharNum] = cpu_to_le16((SerialByte >= 10) ? + (('A' - 10) + SerialByte) : ('0' + SerialByte)); } + + USB_INT_SetGlobalEnableState(CurrentGlobalInt); } #endif diff --git a/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c index e4220e3954..87dddd49d6 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c @@ -69,7 +69,7 @@ void USB_Host_ProcessNextHostState(void) case HOST_STATE_Powered_WaitForDeviceSettle: if (WaitMSRemaining--) { - _delay_ms(1); + Delay_MS(1); break; } else diff --git a/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c index 89d60ebe0f..deaa5e5fbc 100644 --- a/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c @@ -263,10 +263,9 @@ ISR(USB_COM_vect, ISR_BLOCK) Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); USB_INT_Disable(USB_INT_RXSTPI); - NONATOMIC_BLOCK(NONATOMIC_FORCEOFF) - { - USB_Device_ProcessControlRequest(); - } + USB_INT_GlobalEnable(); + + USB_Device_ProcessControlRequest(); Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); USB_INT_Enable(USB_INT_RXSTPI); diff --git a/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h index 6115ec6e3c..e85b67e925 100644 --- a/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h @@ -84,6 +84,37 @@ }; /* Inline Functions: */ + static inline uint_reg_t USB_INT_GetGlobalEnableState(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; + static inline uint_reg_t USB_INT_GetGlobalEnableState(void) + { + GCC_MEMORY_BARRIER(); + return SREG; + } + + static inline void USB_INT_SetGlobalEnableState(uint_reg_t GlobalIntState) ATTR_ALWAYS_INLINE; + static inline void USB_INT_SetGlobalEnableState(uint_reg_t GlobalIntState) + { + GCC_MEMORY_BARRIER(); + SREG = GlobalIntState; + GCC_MEMORY_BARRIER(); + } + + static inline void USB_INT_GlobalEnable(void) ATTR_ALWAYS_INLINE; + static inline void USB_INT_GlobalEnable(void) + { + GCC_MEMORY_BARRIER(); + sei(); + GCC_MEMORY_BARRIER(); + } + + static inline void USB_INT_GlobalDisable(void) ATTR_ALWAYS_INLINE; + static inline void USB_INT_GlobalDisable(void) + { + GCC_MEMORY_BARRIER(); + cli(); + GCC_MEMORY_BARRIER(); + } + static inline void USB_INT_Enable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; static inline void USB_INT_Enable(const uint8_t Interrupt) { diff --git a/LUFA/Drivers/USB/Core/DeviceStandardReq.c b/LUFA/Drivers/USB/Core/DeviceStandardReq.c index e36820387d..a502c09494 100644 --- a/LUFA/Drivers/USB/Core/DeviceStandardReq.c +++ b/LUFA/Drivers/USB/Core/DeviceStandardReq.c @@ -114,20 +114,20 @@ void USB_Device_ProcessControlRequest(void) static void USB_Device_SetAddress(void) { - uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F); - - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - Endpoint_ClearSETUP(); + uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F); + uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); + USB_INT_GlobalDisable(); + + Endpoint_ClearSETUP(); - Endpoint_ClearStatusStage(); + Endpoint_ClearStatusStage(); - while (!(Endpoint_IsINReady())); + while (!(Endpoint_IsINReady())); - USB_Device_SetDeviceAddress(DeviceAddress); - } - + USB_Device_SetDeviceAddress(DeviceAddress); USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default; + + USB_INT_SetGlobalEnableState(CurrentGlobalInt); } static void USB_Device_SetConfiguration(void) diff --git a/LUFA/Drivers/USB/Core/UC3/Device_UC3.h b/LUFA/Drivers/USB/Core/UC3/Device_UC3.h index 8389d62dcb..150b188605 100644 --- a/LUFA/Drivers/USB/Core/UC3/Device_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/Device_UC3.h @@ -187,26 +187,28 @@ static inline void USB_Device_GetSerialString(uint16_t* UnicodeString) { - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) + uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); + USB_INT_GlobalDisable(); + + uint8_t* SigReadAddress = (uint8_t*)0x80800204; + + for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++) { - uint8_t* SigReadAddress = (uint8_t*)0x80800204; + uint8_t SerialByte = *SigReadAddress; - for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++) + if (SerialCharNum & 0x01) { - uint8_t SerialByte = *SigReadAddress; - - if (SerialCharNum & 0x01) - { - SerialByte >>= 4; - SigReadAddress++; - } + SerialByte >>= 4; + SigReadAddress++; + } - SerialByte &= 0x0F; + SerialByte &= 0x0F; - UnicodeString[SerialCharNum] = cpu_to_le16((SerialByte >= 10) ? - (('A' - 10) + SerialByte) : ('0' + SerialByte)); - } + UnicodeString[SerialCharNum] = cpu_to_le16((SerialByte >= 10) ? + (('A' - 10) + SerialByte) : ('0' + SerialByte)); } + + USB_INT_SetGlobalEnableState(CurrentGlobalInt); } #endif diff --git a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h index 4c3aa09b7a..2fe42aa304 100644 --- a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h @@ -90,13 +90,13 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) /* Macros: */ - #define _ENDPOINT_GET_MAXSIZE(EPIndex) _ENDPOINT_GET_MAXSIZE2(ENDPOINT_DETAILS_EP ## EPIndex) - #define _ENDPOINT_GET_MAXSIZE2(EPDetails) _ENDPOINT_GET_MAXSIZE3(EPDetails) - #define _ENDPOINT_GET_MAXSIZE3(MaxSize, Banks) (MaxSize) + #define _ENDPOINT_GET_MAXSIZE(EPIndex) _ENDPOINT_GET_MAXSIZE2(ENDPOINT_DETAILS_EP ## EPIndex) + #define _ENDPOINT_GET_MAXSIZE2(EPDetails) _ENDPOINT_GET_MAXSIZE3(EPDetails) + #define _ENDPOINT_GET_MAXSIZE3(MaxSize, Banks) (MaxSize) - #define _ENDPOINT_GET_BANKS(EPIndex) _ENDPOINT_GET_BANKS2(ENDPOINT_DETAILS_EP ## EPIndex) - #define _ENDPOINT_GET_BANKS2(EPDetails) _ENDPOINT_GET_BANKS3(EPDetails) - #define _ENDPOINT_GET_BANKS3(MaxSize, Banks) (Banks) + #define _ENDPOINT_GET_BANKS(EPIndex) _ENDPOINT_GET_BANKS2(ENDPOINT_DETAILS_EP ## EPIndex) + #define _ENDPOINT_GET_BANKS2(EPDetails) _ENDPOINT_GET_BANKS3(EPDetails) + #define _ENDPOINT_GET_BANKS3(MaxSize, Banks) (Banks) #if defined(USB_SERIES_UC3A0_AVR) || defined(USB_SERIES_UC3A1_AVR) #define ENDPOINT_DETAILS_MAXEP 7 @@ -130,7 +130,7 @@ #define ENDPOINT_DETAILS_EP6 256, 2 #endif - #define ENDPOINT_HSB_ADDRESS_SPACE_SIZE (64 * 1024UL) + #define ENDPOINT_HSB_ADDRESS_SPACE_SIZE (64 * 1024UL) /* Inline Functions: */ static inline uint32_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST diff --git a/LUFA/Drivers/USB/Core/UC3/Host_UC3.c b/LUFA/Drivers/USB/Core/UC3/Host_UC3.c index 6d49abbb25..b557ff0ed9 100644 --- a/LUFA/Drivers/USB/Core/UC3/Host_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/Host_UC3.c @@ -69,7 +69,7 @@ void USB_Host_ProcessNextHostState(void) case HOST_STATE_Powered_WaitForDeviceSettle: if (WaitMSRemaining--) { - _delay_ms(1); + Delay_MS(1); break; } else diff --git a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h index d7a7da2a90..045aaad1de 100644 --- a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h @@ -99,7 +99,7 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) /* Macros: */ - #define PIPE_HSB_ADDRESS_SPACE_SIZE (64 * 1024UL) + #define PIPE_HSB_ADDRESS_SPACE_SIZE (64 * 1024UL) /* External Variables: */ extern volatile uint8_t USB_SelectedPipe; diff --git a/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c b/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c index 76f4ef022e..76386649ad 100644 --- a/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c @@ -49,7 +49,7 @@ void USB_INT_ClearAllInterrupts(void) AVR32_USBB.udintclr = 0xFFFFFFFF; } -ISR(USB_GEN_vect) +LUFA_ISR(USB_GEN_vect) { #if defined(USB_CAN_BE_DEVICE) #if !defined(NO_SOF_EVENTS) diff --git a/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h b/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h index 1192433600..95a85cf691 100644 --- a/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h @@ -57,6 +57,9 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) /* Macros: */ + #define LUFA_ISR(Name) void Name (void) __attribute__((__interrupt__)); void Name (void) + + /* Enums: */ enum USB_Interrupts_t { USB_INT_VBUSTI = 0, @@ -79,10 +82,38 @@ #endif }; - /* ISR Prototypes: */ - ISR(USB_GEN_vect); - /* Inline Functions: */ + static inline uint_reg_t USB_INT_GetGlobalEnableState(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; + static inline uint_reg_t USB_INT_GetGlobalEnableState(void) + { + GCC_MEMORY_BARRIER(); + return (__builtin_mfsr(AVR32_SR) & AVR32_SR_GM); + } + + static inline void USB_INT_SetGlobalEnableState(uint_reg_t GlobalIntState) ATTR_ALWAYS_INLINE; + static inline void USB_INT_SetGlobalEnableState(uint_reg_t GlobalIntState) + { + GCC_MEMORY_BARRIER(); + __builtin_ssrf(AVR32_SR_GM_OFFSET, GlobalIntState); + GCC_MEMORY_BARRIER(); + } + + static inline void USB_INT_GlobalEnable(void) ATTR_ALWAYS_INLINE; + static inline void USB_INT_GlobalEnable(void) + { + GCC_MEMORY_BARRIER(); + __builtin_csrf(AVR32_SR_GM_OFFSET); + GCC_MEMORY_BARRIER(); + } + + static inline void USB_INT_GlobalDisable(void) ATTR_ALWAYS_INLINE; + static inline void USB_INT_GlobalDisable(void) + { + GCC_MEMORY_BARRIER(); + __builtin_ssrf(AVR32_SR_GM_OFFSET); + GCC_MEMORY_BARRIER(); + } + static inline void USB_INT_Enable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; static inline void USB_INT_Enable(const uint8_t Interrupt) { @@ -335,6 +366,18 @@ void USB_INT_DisableAllInterrupts(void); #endif + /* Public Interface - May be used in end-application: */ + /* ISR Prototypes: */ + #if defined(__DOXYGEN__) + /** Interrupt service routine handler for the USB controller ISR group. This interrupt routine must be + * linked to the entire USB controller ISR vector group inside the AVR32's interrupt controller peripheral, + * using the user application's preferred USB controller driver. + */ + void USB_GEN_vect(void); + #else + LUFA_ISR(USB_GEN_vect); + #endif + /* Disable C linkage for C++ Compilers: */ #if defined(__cplusplus) } diff --git a/LUFA/Scheduler/Scheduler.c b/LUFA/Scheduler/Scheduler.c index 4e71d4d874..87a21491d8 100644 --- a/LUFA/Scheduler/Scheduler.c +++ b/LUFA/Scheduler/Scheduler.c @@ -39,10 +39,12 @@ bool Scheduler_HasDelayElapsed(const uint_least16_t Delay, SchedulerDelayCounter_t CurrentTickValue_LCL; SchedulerDelayCounter_t DelayCounter_LCL; - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - CurrentTickValue_LCL = Scheduler_TickCounter; - } + uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); + USB_INT_GlobalDisable(); + + CurrentTickValue_LCL = Scheduler_TickCounter; + + USB_INT_SetGlobalEnableState(CurrentGlobalInt); DelayCounter_LCL = *DelayCounter; diff --git a/LUFA/Scheduler/Scheduler.h b/LUFA/Scheduler/Scheduler.h index 7aa513322e..499a63a1b4 100644 --- a/LUFA/Scheduler/Scheduler.h +++ b/LUFA/Scheduler/Scheduler.h @@ -219,10 +219,12 @@ ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; static inline void Scheduler_ResetDelay(SchedulerDelayCounter_t* const DelayCounter) { - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - *DelayCounter = Scheduler_TickCounter; - } + uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); + USB_INT_GlobalDisable(); + + *DelayCounter = Scheduler_TickCounter; + + USB_INT_SetGlobalEnableState(CurrentGlobalInt); } /* Function Prototypes: */ diff --git a/Projects/Webserver/Lib/uip/clock.c b/Projects/Webserver/Lib/uip/clock.c index 71eaf2b289..87650b6daa 100644 --- a/Projects/Webserver/Lib/uip/clock.c +++ b/Projects/Webserver/Lib/uip/clock.c @@ -29,10 +29,9 @@ clock_time_t clock_time() { clock_time_t time; - ATOMIC_BLOCK(ATOMIC_FORCEON) - { - time = clock_datetime; - } + USB_INT_GlobalDisable(); + time = clock_datetime; + USB_INT_GlobalEnable(); return time; }