USB_CurrentMode = USB_MODE_None;\r
#endif\r
\r
+ AVR32_PM.GCCTRL[3].cen = false;\r
+\r
USB_IsInitialized = false;\r
}\r
\r
USB_INT_ClearAllInterrupts();\r
\r
USB_Controller_Reset();\r
+ \r
+ AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].pllsel = !(USB_Options & USB_OPT_GCLK_SRC_OSC);\r
+ AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].oscsel = !(USB_Options & USB_OPT_GCLK_CHANNEL_0);\r
+ AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].diven = (F_CLOCK != 48000000UL);\r
+ AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].div = ((F_CLOCK / 2) / 48000000UL);\r
+ AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].cen = true;\r
\r
#if defined(USB_CAN_BE_BOTH)\r
if (UIDModeSelectEnabled)\r
\r
/* Public Interface - May be used in end-application: */\r
/* Macros: */\r
+ /** \name USB Controller Option Masks */\r
+ //@{\r
+ /** Selects one of the system's main clock oscillators as the input clock to the USB Generic Clock source\r
+ * generation module. This indicates that an external oscillator should be used directly instead of an\r
+ * internal PLL clock source.\r
+ */\r
+ #define USB_OPT_GCLK_SRC_OSC (1 << 1)\r
+\r
+ /** Selects one of the system's PLL oscillators as the input clock to the USB Generic Clock source\r
+ * generation module. This indicates that one of the device's PLL outputs should be used instead of an\r
+ * external oscillator source.\r
+ */\r
+ #define USB_OPT_GCLK_SRC_PLL (0 << 1)\r
+\r
+ /** Selects PLL or External Oscillator 0 as the USB Generic Clock source module input clock. */\r
+ #define USB_OPT_GCLK_CHANNEL_0 (1 << 2)\r
+\r
+ /** Selects PLL or External Oscillator 1 as the USB Generic Clock source module input clock. */\r
+ #define USB_OPT_GCLK_CHANNEL_1 (0 << 2)\r
+ //@}\r
+\r
/** \name Endpoint/Pipe Type Masks */\r
//@{\r
/** Mask for a CONTROL type endpoint or pipe.\r
\r
/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
+ /* Macros: */\r
+ #define USB_GCLK_USBB_INDEX 3\r
+ \r
/* Function Prototypes: */\r
#if defined(__INCLUDE_FROM_USB_CONTROLLER_C)\r
#if defined(USB_CAN_BE_DEVICE)\r