1 /* 2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef _HARDWARE_XOSC_H 8 #define _HARDWARE_XOSC_H 9 10 #include "pico.h" 11 #include "hardware/structs/xosc.h" 12 13 14 // Allow lengthening startup delay to accommodate slow-starting oscillators 15 16 // PICO_CONFIG: PICO_XOSC_STARTUP_DELAY_MULTIPLIER, Multiplier to lengthen xosc startup delay to accommodate slow-starting oscillators, type=int, min=1, default=1, group=hardware_xosc 17 #ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER 18 #define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 1 19 #endif 20 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 /** \file hardware/xosc.h 27 * \defgroup hardware_xosc hardware_xosc 28 * 29 * \brief Crystal Oscillator (XOSC) API 30 */ 31 32 /*! \brief Initialise the crystal oscillator system 33 * \ingroup hardware_xosc 34 * 35 * This function will block until the crystal oscillator has stabilised. 36 **/ 37 void xosc_init(void); 38 39 /*! \brief Disable the Crystal oscillator 40 * \ingroup hardware_xosc 41 * 42 * Turns off the crystal oscillator source, and waits for it to become unstable 43 **/ 44 void xosc_disable(void); 45 46 /*! \brief Set the crystal oscillator system to dormant 47 * \ingroup hardware_xosc 48 * 49 * Turns off the crystal oscillator until it is woken by an interrupt. This will block and hence 50 * the entire system will stop, until an interrupt wakes it up. This function will 51 * continue to block until the oscillator becomes stable after its wakeup. 52 **/ 53 void xosc_dormant(void); 54 55 #ifdef __cplusplus 56 } 57 #endif 58 59 #endif 60