HPM SDK
HPMicro Software Development Kit
PLLCTL driver APIs

PLLCTL driver APIs. More...

Macros

#define PLLCTL_PLL_VCO_FREQ_MIN   (375000000U)
 
#define PLLCTL_PLL_VCO_FREQ_MAX   (2200000000U)
 
#define PLLCTL_PLL_LOCK_SS_RESET   PLLCTL_PLL_LOCK_LOCK_SS_RSTPTR_MASK
 
#define PLLCTL_PLL_LOCK_REFDIV   PLLCTL_PLL_LOCK_LOCK_REFDIV_MASK
 
#define PLLCTL_PLL_LOCK_POSTDIV1   PLLCTL_PLL_LOCK_LOCK_POSTDIV1_MASK
 
#define PLLCTL_PLL_LOCK_SS_SPREAD   PLLCTL_PLL_LOCK_LOCK_SS_SPREAD_MASK
 
#define PLLCTL_PLL_LOCK_SS_DIVVAL   PLLCTL_PLL_LOCK_LOCK_SS_DIVVAL_MASK
 
#define PLLCTL_PLL_LOCK_ALL
 

Enumerations

enum  { status_pllctl_not_enabled = ((uint32_t)( status_group_pllctl )*1000U + (uint32_t)( 1 )) , status_pllctl_out_of_range = ((uint32_t)( status_group_pllctl )*1000U + (uint32_t)( 2 )) }
 

Functions

static void pllctl_pll_unlock (PLLCTL_Type *ptr, uint8_t pll, uint32_t lock_mask)
 Unlock pll. More...
 
static void pllctl_pll_lock (PLLCTL_Type *ptr, uint8_t pll, uint32_t lock_mask)
 Lock pll. More...
 
static hpm_stat_t pllctl_pll_ss_disable (PLLCTL_Type *ptr, uint8_t pll)
 Disable spread spectrum. More...
 
static hpm_stat_t pllctl_pll_powerdown (PLLCTL_Type *ptr, uint8_t pll)
 Power down target PLL. More...
 
static hpm_stat_t pllctl_pll_poweron (PLLCTL_Type *ptr, uint8_t pll)
 Power on target PLL. More...
 
static hpm_stat_t pllctl_pll_ss_enable (PLLCTL_Type *ptr, uint8_t pll, uint8_t spread, uint8_t div, bool down_spread)
 Enable spread spectrum mode. More...
 
static hpm_stat_t pllctl_set_postdiv1 (PLLCTL_Type *ptr, uint8_t pll, uint8_t div)
 Set postdiv1 for PLL. More...
 
static hpm_stat_t pllctl_set_fbdiv_int (PLLCTL_Type *ptr, uint8_t pll, uint16_t fbdiv)
 Set fbdiv for PLL integer mode. More...
 
static hpm_stat_t pllctl_set_fbdiv_frac (PLLCTL_Type *ptr, uint8_t pll, uint16_t fbdiv)
 Set fbdiv for PLL fraction mode. More...
 
static hpm_stat_t pllctl_set_frac (PLLCTL_Type *ptr, uint8_t pll, uint32_t frac)
 Set fraction for PLL fraction mode. More...
 
static hpm_stat_t pllctl_get_div (PLLCTL_Type *ptr, uint8_t pll, uint8_t div_index)
 Get PLL divx value. More...
 
static hpm_stat_t pllctl_set_div (PLLCTL_Type *ptr, uint8_t pll, uint8_t div_index, uint16_t div)
 Set divider. More...
 
static bool pllctl_div_is_stable (PLLCTL_Type *ptr, uint8_t pll, uint8_t div_index)
 Check if specific PLL DIV is stable. More...
 
static bool pllctl_pll_is_enabled (PLLCTL_Type *ptr, uint8_t pll)
 Check if target PLL is enabled. More...
 
static bool pllctl_xtal_is_stable (PLLCTL_Type *ptr)
 Check if XTAL is stable. More...
 
static bool pllctl_xtal_is_enabled (PLLCTL_Type *ptr)
 Check if XTAL is enabled. More...
 
static void pllctl_xtal_set_rampup_time (PLLCTL_Type *ptr, uint32_t cycles)
 
hpm_stat_t pllctl_set_pll_work_mode (PLLCTL_Type *ptr, uint8_t pll, bool int_mode)
 Set pll work mode. More...
 
hpm_stat_t pllctl_set_refdiv (PLLCTL_Type *ptr, uint8_t pll, uint8_t div)
 Set refdiv. More...
 
hpm_stat_t pllctl_init_int_pll_with_freq (PLLCTL_Type *ptr, uint8_t pll, uint32_t freq_in_hz)
 Initialize PLL working at integer mode with specific frequency. More...
 
hpm_stat_t pllctl_init_frac_pll_with_freq (PLLCTL_Type *ptr, uint8_t pll, uint32_t freq_in_hz)
 Initialize PLL working at franction mode with specific frequency. More...
 
