![]() |
LUFA Library
120219
|
Module Clock Driver for the AVR32 UC3 microcontrollers. More...
Enumerations | |
enum | UC3_Extern_OSC_ClockTypes_t { EXOSC_MODE_CLOCK = AVR32_PM_OSCCTRL0_MODE_EXT_CLOCK, EXOSC_MODE_900KHZ_MAX = AVR32_PM_OSCCTRL0_MODE_CRYSTAL_G0, EXOSC_MODE_3MHZ_MAX = AVR32_PM_OSCCTRL0_MODE_CRYSTAL_G1, EXOSC_MODE_8MHZ_MAX = AVR32_PM_OSCCTRL0_MODE_CRYSTAL_G2, EXOSC_MODE_8MHZ_OR_MORE = AVR32_PM_OSCCTRL0_MODE_CRYSTAL_G3 } |
enum | UC3_Extern_OSC_ClockStartup_t { EXOSC_START_0CLK = AVR32_PM_OSCCTRL0_STARTUP_0_RCOSC, EXOSC_START_64CLK = AVR32_PM_OSCCTRL0_STARTUP_64_RCOSC, EXOSC_START_128CLK = AVR32_PM_OSCCTRL0_STARTUP_128_RCOSC, EXOSC_START_2048CLK = AVR32_PM_OSCCTRL0_STARTUP_2048_RCOSC, EXOSC_START_4096CLK = AVR32_PM_OSCCTRL0_STARTUP_4096_RCOSC, EXOSC_START_8192CLK = AVR32_PM_OSCCTRL0_STARTUP_8192_RCOSC, EXOSC_START_16384CLK = AVR32_PM_OSCCTRL0_STARTUP_16384_RCOSC } |
enum | UC3_System_ClockSource_t { CLOCK_SRC_SLOW_CLK = 0, CLOCK_SRC_OSC0 = 1, CLOCK_SRC_OSC1 = 2, CLOCK_SRC_PLL0 = 3, CLOCK_SRC_PLL1 = 4 } |
Functions | |
static bool | AVR32CLK_StartExternalOscillator (const uint8_t Channel, const uint8_t Type, const uint8_t Startup) ATTR_ALWAYS_INLINE |
static void | AVR32CLK_StopExternalOscillator (const uint8_t Channel) ATTR_ALWAYS_INLINE |
static bool | AVR32CLK_StartPLL (const uint8_t Channel, const uint8_t Source, const uint32_t SourceFreq, const uint32_t Frequency) ATTR_ALWAYS_INLINE |
static void | AVR32CLK_StopPLL (const uint8_t Channel) ATTR_ALWAYS_INLINE |
static bool | AVR32CLK_StartGenericClock (const uint8_t Channel, const uint8_t Source, const uint32_t SourceFreq, const uint32_t Frequency) ATTR_ALWAYS_INLINE |
static void | AVR32CLK_StopGenericClock (const uint8_t Channel) ATTR_ALWAYS_INLINE |
static bool | AVR32CLK_SetCPUClockSource (const uint8_t Source, const uint32_t SourceFreq) ATTR_ALWAYS_INLINE |
The following files must be built with any user project that uses this module:
Clock management driver for the AVR32 UC3 microcontrollers. This driver allows for the configuration of the various clocks within the device to clock the various peripherals.
Usage Example:
#include <LUFA/Platform/UC3/ClockManagement.h> void main(void) { // Start the master external oscillator which will be used as the main clock reference AVR32CLK_StartExternalOscillator(0, EXOSC_MODE_8MHZ_OR_MORE, EXOSC_START_0CLK); // Start the PLL for the CPU clock, switch CPU to it AVR32CLK_StartPLL(0, CLOCK_SRC_OSC0, 12000000, F_CPU); AVR32CLK_SetCPUClockSource(CLOCK_SRC_PLL0, F_CPU); // Start the PLL for the USB Generic Clock module AVR32CLK_StartPLL(1, CLOCK_SRC_OSC0, 12000000, 48000000); }
Enum for the possible external oscillator statup times.
Enum for the possible external oscillator types.
Enum for the possible module clock sources.
static bool AVR32CLK_SetCPUClockSource | ( | const uint8_t | Source, |
const uint32_t | SourceFreq | ||
) | [inline, static] |
Sets the clock source for the main microcontroller core. The given clock source should be configured and ready for use before this function is called.
This function will configure the FLASH controller's wait states automatically to suit the given clock source.
[in] | Source | Clock source for the CPU core, a value from UC3_System_ClockSource_t. |
[in] | SourceFreq | Frequency of the CPU core's clock source, in Hz. |
true
if the CPU core clock was sucessfully altered, false
if invalid parameters specified. static bool AVR32CLK_StartExternalOscillator | ( | const uint8_t | Channel, |
const uint8_t | Type, | ||
const uint8_t | Startup | ||
) | [inline, static] |
Starts the given external oscillator of the UC3 microcontroller, with the given options. This routine blocks until the oscillator is ready for use.
[in] | Channel | Index of the external oscillator to start. |
[in] | Type | Type of clock attached to the given oscillator channel, a value from UC3_Extern_OSC_ClockTypes_t. |
[in] | Startup | Statup time of the external oscillator, a value from UC3_Extern_OSC_ClockStartup_t. |
true
if the external oscillator was successfully started, false
if invalid parameters specified. static bool AVR32CLK_StartGenericClock | ( | const uint8_t | Channel, |
const uint8_t | Source, | ||
const uint32_t | SourceFreq, | ||
const uint32_t | Frequency | ||
) | [inline, static] |
Starts the given Generic Clock of the UC3 microcontroller, with the given options.
[in] | Channel | Index of the Generic Clock to start. |
[in] | Source | Clock source for the Generic Clock, a value from UC3_System_ClockSource_t. |
[in] | SourceFreq | Frequency of the Generic Clock's clock source, in Hz. |
[in] | Frequency | Target frequency of the Generic Clock's output. |
true
if the Generic Clock was successfully started, false
if invalid parameters specified. static bool AVR32CLK_StartPLL | ( | const uint8_t | Channel, |
const uint8_t | Source, | ||
const uint32_t | SourceFreq, | ||
const uint32_t | Frequency | ||
) | [inline, static] |
Starts the given PLL of the UC3 microcontroller, with the given options. This routine blocks until the PLL is ready for use.
[in] | Channel | Index of the PLL to start. |
[in] | Source | Clock source for the PLL, a value from UC3_System_ClockSource_t. |
[in] | SourceFreq | Frequency of the PLL's clock source, in Hz. |
[in] | Frequency | Target frequency of the PLL's output. |
true
if the PLL was successfully started, false
if invalid parameters specified. static void AVR32CLK_StopExternalOscillator | ( | const uint8_t | Channel | ) | [inline, static] |
Stops the given external oscillator of the UC3 microcontroller.
[in] | Channel | Index of the external oscillator to stop. |
static void AVR32CLK_StopGenericClock | ( | const uint8_t | Channel | ) | [inline, static] |
Stops the given generic clock of the UC3 microcontroller.
[in] | Channel | Index of the generic clock to stop. |
static void AVR32CLK_StopPLL | ( | const uint8_t | Channel | ) | [inline, static] |
Stops the given PLL of the UC3 microcontroller.
[in] | Channel | Index of the PLL to stop. |