Commit 0e6d5cf5 authored by Dean Camera's avatar Dean Camera

Start porting the USB core to the AVR32 UC3B.

parent e11fddfe
......@@ -47,7 +47,11 @@
#define __CONFIGDESCRIPTOR_H__
/* Includes: */
#include <avr/io.h>
#if defined(__AVR32__)
#include <avr32/io.h>
#elif defined(__AVR__)
#include <avr/io.h>
#endif
#include "../../../Common/Common.h"
#include "../HighLevel/USBMode.h"
......
......@@ -50,7 +50,11 @@
#define __USBEVENTS_H__
/* Includes: */
#include <avr/io.h>
#if defined(__AVR32__)
#include <avr32/io.h>
#elif defined(__AVR__)
#include <avr/io.h>
#endif
#include "../../../Common/Common.h"
#include "USBMode.h"
......
......@@ -41,9 +41,16 @@
#define __USBDESCRIPTORS_H__
/* Includes: */
#include <avr/pgmspace.h>
#include <stdbool.h>
#include <stddef.h>
#if defined(__AVR32__)
#include <avr32/io.h>
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#elif defined(__AVR__)
#include <avr/pgmspace.h>
#include <stdbool.h>
#include <stddef.h>
#endif
#include "../../../Common/Common.h"
#include "USBMode.h"
......
......@@ -32,8 +32,14 @@
#define __USBINTERRUPT_H__
/* Includes: */
#include <avr/io.h>
#include <stdbool.h>
#if defined(__AVR32__)
#include <avr32/io.h>
#include <stdbool.h>
#include <stdint.h>
#elif defined(__AVR__)
#include <avr/io.h>
#include <stdbool.h>
#endif
#include "../../../Common/Common.h"
#include "../LowLevel/LowLevel.h"
......
......@@ -69,6 +69,11 @@
* (i.e. AT90USBXXX7) when defined.
*/
#define USB_SERIES_7_AVR
/** Indicates that the target AVR microcontroller belongs to the Series UC3B USB controller
* (i.e. AT32UC3BXXXX) when defined.
*/
#define USB_SERIES_UC3B_AVR
/** Indicates that the target AVR microcontroller and compilation settings allow for the
* target to be configured in USB Device mode when defined.
......@@ -95,9 +100,11 @@
#define USB_SERIES_6_AVR
#elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__))
#define USB_SERIES_7_AVR
#elif (defined(__AVR32_UC3B0256__))
#define USB_SERIES_UC3B_AVR
#endif
#if !defined(USB_SERIES_7_AVR)
#if !defined(USB_SERIES_7_AVR) && !defined(USB_SERIES_UC3B_AVR)
#if defined(USB_HOST_ONLY)
#error USB_HOST_ONLY is not available for the currently selected USB AVR model.
#endif
......
......@@ -32,9 +32,15 @@
#define __USBTASK_H__
/* Includes: */
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
#if defined(__AVR32__)
#include <avr32/io.h>
#include <stdint.h>
#include <stdbool.h>
#elif defined(__AVR__)
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
#endif
#include "../LowLevel/LowLevel.h"
#include "Events.h"
......
......@@ -139,7 +139,7 @@ static void USB_Device_SetAddress(void)
if (DeviceAddress)
USB_DeviceState = DEVICE_STATE_Addressed;
UDADDR = ((1 << ADDEN) | DeviceAddress);
USB_Device_SetDeviceAddress(DeviceAddress);
return;
}
......
......@@ -32,10 +32,15 @@
#define __DEVCHAPTER9_H__
/* Includes: */
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <avr/boot.h>
#if defined(__AVR32__)
#include <avr32/io.h>
#include <stdint.h>
#elif defined(__AVR__)
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <avr/boot.h>
#endif
#include "../HighLevel/StdDescriptors.h"
#include "../HighLevel/Events.h"
......@@ -70,7 +75,11 @@
enum USB_DescriptorMemorySpaces_t
{
MEMSPACE_FLASH = 0, /**< Indicates the requested descriptor is located in FLASH memory */
#if defined(__AVR__) || defined(__DOXYGEN__)
MEMSPACE_EEPROM = 1, /**< Indicates the requested descriptor is located in EEPROM memory */
#endif
MEMSPACE_RAM = 2, /**< Indicates the requested descriptor is located in RAM memory */
};
#endif
......@@ -125,6 +134,10 @@
#elif defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS) && defined(USE_RAM_DESCRIPTORS)
#error Only one of the USE_*_DESCRIPTORS modes should be selected.
#endif
#if defined(USE_EEPROM_DESCRIPTORS) && defined(USB_SERIES_UC3B_AVR)
#error USE_EEPROM_DESCRIPTORS is not available on the UC3B series AVRs.
#endif
/* Function Prototypes: */
void USB_Device_ProcessControlRequest(void);
......
......@@ -41,9 +41,11 @@
#define __USBDEVICE_H__
/* Includes: */
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#if defined(__AVR__)
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#endif
#include "../../../Common/Common.h"
#include "../HighLevel/StdDescriptors.h"
#include "Endpoint.h"
......@@ -59,7 +61,8 @@
/* Public Interface - May be used in end-application: */
/* Macros: */
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)
#if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || \
defined(USB_SERIES_UC3B_AVR) || defined(__DOXYGEN__))
/** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the
* USB interface should be initialized in low speed (1.5Mb/s) mode.
*
......@@ -68,13 +71,13 @@
* \note Restrictions apply on the number, size and type of endpoints which can be used
* when running in low speed mode -- refer to the USB 2.0 standard.
*/
#define USB_DEVICE_OPT_LOWSPEED (1 << 0)
#define USB_DEVICE_OPT_LOWSPEED (1 << 0)
#endif
/** Mask for the Options parameter of the USB_Init() function. This indicates that the
* USB interface should be initialized in full speed (12Mb/s) mode.
*/
#define USB_DEVICE_OPT_FULLSPEED (0 << 0)
#define USB_DEVICE_OPT_FULLSPEED (0 << 0)
/* Pseudo-Function Macros: */
#if defined(__DOXYGEN__)
......@@ -129,16 +132,25 @@
*/
static inline bool USB_Device_DisableSOFEvents(void);
#else
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
#define USB_Device_SendRemoteWakeup() MACROS{ UDCON |= (1 << RMWKUP); }MACROE
#if defined(__AVR32__)
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
#define USB_Device_SendRemoteWakeup() MACROS{ AVR32_USBB.UDCON.rmwkup = true; }MACROE
#define USB_Device_IsRemoteWakeupSent() AVR32_USBB.UDCON.rmwkup
#endif
#define USB_Device_IsUSBSuspended() AVR32_USBB.UDINT.susp
#elif defined(__AVR__)
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
#define USB_Device_SendRemoteWakeup() MACROS{ UDCON |= (1 << RMWKUP); }MACROE
#define USB_Device_IsRemoteWakeupSent() ((UDCON & (1 << RMWKUP)) ? false : true)
#define USB_Device_IsRemoteWakeupSent() ((UDCON & (1 << RMWKUP)) ? false : true)
#endif
#define USB_Device_IsUSBSuspended() ((UDINT & (1 << SUSPI)) ? true : false)
#endif
#define USB_Device_IsUSBSuspended() ((UDINT & (1 << SUSPI)) ? true : false)
#define USB_Device_EnableSOFEvents() MACROS{ USB_INT_Enable(USB_INT_SOFI); }MACROE
#define USB_Device_EnableSOFEvents() MACROS{ USB_INT_Enable(USB_INT_SOFI); }MACROE
#define USB_Device_DisableSOFEvents() MACROS{ USB_INT_Disable(USB_INT_SOFI); }MACROE
#endif
......@@ -207,8 +219,17 @@
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#define USB_Device_SetLowSpeed() MACROS{ UDCON |= (1 << LSM); }MACROE
#define USB_Device_SetFullSpeed() MACROS{ UDCON &= ~(1 << LSM); }MACROE
#if defined(__AVR32__)
#define USB_Device_SetLowSpeed() MACROS{ AVR32_USBB.UDCON.ls = true; }MACROE
#define USB_Device_SetFullSpeed() MACROS{ AVR32_USBB.UDCON.ls = false; }MACROE
#define USB_Device_SetDeviceAddress(addr) MACROS{ AVR32_USBB.UDADDR = (AVR32_USBB_UDCON_ADDEN_MASK | DeviceAddress); }MACROE
#elif defined(__AVR__)
#define USB_Device_SetLowSpeed() MACROS{ UDCON |= (1 << LSM); }MACROE
#define USB_Device_SetFullSpeed() MACROS{ UDCON &= ~(1 << LSM); }MACROE
#define USB_Device_SetDeviceAddress(addr) MACROS{ UDADDR = ((1 << ADDEN) | DeviceAddress); }MACROE
#endif
#endif
#endif
......
......@@ -225,12 +225,14 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr++))
#include "Template/Template_Endpoint_RW.c"
#define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr++))
#include "Template/Template_Endpoint_RW.c"
#if defined(__AVR__)
#define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr++))
#include "Template/Template_Endpoint_RW.c"
#endif
#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_BE
#define TEMPLATE_BUFFER_TYPE const void*
......@@ -239,12 +241,14 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(*((uint8_t*)BufferPtr--))
#include "Template/Template_Endpoint_RW.c"
#define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr--))
#include "Template/Template_Endpoint_RW.c"
#if defined(__AVR__)
#define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr--))
#include "Template/Template_Endpoint_RW.c"
#endif
#define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_BE
#define TEMPLATE_BUFFER_TYPE const void*
......@@ -260,12 +264,14 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr++) = Endpoint_Read_Byte()
#include "Template/Template_Endpoint_RW.c"
#define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE
#define TEMPLATE_BUFFER_TYPE void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_write_byte((uint8_t*)BufferPtr++, Endpoint_Read_Byte())
#include "Template/Template_Endpoint_RW.c"
#if defined(__AVR__)
#define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE
#define TEMPLATE_BUFFER_TYPE void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_write_byte((uint8_t*)BufferPtr++, Endpoint_Read_Byte())
#include "Template/Template_Endpoint_RW.c"
#endif
#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_BE
#define TEMPLATE_BUFFER_TYPE void*
......@@ -274,12 +280,14 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr--) = Endpoint_Read_Byte()
#include "Template/Template_Endpoint_RW.c"
#define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE
#define TEMPLATE_BUFFER_TYPE void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_write_byte((uint8_t*)BufferPtr--, Endpoint_Read_Byte())
#include "Template/Template_Endpoint_RW.c"
#if defined(__AVR__)
#define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE
#define TEMPLATE_BUFFER_TYPE void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_write_byte((uint8_t*)BufferPtr--, Endpoint_Read_Byte())
#include "Template/Template_Endpoint_RW.c"
#endif
#endif
......@@ -293,10 +301,12 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr++))
#include "Template/Template_Endpoint_Control_W.c"
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_LE
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr++))
#include "Template/Template_Endpoint_Control_W.c"
#if defined(__AVR__)
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_LE
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr++))
#include "Template/Template_Endpoint_Control_W.c"
#endif
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_BE
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
......@@ -308,29 +318,35 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr--))
#include "Template/Template_Endpoint_Control_W.c"
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_BE
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr--))
#include "Template/Template_Endpoint_Control_W.c"
#if defined(__AVR__)
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_BE
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr--))
#include "Template/Template_Endpoint_Control_W.c"
#endif
#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_LE
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr++) = Endpoint_Read_Byte()
#include "Template/Template_Endpoint_Control_R.c"
#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_LE
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_write_byte((uint8_t*)BufferPtr++, Endpoint_Read_Byte())
#include "Template/Template_Endpoint_Control_R.c"
#if defined(__AVR__)
#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_LE
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_write_byte((uint8_t*)BufferPtr++, Endpoint_Read_Byte())
#include "Template/Template_Endpoint_Control_R.c"
#endif
#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_BE
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr--) = Endpoint_Read_Byte()
#include "Template/Template_Endpoint_Control_R.c"
#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_BE
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_write_byte((uint8_t*)BufferPtr--, Endpoint_Read_Byte())
#include "Template/Template_Endpoint_Control_R.c"
#if defined(__AVR__)
#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_BE
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_write_byte((uint8_t*)BufferPtr--, Endpoint_Read_Byte())
#include "Template/Template_Endpoint_Control_R.c"
#endif
#endif
......@@ -66,11 +66,17 @@
#define __ENDPOINT_H__
/* Includes: */
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <stdbool.h>
#if defined(__AVR32__)
#include <avr32/io.h>
#include <stdint.h>
#include <stdbool.h>
#elif defined(__AVR__)
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <stdbool.h>
#endif
#include "../../../Common/Common.h"
#include "../HighLevel/USBTask.h"
......@@ -486,7 +492,11 @@
static inline uint8_t Endpoint_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Endpoint_Read_Byte(void)
{
#if defined(__AVR32__)
return 0; // TODO
#elif defined(__AVR__)
return UEDATX;
#endif
}
/** Writes one byte from the currently selected endpoint's bank, for IN direction endpoints.
......@@ -498,7 +508,11 @@
static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Byte(const uint8_t Byte)
{
#if defined(__AVR32__)
// TODO
#elif defined(__AVR__)
UEDATX = Byte;
#endif
}
/** Discards one byte from the currently selected endpoint's bank, for OUT direction endpoints.
......@@ -510,7 +524,11 @@
{
uint8_t Dummy;
#if defined(__AVR32__)
// TODO
#elif defined(__AVR__)
Dummy = UEDATX;
#endif
}
/** Reads two bytes from the currently selected endpoint's bank in little endian format, for OUT
......@@ -529,8 +547,12 @@
uint8_t Bytes[2];
} Data;
#if defined(__AVR32__)
// TODO
#elif defined(__AVR__)
Data.Bytes[0] = UEDATX;
Data.Bytes[1] = UEDATX;
#endif
return Data.Word;
}
......@@ -551,8 +573,12 @@
uint8_t Bytes[2];
} Data;
#if defined(__AVR32__)
// TODO
#elif defined(__AVR__)
Data.Bytes[1] = UEDATX;
Data.Bytes[0] = UEDATX;
#endif
return Data.Word;
}
......@@ -567,8 +593,12 @@
static inline void Endpoint_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Word_LE(const uint16_t Word)
{
#if defined(__AVR32__)
// TODO
#elif defined(__AVR__)
UEDATX = (Word & 0xFF);
UEDATX = (Word >> 8);
#endif
}
/** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN
......@@ -581,8 +611,12 @@
static inline void Endpoint_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Word_BE(const uint16_t Word)
{
#if defined(__AVR32__)
// TODO
#elif defined(__AVR__)
UEDATX = (Word >> 8);
UEDATX = (Word & 0xFF);
#endif
}
/** Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints.
......@@ -594,8 +628,12 @@
{
uint8_t Dummy;
#if defined(__AVR32__)
// TODO
#elif defined(__AVR__)
Dummy = UEDATX;
Dummy = UEDATX;
#endif
}
/** Reads four bytes from the currently selected endpoint's bank in little endian format, for OUT
......@@ -614,10 +652,14 @@
uint8_t Bytes[4];
} Data;
#if defined(__AVR32__)
// TODO
#elif defined(__AVR__)
Data.Bytes[0] = UEDATX;
Data.Bytes[1] = UEDATX;
Data.Bytes[2] = UEDATX;
Data.Bytes[3] = UEDATX;
#endif
return Data.DWord;
}
......@@ -638,10 +680,14 @@
uint8_t Bytes[4];
} Data;
#if defined(__AVR32__)
// TODO
#elif defined(__AVR__)
Data.Bytes[3] = UEDATX;
Data.Bytes[2] = UEDATX;
Data.Bytes[1] = UEDATX;
Data.Bytes[0] = UEDATX;
#endif
return Data.DWord;
}
......@@ -656,10 +702,14 @@
static inline void Endpoint_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_DWord_LE(const uint32_t DWord)
{
#if defined(__AVR32__)
// TODO
#elif defined(__AVR__)
UEDATX = (DWord & 0xFF);
UEDATX = (DWord >> 8);
UEDATX = (DWord >> 16);
UEDATX = (DWord >> 24);
#endif
}
/** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN
......@@ -672,10 +722,14 @@
static inline void Endpoint_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_DWord_BE(const uint32_t DWord)
{
#if defined(__AVR32__)
// TODO
#elif defined(__AVR__)
UEDATX = (DWord >> 24);
UEDATX = (DWord >> 16);
UEDATX = (DWord >> 8);
UEDATX = (DWord & 0xFF);
#endif
}
/** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints.
......@@ -687,10 +741,14 @@
{
uint8_t Dummy;
#if defined(__AVR32__)
// TODO
#elif defined(__AVR__)
Dummy = UEDATX;
Dummy = UEDATX;
Dummy = UEDATX;
Dummy = UEDATX;
#endif
}
/* External Variables: */
......
......@@ -41,10 +41,16 @@
#define __USBHOST_H__
/* Includes: */
#include <avr/io.h>
#include <stdbool.h>
#include <util/delay.h>
#if defined(__AVR32__)
#include <avr32/io.h>
#include <stdint.h>
#include <stdbool.h>
#elif defined(__AVR__)
#include <avr/io.h>
#include <stdbool.h>
#include <util/delay.h>
#endif
#include "../../../Common/Common.h"
#include "../HighLevel/USBInterrupt.h"
#include "../HighLevel/StdDescriptors.h"
......
......@@ -32,8 +32,14 @@
#define __HOSTCHAPTER9_H__
/* Includes: */
#include <avr/io.h>
#include <stdbool.h>
#if defined(__AVR32__)
#include <avr32/io.h>
#include <stdint.h>
#include <stdbool.h>
#elif defined(__AVR__)
#include <avr/io.h>
#include <stdbool.h>
#endif
#include "LowLevel.h"
#include "../HighLevel/USBMode.h"
......
......@@ -40,10 +40,16 @@
#define __USBLOWLEVEL_H__
/* Includes: */
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
#if defined(__AVR32__)
#include <avr32/io.h>
#include <stdint.h>
#include <stdbool.h>
#elif defined(__AVR__)
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
#endif
#include "../HighLevel/USBMode.h"
#include "../../../Common/Common.h"
......
......@@ -42,8 +42,14 @@
#define __USBOTG_H__
/* Includes: */
#include <avr/io.h>
#include <stdbool.h>
#if defined(__AVR32__)
#include <avr32/io.h>