diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-04-08 05:40:25 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-04-08 05:40:25 +0000 |
commit | c263ea837ae7e3c0e963b798afdffd501790ce2c (patch) | |
tree | a899d943856b48f6889cf1fe9f5b97ccc58ca598 /LUFA/Drivers/USB | |
parent | de9bd767dc8578a45a195fb1e37dd4ff26ae9567 (diff) | |
download | lufa-c263ea837ae7e3c0e963b798afdffd501790ce2c.tar.gz lufa-c263ea837ae7e3c0e963b798afdffd501790ce2c.tar.bz2 lufa-c263ea837ae7e3c0e963b798afdffd501790ce2c.zip |
Move global interrupt enable/disable functions out to Common.h and document them.
Diffstat (limited to 'LUFA/Drivers/USB')
-rw-r--r-- | LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h | 6 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h | 31 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/DeviceStandardReq.c | 6 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/UC3/Device_UC3.h | 6 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h | 39 |
7 files changed, 13 insertions, 79 deletions
diff --git a/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h index 77af51255..47f58b27d 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h @@ -199,8 +199,8 @@ static inline void USB_Device_GetSerialString(uint16_t* UnicodeString) { - uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); - USB_INT_GlobalDisable(); + uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); + GlobalInterruptDisable(); uint8_t SigReadAddress = 0x0E; @@ -220,7 +220,7 @@ (('A' - 10) + SerialByte) : ('0' + SerialByte)); } - USB_INT_SetGlobalEnableState(CurrentGlobalInt); + SetGlobalInterruptMask(CurrentGlobalInt); } #endif diff --git a/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c index deaa5e5fb..4939ec2ed 100644 --- a/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c @@ -263,7 +263,7 @@ ISR(USB_COM_vect, ISR_BLOCK) Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); USB_INT_Disable(USB_INT_RXSTPI); - USB_INT_GlobalEnable(); + GlobalInterruptEnable(); USB_Device_ProcessControlRequest(); diff --git a/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h index e85b67e92..6115ec6e3 100644 --- a/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h @@ -84,37 +84,6 @@ }; /* 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 a502c0949..2e6d8f8c0 100644 --- a/LUFA/Drivers/USB/Core/DeviceStandardReq.c +++ b/LUFA/Drivers/USB/Core/DeviceStandardReq.c @@ -115,8 +115,8 @@ void USB_Device_ProcessControlRequest(void) static void USB_Device_SetAddress(void) { uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F); - uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); - USB_INT_GlobalDisable(); + uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); + GlobalInterruptDisable(); Endpoint_ClearSETUP(); @@ -127,7 +127,7 @@ static void USB_Device_SetAddress(void) USB_Device_SetDeviceAddress(DeviceAddress); USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default; - USB_INT_SetGlobalEnableState(CurrentGlobalInt); + SetGlobalInterruptMask(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 150b18860..2a029bf08 100644 --- a/LUFA/Drivers/USB/Core/UC3/Device_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/Device_UC3.h @@ -187,8 +187,8 @@ static inline void USB_Device_GetSerialString(uint16_t* UnicodeString)
{
- uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState();
- USB_INT_GlobalDisable();
+ uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask();
+ GlobalInterruptDisable();
uint8_t* SigReadAddress = (uint8_t*)0x80800204;
@@ -208,7 +208,7 @@ (('A' - 10) + SerialByte) : ('0' + SerialByte));
}
- USB_INT_SetGlobalEnableState(CurrentGlobalInt);
+ SetGlobalInterruptMask(CurrentGlobalInt);
}
#endif
diff --git a/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c b/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c index 76386649a..76f4ef022 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;
}
-LUFA_ISR(USB_GEN_vect)
+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 a9ad56611..2cebf4106 100644 --- a/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h @@ -55,10 +55,7 @@ #endif
/* Private Interface - For use in library only: */
- #if !defined(__DOXYGEN__)
- /* Macros: */
- #define LUFA_ISR(Name) void Name (void) __attribute__((__interrupt__)); void Name (void)
-
+ #if !defined(__DOXYGEN__)
/* Enums: */
enum USB_Interrupts_t
{
@@ -83,38 +80,6 @@ };
/* 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);
- }
-
- 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();
- if (GlobalIntState & AVR32_SR_GM)
- __builtin_ssrf(AVR32_SR_GM_OFFSET);
- 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)
{
@@ -376,7 +341,7 @@ */
void USB_GEN_vect(void);
#else
- LUFA_ISR(USB_GEN_vect);
+ ISR(USB_GEN_vect);
#endif
/* Disable C linkage for C++ Compilers: */
|