uint32_t pllctl_get_pll_freq_in_hz (PLLCTL_Type *ptr, uint8_t pll)
 Get frequency of target PLL. More...
 

Detailed Description

PLLCTL driver APIs.

Macro Definition Documentation

◆ PLLCTL_PLL_LOCK_ALL

#define PLLCTL_PLL_LOCK_ALL

#include <drivers/inc/hpm_pllctl_drv.h>

Value:
| PLLCTL_PLL_LOCK_LOCK_SS_SPREAD_MASK \
#define PLLCTL_PLL_LOCK_LOCK_SS_RSTPTR_MASK
Definition: hpm_pllctl_regs.h:252
#define PLLCTL_PLL_LOCK_LOCK_REFDIV_MASK
Definition: hpm_pllctl_regs.h:264
#define PLLCTL_PLL_LOCK_LOCK_SS_DIVVAL_MASK
Definition: hpm_pllctl_regs.h:300
#define PLLCTL_PLL_LOCK_LOCK_POSTDIV1_MASK
Definition: hpm_pllctl_regs.h:276

◆ PLLCTL_PLL_LOCK_POSTDIV1

#define PLLCTL_PLL_LOCK_POSTDIV1   PLLCTL_PLL_LOCK_LOCK_POSTDIV1_MASK

◆ PLLCTL_PLL_LOCK_REFDIV

#define PLLCTL_PLL_LOCK_REFDIV   PLLCTL_PLL_LOCK_LOCK_REFDIV_MASK

◆ PLLCTL_PLL_LOCK_SS_DIVVAL

#define PLLCTL_PLL_LOCK_SS_DIVVAL   PLLCTL_PLL_LOCK_LOCK_SS_DIVVAL_MASK

◆ PLLCTL_PLL_LOCK_SS_RESET

#define PLLCTL_PLL_LOCK_SS_RESET   PLLCTL_PLL_LOCK_LOCK_SS_RSTPTR_MASK

◆ PLLCTL_PLL_LOCK_SS_SPREAD

#define PLLCTL_PLL_LOCK_SS_SPREAD   PLLCTL_PLL_LOCK_LOCK_SS_SPREAD_MASK

◆ PLLCTL_PLL_VCO_FREQ_MAX

#define PLLCTL_PLL_VCO_FREQ_MAX   (2200000000U)

◆ PLLCTL_PLL_VCO_FREQ_MIN

#define PLLCTL_PLL_VCO_FREQ_MIN   (375000000U)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

#include <drivers/inc/hpm_pllctl_drv.h>

Enumerator
status_pllctl_not_enabled 
status_pllctl_out_of_range 

Function Documentation

◆ pllctl_div_is_stable()

static bool pllctl_div_is_stable ( PLLCTL_Type ptr,
uint8_t  pll,
uint8_t  div_index 
)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Check if specific PLL DIV is stable.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
[in]div_indexTarget DIV to check
Returns
true if target PLL DIV is stable

◆ pllctl_get_div()

static hpm_stat_t pllctl_get_div ( PLLCTL_Type ptr,
uint8_t  pll,
uint8_t  div_index 
)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Get PLL divx value.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
[in]div_indexTarget DIV to query
Returns
Divider value of target DIV

◆ pllctl_get_pll_freq_in_hz()

uint32_t pllctl_get_pll_freq_in_hz ( PLLCTL_Type ptr,
uint8_t  pll 
)

#include <drivers/inc/hpm_pllctl_drv.h>

Get frequency of target PLL.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
Returns
current frequency of target PLL in Hz

◆ pllctl_init_frac_pll_with_freq()

hpm_stat_t pllctl_init_frac_pll_with_freq ( PLLCTL_Type ptr,
uint8_t  pll,
uint32_t  freq_in_hz 
)

#include <drivers/inc/hpm_pllctl_drv.h>

Initialize PLL working at franction mode with specific frequency.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
[in]freq_in_hzTarget frequency, expected >= 375000000Hz
Returns
status_success if everything is okay
Note
The actual frequency might be slightly different from freq_in_hz due to calculation.

◆ pllctl_init_int_pll_with_freq()

hpm_stat_t pllctl_init_int_pll_with_freq ( PLLCTL_Type ptr,
uint8_t  pll,
uint32_t  freq_in_hz 
)

#include <drivers/inc/hpm_pllctl_drv.h>

Initialize PLL working at integer mode with specific frequency.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
[in]freq_in_hzTarget frequency, expected >= 375000000Hz
Returns
status_success if everything is okay
Note
The actual frequency might be slightly different from freq_in_hz due to calculation.

◆ pllctl_pll_is_enabled()

static bool pllctl_pll_is_enabled ( PLLCTL_Type ptr,
uint8_t  pll 
)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Check if target PLL is enabled.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
Returns
true if target PLL is enabled

◆ pllctl_pll_lock()

static void pllctl_pll_lock ( PLLCTL_Type ptr,
uint8_t  pll,
uint32_t  lock_mask 
)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Lock pll.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
[in]lock_maskMask of PLL parts to be locked

◆ pllctl_pll_powerdown()

