Microchip® Advanced Software Framework

sysclk_auto.c File Reference

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.

Precondition
The USB generic clock must be configured to 48MHz.

References AVR32_SCIF_GC_NO_DIV_CLOCK, AVR32_SCIF_GCLK_USBC, scif_gc_enable(), scif_gc_setup(), and SCIF_GCCTRL_PLL0.