rt-thread-official/bsp/essemi/es8p508x/libraries/CMSIS/system_ES8P508x.c

77 lines
2.2 KiB
C
Raw Normal View History

2019-11-07 10:00:14 +08:00
/***************************************************************
*Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd
*<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> system_ES8P508x.c
*<EFBFBD><EFBFBD> <EFBFBD>ߣ<EFBFBD> Liut
*<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> V1.00
*<EFBFBD><EFBFBD> <EFBFBD>ڣ<EFBFBD> 2017/07/14
*<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
*<EFBFBD><EFBFBD> ע<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ES8P508xоƬ
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧϰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾʹ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD>κη<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ρ<EFBFBD>
***************************************************************/
#include "system_ES8P508x.h"
#include "lib_config.h"
uint32_t SystemCoreClock = 48000000;
/***************************************************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SystemCoreClockUpdate
<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ڲ<EFBFBD>ʱ<EFBFBD><EFBFBD>20MHZ<EFBFBD><EFBFBD>ͬʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>SystemCoreClock
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
***************************************************************/
void SystemCoreClockUpdate (void)
{
uint32_t Prot_Temp;
uint16_t Count=0;
SystemClockSelect(SCU_SysClk_HRC , CLK_SEL_HRC); //ѡ<><D1A1>ϵͳʱ<CDB3><CAB1>ΪHRCʱ<43><CAB1>
PLLClock_Config(DISABLE, SCU_PLL_HRC, SCU_PLL_48M,ENABLE); //PLL<4C><4C>ֹ
Prot_Temp = SCU->PROT.PROT;
if(Prot_Temp != 0) //д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{SCU->PROT.Word = 0x55AA6996;} //<2F><><EFBFBD><EFBFBD>
SCU->SCLKEN1.HRC_EN = 1; //ʹ<><CAB9><EFBFBD>ڲ<EFBFBD>20MHZ
do
{
Count++;
}
while((SCU->SCLKEN1.HRC_RDY == 0)&&(Count != 0xFFF)); //<2F>ȴ<EFBFBD>ʱ<EFBFBD>ӿ<EFBFBD><D3BF><EFBFBD>
if(Count == 0xFFF)
{
return ;
}
SCU->SCLKEN0.SYSCLK_DIV = 0; //ϵͳʱ<CDB3>Ӻ<EFBFBD><D3BA><EFBFBD>Ƶ1:1
switch(SCU->SCLKEN0.CLK_SEL)
{
case 0:
SystemCoreClock = 20000000; //HRC
break;
case 1:
SystemCoreClock = 32000; //LRC
break;
default:
break;
}
if(Prot_Temp != 0) //д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{SCU->PROT.Word = 0x00000000;} //<2F><><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>
}
/***************************************************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SystemInit
<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
***************************************************************/
void SystemInit (void)
{
SystemCoreClockUpdate();
}
/*************************END OF FILE**********************/