static hpm_stat_t pllctl_pll_powerdown ( PLLCTL_Type ptr,
uint8_t  pll 
)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Power down target PLL.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
Returns
status_success if everything is okay

◆ pllctl_pll_poweron()

static hpm_stat_t pllctl_pll_poweron ( PLLCTL_Type ptr,
uint8_t  pll 
)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Power on target PLL.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
Returns
status_success if everything is okay

◆ pllctl_pll_ss_disable()

static hpm_stat_t pllctl_pll_ss_disable ( PLLCTL_Type ptr,
uint8_t  pll 
)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Disable spread spectrum.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
Returns
status_success if everything is okay

◆ pllctl_pll_ss_enable()

static hpm_stat_t pllctl_pll_ss_enable ( PLLCTL_Type ptr,
uint8_t  pll,
uint8_t  spread,
uint8_t  div,
bool  down_spread 
)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Enable spread spectrum mode.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
[in]spreadSpread spectrum depth (1-31, from 0.1% to 3.1%)
[in]divSpread spectrum divider (1-63, divide by 1 to 63)
[in]down_spreadSet true if need down-spread, otherwise center-spread
Returns
status_success if everything is okay

◆ pllctl_pll_unlock()

static void pllctl_pll_unlock ( PLLCTL_Type ptr,
uint8_t  pll,
uint32_t  lock_mask 
)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Unlock pll.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
[in]lock_maskMask of PLL parts to be unlocked

◆ pllctl_set_div()

static hpm_stat_t pllctl_set_div ( PLLCTL_Type ptr,
uint8_t  pll,
uint8_t  div_index,
uint16_t  div 
)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Set divider.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
[in]div_indexDIV index
[in]divDivider value (starting from 1)
Returns
status_success if everything is okay

◆ pllctl_set_fbdiv_frac()

static hpm_stat_t pllctl_set_fbdiv_frac ( PLLCTL_Type ptr,
uint8_t  pll,
uint16_t  fbdiv 
)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Set fbdiv for PLL fraction mode.

Fout = Fref/refdive * (fbdiv + frac/2^24)/postdiv1

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
[in]fbdivFbdiv value (0x1~0x1000)
Note
fbdiv value can not set too large, if Fref/refdiv * fbdiv > 2GHz, it might cause irrecoverable damage to that PLL
Returns
status_success if everything is okay

◆ pllctl_set_fbdiv_int()

static hpm_stat_t pllctl_set_fbdiv_int ( PLLCTL_Type ptr,
uint8_t  pll,
uint16_t  fbdiv 
)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Set fbdiv for PLL integer mode.

Fout = Fref/refdiv * fbdiv / postdiv1

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
[in]fbdivFbdiv value (0x1~0x1000)
Note
fbdiv value can not set too large, if Fref/refdiv * fbdiv > 2GHz, it might cause irrecoverable damage to that PLL
Returns
status_success if everything is okay

◆ pllctl_set_frac()

static hpm_stat_t pllctl_set_frac ( PLLCTL_Type ptr,
uint8_t  pll,
uint32_t  frac 
)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Set fraction for PLL fraction mode.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
[in]frac24-bit fixed float point value
Returns

◆ pllctl_set_pll_work_mode()

hpm_stat_t pllctl_set_pll_work_mode ( PLLCTL_Type ptr,
uint8_t  pll,
bool  int_mode 
)

#include <drivers/inc/hpm_pllctl_drv.h>

Set pll work mode.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
[in]int_modetrue: integer mode, false - fraction mode
Returns
status_success if everything is okay

◆ pllctl_set_postdiv1()

static hpm_stat_t pllctl_set_postdiv1 ( PLLCTL_Type ptr,
uint8_t  pll,
uint8_t  div 
)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Set postdiv1 for PLL.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
[in]divPostdiv1 value (0x1~0x7)
Returns
status_success if everything is okay

◆ pllctl_set_refdiv()

hpm_stat_t pllctl_set_refdiv ( PLLCTL_Type ptr,
uint8_t  pll,
uint8_t  div 
)

#include <drivers/inc/hpm_pllctl_drv.h>

Set refdiv.

Parameters
[in]ptrPLLCTL base address
[in]pllTarget PLL index
[in]divDivider value (0x1-0x3F)
Returns
status_success if everything is okay

◆ pllctl_xtal_is_enabled()

static bool pllctl_xtal_is_enabled ( PLLCTL_Type ptr)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Check if XTAL is enabled.

Parameters
[in]ptrPLLCTL base address
Returns
true if XTAL is enabled

◆ pllctl_xtal_is_stable()

static bool pllctl_xtal_is_stable ( PLLCTL_Type ptr)
inlinestatic

#include <drivers/inc/hpm_pllctl_drv.h>

Check if XTAL is stable.

Parameters
[in]ptrPLLCTL base address
Returns
true if XTAL is stable

◆ pllctl_xtal_set_rampup_time()

static void pllctl_xtal_set_rampup_time ( PLLCTL_Type ptr,
uint32_t  cycles 
)
inlinestatic