Add __VA_ARGS__ support to the LUFA supplied ISR macro. Add proper result typecasting to the SWAPENDIAN_* macros.

Switch to using -1 on the UC3 target to obtain a register mask with all bits set (for clearing interrupts and status flags).

Fix incorrect USB controller mode on the UC3 when a fixed mode is specified as a compile time option due to AVR32_USBB.USBCON.uide being set by default.

Make USB_Descriptor_String_t use a uint16_t for Unicode strings on all targets except the AVR8 (retained for backwards compatibility).
pull/1469/head
Dean Camera 14 years ago
parent 7b0cebc1d7
commit f670bdeff8

@ -236,9 +236,7 @@ ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-l
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += -Wl,--rodata-writable
LDFLAGS += -Wl,--gc-sections --rodata-writable
LDFLAGS += -Wl,--direct-data
#LDFLAGS += -T linker_script.x

@ -257,7 +257,7 @@
*
* \param Name Unique name of the interrupt service routine.
*/
#define ISR(Name, ...) void Name (void) __attribute__((__interrupt__)); void Name (void)
#define ISR(Name, ...) void Name (void) __attribute__((__interrupt__)) __VA_ARGS__; void Name (void)
#endif
/* Inline Functions: */

@ -78,7 +78,7 @@
*
* \return Input value with the byte ordering reversed.
*/
#define SWAPENDIAN_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
#define SWAPENDIAN_16(x) (uint16_t)((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
/** Swaps the byte ordering of a 32-bit value at compile-time. Do not use this macro for swapping byte orderings
* of dynamic values computed at runtime- use \ref SwapEndian_32() instead. The result of this macro can be used
@ -91,7 +91,7 @@
*
* \return Input value with the byte ordering reversed.
*/
#define SWAPENDIAN_32(x) ((((x) & 0xFF000000UL) >> 24UL) | (((x) & 0x00FF0000UL) >> 8UL) | \
#define SWAPENDIAN_32(x) (uint32_t)((((x) & 0xFF000000UL) >> 24UL) | (((x) & 0x00FF0000UL) >> 8UL) | \
(((x) & 0x0000FF00UL) << 8UL) | (((x) & 0x000000FFUL) << 24UL))
#if defined(ARCH_BIG_ENDIAN) && !defined(le16_to_cpu)

@ -612,7 +612,10 @@
{
USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
wchar_t UnicodeString[]; /**< String data, as unicode characters (alternatively,
#if (ARCH == ARCH_AVR8)
wchar_t UnicodeString[];
#else
uint16_t UnicodeString[]; /**< String data, as unicode characters (alternatively,
* string language IDs). If normal ASCII characters are
* to be used, they must be added as an array of characters
* rather than a normal C string so that they are widened to
@ -623,6 +626,7 @@
* Unicode strings, and may be used instead of an explicit
* array of ASCII characters.
*/
#endif
} ATTR_PACKED USB_Descriptor_String_t;
/** \brief Standard USB String Descriptor (USB-IF naming conventions).

@ -61,7 +61,7 @@ void Endpoint_ClearEndpoints(void)
{
Endpoint_SelectEndpoint(EPNum);
(&AVR32_USBB.uecfg0)[EPNum] = 0;
(&AVR32_USBB.uecon0clr)[EPNum] = 0xFFFFFFFF;
(&AVR32_USBB.uecon0clr)[EPNum] = -1;
USB_EndpointFIFOPos[EPNum] = &AVR32_USBB_SLAVE[EPNum * 0x10000];
Endpoint_DisableEndpoint();
}

@ -69,7 +69,7 @@ void Pipe_ClearPipes(void)
{
Pipe_SelectPipe(PNum);
(&AVR32_USBB.upcfg0)[PNum] = 0;
(&AVR32_USBB.upcon0clr)[PNum] = 0xFFFFFFFF;
(&AVR32_USBB.upcon0clr)[PNum] = -1;
USB_PipeFIFOPos[PNum] = &AVR32_USBB_SLAVE[PNum * 0x10000];
Pipe_DisablePipe();
}

@ -72,6 +72,8 @@ void USB_Init(
AVR32_USBB.USBCON.uide = false;
USB_CurrentMode = Mode;
}
#else
AVR32_USBB.USBCON.uide = false;
#endif
USB_IsInitialized = true;

@ -36,8 +36,8 @@ void USB_INT_DisableAllInterrupts(void)
AVR32_USBB.USBCON.vbuste = false;
AVR32_USBB.USBCON.idte = false;
AVR32_USBB.uhinteclr = 0xFFFFFFFF;
AVR32_USBB.udinteclr = 0xFFFFFFFF;
AVR32_USBB.uhinteclr = -1;
AVR32_USBB.udinteclr = -1;
}
void USB_INT_ClearAllInterrupts(void)
@ -45,8 +45,8 @@ void USB_INT_ClearAllInterrupts(void)
AVR32_USBB.USBSTACLR.vbustic = true;
AVR32_USBB.USBSTACLR.idtic = true;
AVR32_USBB.uhintclr = 0xFFFFFFFF;
AVR32_USBB.udintclr = 0xFFFFFFFF;
AVR32_USBB.uhintclr = -1;
AVR32_USBB.udintclr = -1;
}
ISR(USB_GEN_vect)

Loading…
Cancel
Save