Module Clock Driver for the AVR USB XMEGA microcontrollers. More...
Enumerations | |
enum | XMEGA_Extern_OSC_ClockFrequency_t { EXOSC_FREQ_2MHZ_MAX = OSC_FRQRANGE_04TO2_gc, EXOSC_FREQ_9MHZ_MAX = OSC_FRQRANGE_2TO9_gc, EXOSC_FREQ_12MHZ_MAX = OSC_FRQRANGE_9TO12_gc, EXOSC_FREQ_16MHZ_MAX = OSC_FRQRANGE_12TO16_gc } |
enum | XMEGA_Extern_OSC_ClockStartup_t { EXOSC_START_6CLK = OSC_XOSCSEL_EXTCLK_gc, EXOSC_START_32KCLK = OSC_XOSCSEL_32KHz_gc, EXOSC_START_256CLK = OSC_XOSCSEL_XTAL_256CLK_gc, EXOSC_START_1KCLK = OSC_XOSCSEL_XTAL_1KCLK_gc, EXOSC_START_16KCLK = OSC_XOSCSEL_XTAL_16KCLK_gc } |
enum | XMEGA_System_ClockSource_t { CLOCK_SRC_INT_RC2MHZ = 0, CLOCK_SRC_INT_RC32MHZ = 1, CLOCK_SRC_INT_RC32KHZ = 2, CLOCK_SRC_XOSC = 3, CLOCK_SRC_PLL = 4 } |
enum | XMEGA_System_DFLLReference_t { DFLL_REF_INT_RC32KHZ = 0, DFLL_REF_EXT_RC32KHZ = 1, DFLL_REF_INT_USBSOF = 2 } |
Functions | |
static void | XMEGACLK_CCP_Write (volatile void *Address, const uint8_t Value) ATTR_ALWAYS_INLINE |
static bool | XMEGACLK_SetCPUClockSource (const uint8_t Source) ATTR_ALWAYS_INLINE |
static bool | XMEGACLK_StartDFLL (const uint8_t Source, const uint8_t Reference, const uint32_t Frequency) ATTR_ALWAYS_INLINE |
static bool | XMEGACLK_StartExternalOscillator (const uint8_t FreqRange, const uint8_t Startup) ATTR_ALWAYS_INLINE |
static uint8_t | XMEGACLK_StartInternalOscillator (const uint8_t Source) ATTR_ALWAYS_INLINE |
static bool | XMEGACLK_StartPLL (const uint8_t Source, const uint32_t SourceFreq, const uint32_t Frequency) ATTR_ALWAYS_INLINE |
static bool | XMEGACLK_StopDFLL (const uint8_t Source) ATTR_ALWAYS_INLINE |
static void | XMEGACLK_StopExternalOscillator (void) ATTR_ALWAYS_INLINE |
static bool | XMEGACLK_StopInternalOscillator (const uint8_t Source) ATTR_ALWAYS_INLINE |
static void | XMEGACLK_StopPLL (void) ATTR_ALWAYS_INLINE |
The following files must be built with any user project that uses this module:
Clock management driver for the AVR USB XMEGA microcontrollers. This driver allows for the configuration of the various clocks within the device to clock the various peripherals.
Usage Example:
Enum for the possible external oscillator frequency ranges.
Enum for the possible external oscillator startup times.
Enum for the possible module clock sources.
Enum for the possible DFLL clock reference sources.
|
inlinestatic |
Write a value to a location protected by the XMEGA CCP protection mechanism. This function uses inline assembly to ensure that the protected address is written to within four clock cycles of the CCP key being written.
[in] | Address | Address to write to, a memory address protected by the CCP mechanism |
[in] | Value | Value to write to the protected location |
|
inlinestatic |
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.
[in] | Source | Clock source for the CPU core, a value from XMEGA_System_ClockSource_t. |
true
if the CPU core clock was successfully altered, false
if invalid parameters specified.
|
inlinestatic |
Starts the DFLL of the XMEGA microcontroller, with the given options.
[in] | Source | RC Clock source for the DFLL, a value from XMEGA_System_ClockSource_t. |
[in] | Reference | Reference clock source for the DFLL, an value from XMEGA_System_DFLLReference_t. |
[in] | Frequency | Target frequency of the DFLL's output. |
true
if the DFLL was successfully started, false
if invalid parameters specified.
|
inlinestatic |
Starts the external oscillator of the XMEGA microcontroller, with the given options. This routine blocks until the oscillator is ready for use.
[in] | FreqRange | Frequency range of the external oscillator, a value from XMEGA_Extern_OSC_ClockFrequency_t. |
[in] | Startup | Startup time of the external oscillator, a value from XMEGA_Extern_OSC_ClockStartup_t. |
true
if the external oscillator was successfully started, false
if invalid parameters specified.
|
inlinestatic |
Starts the given internal oscillator of the XMEGA microcontroller, with the given options. This routine blocks until the oscillator is ready for use.
[in] | Source | Internal oscillator to start, a value from XMEGA_System_ClockSource_t. |
true
if the internal oscillator was successfully started, false
if invalid parameters specified.
|
inlinestatic |
Starts the PLL of the XMEGA microcontroller, with the given options. This routine blocks until the PLL is ready for use.
[in] | Source | Clock source for the PLL, a value from XMEGA_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.
|
inlinestatic |
Stops the given DFLL of the XMEGA microcontroller.
[in] | Source | RC Clock source for the DFLL to be stopped, a value from XMEGA_System_ClockSource_t. |
true
if the DFLL was successfully stopped, false
if invalid parameters specified.
|
inlinestatic |
Stops the external oscillator of the XMEGA microcontroller.
|
inlinestatic |
Stops the given internal oscillator of the XMEGA microcontroller.
[in] | Source | Internal oscillator to stop, a value from XMEGA_System_ClockSource_t. |
true
if the internal oscillator was successfully stopped, false
if invalid parameters specified.
|
inlinestatic |
Stops the PLL of the XMEGA microcontroller.