Application-specific system clock management to support automatic detection of external oscillator.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
#include "preprocessor.h"
#include "compiler.h"
#include "board.h"
#include "pm_uc3c.h"
#include "scif_uc3c.h"
#include "ast.h"
#include "cycle_counter.h"
#include "flashc.h"
#include "sysclk_auto.h"
#include "freq_detect.h"
Functions | |
External routines required by main.c file and usbc driver | |
void | sysclk_auto_init (void) |
Detects extern OSC frequency and initialize system clocks on it. More... | |
void | sysclk_auto_enable_usb (void) |
Enable the USB generic clock. More... | |
void | sysclk_auto_disable_usb (void) |
Disable the USB generic clock. More... | |
External routines required by frequency detection service | |
void | freq_detect_iface_ref_cnt_reset (void) |
Callback used to reset the counter of the reference's oscillator. More... | |
int | freq_detect_iface_ref_cnt_value (void) |
Callback used to read the counter value of the reference's oscillator. More... | |
void | freq_detect_iface_target_cnt_reset (void) |
Callback used to reset the counter of the target oscillator. More... | |
int | freq_detetc_iface_target_cnt_value (void) |
Callback used to read the counter value of the target oscillator. More... | |
void sysclk_auto_disable_usb | ( | void | ) |
Disable the USB generic clock.
References AVR32_SCIF_GC_NO_DIV_CLOCK, AVR32_SCIF_GCLK_USBC, scif_gc_setup(), and SCIF_GCCTRL_PLL0.
void sysclk_auto_enable_usb | ( | void | ) |
Enable the USB generic clock.
References AVR32_SCIF_GC_NO_DIV_CLOCK, AVR32_SCIF_GCLK_USBC, scif_gc_enable(), scif_gc_setup(), and SCIF_GCCTRL_PLL0.
void sysclk_auto_init | ( | void | ) |
Detects extern OSC frequency and initialize system clocks on it.
References ast_enable(), ast_init_counter(), AST_OSC_RC, AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, scif_pll_opt_t::div, flashc_set_flash_waitstate_and_readmode(), flashc_set_wait_state(), freq_detect_start(), scif_pll_opt_t::lockcount, scif_pll_opt_t::mul, scif_pll_opt_t::osc, u_avr32_scif_oscctrl_t::OSCCTRL, scif_pll_opt_t::pll_div2, scif_pll_opt_t::pll_freq, scif_pll_opt_t::pll_wbwdisable, PM_CLK_DOMAIN_0, PM_CLK_DOMAIN_1, PM_CLK_DOMAIN_2, PM_CLK_DOMAIN_3, PM_CLK_DOMAIN_4, PM_CLK_SRC_OSC0, PM_CLK_SRC_PLL0, pm_disable_clk_domain_div(), pm_set_mclk_source(), scif_enable_osc(), SCIF_OSC0, SCIF_OSC_MODE_2PIN_CRYSTAL, SCIF_PLL0, scif_pll_enable(), scif_pll_setup(), SCIF_UNLOCK, and scif_wait_for_pll_locked().
Referenced by main().