Chip-specific oscillator management functions.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | CONFIG_RCFAST_FRANGE 0 |
#define | OSC0_MODE_VALUE UNDEFINED |
Board-dependent value written to the MODE bitfield of PM_OSCCTRL(0) More... | |
#define | OSC0_STARTUP_TIMEOUT UNDEFINED |
Number of slow clock cycles to wait for OSC0 to start. More... | |
#define | OSC0_STARTUP_VALUE UNDEFINED |
Board-dependent value written to the STARTUP bitfield of PM_OSCCTRL(0) More... | |
#define | OSC32_MODE_VALUE UNDEFINED |
#define | OSC32_STARTUP_TIMEOUT UNDEFINED |
#define | OSC32_STARTUP_VALUE UNDEFINED |
Oscillator identifiers | |
#define | OSC_ID_OSC0 0 |
External Oscillator 0. More... | |
#define | OSC_ID_OSC32 1 |
External 32 kHz oscillator. More... | |
#define | OSC_ID_RC32K 2 |
Internal 32 kHz RC oscillator. More... | |
#define | OSC_ID_RC80M 3 |
Internal 80 MHz RC oscillator. More... | |
#define | OSC_ID_RCFAST 4 |
Internal 4-8-12 MHz RCFAST oscillator. More... | |
#define | OSC_ID_RC1M 5 |
Internal 1 MHz RC oscillator. More... | |
#define | OSC_ID_RCSYS 6 |
Internal System RC oscillator. More... | |
OSC0 mode values | |
#define | OSC_MODE_EXTERNAL 0 |
External clock connected to XIN. More... | |
#define | OSC_MODE_XTAL SCIF_OSCCTRL0_MODE |
Crystal connected to XIN/XOUT. More... | |
OSC32 mode values | |
#define | OSC32_MODE_EXTERNAL BSCIF_OSCCTRL32_MODE(0) |
External clock connected to XIN32. More... | |
#define | OSC32_MODE_XTAL BSCIF_OSCCTRL32_MODE(1) |
Crystal connected to XIN32/XOUT32. More... | |
#define | OSC32_MODE_XTAL_HC BSCIF_OSCCTRL32_MODE(4) |
Crystal connected to XIN32/XOUT32 in high current mode. More... | |
OSC0 startup values | |
#define | OSC_STARTUP_0 SCIF_OSCCTRL0_STARTUP(0) |
0 cycles More... | |
#define | OSC_STARTUP_64 SCIF_OSCCTRL0_STARTUP(1) |
64 cycles (560 us) More... | |
#define | OSC_STARTUP_128 SCIF_OSCCTRL0_STARTUP(2) |
128 cycles (1.1 ms) More... | |
#define | OSC_STARTUP_2048 SCIF_OSCCTRL0_STARTUP(3) |
2048 cycles (18 ms) More... | |
#define | OSC_STARTUP_4096 SCIF_OSCCTRL0_STARTUP(4) |
4096 cycles (36 ms) More... | |
#define | OSC_STARTUP_8192 SCIF_OSCCTRL0_STARTUP(5) |
8192 cycles (71 ms) More... | |
#define | OSC_STARTUP_16384 SCIF_OSCCTRL0_STARTUP(6) |
16384 cycles (143 ms) More... | |
#define | OSC_STARTUP_32768 SCIF_OSCCTRL0_STARTUP(7) |
32768 cycles (285 ms) More... | |
OSC32 startup values | |
#define | OSC32_STARTUP_0 BSCIF_OSCCTRL32_STARTUP(0) |
0 cycles More... | |
#define | OSC32_STARTUP_128 BSCIF_OSCCTRL32_STARTUP(1) |
128 cycles (1.1 ms) More... | |
#define | OSC32_STARTUP_8192 BSCIF_OSCCTRL32_STARTUP(2) |
8192 cycles (72.3 ms) More... | |
#define | OSC32_STARTUP_16384 BSCIF_OSCCTRL32_STARTUP(3) |
16384 cycles (143 ms) More... | |
#define | OSC32_STARTUP_65536 BSCIF_OSCCTRL32_STARTUP(4) |
65536 cycles (570 ms) More... | |
#define | OSC32_STARTUP_131072 BSCIF_OSCCTRL32_STARTUP(5) |
131072 cycles (1.1 s) More... | |
#define | OSC32_STARTUP_262144 BSCIF_OSCCTRL32_STARTUP(6) |
262144 cycles (2.3 s) More... | |
#define | OSC32_STARTUP_524288 BSCIF_OSCCTRL32_STARTUP(7) |
524288 cycles (4.6 s) More... | |
Board-specific configuration parameters | |
The following definitions must be provided by the board code for all working oscillators on the board. | |
#define | BOARD_OSC32_SELCURR BSCIF_OSCCTRL32_SELCURR(10) |
Crystal current selection for OSC32. More... | |
RC oscillator frequency limits | |
The frequency of the internal RC oscillators may drift a bit as a result of temperature changes. These definitions provide upper and lower limits which may be used to calculate upper and lower limits of timeouts, derived clock frequencies, etc. | |
#define | OSC_RCSYS_NOMINAL_HZ 115000 |
Nominal frequency of RCSYS in Hz. More... | |
#define | OSC_RCSYS_MIN_HZ 100000 |
Minimum frequency of RCSYS in Hz. More... | |
#define | OSC_RCSYS_MAX_HZ 120000 |
Maximum frequency of RCSYS in Hz. More... | |
#define | OSC_RC32K_NOMINAL_HZ 32768 |
Nominal frequency of RC32K in Hz. More... | |
#define | OSC_RC32K_MIN_HZ 20000 |
Minimum frequency of RC32K in Hz. More... | |
#define | OSC_RC32K_MAX_HZ 44000 |
Maximum frequency of RC32K in Hz. More... | |
#define | OSC_RC80M_NOMINAL_HZ 80000000 |
Nominal frequency of RC80M in Hz. More... | |
#define | OSC_RCFAST4M_NOMINAL_HZ 4000000 |
Nominal frequency of RCFAST4M in Hz. More... | |
#define | OSC_RCFAST8M_NOMINAL_HZ 8000000 |
Nominal frequency of RCFAST8M in Hz. More... | |
#define | OSC_RCFAST12M_NOMINAL_HZ 12000000 |
Nominal frequency of RCFAST12M in Hz. More... | |
#define | OSC_RC1M_NOMINAL_HZ 1000000 |
Nominal frequency of RC1M in Hz. More... | |
Functions | |
void | osc_priv_disable_osc0 (void) |
void | osc_priv_disable_osc32 (void) |
void | osc_priv_disable_rc1m (void) |
void | osc_priv_disable_rc32k (void) |
void | osc_priv_disable_rc80m (void) |
void | osc_priv_disable_rcfast (void) |
void | osc_priv_enable_osc0 (void) |
void | osc_priv_enable_osc32 (void) |
void | osc_priv_enable_rc1m (void) |
void | osc_priv_enable_rc32k (void) |
void | osc_priv_enable_rc80m (void) |
void | osc_priv_enable_rcfast (void) |
Oscillator Management | |
static void | osc_enable (uint8_t id) |
Enable oscillator id. More... | |
static void | osc_disable (uint8_t id) |
Disable 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... | |