/****************************************************************************** * Copyright (C) 2021, Xiaohua Semiconductor Co., Ltd. All rights reserved. * * This software component is licensed by XHSC under BSD 3-Clause license * (the "License"); You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ******************************************************************************/ /****************************************************************************** ** @file system_hc32l130f8ua.c ** ** @brief Headerfile for SYSTEM functions ** ** @author MADS Team ** ** - 2022-01-26. ** ******************************************************************************/ /******************************************************************************/ /* Include files */ /******************************************************************************/ #include "base_types.h" #include "hc32l130f8ua.h" #include "system_hc32l130f8ua.h" /** ****************************************************************************** ** System Clock Frequency (Core Clock) Variable according CMSIS ******************************************************************************/ uint32_t SystemCoreClock; //add clock source. void SystemCoreClockUpdate (void) // Update SystemCoreClock variable { SystemCoreClock = 4000000; } /** ****************************************************************************** ** \brief Setup the microcontroller system. Initialize the System and update ** the SystemCoreClock variable. ** ** \param none ** \return none ******************************************************************************/ void SystemInit(void) { // TODO load trim from flash //hcr 4MHz manual trim. M0P_SYSCTRL->RCH_CR_f.TRIM = (*((volatile uint16_t*) (0x00100C08ul))); //Loader 4MHz Trimming value SystemCoreClockUpdate(); }