Microchip® Advanced Software Framework

xmega/osc.h File Reference

Chip-specific oscillator management functions.

Copyright (c) 2010-2018 Microchip Technology Inc. and its subsidiaries.

#include <compiler.h>
#include <board.h>

Macros

#define BOARD_XOSC_STARTUP_CYCLES   (BOARD_XOSC_HZ / 1000000 * BOARD_XOSC_STARTUP_US)
 
#define CONFIG_XOSC_32KHZ_LPM
 Define for enabling Low Power Mode for 32 kHz external oscillator. More...
 
#define CONFIG_XOSC_RANGE   0
 Board-dependent value that sets the frequency range of the external oscillator. More...
 
#define CONFIG_XOSC_STARTUP   0
 Board-dependent value that determines the number of start-up cycles for external resonators, based on BOARD_XOSC_STARTUP_US. More...
 
Oscillator identifiers
#define OSC_ID_RC2MHZ   OSC_RC2MEN_bm
 2 MHz Internal RC Oscillator More...
 
#define OSC_ID_RC32MHZ   OSC_RC32MEN_bm
 32 MHz Internal RC Oscillator More...
 
#define OSC_ID_RC32KHZ   OSC_RC32KEN_bm
 32 KHz Internal RC Oscillator More...
 
#define OSC_ID_XOSC   OSC_XOSCEN_bm
 External Oscillator. More...
 
#define OSC_ID_RC8MHZ   OSC_RC8MEN_bm
 8 MHz Internal RC Oscillator More...
 
#define OSC_ID_USBSOF   0xff
 Reference from USB Start Of Frame. More...
 
External oscillator types
#define XOSC_TYPE_EXTERNAL   0
 External clock signal. More...
 
#define XOSC_TYPE_32KHZ   2
 32.768 kHz resonator on TOSC More...
 
#define XOSC_TYPE_XTAL   3
 0.4 to 16 MHz resonator on XTAL More...
 
XTAL resonator start-up cycles
#define XOSC_STARTUP_256   0
 256 cycle start-up time More...
 
#define XOSC_STARTUP_1024   1
 1 k cycle start-up time More...
 
#define XOSC_STARTUP_16384   2
 16 k cycle start-up time More...
 
XTAL resonator frequency range
#define XOSC_RANGE_04TO2   OSC_FRQRANGE_04TO2_gc
 0.4 to 2 MHz frequency range More...
 
#define XOSC_RANGE_2TO9   OSC_FRQRANGE_2TO9_gc
 2 to 9 MHz frequency range More...
 
#define XOSC_RANGE_9TO12   OSC_FRQRANGE_9TO12_gc
 9 to 12 MHz frequency range More...
 
#define XOSC_RANGE_12TO16   OSC_FRQRANGE_12TO16_gc
 12 to 16 MHz frequency range More...
 

Functions

static void osc_enable_external (uint8_t id)
 Enable external oscillator id. More...
 
static void osc_enable_internal (uint8_t id)
 Enable internal oscillator id. More...
 
Oscillator Management
static void osc_disable (uint8_t id)
 Disable oscillator id. More...
 
static void osc_enable (uint8_t id)
 Enable oscillator id. More...
 
static bool osc_is_ready (uint8_t id)
 Determine whether oscillator id is ready. More...
 
static uint32_t osc_get_rate (uint8_t id)
 Return the frequency of oscillator id in Hz. More...
 
XMEGA-Specific Oscillator Features
static void osc_enable_autocalibration (uint8_t id, uint8_t ref_id)
 Enable DFLL-based automatic calibration of an internal oscillator. More...
 
static void osc_disable_autocalibration (uint8_t id)
 Disable DFLL-based automatic calibration of an internal oscillator. More...
 
static void osc_user_calibration (uint8_t id, uint16_t calib)
 Load a specific calibration value for the specified oscillator. More...