projects
/
pub
/
lufa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2d98e54
)
Add additional preprocessor sanity checks for the XMEGA platform based on the USB...
author
Dean Camera
<dean@fourwalledcubicle.com>
Sat, 5 May 2012 19:46:20 +0000
(19:46 +0000)
committer
Dean Camera
<dean@fourwalledcubicle.com>
Sat, 5 May 2012 19:46:20 +0000
(19:46 +0000)
LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h
patch
|
blob
|
blame
|
history
diff --git
a/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h
b/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h
index
268fe95
..
4d75cc2
100644
(file)
--- a/
LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h
+++ b/
LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h
@@
-92,10
+92,12
@@
*/
#define USB_DEVICE_OPT_LOWSPEED (1 << 0)
*/
#define USB_DEVICE_OPT_LOWSPEED (1 << 0)
- /** Mask for the Options parameter of the \ref 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)
+ #if (F_USB > 6000000)
+ /** Mask for the Options parameter of the \ref 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)
+ #endif
//@}
#if (!defined(NO_INTERNAL_SERIAL) || defined(__DOXYGEN__))
//@}
#if (!defined(NO_INTERNAL_SERIAL) || defined(__DOXYGEN__))
diff --git
a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
index
ffdca3a
..
844ef65
100644
(file)
--- a/
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
+++ b/
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
@@
-105,11
+105,15
@@
void USB_Disable(void)
void USB_ResetInterface(void)
{
void USB_ResetInterface(void)
{
+ #if defined(USB_DEVICE_OPT_FULLSPEED)
if (USB_Options & USB_DEVICE_OPT_LOWSPEED)
CLK.USBCTRL = (((F_USB / 6000000) - 1) << CLK_USBPSDIV_gp);
else
CLK.USBCTRL = (((F_USB / 48000000) - 1) << CLK_USBPSDIV_gp);
if (USB_Options & USB_DEVICE_OPT_LOWSPEED)
CLK.USBCTRL = (((F_USB / 6000000) - 1) << CLK_USBPSDIV_gp);
else
CLK.USBCTRL = (((F_USB / 48000000) - 1) << CLK_USBPSDIV_gp);
-
+ #else
+ CLK.USBCTRL = (((F_USB / 6000000) - 1) << CLK_USBPSDIV_gp);
+ #endif
+
if (USB_Options & USB_OPT_PLLCLKSRC)
CLK.USBCTRL |= (CLK_USBSRC_PLL_gc | CLK_USBSEN_bm);
else
if (USB_Options & USB_OPT_PLLCLKSRC)
CLK.USBCTRL |= (CLK_USBSRC_PLL_gc | CLK_USBSEN_bm);
else
diff --git
a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h
b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h
index
1cdb6f0
..
25402e8
100644
(file)
--- a/
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h
+++ b/
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h
@@
-95,7
+95,7
@@
#error F_USB is not defined. You must define F_USB to the frequency of the unprescaled USB controller clock in your project makefile.
#endif
#error F_USB is not defined. You must define F_USB to the frequency of the unprescaled USB controller clock in your project makefile.
#endif
- #if (
F_USB % 6000000
)
+ #if (
(F_USB % 6000000) || (F_USB < 6000000)
)
#error Invalid F_USB specified. F_USB must be a multiple of 6MHz for USB Low Speed operation, and a multiple of 48MHz for Full Speed operation.
#endif
#error Invalid F_USB specified. F_USB must be a multiple of 6MHz for USB Low Speed operation, and a multiple of 48MHz for Full Speed operation.
#endif