PER Firmware
Loading...
Searching...
No Matches
rcc_priv.h File Reference

G4 RCC private/register level implementation. More...

#include <stdint.h>
#include "stm32g474xx.h"
#include "common/phal_G4/rcc/rcc.h"
Include dependency graph for rcc_priv.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  RCC_PRIV_PLLSource_t : uint32_t { RCC_PRIV_PLL_SRC_HSI = RCC_PLLCFGR_PLLSRC_HSI , RCC_PRIV_PLL_SRC_HSE = RCC_PLLCFGR_PLLSRC_HSE }
 Oscillator source for RCC->PLLCFGR. Either HSI or HSE. More...
 

Functions

void PHAL_RCC_priv_enableHSI (void)
 Enable HSI16 and block until it's ready.
 
void PHAL_RCC_priv_disableHSI (void)
 Disable HSI16 and block until it's off.
 
void PHAL_RCC_priv_enableHSE (void)
 
void PHAL_RCC_priv_setFlashLatency (uint32_t latency_ws)
 
void PHAL_RCC_priv_configurePLL (RCC_PRIV_PLLSource_t src)
 
void PHAL_RCC_priv_enableBoostMode (void)
 
void PHAL_RCC_priv_switchSysclkToHSI (void)
 Switch SYSCLK to HSI16 and block until the switch is confirmed.
 
void PHAL_RCC_priv_switchSysclkToHSE (void)
 Switch SYSCLK to HSE and block until the switch is confirmed.
 
void PHAL_RCC_priv_switchSysclkToPLL (void)
 Switch SYSCLK to the PLL and block until the switch is confirmed.
 
void PHAL_RCC_priv_setBusPrescalersToDiv1 (void)
 Set the AHB, APB1, and APB2 prescalers to divide-by-1 (undivided)
 

Variables

static constexpr uint32_t RCC_PRIV_HSI_CLOCK_RATE_HZ = 16'000'000U
 
static constexpr uint32_t RCC_PRIV_HSE_CLOCK_RATE_HZ = 16'000'000U
 
static constexpr uint32_t RCC_PRIV_PLL_M = 4U
 
static constexpr uint32_t RCC_PRIV_PLL_N = 85U
 
static constexpr uint32_t RCC_PRIV_PLL_R = 2U
 
static constexpr uint32_t RCC_PRIV_PLL_VCO_INPUT_HZ = RCC_PRIV_HSI_CLOCK_RATE_HZ / RCC_PRIV_PLL_M
 
static constexpr uint32_t RCC_PRIV_PLL_VCO_OUTPUT_HZ = RCC_PRIV_PLL_VCO_INPUT_HZ * RCC_PRIV_PLL_N
 
static constexpr uint32_t RCC_PRIV_PLL_OUTPUT_HZ = RCC_PRIV_PLL_VCO_OUTPUT_HZ / RCC_PRIV_PLL_R
 

Detailed Description

G4 RCC private/register level implementation.

Author
Millan Kumar (kumar.nosp@m.798@.nosp@m.purdu.nosp@m.e.ed.nosp@m.u)

Enumeration Type Documentation

◆ RCC_PRIV_PLLSource_t

enum RCC_PRIV_PLLSource_t : uint32_t

Oscillator source for RCC->PLLCFGR. Either HSI or HSE.

Enumerator
RCC_PRIV_PLL_SRC_HSI 
RCC_PRIV_PLL_SRC_HSE 

Function Documentation

◆ PHAL_RCC_priv_configurePLL()

void PHAL_RCC_priv_configurePLL ( RCC_PRIV_PLLSource_t src)

Configure and lock the PLL for RCC_PRIV_PLL_OUTPUT_HZ from the given source. Does not touch SYSCLK. PLL runs, unselected, until PHAL_RCC_priv_switchSysclkToPLL

Here is the caller graph for this function:

◆ PHAL_RCC_priv_disableHSI()

void PHAL_RCC_priv_disableHSI ( void )

Disable HSI16 and block until it's off.

Here is the caller graph for this function:

◆ PHAL_RCC_priv_enableBoostMode()

void PHAL_RCC_priv_enableBoostMode ( void )

Enable Range 1 boost mode, required before SYSCLK can exceed 150 MHz Call after the PLL is locked and before switching SYSCLK to it

Here is the caller graph for this function:

◆ PHAL_RCC_priv_enableHSE()

void PHAL_RCC_priv_enableHSE ( void )

Enable HSE in bypass mode (this board feeds it an external 16 MHz signal directly, not a crystal) and block until it's ready

Here is the caller graph for this function:

◆ PHAL_RCC_priv_enableHSI()

void PHAL_RCC_priv_enableHSI ( void )

Enable HSI16 and block until it's ready.

Here is the caller graph for this function:

◆ PHAL_RCC_priv_setBusPrescalersToDiv1()

void PHAL_RCC_priv_setBusPrescalersToDiv1 ( void )

Set the AHB, APB1, and APB2 prescalers to divide-by-1 (undivided)

Here is the caller graph for this function:

◆ PHAL_RCC_priv_setFlashLatency()

void PHAL_RCC_priv_setFlashLatency ( uint32_t latency_ws)

Set the flash wait states for the upcoming HCLK rate Safe to call before increasing the clock (more wait states than currently needed is fine)

Here is the caller graph for this function:

◆ PHAL_RCC_priv_switchSysclkToHSE()

void PHAL_RCC_priv_switchSysclkToHSE ( void )

Switch SYSCLK to HSE and block until the switch is confirmed.

Here is the caller graph for this function:

◆ PHAL_RCC_priv_switchSysclkToHSI()

void PHAL_RCC_priv_switchSysclkToHSI ( void )

Switch SYSCLK to HSI16 and block until the switch is confirmed.

Here is the caller graph for this function:

◆ PHAL_RCC_priv_switchSysclkToPLL()

void PHAL_RCC_priv_switchSysclkToPLL ( void )

Switch SYSCLK to the PLL and block until the switch is confirmed.

Here is the caller graph for this function:

Variable Documentation

◆ RCC_PRIV_HSE_CLOCK_RATE_HZ

uint32_t RCC_PRIV_HSE_CLOCK_RATE_HZ = 16'000'000U
staticconstexpr

◆ RCC_PRIV_HSI_CLOCK_RATE_HZ

uint32_t RCC_PRIV_HSI_CLOCK_RATE_HZ = 16'000'000U
staticconstexpr

◆ RCC_PRIV_PLL_M

uint32_t RCC_PRIV_PLL_M = 4U
staticconstexpr

◆ RCC_PRIV_PLL_N

uint32_t RCC_PRIV_PLL_N = 85U
staticconstexpr

◆ RCC_PRIV_PLL_OUTPUT_HZ

uint32_t RCC_PRIV_PLL_OUTPUT_HZ = RCC_PRIV_PLL_VCO_OUTPUT_HZ / RCC_PRIV_PLL_R
staticconstexpr

◆ RCC_PRIV_PLL_R

uint32_t RCC_PRIV_PLL_R = 2U
staticconstexpr

◆ RCC_PRIV_PLL_VCO_INPUT_HZ

uint32_t RCC_PRIV_PLL_VCO_INPUT_HZ = RCC_PRIV_HSI_CLOCK_RATE_HZ / RCC_PRIV_PLL_M
staticconstexpr

◆ RCC_PRIV_PLL_VCO_OUTPUT_HZ

uint32_t RCC_PRIV_PLL_VCO_OUTPUT_HZ = RCC_PRIV_PLL_VCO_INPUT_HZ * RCC_PRIV_PLL_N
staticconstexpr