Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Erik Strand
lufa
Commits
6005a421
Commit
6005a421
authored
Mar 13, 2011
by
Dean Camera
Browse files
Add experimental support for the UC3A0, UC3A1 and UC3A3 series AVR32 microcontrollers.
parent
f301a4a2
Changes
5
Hide whitespace changes
Inline
Side-by-side
LUFA/Common/Common.h
View file @
6005a421
...
...
@@ -214,6 +214,12 @@
*/
#define GCC_FORCE_POINTER_ACCESS(StructPtr) __asm__ __volatile__("" : "=b" (StructPtr) : "0" (StructPtr))
/** Forces GCC to create a memory barrier, ensuring that memory accesses are not reordered past the barrier point.
* This can be used before ordering-critical operations, to ensure that the compiler does not re-order the resulting
* assembly output in an unexpected manner on sections of code that are ordering-specific.
*/
#define GCC_MEMORY_BARRIER() __asm__ __volatile__("" ::: "memory");
/* Inline Functions: */
/** Function to reverse the individual bits in a byte - i.e. bit 7 is moved to bit 0, bit 6 to bit 1,
* etc.
...
...
LUFA/Drivers/USB/Core/StdDescriptors.h
View file @
6005a421
...
...
@@ -76,17 +76,24 @@
*/
#define NO_DESCRIPTOR 0
/** Macro to calculate the power value for the configuration descriptor, from a given number of milliamperes. */
/** Macro to calculate the power value for the configuration descriptor, from a given number of milliamperes.
*
* \param[in] mA Maximum number of milliamps the device consumes when the given configuration is selected.
*/
#define USB_CONFIG_POWER_MA(mA) ((mA) >> 1)
/** Macro to calculate the Unicode length of a string with a given number of Unicode characters.
* Should be used in string descriptor's headers for giving the string descriptor's byte length.
*
* \param[in] UnicodeChars Number of Unicode characters in the string text.
*/
#define USB_STRING_LEN(
str)
(sizeof(USB_Descriptor_Header_t) + ((
str
) << 1))
#define USB_STRING_LEN(
UnicodeChars)
(sizeof(USB_Descriptor_Header_t) + ((
UnicodeChars
) << 1))
/** Macro to encode a given four digit floating point version number (e.g. 01.23) into Binary Coded
* Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the
* standard device descriptor.
*
* \param[in] x Version number to encode as a 16-bit little-endian number, as a floating point number.
*/
#define VERSION_BCD(x) CPU_TO_LE16((((VERSION_TENS(x) << 4) | VERSION_ONES(x)) << 8) | \
((VERSION_TENTHS(x) << 4) | VERSION_HUNDREDTHS(x)))
...
...
LUFA/Drivers/USB/Core/UC3B/USBController_UC3B.c
View file @
6005a421
...
...
@@ -104,11 +104,11 @@ void USB_ResetInterface(void)
bool
UIDModeSelectEnabled
=
AVR32_USBB
.
USBCON
.
uide
;
#endif
AVR32_PM
.
GCCTRL
[
USB
_GCLK_USBB
_INDEX
].
pllsel
=
!
(
USB_Options
&
USB_OPT_GCLK_SRC_OSC
);
AVR32_PM
.
GCCTRL
[
USB
_GCLK_USBB
_INDEX
].
oscsel
=
!
(
USB_Options
&
USB_OPT_GCLK_CHANNEL_0
);
AVR32_PM
.
GCCTRL
[
USB
_GCLK_USBB
_INDEX
].
diven
=
(
F_CLOCK
!=
48000000UL
);
AVR32_PM
.
GCCTRL
[
USB
_GCLK_USBB
_INDEX
].
div
=
(
F_CLOCK
==
48000000UL
)
?
0
:
(
uint32_t
)(((
F_CLOCK
/
48000000UL
)
-
1
)
/
2
);
AVR32_PM
.
GCCTRL
[
USB
_GCLK_USBB
_INDEX
].
cen
=
true
;
AVR32_PM
.
GCCTRL
[
AVR32_PM
_GCLK_USBB
].
pllsel
=
!
(
USB_Options
&
USB_OPT_GCLK_SRC_OSC
);
AVR32_PM
.
GCCTRL
[
AVR32_PM
_GCLK_USBB
].
oscsel
=
!
(
USB_Options
&
USB_OPT_GCLK_CHANNEL_0
);
AVR32_PM
.
GCCTRL
[
AVR32_PM
_GCLK_USBB
].
diven
=
(
F_CLOCK
!=
USB_CLOCK_REQUIRED_FREQ
);
AVR32_PM
.
GCCTRL
[
AVR32_PM
_GCLK_USBB
].
div
=
(
F_CLOCK
==
USB_CLOCK_REQUIRED_FREQ
)
?
0
:
(
uint32_t
)(((
F_CLOCK
/
USB_CLOCK_REQUIRED_FREQ
)
-
1
)
/
2
);
AVR32_PM
.
GCCTRL
[
AVR32_PM
_GCLK_USBB
].
cen
=
true
;
USB_INT_DisableAllInterrupts
();
USB_INT_ClearAllInterrupts
();
...
...
LUFA/Drivers/USB/Core/UC3B/USBController_UC3B.h
View file @
6005a421
...
...
@@ -293,8 +293,12 @@
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#define USB_GCLK_USBB_INDEX 3
/* Macros: */
#if defined(USB_SERIES_UC3A3_AVR)
#define USB_CLOCK_REQUIRED_FREQ 12000000UL
#else
#define USB_CLOCK_REQUIRED_FREQ 48000000UL
#endif
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_USB_CONTROLLER_C)
...
...
LUFA/Drivers/USB/Core/USBMode.h
View file @
6005a421
...
...
@@ -62,30 +62,50 @@
/* Public Interface - May be used in end-application: */
#if defined(__DOXYGEN__)
/** Indicates that the target AVR microcontroller belongs to the Series 2 USB controller
/** Indicates that the target AVR microcontroller belongs to the Series 2
AVR8
USB controller
* (i.e. AT90USBxxx2 or ATMEGAxxU2) when defined.
*/
#define USB_SERIES_2_AVR
/** Indicates that the target AVR microcontroller belongs to the Series 4 USB controller
/** Indicates that the target AVR microcontroller belongs to the Series 4
AVR8
USB controller
* (i.e. ATMEGAxxU4) when defined.
*/
#define USB_SERIES_4_AVR
/** Indicates that the target AVR microcontroller belongs to the Series 6 USB controller
/** Indicates that the target AVR microcontroller belongs to the Series 6
AVR8
USB controller
* (i.e. AT90USBxxx6) when defined.
*/
#define USB_SERIES_6_AVR
/** Indicates that the target AVR microcontroller belongs to the Series 7 USB controller
/** Indicates that the target AVR microcontroller belongs to the Series 7
AVR8
USB controller
* (i.e. AT90USBxxx7) when defined.
*/
#define USB_SERIES_7_AVR
/** Indicates that the target AVR microcontroller belongs to the UC3
B
Series USB controller
* (i.e. AT32UC3
B
*) when defined.
/** Indicates that the target AVR microcontroller belongs to the
AVR32
UC3
A0
Series USB controller
* (i.e. AT32UC3
A0
*) when defined.
*/
#define USB_SERIES_UC3B_AVR
#define USB_SERIES_UC3A0_AVR
/** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A1 Series USB controller
* (i.e. AT32UC3A1*) when defined.
*/
#define USB_SERIES_UC3A1_AVR
/** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A3 Series USB controller
* (i.e. AT32UC3A3*) when defined.
*/
#define USB_SERIES_UC3A3_AVR
/** Indicates that the target AVR microcontroller belongs to the AVR32 UC3B0 Series USB controller
* (i.e. AT32UC3B0*) when defined.
*/
#define USB_SERIES_UC3B0_AVR
/** Indicates that the target AVR microcontroller belongs to the AVR32 UC3B1 Series USB controller
* (i.e. AT32UC3B1*) when defined.
*/
#define USB_SERIES_UC3B1_AVR
/** Indicates that the target microcontroller and compilation settings allow for the
* target to be configured in USB Device mode when defined.
...
...
@@ -117,11 +137,30 @@
#define USB_SERIES_7_AVR
#define USB_CAN_BE_DEVICE
#define USB_CAN_BE_HOST
#elif (defined(__AVR32_UC3B0512__) || defined(__AVR32_UC3B1512__) || \
defined(__AVR32_UC3B0256__) || defined(__AVR32_UC3B1256__) || \
defined(__AVR32_UC3B0128__) || defined(__AVR32_UC3B1128__) || \
defined(__AVR32_UC3B064__) || defined(__AVR32_UC3B164__))
#define USB_SERIES_UC3B_AVR
#elif (defined(__AVR32_UC3A0512__) || defined(__AVR32_UC3A0256__) || \
defined(__AVR32_UC3A0128__) || defined(__AVR32_UC3A064__))
#define USB_SERIES_UC3A0_AVR
#define USB_CAN_BE_DEVICE
#define USB_CAN_BE_HOST
#elif (defined(__AVR32_UC3A1512__) || defined(__AVR32_UC3A1256__) || \
defined(__AVR32_UC3A1128__) || defined(__AVR32_UC3A164__))
#define USB_SERIES_UC3A1_AVR
#define USB_CAN_BE_DEVICE
#define USB_CAN_BE_HOST
#elif (defined(__AVR32_UC3A3256__) || defined(__AVR32_UC3A3256S__) || \
defined(__AVR32_UC3A3128__) || defined(__AVR32_UC3A3128S__) || \
defined(__AVR32_UC3A364__) || defined(__AVR32_UC3A364S__))
#define USB_SERIES_UC3A3_AVR
#define USB_CAN_BE_DEVICE
#define USB_CAN_BE_HOST
#elif (defined(__AVR32_UC3B0512__) || defined(__AVR32_UC3B0256__) || \
defined(__AVR32_UC3B0128__) || defined(__AVR32_UC3B064__))
#define USB_SERIES_UC3B0_AVR
#define USB_CAN_BE_DEVICE
#define USB_CAN_BE_HOST
#elif (defined(__AVR32_UC3B1512__) || defined(__AVR32_UC3B1256__) || \
defined(__AVR32_UC3B1128__) || defined(__AVR32_UC3B164__))
#define USB_SERIES_UC3B1_AVR
#define USB_CAN_BE_DEVICE
#define USB_CAN_BE_HOST
#endif
...
...
@@ -153,7 +192,7 @@
#endif
#if (!defined(USB_CAN_BE_DEVICE) && !defined(USB_CAN_BE_HOST))
#error The currently selected architecture is not supported under the USB component of the library.
#error The currently selected
device or
architecture is not supported under the USB component of the library.
#endif
#endif
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment