Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lufa
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Erik Strand
lufa
Commits
6005a421
Commit
6005a421
authored
Mar 13, 2011
by
Dean Camera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add experimental support for the UC3A0, UC3A1 and UC3A3 series AVR32 microcontrollers.
parent
f301a4a2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
78 additions
and
22 deletions
+78
-22
LUFA/Common/Common.h
LUFA/Common/Common.h
+6
-0
LUFA/Drivers/USB/Core/StdDescriptors.h
LUFA/Drivers/USB/Core/StdDescriptors.h
+9
-2
LUFA/Drivers/USB/Core/UC3B/USBController_UC3B.c
LUFA/Drivers/USB/Core/UC3B/USBController_UC3B.c
+5
-5
LUFA/Drivers/USB/Core/UC3B/USBController_UC3B.h
LUFA/Drivers/USB/Core/UC3B/USBController_UC3B.h
+6
-2
LUFA/Drivers/USB/Core/USBMode.h
LUFA/Drivers/USB/Core/USBMode.h
+52
-13
No files found.
LUFA/Common/Common.h
View file @
6005a421
...
@@ -214,6 +214,12 @@
...
@@ -214,6 +214,12 @@
*/
*/
#define GCC_FORCE_POINTER_ACCESS(StructPtr) __asm__ __volatile__("" : "=b" (StructPtr) : "0" (StructPtr))
#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: */
/* 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,
/** Function to reverse the individual bits in a byte - i.e. bit 7 is moved to bit 0, bit 6 to bit 1,
* etc.
* etc.
...
...
LUFA/Drivers/USB/Core/StdDescriptors.h
View file @
6005a421
...
@@ -76,17 +76,24 @@
...
@@ -76,17 +76,24 @@
*/
*/
#define NO_DESCRIPTOR 0
#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)
#define USB_CONFIG_POWER_MA(mA) ((mA) >> 1)
/** Macro to calculate the Unicode length of a string with a given number of Unicode characters.
/** 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.
* 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
/** 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
* Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the
* standard device descriptor.
* 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) | \
#define VERSION_BCD(x) CPU_TO_LE16((((VERSION_TENS(x) << 4) | VERSION_ONES(x)) << 8) | \
((VERSION_TENTHS(x) << 4) | VERSION_HUNDREDTHS(x)))
((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)
...
@@ -104,11 +104,11 @@ void USB_ResetInterface(void)
bool
UIDModeSelectEnabled
=
AVR32_USBB
.
USBCON
.
uide
;
bool
UIDModeSelectEnabled
=
AVR32_USBB
.
USBCON
.
uide
;
#endif
#endif
AVR32_PM
.
GCCTRL
[
USB_GCLK_USBB_INDEX
].
pllsel
=
!
(
USB_Options
&
USB_OPT_GCLK_SRC_OSC
);
AVR32_PM
.
GCCTRL
[
AVR32_PM_GCLK_USBB
].
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
[
AVR32_PM_GCLK_USBB
].
oscsel
=
!
(
USB_Options
&
USB_OPT_GCLK_CHANNEL_0
);
AVR32_PM
.
GCCTRL
[
USB_GCLK_USBB_INDEX
].
diven
=
(
F_CLOCK
!=
48000000UL
);
AVR32_PM
.
GCCTRL
[
AVR32_PM_GCLK_USBB
].
diven
=
(
F_CLOCK
!=
USB_CLOCK_REQUIRED_FREQ
);
AVR32_PM
.
GCCTRL
[
USB_GCLK_USBB_INDEX
].
div
=
(
F_CLOCK
==
48000000UL
)
?
0
:
(
uint32_t
)(((
F_CLOCK
/
48000000UL
)
-
1
)
/
2
);
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
[
USB_GCLK_USBB_INDEX
].
cen
=
true
;
AVR32_PM
.
GCCTRL
[
AVR32_PM_GCLK_USBB
].
cen
=
true
;
USB_INT_DisableAllInterrupts
();
USB_INT_DisableAllInterrupts
();
USB_INT_ClearAllInterrupts
();
USB_INT_ClearAllInterrupts
();
...
...
LUFA/Drivers/USB/Core/UC3B/USBController_UC3B.h
View file @
6005a421
...
@@ -293,8 +293,12 @@
...
@@ -293,8 +293,12 @@
/* Private Interface - For use in library only: */
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
#if !defined(__DOXYGEN__)
/* Macros: */
/* Macros: */
#define USB_GCLK_USBB_INDEX 3
#if defined(USB_SERIES_UC3A3_AVR)
#define USB_CLOCK_REQUIRED_FREQ 12000000UL
#else
#define USB_CLOCK_REQUIRED_FREQ 48000000UL
#endif
/* Function Prototypes: */
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_USB_CONTROLLER_C)
#if defined(__INCLUDE_FROM_USB_CONTROLLER_C)
...
...
LUFA/Drivers/USB/Core/USBMode.h
View file @
6005a421
...
@@ -62,30 +62,50 @@
...
@@ -62,30 +62,50 @@
/* Public Interface - May be used in end-application: */
/* Public Interface - May be used in end-application: */
#if defined(__DOXYGEN__)
#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.
* (i.e. AT90USBxxx2 or ATMEGAxxU2) when defined.
*/
*/
#define USB_SERIES_2_AVR
#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.
* (i.e. ATMEGAxxU4) when defined.
*/
*/
#define USB_SERIES_4_AVR
#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.
* (i.e. AT90USBxxx6) when defined.
*/
*/
#define USB_SERIES_6_AVR
#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.
* (i.e. AT90USBxxx7) when defined.
*/
*/
#define USB_SERIES_7_AVR
#define USB_SERIES_7_AVR
/** Indicates that the target AVR microcontroller belongs to the
UC3B
Series USB controller
/** Indicates that the target AVR microcontroller belongs to the
AVR32 UC3A0
Series USB controller
* (i.e. AT32UC3
B
*) when defined.
* (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
/** Indicates that the target microcontroller and compilation settings allow for the
* target to be configured in USB Device mode when defined.
* target to be configured in USB Device mode when defined.
...
@@ -117,11 +137,30 @@
...
@@ -117,11 +137,30 @@
#define USB_SERIES_7_AVR
#define USB_SERIES_7_AVR
#define USB_CAN_BE_DEVICE
#define USB_CAN_BE_DEVICE
#define USB_CAN_BE_HOST
#define USB_CAN_BE_HOST
#elif (defined(__AVR32_UC3B0512__) || defined(__AVR32_UC3B1512__) || \
#elif (defined(__AVR32_UC3A0512__) || defined(__AVR32_UC3A0256__) || \
defined(__AVR32_UC3B0256__) || defined(__AVR32_UC3B1256__) || \
defined(__AVR32_UC3A0128__) || defined(__AVR32_UC3A064__))
defined(__AVR32_UC3B0128__) || defined(__AVR32_UC3B1128__) || \
#define USB_SERIES_UC3A0_AVR
defined(__AVR32_UC3B064__) || defined(__AVR32_UC3B164__))
#define USB_CAN_BE_DEVICE
#define USB_SERIES_UC3B_AVR
#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_DEVICE
#define USB_CAN_BE_HOST
#define USB_CAN_BE_HOST
#endif
#endif
...
@@ -153,7 +192,7 @@
...
@@ -153,7 +192,7 @@
#endif
#endif
#if (!defined(USB_CAN_BE_DEVICE) && !defined(USB_CAN_BE_HOST))
#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
#endif
#endif
...
...
Write
Preview
Markdown
is supported
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