Fixed swapped Little Endian/Big Endian endpoint and pipe write code for the UC3 devic...
authorDean Camera <dean@fourwalledcubicle.com>
Sat, 26 May 2012 16:02:20 +0000 (16:02 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sat, 26 May 2012 16:02:20 +0000 (16:02 +0000)
LUFA/DoxygenPages/ChangeLog.txt
LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c
LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h
LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h
LUFA/Drivers/USB/Core/UC3/USBController_UC3.c

index 7758f8b..43a1b6f 100644 (file)
@@ -64,6 +64,7 @@
   *   - Fixed possible deadlock in the CDC device driver if the USB connection is dropped while the CDC_REQ_SetLineEncoding control request is being processed by
   *     the stack (thanks to Jonathan Hudgins)
   *   - Fixed broken MIDI host driver MIDI_Host_ReceiveEventPacket() function due to not unfreezing the MIDI data IN pipe before use (thanks to Michael Brown)
   *   - Fixed possible deadlock in the CDC device driver if the USB connection is dropped while the CDC_REQ_SetLineEncoding control request is being processed by
   *     the stack (thanks to Jonathan Hudgins)
   *   - Fixed broken MIDI host driver MIDI_Host_ReceiveEventPacket() function due to not unfreezing the MIDI data IN pipe before use (thanks to Michael Brown)
+  *   - Fixed swapped Little Endian/Big Endian endpoint and pipe write code for the UC3 devices (thanks to Andrew Chu)
   *  - Library Applications:
   *   - Fixed error in the AVRISP-MKII programmer when ISP mode is used at 64KHz (thanks to Ben R. Porter)
   *   - Fixed AVRISP-MKII programmer project failing to compile for the U4 chips when VTARGET_ADC_CHANNEL is defined to an invalid channel and NO_VTARGET_DETECT is
   *  - Library Applications:
   *   - Fixed error in the AVRISP-MKII programmer when ISP mode is used at 64KHz (thanks to Ben R. Porter)
   *   - Fixed AVRISP-MKII programmer project failing to compile for the U4 chips when VTARGET_ADC_CHANNEL is defined to an invalid channel and NO_VTARGET_DETECT is
index e5aa40c..6b710c3 100644 (file)
@@ -406,8 +406,7 @@ static bool RNDIS_Device_ProcessNDISSet(USB_ClassInfo_RNDIS_Device_t* const RNDI
        {
                case OID_GEN_CURRENT_PACKET_FILTER:
                        RNDISInterfaceInfo->State.CurrPacketFilter = le32_to_cpu(*((uint32_t*)SetData));
        {
                case OID_GEN_CURRENT_PACKET_FILTER:
                        RNDISInterfaceInfo->State.CurrPacketFilter = le32_to_cpu(*((uint32_t*)SetData));
-                       RNDISInterfaceInfo->State.CurrRNDISState   = le32_to_cpu((RNDISInterfaceInfo->State.CurrPacketFilter) ?
-                                                                                RNDIS_Data_Initialized : RNDIS_Data_Initialized);
+                       RNDISInterfaceInfo->State.CurrRNDISState   = (RNDISInterfaceInfo->State.CurrPacketFilter) ? RNDIS_Data_Initialized : RNDIS_Initialized;
 
                        return true;
                case OID_802_3_MULTICAST_LIST:
 
                        return true;
                case OID_802_3_MULTICAST_LIST:
index 84801a1..a1b2a16 100644 (file)
                        static inline void Endpoint_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Endpoint_Write_16_LE(const uint16_t Data)
                        {
                        static inline void Endpoint_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Endpoint_Write_16_LE(const uint16_t Data)
                        {
-                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 8);
                                *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data & 0xFF);
                                *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data & 0xFF);
+                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 8);
                        }
 
                        /** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN
                        }
 
                        /** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN
                        static inline void Endpoint_Write_16_BE(const uint16_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Endpoint_Write_16_BE(const uint16_t Data)
                        {
                        static inline void Endpoint_Write_16_BE(const uint16_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Endpoint_Write_16_BE(const uint16_t Data)
                        {
-                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data & 0xFF);
                                *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 8);
                                *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 8);
+                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data & 0xFF);
                        }
 
                        /** Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints.
                        }
 
                        /** Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints.
                        static inline void Endpoint_Write_32_LE(const uint32_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Endpoint_Write_32_LE(const uint32_t Data)
                        {
                        static inline void Endpoint_Write_32_LE(const uint32_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Endpoint_Write_32_LE(const uint32_t Data)
                        {
-                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 24);
-                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 16);
-                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 8);
                                *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data &  0xFF);
                                *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data &  0xFF);
+                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 8);
+                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 16);
+                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 24);
                        }
 
                        /** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN
                        }
 
                        /** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN
                        static inline void Endpoint_Write_32_BE(const uint32_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Endpoint_Write_32_BE(const uint32_t Data)
                        {
                        static inline void Endpoint_Write_32_BE(const uint32_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Endpoint_Write_32_BE(const uint32_t Data)
                        {
-                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data &  0xFF);
-                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 8);
-                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 16);
                                *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 24);
                                *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 24);
+                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 16);
+                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 8);
+                               *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data &  0xFF);
                        }
 
                        /** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints.
                        }
 
                        /** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints.
index 837afe8..0c3136e 100644 (file)
                        static inline void Pipe_ClearSETUP(void)
                        {
                                (&AVR32_USBB.UPSTA0CLR)[USB_Pipe_SelectedPipe].txstpic = true;
                        static inline void Pipe_ClearSETUP(void)
                        {
                                (&AVR32_USBB.UPSTA0CLR)[USB_Pipe_SelectedPipe].txstpic = true;
+                               (&AVR32_USBB.UPCON0CLR)[USB_Pipe_SelectedPipe].fifoconc = true;
                                USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe] = &AVR32_USBB_SLAVE[USB_Pipe_SelectedPipe * PIPE_HSB_ADDRESS_SPACE_SIZE];
                        }
 
                                USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe] = &AVR32_USBB_SLAVE[USB_Pipe_SelectedPipe * PIPE_HSB_ADDRESS_SPACE_SIZE];
                        }
 
                        static inline void Pipe_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Pipe_Write_16_LE(const uint16_t Data)
                        {
                        static inline void Pipe_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Pipe_Write_16_LE(const uint16_t Data)
                        {
-                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 8);
                                *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data & 0xFF);
                                *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data & 0xFF);
+                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 8);
                        }
 
                        /** Writes two bytes to the currently selected pipe's bank in big endian format, for IN
                        }
 
                        /** Writes two bytes to the currently selected pipe's bank in big endian format, for IN
                        static inline void Pipe_Write_16_BE(const uint16_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Pipe_Write_16_BE(const uint16_t Data)
                        {
                        static inline void Pipe_Write_16_BE(const uint16_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Pipe_Write_16_BE(const uint16_t Data)
                        {
-                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data & 0xFF);
                                *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 8);
                                *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 8);
+                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data & 0xFF);
                        }
 
                        /** Discards two bytes from the currently selected pipe's bank, for OUT direction pipes.
                        }
 
                        /** Discards two bytes from the currently selected pipe's bank, for OUT direction pipes.
                        static inline void Pipe_Write_32_LE(const uint32_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Pipe_Write_32_LE(const uint32_t Data)
                        {
                        static inline void Pipe_Write_32_LE(const uint32_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Pipe_Write_32_LE(const uint32_t Data)
                        {
-                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 24);
-                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 16);
-                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 8);
                                *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data &  0xFF);
                                *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data &  0xFF);
+                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 8);
+                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 16);
+                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 24);
                        }
 
                        /** Writes four bytes to the currently selected pipe's bank in big endian format, for IN
                        }
 
                        /** Writes four bytes to the currently selected pipe's bank in big endian format, for IN
                        static inline void Pipe_Write_32_BE(const uint32_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Pipe_Write_32_BE(const uint32_t Data)
                        {
                        static inline void Pipe_Write_32_BE(const uint32_t Data) ATTR_ALWAYS_INLINE;
                        static inline void Pipe_Write_32_BE(const uint32_t Data)
                        {
-                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data &  0xFF);
-                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 8);
-                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 16);
                                *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 24);
                                *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 24);
+                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 16);
+                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 8);
+                               *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data &  0xFF);
                        }
 
                        /** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes.
                        }
 
                        /** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes.
index 3277244..9e4e4a2 100644 (file)
@@ -138,7 +138,7 @@ void USB_ResetInterface(void)
        else if (USB_CurrentMode == USB_MODE_Host)
        {
                #if defined(INVERTED_VBUS_ENABLE_LINE)
        else if (USB_CurrentMode == USB_MODE_Host)
        {
                #if defined(INVERTED_VBUS_ENABLE_LINE)
-               AVR32_USBB.USBCON.vbuspol = true;
+               AVR32_USBB.USBCON.vbuspo = true;
                #endif
                
                #if defined(USB_CAN_BE_HOST)
                #endif
                
                #if defined(USB_CAN_BE_HOST)