MG32L003 Standard Peripherals Firmware Library
Macros | Functions
mg32l003_rcc.c File Reference

This file provides all the RCC firmware functions. More...

#include "mg32l003_rcc.h"

Macros

#define RCC_REGWR_LOCK()   (RCC->UNLOCK = (0x2AD5334C << RCC_UNLOCK_KEY_Pos) & RCC_UNLOCK_KEY)
 
#define RCC_REGWR_UNLOCK()   (RCC->UNLOCK = RCC_UNLOCK_UNLOCK | (0x2AD5334C << RCC_UNLOCK_KEY_Pos))
 
#define RCC_SYSTEMCR_UNLOCK_KEY   ((uint32_t)0x5A69)
 
#define RCC_SYSTEMCR_UNLOCK_Pos   ((uint32_t)16)
 
#define RCC_SET_KEYBIT(REG, BIT)   ((REG) |= (BIT | (RCC_SYSTEMCR_UNLOCK_KEY << RCC_SYSTEMCR_UNLOCK_Pos)))
 
#define RCC_MODIFY_KEYREG(REG, CLEARMASK, SETVALUE)   WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETVALUE | (RCC_SYSTEMCR_UNLOCK_KEY << RCC_SYSTEMCR_UNLOCK_Pos))))
 
#define RCC_WRITE_KEYREG(REG, VAL)   ((REG) = (VAL | (RCC_SYSTEMCR_UNLOCK_KEY << RCC_SYSTEMCR_UNLOCK_Pos)))
 
#define RCC_CLEAR_KEYBIT(REG, CLEARMASK)   WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (RCC_SYSTEMCR_UNLOCK_KEY << RCC_SYSTEMCR_UNLOCK_Pos)))
 

Functions

void RCC_DeInit (void)
 Resets the RCC clock configuration to the default reset state. More...
 
void RCC_HSIConfig (const uint32_t HSI_Value, FunctionalState NewState)
 Configures the Internal High Speed oscillator (HSI). More...
 
void RCC_LSIConfig (uint32_t LSI_Value, uint32_t LSI_StartUPTime, FunctionalState NewState)
 Configures the Internal low Speed oscillator (LSI). More...
 
void RCC_HSEConfig (uint32_t RCC_HSE)
 Configures the External High Speed oscillator (HSE). More...
 
void RCC_LSEConfig (uint32_t RCC_LSE)
 Configures the External Low Speed oscillator (LSE). More...
 
void RCC_HSEDriveCurrentConfig (uint32_t Current)
 Configures the drive current of High Speed oscillator (HSE). More...
 
void RCC_HSEStartTimeConfig (uint32_t Time)
 Configures the start time of High Speed oscillator (HSE). More...
 
void RCC_LSEDriveCurrentConfig (uint32_t Current)
 Configures the drive current of Low Speed oscillator (LSE). More...
 
void RCC_LSEStartTimeConfig (uint32_t Time)
 Configures the start time of Low Speed oscillator (LSE). More...
 
void RCC_SYSCLKConfig (uint32_t RCC_SYSCLKSource)
 Configures the SYS Clock (SYSCLK). More...
 
void RCC_AHBCLKConfig (uint32_t RCC_AHBCLKDiv)
 Configures the AHB clock (AHBCLK). More...
 
void RCC_APBCLKConfig (uint32_t RCC_APBCLKDiv)
 Configures the APB clock (APBCLK). More...
 
void RCC_MCOConfig (uint32_t RCC_MCOSource, uint32_t RCC_MCOHCLKDiv)
 Selects the clock source to output on MCO pin. More...
 
void RCC_MCOCmd (FunctionalState NewState)
 Enable or Disable the MCO Clock output. More...
 
void RCC_GetClocksFreq (RCC_ClocksTypeDef *RCC_Clocks)
 Returns the frequencies of different on chip clocks. More...
 
void RCC_AHBPeriphClockCmd (uint32_t RCC_AHBPeriph, FunctionalState NewState)
 Enables or disables the AHB peripheral clock. More...
 
void RCC_APBPeriphClockCmd (uint32_t RCC_APBPeriph, FunctionalState NewState)
 Enables or disables the APB peripheral clock. More...
 
void RCC_AHBPeriphResetCmd (uint32_t RCC_AHBPeriph, FunctionalState NewState)
 Forces or releases AHB peripheral reset. More...
 
void RCC_APBPeriphResetCmd (uint32_t RCC_APBPeriph, FunctionalState NewState)
 Forces or releases APB peripheral reset. More...
 
void RCC_RTCPeriphResetCmd (FunctionalState NewState)
 Forces or releases RTC peripheral reset. More...
 
FlagStatus RCC_GetResetFlagStatus (uint32_t RCC_RSTFLAG)
 Checks whether the specified RCC reset flag is set or not. More...
 
void RCC_ClearResetFlags (uint32_t RCC_RSTFLAG)
 Clear the specified RCC reset flag. More...
 

Detailed Description

This file provides all the RCC firmware functions.

Author
megawin Application Team
Version
V0.0.5
Date
13-August-2024