/* * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. * * SPDX-License-Identifier: BSD-3-Clause *//* ... */#ifndef_HARDWARE_PLL_H#define_HARDWARE_PLL_H#include"pico.h"#include"hardware/structs/pll.h"#ifdef__cplusplusextern"C"{#endif/** \file hardware/pll.h * \defgroup hardware_pll hardware_pll * * \brief Phase Locked Loop control APIs * * There are two PLLs in RP2040. They are: * - pll_sys - Used to generate up to a 133MHz system clock * - pll_usb - Used to generate a 48MHz USB reference clock * * For details on how the PLLs are calculated, please refer to the RP2040 datasheet. *//* ... */typedefpll_hw_t*PLL;#definepll_syspll_sys_hw#definepll_usbpll_usb_hw#ifndefPICO_PLL_VCO_MIN_FREQ_HZ#ifdefPICO_PLL_VCO_MIN_FREQ_MHZ#definePICO_PLL_VCO_MIN_FREQ_HZ(PICO_PLL_VCO_MIN_FREQ_MHZ*MHZ)#elifdefined(PICO_PLL_VCO_MIN_FREQ_KHZ)#definePICO_PLL_VCO_MIN_FREQ_HZ(PICO_PLL_VCO_MIN_FREQ_KHZ*KHZ)#else#definePICO_PLL_VCO_MIN_FREQ_HZ(750*MHZ)#endif/* ... */#endif#ifndefPICO_PLL_VCO_MAX_FREQ_HZ#ifdefPICO_PLL_VCO_MAX_FREQ_MHZ#definePICO_PLL_VCO_MAX_FREQ_HZ(PICO_PLL_VCO_MAX_FREQ_MHZ*MHZ)#elifdefined(PICO_PLL_VCO_MAX_FREQ_KHZ)#definePICO_PLL_VCO_MAX_FREQ_HZ(PICO_PLL_VCO_MAX_FREQ_KHZ*KHZ)#else#definePICO_PLL_VCO_MAX_FREQ_HZ(1600*MHZ)#endif/* ... */#endif/*! \brief Initialise specified PLL. * \ingroup hardware_pll * \param pll pll_sys or pll_usb * \param ref_div Input clock divider. * \param vco_freq Requested output from the VCO (voltage controlled oscillator) * \param post_div1 Post Divider 1 - range 1-7. Must be >= post_div2 * \param post_div2 Post Divider 2 - range 1-7 *//* ... */voidpll_init(PLLpll,uintref_div,uintvco_freq,uintpost_div1,uintpost_div2);/*! \brief Release/uninitialise specified PLL. * \ingroup hardware_pll * * This will turn off the power to the specified PLL. Note this function does not currently check if * the PLL is in use before powering it off so should be used with care. * * \param pll pll_sys or pll_usb *//* ... */voidpll_deinit(PLLpll);/** * \def PLL_RESET_NUM(pll) * \ingroup hardware_pll * \hideinitializer * \brief Returns the \ref reset_num_t used to reset a given PLL instance * * Note this macro is intended to resolve at compile time, and does no parameter checking *//* ... */#ifndefPLL_RESET_NUM#definePLL_RESET_NUM(pll)((pll_usb_hw==(pll))?RESET_PLL_USB:RESET_PLL_SYS)#endif#ifdef__cplusplus}extern "C" { ... }#endif/* ... */#endif
Details
Show: from
Types: Columns:
All items filtered out
All items filtered out
This file uses the notable symbols shown below. Click anywhere in the file to view more details.