📄 stm32f10x_rcc.lst
字号:
##############################################################################
# #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 KICKSTART 13/Mar/2009 16:01:12 #
# Copyright 1999-2005 IAR Systems. All rights reserved. #
# #
# Cpu mode = thumb #
# Endian = little #
# Stack alignment = 4 #
# Source file = E:\UC_OS\Micrium\Software\CPU\ST\STM32\src\stm32f10x #
# _rcc.c #
# Command line = E:\UC_OS\Micrium\Software\CPU\ST\STM32\src\stm32f10x #
# _rcc.c -lCN E:\UC_OS\Micrium\Software\EvalBoards\ST\ #
# STM3210B-EVAL\IAR\OS-Probe\Flash\List\ -o #
# E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
# L\IAR\OS-Probe\Flash\Obj\ -z6 --no_unroll #
# --no_inline --no_tbaa --no_scheduling --debug #
# --cpu_mode thumb --endian little --cpu cortex-M3 #
# --stack_align 4 -e --fpu None --dlib_config #
# "C:\Program Files\IAR Systems\Embedded Workbench #
# 4.0 Kickstart\arm\LIB\dl7mptnnl8n.h" -I #
# E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
# L\IAR\OS-Probe\ -I E:\UC_OS\Micrium\Software\EvalBoa #
# rds\ST\STM3210B-EVAL\IAR\OS-Probe\..\..\..\..\..\uco #
# s-ii\ports\arm-cortex-m3\generic\iar\ -I #
# E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
# L\IAR\OS-Probe\..\..\..\..\..\ucos-ii\source\ -I #
# E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
# L\IAR\OS-Probe\..\..\..\..\..\uc-lib\ -I #
# E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
# L\IAR\OS-Probe\..\..\..\..\..\uc-cpu\ -I #
# E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
# L\IAR\OS-Probe\..\..\..\..\..\uc-cpu\ARM-Cortex-M3\I #
# AR\ -I E:\UC_OS\Micrium\Software\EvalBoards\ST\STM32 #
# 10B-EVAL\IAR\OS-Probe\..\..\..\..\..\cpu\st\stm32\in #
# c\ -I E:\UC_OS\Micrium\Software\EvalBoards\ST\STM321 #
# 0B-EVAL\IAR\OS-Probe\..\BSP\ -I #
# E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
# L\IAR\OS-Probe\..\..\..\..\..\uC-Probe\Target\Commun #
# ication\Generic\RS-232\Source\ -I #
# E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
# L\IAR\OS-Probe\..\..\..\..\..\uC-Probe\Target\Commun #
# ication\Generic\RS-232\Ports\ST\STM32\ -I #
# E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
# L\IAR\OS-Probe\..\..\..\..\..\uC-Probe\Target\Commun #
# ication\Generic\Source\ -I #
# E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
# L\IAR\OS-Probe\..\..\..\..\..\uC-Probe\Target\Plugin #
# s\uCOS-II\ -I "C:\Program Files\IAR #
# Systems\Embedded Workbench 4.0 Kickstart\arm\INC\" #
# List file = E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
# L\IAR\OS-Probe\Flash\List\stm32f10x_rcc.lst #
# Object file = E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
# L\IAR\OS-Probe\Flash\Obj\stm32f10x_rcc.r79 #
# #
# #
##############################################################################
E:\UC_OS\Micrium\Software\CPU\ST\STM32\src\stm32f10x_rcc.c
1 /******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
2 * File Name : stm32f10x_rcc.c
3 * Author : MCD Application Team
4 * Date First Issued : 09/29/2006
5 * Description : This file provides all the RCC firmware functions.
6 ********************************************************************************
7 * History:
8 * 05/21/2007: V0.3
9 * 04/02/2007: V0.2
10 * 02/05/2007: V0.1
11 * 09/29/2006: V0.01
12 ********************************************************************************
13 * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
14 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
15 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
16 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
17 * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
18 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
19 *******************************************************************************/
20
21 /* Includes ------------------------------------------------------------------*/
22 #include "stm32f10x_rcc.h"
23
24 /* Private typedef -----------------------------------------------------------*/
25 /* Private define ------------------------------------------------------------*/
26 /* ------------ RCC registers bit address in the alias region ----------- */
27 #define RCC_OFFSET (RCC_BASE - PERIPH_BASE)
28
29 /* --- CR Register ---*/
30 /* Alias word address of HSION bit */
31 #define CR_OFFSET (RCC_OFFSET + 0x00)
32 #define HSION_BitNumber 0x00
33 #define CR_HSION_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (HSION_BitNumber * 4))
34
35 /* Alias word address of PLLON bit */
36 #define PLLON_BitNumber 0x18
37 #define CR_PLLON_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (PLLON_BitNumber * 4))
38
39 /* Alias word address of CSSON bit */
40 #define CSSON_BitNumber 0x13
41 #define CR_CSSON_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (CSSON_BitNumber * 4))
42
43 /* --- CFGR Register ---*/
44 /* Alias word address of USBPRE bit */
45 #define CFGR_OFFSET (RCC_OFFSET + 0x04)
46 #define USBPRE_BitNumber 0x16
47 #define CFGR_USBPRE_BB (PERIPH_BB_BASE + (CFGR_OFFSET * 32) + (USBPRE_BitNumber * 4))
48
49 /* --- BDCR Register ---*/
50 /* Alias word address of RTCEN bit */
51 #define BDCR_OFFSET (RCC_OFFSET + 0x20)
52 #define RTCEN_BitNumber 0x0F
53 #define BDCR_RTCEN_BB (PERIPH_BB_BASE + (BDCR_OFFSET * 32) + (RTCEN_BitNumber * 4))
54
55 /* Alias word address of BDRST bit */
56 #define BDRST_BitNumber 0x10
57 #define BDCR_BDRST_BB (PERIPH_BB_BASE + (BDCR_OFFSET * 32) + (BDRST_BitNumber * 4))
58
59 /* --- CSR Register ---*/
60 /* Alias word address of LSION bit */
61 #define CSR_OFFSET (RCC_OFFSET + 0x24)
62 #define LSION_BitNumber 0x00
63 #define CSR_LSION_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (LSION_BitNumber * 4))
64
65 /* ---------------------- RCC registers bit mask ------------------------ */
66 /* CR register bit mask */
67 #define CR_HSEBYP_Reset ((u32)0xFFFBFFFF)
68 #define CR_HSEBYP_Set ((u32)0x00040000)
69 #define CR_HSEON_Reset ((u32)0xFFFEFFFF)
70 #define CR_HSEON_Set ((u32)0x00010000)
71 #define CR_HSITRIM_Mask ((u32)0xFFFFFF07)
72
73 /* CFGR register bit mask */
74 #define CFGR_PLL_Mask ((u32)0xFFC0FFFF)
75 #define CFGR_PLLMull_Mask ((u32)0x003C0000)
76 #define CFGR_PLLSRC_Mask ((u32)0x00010000)
77 #define CFGR_PLLXTPRE_Mask ((u32)0x00020000)
78 #define CFGR_SWS_Mask ((u32)0x0000000C)
79 #define CFGR_SW_Mask ((u32)0xFFFFFFFC)
80 #define CFGR_HPRE_Reset_Mask ((u32)0xFFFFFF0F)
81 #define CFGR_HPRE_Set_Mask ((u32)0x000000F0)
82 #define CFGR_PPRE1_Reset_Mask ((u32)0xFFFFF8FF)
83 #define CFGR_PPRE1_Set_Mask ((u32)0x00000700)
84 #define CFGR_PPRE2_Reset_Mask ((u32)0xFFFFC7FF)
85 #define CFGR_PPRE2_Set_Mask ((u32)0x00003800)
86 #define CFGR_ADCPRE_Reset_Mask ((u32)0xFFFF3FFF)
87 #define CFGR_ADCPRE_Set_Mask ((u32)0x0000C000)
88
89 /* CSR register bit mask */
90 #define CSR_RMVF_Set ((u32)0x01000000)
91
92 /* RCC Flag Mask */
93 #define FLAG_Mask ((u8)0x1F)
94
95 /* Typical Value of the HSI in Hz */
96 #define HSI_Value ((u32)8000000)
97
98 /* BDCR register base address */
99 #define BDCR_BASE (PERIPH_BASE + BDCR_OFFSET)
100
101 /* Time out for HSE start up */
102 #define HSEStartUp_TimeOut 128
103
104 /* Private macro -------------------------------------------------------------*/
105 /* Private variables ---------------------------------------------------------*/
\ In segment DATA_C, align 4, align-sorted
106 static uc8 APBAHBPrescTable[16] = {0, 0, 0, 0, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 9};
\ APBAHBPrescTable:
\ 00000000 000000000102 DC8 0, 0, 0, 0, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 9
\ 030401020304
\ 06070809
\ 00000010 02040608 DC8 2, 4, 6, 8
107 static uc8 ADCPrescTable[4] = {2, 4, 6, 8};
108
109 /* Private function prototypes -----------------------------------------------*/
110 /* Private functions ---------------------------------------------------------*/
111
112 /*******************************************************************************
113 * Function Name : RCC_DeInit
114 * Description : Deinitializes the RCC peripheral registers to their default
115 * reset values.
116 * - The HSITRIM[4:0] bits in RCC_CR register are not modified
117 * by this function.
118 * - The RCC_BDCR and RCC_CSR registers are not reset by this
119 * function.
120 * Input : None
121 * Output : None
122 * Return : None
123 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
124 void RCC_DeInit(void)
125 {
\ RCC_DeInit:
\ 00000000 10B5 PUSH {R4,LR}
126 /* Disable APB2 Peripheral Reset */
127 RCC->APB2RSTR = 0x00000000;
\ 00000002 0020 MOVS R0,#+0
\ 00000004 .... LDR.N R1,??DataTable15 ;; 0x4002100c
\ 00000006 0860 STR R0,[R1, #+0]
128
129 /* Disable APB1 Peripheral Reset */
130 RCC->APB1RSTR = 0x00000000;
\ 00000008 091D ADDS R1,R1,#+4
\ 0000000A 0860 STR R0,[R1, #+0]
131
132 /* FLITF and SRAM Clock ON */
133 RCC->AHBENR = 0x00000014;
\ 0000000C 091D ADDS R1,R1,#+4
\ 0000000E 1422 MOVS R2,#+20
\ 00000010 0A60 STR R2,[R1, #+0]
134
135 /* Disable APB2 Peripheral Clock */
136 RCC->APB2ENR = 0x00000000;
\ 00000012 091D ADDS R1,R1,#+4
\ 00000014 0860 STR R0,[R1, #+0]
137
138 /* Disable APB1 Peripheral Clock */
139 RCC->APB1ENR = 0x00000000;
\ 00000016 091D ADDS R1,R1,#+4
\ 00000018 0860 STR R0,[R1, #+0]
140
141 /* Set HSION bit */
142 RCC->CR |= (u32)0x00000001;
\ 0000001A 1C39 SUBS R1,R1,#+28
\ 0000001C 0A68 LDR R2,[R1, #+0]
\ 0000001E 52F00102 ORRS R2,R2,#0x1
\ 00000022 0A60 STR R2,[R1, #+0]
143
144 /* Reset SW[1:0], HPRE[3:0], PPRE1[2:0], PPRE2[2:0], ADCPRE[1:0] and MCO[2:0] bits*/
145 RCC->CFGR &= 0xF8FF0000;
\ 00000024 .... LDR.N R2,??DataTable14 ;; 0x40021004
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -