用于EagleEye3.0 规则集漏报和误报测试的示例项目,项目收集于github和gitee
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.2 KiB

5 months ago
#include "systick.h"
/******************************************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:void RCC_HSE_Config(void)
*<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>
******************************************************************/
#ifdef REVISE_SYSTICK
void RCC_HSE_Config(void)
{
RCC_DeInit();//<EFBFBD><EFBFBD>RCC<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊȱʡֵ
RCC_HSEConfig(RCC_HSE_ON);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>HSE
if(RCC_WaitForHSEStartUp()==SUCCESS)//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>HSE<EFBFBD>Ƿ<EFBFBD><EFBFBD>ȶ<EFBFBD>
{
RCC_HCLKConfig(RCC_SYSCLK_Div1);//<EFBFBD><EFBFBD>HCLKʱ<EFBFBD>ӵ<EFBFBD><EFBFBD><EFBFBD>ϵͳʱ<EFBFBD><EFBFBD>
RCC_PCLK1Config(RCC_HCLK_Div1);//<EFBFBD><EFBFBD>PCLK1ʱ<EFBFBD>ӵ<EFBFBD><EFBFBD><EFBFBD>HCLK
RCC_PCLK2Config(RCC_HCLK_Div2);//PCLK2ʱ<EFBFBD>ӵ<EFBFBD><EFBFBD><EFBFBD>HCLK<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>
RCC_PLLConfig(RCC_PLLSource_HSE_Div1,RCC_PLLMul_9);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HSE<EFBFBD><EFBFBD><EFBFBD><EFBFBD>9<EFBFBD><EFBFBD>Ƶ
RCC_PLLCmd(ENABLE);//ʹ<EFBFBD><EFBFBD>PLL
while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>PLL<EFBFBD>Ƿ<EFBFBD>׼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);//<EFBFBD><EFBFBD>PLLʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊϵͳʱ<EFBFBD><EFBFBD>
while(RCC_GetSYSCLKSource()!=0x08);//<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD>PLL<EFBFBD><EFBFBD>Ϊϵͳʱ<EFBFBD>ӣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD>
}
}
#endif
/******************************************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:void delay_us(uint16_t uns)
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD>ϵͳʵ<EFBFBD>־<EFBFBD>ȷ<EFBFBD><EFBFBD>ʱ1us
*<EFBFBD><EFBFBD><EFBFBD>uns
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
******************************************************************/
void delay_us(uint16_t uns)
{
uint32_t temp;
SysTick->LOAD=9*uns;//<EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>ת<EFBFBD>ؼĴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD>ֵ
SysTick->VAL=0x00;//<EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռĴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>LOAD<EFBFBD>е<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>װ<EFBFBD>ص<EFBFBD>VAL<EFBFBD><EFBFBD>
SysTick->CTRL=0x01;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>ΪHCLK/8
do
{
temp=SysTick->CTRL;//<EFBFBD><EFBFBD>ȡCTRL<EFBFBD>е<EFBFBD>ֵ<EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>־λ<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>λ
}while((temp&0x01)&&(!(temp&(1<<16))));
SysTick->VAL=0x00;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>VAL<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD>
SysTick->CTRL=0x00;//<EFBFBD>رն<EFBFBD>ʱ<EFBFBD><EFBFBD>
}
/******************************************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:void delay_ms(uint16_t ums)
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD>ϵͳʵ<EFBFBD>־<EFBFBD>ȷ<EFBFBD><EFBFBD>ʱ1ms
*<EFBFBD><EFBFBD><EFBFBD>uns
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
******************************************************************/
void delay_ms(uint16_t ums)
{
uint32_t temp;
SysTick->LOAD=9000*ums;//<EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>ת<EFBFBD>ؼĴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD>ֵ
SysTick->VAL=0x00;//<EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռĴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>LOAD<EFBFBD>е<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>װ<EFBFBD>ص<EFBFBD>VAL<EFBFBD><EFBFBD>
SysTick->CTRL=0x01;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>ΪHCLK/8
do
{
temp=SysTick->CTRL;//<EFBFBD><EFBFBD>ȡCTRL<EFBFBD>е<EFBFBD>ֵ<EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>־λ<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>λ
}while((temp&0x01)&&(!(temp&(1<<16))));
SysTick->VAL=0x00;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>VAL<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD>
SysTick->CTRL=0x00;//<EFBFBD>رն<EFBFBD>ʱ<EFBFBD><EFBFBD>
}