SystemInit()函数的结构分析
时间:11-23
来源:互联网
点击:
系统函数调用顺序startup_stm32f10x_cl.s→ SystemInit() → SetSysClock()→ SetSysClockTo72()
总结:开始是在keil4里看代码,很混乱,后来把他粘到Notepad编辑器,一点击就可以看出这个子函数到哪结束
[cpp]view plaincopy
- #ifdefined(STM32F10X_LD_VL)||(definedSTM32F10X_MD_VL)||(definedSTM32F10X_HD_VL)
- /*#defineSYSCLK_FREQ_HSEHSE_VALUE*/
- #defineSYSCLK_FREQ_24MHz24000000
- #else
- /*#defineSYSCLK_FREQ_HSEHSE_VALUE*/
- /*#defineSYSCLK_FREQ_24MHz24000000*/
- /*#defineSYSCLK_FREQ_36MHz36000000*/
- /*#defineSYSCLK_FREQ_48MHz48000000*/
- /*#defineSYSCLK_FREQ_56MHz56000000*/
- #defineSYSCLK_FREQ_72MHz72000000
- #endif
下面定义的SystemCoreClock 变量是为了方便取出几种情况下系统时钟的实际值,例SYSCLK_FREQ_24MHz 也就是24000000。
[cpp]view plaincopy
- #ifdefSYSCLK_FREQ_HSE
- uint32_tSystemCoreClock=SYSCLK_FREQ_HSE;/*!
equency(CoreClock)*/ - #elifdefinedSYSCLK_FREQ_24MHz
- uint32_tSystemCoreClock=SYSCLK_FREQ_24MHz;/*!
- #elifdefinedSYSCLK_FREQ_36MHz
- uint32_tSystemCoreClock=SYSCLK_FREQ_36MHz;/*!
- #elifdefinedSYSCLK_FREQ_48MHz
- uint32_tSystemCoreClock=SYSCLK_FREQ_48MHz;/*!
- #elifdefinedSYSCLK_FREQ_56MHz
- uint32_tSystemCoreClock=SYSCLK_FREQ_56MHz;/*!
- #elifdefinedSYSCLK_FREQ_72MHz
- uint32_tSystemCoreClock=SYSCLK_FREQ_72MHz;/*!
- #else/*!
- uint32_tSystemCoreClock=HSI_VALUE;/*!
- #endif
[cpp]view plaincopy
- staticvoidSetSysClock(void)
- {
- #ifdefSYSCLK_FREQ_HSE
- SetSysClockToHSE();
- #elifdefinedSYSCLK_FREQ_24MHz
- SetSysClockTo24();
- #elifdefinedSYSCLK_FREQ_36MHz
- SetSysClockTo36();
- #elifdefinedSYSCLK_FREQ_48MHz
- SetSysClockTo48();
- #elifdefinedSYSCLK_FREQ_56MHz
- SetSysClockTo56();
- #elifdefinedSYSCLK_FREQ_72MHz
- SetSysClockTo72();
- #endif
- /*Ifnoneofthedefineaboveisenabled,theHSIisusedasSystemclock
- source(defaultafterreset)*/
- }
[cpp]view plaincopy
- #ifdefSYSCLK_FREQ_HSE
- /**
- *@briefSelectsHSEasSystemclocksourceandconfigureHCLK,PCLK2
- *andPCLK1prescalers.
- *@noteThisfunctionshouldbeusedonlyafterreset.
- *@paramNone
- *@retvalNone
- */
- staticvoidSetSysClockToHSE(void)
- {
- ......
- }
[cpp]view plaincopy
- #elifdefinedSYSCLK_FREQ_24MHz
- /**
- *@briefSetsSystemclockfrequencyto24MHzandconfigureHCLK,PCLK2
- *andPCLK1prescalers.
- *@noteThisfunctionshouldbeusedonlyafterreset.
- *@paramNone
- *@retvalNone
- */
- staticvoidSetSysClockTo24(void)
- {
- ........
- }
[cpp]view plaincopy
- #elifdefinedSYSCLK_FREQ_36MHz
- /**
- *@briefSetsSystemclockfrequencyto36MHzandconfigureHCLK,PCLK2
- *andPCLK1prescalers.
- *@noteThisfunctionshouldbeusedonlyafterreset.
- *@paramNone
- *@retvalNone
- */
- staticvoidSetSysClockTo36(void)
- {
- ......
- }
[cpp]view plaincopy
- #elifdefinedSYSCLK_FREQ_72MHz
- /**
- *@briefSetsSystemclockfrequencyto72MHzandconfigureHCLK,PCLK2
- *andPCLK1prescalers.
- *@noteThisfunctionshouldbeusedonlyafterreset.
- *@paramNone
- *@retvalNone
- */
- staticvoidSetSysClockTo72(void)
- {
- .......
- }
SystemInit()函数结构分 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)