Application-specific system clock management to support automatic detection of external oscillator.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include "preprocessor.h"
#include "compiler.h"
#include "board.h"
#include "pm_uc3l.h"
#include "scif_uc3l.h"
#include "flashcdw.h"
#include "ast.h"
#include "cycle_counter.h"
#include "sysclk_auto.h"
#include "freq_detect.h"
#include "gpio.h"
Data Structures | |
union | u_avr32_scif_oscctrl0_t |
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 scif_gc_setup().
void sysclk_auto_enable_usb | ( | void | ) |
Enable the USB generic clock.
References scif_gc_enable(), and scif_gc_setup().
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, flashcdw_set_flash_waitstate_and_readmode(), freq_detect_start(), u_avr32_scif_oscctrl0_t::oscctrl0, u_avr32_scif_oscctrl0_t::OSCCTRL0, PM_CKSEL_DIVRATIO_4, PM_CLK_SRC_OSC0, PM_CLK_SRC_RC120M, pm_set_clk_domain_div(), pm_set_mclk_source(), scif_enable_osc(), SCIF_OSC0, SCIF_OSC_MODE_2PIN_CRYSTAL, scif_pll0_enable(), scif_pll0_setup(), scif_start_rc120M(), SCIF_UNLOCK, and scif_wait_for_pll0_locked().
Referenced by main().