*\r
* \param[in] EndpointNumber Endpoint number whose FIFO buffers are to be reset.\r
*/\r
- static inline void Endpoint_ResetFIFO(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;\r
- static inline void Endpoint_ResetFIFO(const uint8_t EndpointNumber)\r
+ static inline void Endpoint_ResetEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;\r
+ static inline void Endpoint_ResetEndpoint(const uint8_t EndpointNumber)\r
{\r
AVR32_USBB.uerst |= (AVR32_USBB_EPRST0_MASK << EndpointNumber);\r
AVR32_USBB.uerst &= ~(AVR32_USBB_EPRST0_MASK << EndpointNumber);\r
(&AVR32_USBB.UECON0SET)[USB_SelectedEndpoint].killbks = true;\r
while ((&AVR32_USBB.UECON0)[USB_SelectedEndpoint].killbk);\r
}\r
-\r
- USB_EndpointFIFOPos[USB_SelectedEndpoint] = &AVR32_USBB_SLAVE[USB_SelectedEndpoint * 0x10000];\r
}\r
\r
/** Determines if the currently selected endpoint may be read from (if data is waiting in the endpoint\r
uint16_t Byte1 = *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++);\r
uint16_t Byte0 = *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++);\r
\r
- return ((Byte1 << 8) | Byte0);\r
+ return ((Byte0 << 8) | Byte1);\r
}\r
\r
/** Reads two bytes from the currently selected endpoint's bank in big endian format, for OUT\r
uint16_t Byte0 = *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++);\r
uint16_t Byte1 = *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++);\r
\r
- return ((Byte1 << 8) | Byte0);\r
+ return ((Byte0 << 8) | Byte1);\r
}\r
\r
/** Writes two bytes to the currently selected endpoint's bank in little endian format, for IN\r
static inline void Endpoint_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE;\r
static inline void Endpoint_Write_Word_LE(const uint16_t Word)\r
{\r
- *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (Word & 0xFF);\r
*(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (Word >> 8);\r
+ *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (Word & 0xFF);\r
}\r
\r
/** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN\r
static inline void Endpoint_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE;\r
static inline void Endpoint_Write_Word_BE(const uint16_t Word)\r
{\r
- *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (Word >> 8);\r
*(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (Word & 0xFF);\r
+ *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (Word >> 8);\r
}\r
\r
/** Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints.\r
uint32_t Byte1 = *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++);\r
uint32_t Byte0 = *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++);\r
\r
- return ((Byte3 << 24) | (Byte2 << 16) | (Byte1 << 8) | Byte0);\r
+ return ((Byte0 << 24) | (Byte1 << 16) | (Byte2 << 8) | Byte3);\r
}\r
\r
/** Reads four bytes from the currently selected endpoint's bank in big endian format, for OUT\r
uint32_t Byte2 = *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++);\r
uint32_t Byte3 = *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++);\r
\r
- return ((Byte3 << 24) | (Byte2 << 16) | (Byte1 << 8) | Byte0);\r
+ return ((Byte0 << 24) | (Byte1 << 16) | (Byte2 << 8) | Byte3);\r
}\r
\r
/** Writes four bytes to the currently selected endpoint's bank in little endian format, for IN\r
static inline void Endpoint_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE;\r
static inline void Endpoint_Write_DWord_LE(const uint32_t DWord)\r
{\r
- *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (DWord & 0xFF);\r
- *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (DWord >> 8);\r
- *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (DWord >> 16);\r
*(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (DWord >> 24);\r
+ *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (DWord >> 16);\r
+ *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (DWord >> 8);\r
+ *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (DWord & 0xFF);\r
}\r
\r
/** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN\r
static inline void Endpoint_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE;\r
static inline void Endpoint_Write_DWord_BE(const uint32_t DWord)\r
{\r
- *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (DWord >> 24);\r
- *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (DWord >> 16);\r
- *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (DWord >> 8);\r
*(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (DWord & 0xFF);\r
+ *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (DWord >> 8);\r
+ *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (DWord >> 16);\r
+ *(((volatile uint8_t** volatile)USB_EndpointFIFOPos)[USB_SelectedEndpoint]++) = (DWord >> 24);\r
}\r
\r
/** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints.\r