annotate f103c8/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h @ 6:ca42336826bd default tip

working on clock sources
author cin
date Mon, 23 Jan 2017 02:40:17 +0300
parents 0c59e7a7782a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
2 ******************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
3 * @file stm32f1xx_hal_rcc.h
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
4 * @author MCD Application Team
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
5 * @version V1.0.4
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
6 * @date 29-April-2016
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
7 * @brief Header file of RCC HAL module.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
8 ******************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
9 * @attention
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
10 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
12 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
13 * Redistribution and use in source and binary forms, with or without modification,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
14 * are permitted provided that the following conditions are met:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
15 * 1. Redistributions of source code must retain the above copyright notice,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
16 * this list of conditions and the following disclaimer.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
18 * this list of conditions and the following disclaimer in the documentation
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
19 * and/or other materials provided with the distribution.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
21 * may be used to endorse or promote products derived from this software
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
22 * without specific prior written permission.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
23 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
34 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
35 ******************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
36 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
37
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
38 /* Define to prevent recursive inclusion -------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
39 #ifndef __STM32F1xx_HAL_RCC_H
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
40 #define __STM32F1xx_HAL_RCC_H
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
41
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
42 #ifdef __cplusplus
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
43 extern "C" {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
44 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
45
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
46 /* Includes ------------------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
47 #include "stm32f1xx_hal_def.h"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
48
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
49 /** @addtogroup STM32F1xx_HAL_Driver
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
50 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
51 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
52
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
53 /** @addtogroup RCC
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
54 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
55 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
56
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
57 /** @addtogroup RCC_Private_Constants
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
58 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
59 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
60
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
61 /** @defgroup RCC_Timeout RCC Timeout
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
62 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
63 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
64
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
65 /* Disable Backup domain write protection state change timeout */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
66 #define RCC_DBP_TIMEOUT_VALUE ((uint32_t)100) /* 100 ms */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
67 /* LSE state change timeout */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
68 #define RCC_LSE_TIMEOUT_VALUE LSE_STARTUP_TIMEOUT
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
69 #define CLOCKSWITCH_TIMEOUT_VALUE ((uint32_t)5000) /* 5 s */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
70 #define HSE_TIMEOUT_VALUE HSE_STARTUP_TIMEOUT
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
71 #define HSI_TIMEOUT_VALUE ((uint32_t)2) /* 2 ms (minimum Tick + 1) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
72 #define LSI_TIMEOUT_VALUE ((uint32_t)2) /* 2 ms (minimum Tick + 1) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
73 #define PLL_TIMEOUT_VALUE ((uint32_t)2) /* 2 ms (minimum Tick + 1) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
74 #define LSI_VALUE ((uint32_t)40000) /* 40kHz */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
75 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
76 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
77 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
78
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
79 /** @defgroup RCC_Register_Offset Register offsets
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
80 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
81 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
82 #define RCC_OFFSET (RCC_BASE - PERIPH_BASE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
83 #define RCC_CR_OFFSET 0x00
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
84 #define RCC_CFGR_OFFSET 0x04
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
85 #define RCC_CIR_OFFSET 0x08
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
86 #define RCC_BDCR_OFFSET 0x20
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
87 #define RCC_CSR_OFFSET 0x24
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
88
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
89 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
90 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
91 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
92
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
93 /** @defgroup RCC_BitAddress_AliasRegion BitAddress AliasRegion
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
94 * @brief RCC registers bit address in the alias region
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
95 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
96 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
97 #define RCC_CR_OFFSET_BB (RCC_OFFSET + RCC_CR_OFFSET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
98 #define RCC_CFGR_OFFSET_BB (RCC_OFFSET + RCC_CFGR_OFFSET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
99 #define RCC_CIR_OFFSET_BB (RCC_OFFSET + RCC_CIR_OFFSET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
100 #define RCC_BDCR_OFFSET_BB (RCC_OFFSET + RCC_BDCR_OFFSET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
101 #define RCC_CSR_OFFSET_BB (RCC_OFFSET + RCC_CSR_OFFSET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
102
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
103 /* --- CR Register ---*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
104 /* Alias word address of HSION bit */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
105 #define RCC_HSION_BIT_NUMBER POSITION_VAL(RCC_CR_HSION)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
106 #define RCC_CR_HSION_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32) + (RCC_HSION_BIT_NUMBER * 4)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
107 /* Alias word address of HSEON bit */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
108 #define RCC_HSEON_BIT_NUMBER POSITION_VAL(RCC_CR_HSEON)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
109 #define RCC_CR_HSEON_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32) + (RCC_HSEON_BIT_NUMBER * 4)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
110 /* Alias word address of CSSON bit */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
111 #define RCC_CSSON_BIT_NUMBER POSITION_VAL(RCC_CR_CSSON)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
112 #define RCC_CR_CSSON_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32) + (RCC_CSSON_BIT_NUMBER * 4)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
113 /* Alias word address of PLLON bit */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
114 #define RCC_PLLON_BIT_NUMBER POSITION_VAL(RCC_CR_PLLON)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
115 #define RCC_CR_PLLON_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32) + (RCC_PLLON_BIT_NUMBER * 4)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
116
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
117 /* --- CSR Register ---*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
118 /* Alias word address of LSION bit */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
119 #define RCC_LSION_BIT_NUMBER POSITION_VAL(RCC_CSR_LSION)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
120 #define RCC_CSR_LSION_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32) + (RCC_LSION_BIT_NUMBER * 4)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
121
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
122 /* Alias word address of RMVF bit */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
123 #define RCC_RMVF_BIT_NUMBER POSITION_VAL(RCC_CSR_RMVF)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
124 #define RCC_CSR_RMVF_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32) + (RCC_RMVF_BIT_NUMBER * 4)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
125
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
126 /* --- BDCR Registers ---*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
127 /* Alias word address of LSEON bit */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
128 #define RCC_LSEON_BIT_NUMBER POSITION_VAL(RCC_BDCR_LSEON)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
129 #define RCC_BDCR_LSEON_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_BDCR_OFFSET_BB * 32) + (RCC_LSEON_BIT_NUMBER * 4)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
130
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
131 /* Alias word address of LSEON bit */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
132 #define RCC_LSEBYP_BIT_NUMBER POSITION_VAL(RCC_BDCR_LSEBYP)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
133 #define RCC_BDCR_LSEBYP_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_BDCR_OFFSET_BB * 32) + (RCC_LSEBYP_BIT_NUMBER * 4)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
134
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
135 /* Alias word address of RTCEN bit */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
136 #define RCC_RTCEN_BIT_NUMBER POSITION_VAL(RCC_BDCR_RTCEN)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
137 #define RCC_BDCR_RTCEN_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_BDCR_OFFSET_BB * 32) + (RCC_RTCEN_BIT_NUMBER * 4)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
138
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
139 /* Alias word address of BDRST bit */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
140 #define RCC_BDRST_BIT_NUMBER POSITION_VAL(RCC_BDCR_BDRST)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
141 #define RCC_BDCR_BDRST_BB ((uint32_t)(PERIPH_BB_BASE + (RCC_BDCR_OFFSET_BB * 32) + (RCC_BDRST_BIT_NUMBER * 4)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
142
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
143 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
144 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
145 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
146
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
147 /* CR register byte 2 (Bits[23:16]) base address */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
148 #define RCC_CR_BYTE2_ADDRESS ((uint32_t)(RCC_BASE + RCC_CR_OFFSET + 0x02))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
149
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
150 /* CIR register byte 1 (Bits[15:8]) base address */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
151 #define RCC_CIR_BYTE1_ADDRESS ((uint32_t)(RCC_BASE + RCC_CIR_OFFSET + 0x01))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
152
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
153 /* CIR register byte 2 (Bits[23:16]) base address */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
154 #define RCC_CIR_BYTE2_ADDRESS ((uint32_t)(RCC_BASE + RCC_CIR_OFFSET + 0x02))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
155
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
156 /* Defines used for Flags */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
157 #define CR_REG_INDEX ((uint8_t)1)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
158 #define BDCR_REG_INDEX ((uint8_t)2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
159 #define CSR_REG_INDEX ((uint8_t)3)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
160
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
161 #define RCC_FLAG_MASK ((uint8_t)0x1F)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
162
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
163 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
164 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
165 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
166
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
167 /** @addtogroup RCC_Private_Macros
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
168 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
169 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
170 /** @defgroup RCC_Alias_For_Legacy Alias define maintained for legacy
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
171 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
172 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
173 #define __HAL_RCC_SYSCFG_CLK_DISABLE __HAL_RCC_AFIO_CLK_DISABLE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
174 #define __HAL_RCC_SYSCFG_CLK_ENABLE __HAL_RCC_AFIO_CLK_ENABLE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
175 #define __HAL_RCC_SYSCFG_FORCE_RESET __HAL_RCC_AFIO_FORCE_RESET
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
176 #define __HAL_RCC_SYSCFG_RELEASE_RESET __HAL_RCC_AFIO_RELEASE_RESET
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
177 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
178 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
179 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
180
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
181 #define IS_RCC_PLLSOURCE(__SOURCE__) (((__SOURCE__) == RCC_PLLSOURCE_HSI_DIV2) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
182 ((__SOURCE__) == RCC_PLLSOURCE_HSE))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
183 #define IS_RCC_OSCILLATORTYPE(__OSCILLATOR__) (((__OSCILLATOR__) == RCC_OSCILLATORTYPE_NONE) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
184 (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSE) == RCC_OSCILLATORTYPE_HSE) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
185 (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSI) == RCC_OSCILLATORTYPE_HSI) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
186 (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSI) == RCC_OSCILLATORTYPE_LSI) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
187 (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSE) == RCC_OSCILLATORTYPE_LSE))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
188 #define IS_RCC_HSE(__HSE__) (((__HSE__) == RCC_HSE_OFF) || ((__HSE__) == RCC_HSE_ON) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
189 ((__HSE__) == RCC_HSE_BYPASS))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
190 #define IS_RCC_LSE(__LSE__) (((__LSE__) == RCC_LSE_OFF) || ((__LSE__) == RCC_LSE_ON) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
191 ((__LSE__) == RCC_LSE_BYPASS))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
192 #define IS_RCC_HSI(__HSI__) (((__HSI__) == RCC_HSI_OFF) || ((__HSI__) == RCC_HSI_ON))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
193 #define IS_RCC_CALIBRATION_VALUE(__VALUE__) ((__VALUE__) <= 0x1F)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
194 #define IS_RCC_LSI(__LSI__) (((__LSI__) == RCC_LSI_OFF) || ((__LSI__) == RCC_LSI_ON))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
195 #define IS_RCC_PLL(__PLL__) (((__PLL__) == RCC_PLL_NONE) || ((__PLL__) == RCC_PLL_OFF) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
196 ((__PLL__) == RCC_PLL_ON))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
197
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
198 #define IS_RCC_CLOCKTYPE(CLK) ((((CLK) & RCC_CLOCKTYPE_SYSCLK) == RCC_CLOCKTYPE_SYSCLK) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
199 (((CLK) & RCC_CLOCKTYPE_HCLK) == RCC_CLOCKTYPE_HCLK) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
200 (((CLK) & RCC_CLOCKTYPE_PCLK1) == RCC_CLOCKTYPE_PCLK1) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
201 (((CLK) & RCC_CLOCKTYPE_PCLK2) == RCC_CLOCKTYPE_PCLK2))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
202 #define IS_RCC_SYSCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_SYSCLKSOURCE_HSI) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
203 ((__SOURCE__) == RCC_SYSCLKSOURCE_HSE) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
204 ((__SOURCE__) == RCC_SYSCLKSOURCE_PLLCLK))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
205 #define IS_RCC_SYSCLKSOURCE_STATUS(__SOURCE__) (((__SOURCE__) == RCC_SYSCLKSOURCE_STATUS_HSI) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
206 ((__SOURCE__) == RCC_SYSCLKSOURCE_STATUS_HSE) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
207 ((__SOURCE__) == RCC_SYSCLKSOURCE_STATUS_PLLCLK))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
208 #define IS_RCC_HCLK(__HCLK__) (((__HCLK__) == RCC_SYSCLK_DIV1) || ((__HCLK__) == RCC_SYSCLK_DIV2) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
209 ((__HCLK__) == RCC_SYSCLK_DIV4) || ((__HCLK__) == RCC_SYSCLK_DIV8) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
210 ((__HCLK__) == RCC_SYSCLK_DIV16) || ((__HCLK__) == RCC_SYSCLK_DIV64) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
211 ((__HCLK__) == RCC_SYSCLK_DIV128) || ((__HCLK__) == RCC_SYSCLK_DIV256) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
212 ((__HCLK__) == RCC_SYSCLK_DIV512))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
213 #define IS_RCC_PCLK(__PCLK__) (((__PCLK__) == RCC_HCLK_DIV1) || ((__PCLK__) == RCC_HCLK_DIV2) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
214 ((__PCLK__) == RCC_HCLK_DIV4) || ((__PCLK__) == RCC_HCLK_DIV8) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
215 ((__PCLK__) == RCC_HCLK_DIV16))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
216 #define IS_RCC_MCO(__MCO__) ((__MCO__) == RCC_MCO)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
217 #define IS_RCC_MCODIV(__DIV__) (((__DIV__) == RCC_MCODIV_1))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
218 #define IS_RCC_RTCCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_RTCCLKSOURCE_NO_CLK) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
219 ((__SOURCE__) == RCC_RTCCLKSOURCE_LSE) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
220 ((__SOURCE__) == RCC_RTCCLKSOURCE_LSI) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
221 ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV128))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
222
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
223 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
224 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
225 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
226
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
227 /* Exported types ------------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
228
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
229 /** @defgroup RCC_Exported_Types RCC Exported Types
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
230 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
231 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
232
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
233 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
234 * @brief RCC PLL configuration structure definition
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
235 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
236 typedef struct
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
237 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
238 uint32_t PLLState; /*!< PLLState: The new state of the PLL.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
239 This parameter can be a value of @ref RCC_PLL_Config */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
240
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
241 uint32_t PLLSource; /*!< PLLSource: PLL entry clock source.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
242 This parameter must be a value of @ref RCC_PLL_Clock_Source */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
243
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
244 uint32_t PLLMUL; /*!< PLLMUL: Multiplication factor for PLL VCO input clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
245 This parameter must be a value of @ref RCCEx_PLL_Multiplication_Factor */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
246 } RCC_PLLInitTypeDef;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
247
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
248 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
249 * @brief RCC System, AHB and APB busses clock configuration structure definition
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
250 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
251 typedef struct
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
252 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
253 uint32_t ClockType; /*!< The clock to be configured.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
254 This parameter can be a value of @ref RCC_System_Clock_Type */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
255
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
256 uint32_t SYSCLKSource; /*!< The clock source (SYSCLKS) used as system clock.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
257 This parameter can be a value of @ref RCC_System_Clock_Source */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
258
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
259 uint32_t AHBCLKDivider; /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
260 This parameter can be a value of @ref RCC_AHB_Clock_Source */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
261
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
262 uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
263 This parameter can be a value of @ref RCC_APB1_APB2_Clock_Source */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
264
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
265 uint32_t APB2CLKDivider; /*!< The APB2 clock (PCLK2) divider. This clock is derived from the AHB clock (HCLK).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
266 This parameter can be a value of @ref RCC_APB1_APB2_Clock_Source */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
267 } RCC_ClkInitTypeDef;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
268
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
269 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
270 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
271 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
272
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
273 /* Exported constants --------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
274 /** @defgroup RCC_Exported_Constants RCC Exported Constants
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
275 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
276 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
277
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
278 /** @defgroup RCC_PLL_Clock_Source PLL Clock Source
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
279 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
280 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
281
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
282 #define RCC_PLLSOURCE_HSI_DIV2 ((uint32_t)0x00000000) /*!< HSI clock divided by 2 selected as PLL entry clock source */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
283 #define RCC_PLLSOURCE_HSE RCC_CFGR_PLLSRC /*!< HSE clock selected as PLL entry clock source */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
284
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
285 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
286 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
287 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
288
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
289 /** @defgroup RCC_Oscillator_Type Oscillator Type
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
290 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
291 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
292 #define RCC_OSCILLATORTYPE_NONE ((uint32_t)0x00000000)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
293 #define RCC_OSCILLATORTYPE_HSE ((uint32_t)0x00000001)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
294 #define RCC_OSCILLATORTYPE_HSI ((uint32_t)0x00000002)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
295 #define RCC_OSCILLATORTYPE_LSE ((uint32_t)0x00000004)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
296 #define RCC_OSCILLATORTYPE_LSI ((uint32_t)0x00000008)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
297 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
298 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
299 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
300
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
301 /** @defgroup RCC_HSE_Config HSE Config
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
302 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
303 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
304 #define RCC_HSE_OFF ((uint32_t)0x00000000) /*!< HSE clock deactivation */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
305 #define RCC_HSE_ON RCC_CR_HSEON /*!< HSE clock activation */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
306 #define RCC_HSE_BYPASS ((uint32_t)(RCC_CR_HSEBYP | RCC_CR_HSEON)) /*!< External clock source for HSE clock */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
307 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
308 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
309 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
310
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
311 /** @defgroup RCC_LSE_Config LSE Config
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
312 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
313 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
314 #define RCC_LSE_OFF ((uint32_t)0x00000000) /*!< LSE clock deactivation */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
315 #define RCC_LSE_ON RCC_BDCR_LSEON /*!< LSE clock activation */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
316 #define RCC_LSE_BYPASS ((uint32_t)(RCC_BDCR_LSEBYP | RCC_BDCR_LSEON)) /*!< External clock source for LSE clock */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
317
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
318 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
319 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
320 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
321
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
322 /** @defgroup RCC_HSI_Config HSI Config
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
323 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
324 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
325 #define RCC_HSI_OFF ((uint32_t)0x00000000) /*!< HSI clock deactivation */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
326 #define RCC_HSI_ON RCC_CR_HSION /*!< HSI clock activation */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
327
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
328 #define RCC_HSICALIBRATION_DEFAULT ((uint32_t)0x10) /* Default HSI calibration trimming value */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
329
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
330 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
331 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
332 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
333
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
334 /** @defgroup RCC_LSI_Config LSI Config
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
335 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
336 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
337 #define RCC_LSI_OFF ((uint32_t)0x00000000) /*!< LSI clock deactivation */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
338 #define RCC_LSI_ON RCC_CSR_LSION /*!< LSI clock activation */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
339
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
340 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
341 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
342 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
343
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
344 /** @defgroup RCC_PLL_Config PLL Config
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
345 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
346 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
347 #define RCC_PLL_NONE ((uint32_t)0x00000000) /*!< PLL is not configured */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
348 #define RCC_PLL_OFF ((uint32_t)0x00000001) /*!< PLL deactivation */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
349 #define RCC_PLL_ON ((uint32_t)0x00000002) /*!< PLL activation */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
350
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
351 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
352 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
353 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
354
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
355 /** @defgroup RCC_System_Clock_Type System Clock Type
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
356 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
357 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
358 #define RCC_CLOCKTYPE_SYSCLK ((uint32_t)0x00000001) /*!< SYSCLK to configure */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
359 #define RCC_CLOCKTYPE_HCLK ((uint32_t)0x00000002) /*!< HCLK to configure */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
360 #define RCC_CLOCKTYPE_PCLK1 ((uint32_t)0x00000004) /*!< PCLK1 to configure */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
361 #define RCC_CLOCKTYPE_PCLK2 ((uint32_t)0x00000008) /*!< PCLK2 to configure */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
362
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
363 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
364 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
365 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
366
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
367 /** @defgroup RCC_System_Clock_Source System Clock Source
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
368 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
369 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
370 #define RCC_SYSCLKSOURCE_HSI RCC_CFGR_SW_HSI /*!< HSI selected as system clock */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
371 #define RCC_SYSCLKSOURCE_HSE RCC_CFGR_SW_HSE /*!< HSE selected as system clock */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
372 #define RCC_SYSCLKSOURCE_PLLCLK RCC_CFGR_SW_PLL /*!< PLL selected as system clock */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
373
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
374 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
375 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
376 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
377
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
378 /** @defgroup RCC_System_Clock_Source_Status System Clock Source Status
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
379 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
380 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
381 #define RCC_SYSCLKSOURCE_STATUS_HSI RCC_CFGR_SWS_HSI /*!< HSI used as system clock */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
382 #define RCC_SYSCLKSOURCE_STATUS_HSE RCC_CFGR_SWS_HSE /*!< HSE used as system clock */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
383 #define RCC_SYSCLKSOURCE_STATUS_PLLCLK RCC_CFGR_SWS_PLL /*!< PLL used as system clock */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
384
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
385 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
386 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
387 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
388
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
389 /** @defgroup RCC_AHB_Clock_Source AHB Clock Source
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
390 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
391 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
392 #define RCC_SYSCLK_DIV1 RCC_CFGR_HPRE_DIV1 /*!< SYSCLK not divided */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
393 #define RCC_SYSCLK_DIV2 RCC_CFGR_HPRE_DIV2 /*!< SYSCLK divided by 2 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
394 #define RCC_SYSCLK_DIV4 RCC_CFGR_HPRE_DIV4 /*!< SYSCLK divided by 4 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
395 #define RCC_SYSCLK_DIV8 RCC_CFGR_HPRE_DIV8 /*!< SYSCLK divided by 8 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
396 #define RCC_SYSCLK_DIV16 RCC_CFGR_HPRE_DIV16 /*!< SYSCLK divided by 16 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
397 #define RCC_SYSCLK_DIV64 RCC_CFGR_HPRE_DIV64 /*!< SYSCLK divided by 64 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
398 #define RCC_SYSCLK_DIV128 RCC_CFGR_HPRE_DIV128 /*!< SYSCLK divided by 128 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
399 #define RCC_SYSCLK_DIV256 RCC_CFGR_HPRE_DIV256 /*!< SYSCLK divided by 256 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
400 #define RCC_SYSCLK_DIV512 RCC_CFGR_HPRE_DIV512 /*!< SYSCLK divided by 512 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
401
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
402 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
403 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
404 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
405
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
406 /** @defgroup RCC_APB1_APB2_Clock_Source APB1 APB2 Clock Source
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
407 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
408 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
409 #define RCC_HCLK_DIV1 RCC_CFGR_PPRE1_DIV1 /*!< HCLK not divided */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
410 #define RCC_HCLK_DIV2 RCC_CFGR_PPRE1_DIV2 /*!< HCLK divided by 2 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
411 #define RCC_HCLK_DIV4 RCC_CFGR_PPRE1_DIV4 /*!< HCLK divided by 4 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
412 #define RCC_HCLK_DIV8 RCC_CFGR_PPRE1_DIV8 /*!< HCLK divided by 8 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
413 #define RCC_HCLK_DIV16 RCC_CFGR_PPRE1_DIV16 /*!< HCLK divided by 16 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
414
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
415 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
416 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
417 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
418
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
419 /** @defgroup RCC_RTC_Clock_Source RTC Clock Source
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
420 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
421 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
422 #define RCC_RTCCLKSOURCE_NO_CLK ((uint32_t)0x00000000) /*!< No clock */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
423 #define RCC_RTCCLKSOURCE_LSE RCC_BDCR_RTCSEL_LSE /*!< LSE oscillator clock used as RTC clock */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
424 #define RCC_RTCCLKSOURCE_LSI RCC_BDCR_RTCSEL_LSI /*!< LSI oscillator clock used as RTC clock */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
425 #define RCC_RTCCLKSOURCE_HSE_DIV128 RCC_BDCR_RTCSEL_HSE /*!< HSE oscillator clock divided by 128 used as RTC clock */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
426 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
427 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
428 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
429
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
430
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
431 /** @defgroup RCC_MCO_Index MCO Index
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
432 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
433 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
434 #define RCC_MCO1 ((uint32_t)0x00000000)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
435 #define RCC_MCO RCC_MCO1 /*!< MCO1 to be compliant with other families with 2 MCOs*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
436
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
437 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
438 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
439 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
440
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
441 /** @defgroup RCC_MCOx_Clock_Prescaler MCO Clock Prescaler
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
442 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
443 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
444 #define RCC_MCODIV_1 ((uint32_t)0x00000000)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
445
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
446 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
447 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
448 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
449
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
450 /** @defgroup RCC_Interrupt Interrupts
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
451 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
452 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
453 #define RCC_IT_LSIRDY ((uint8_t)RCC_CIR_LSIRDYF) /*!< LSI Ready Interrupt flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
454 #define RCC_IT_LSERDY ((uint8_t)RCC_CIR_LSERDYF) /*!< LSE Ready Interrupt flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
455 #define RCC_IT_HSIRDY ((uint8_t)RCC_CIR_HSIRDYF) /*!< HSI Ready Interrupt flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
456 #define RCC_IT_HSERDY ((uint8_t)RCC_CIR_HSERDYF) /*!< HSE Ready Interrupt flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
457 #define RCC_IT_PLLRDY ((uint8_t)RCC_CIR_PLLRDYF) /*!< PLL Ready Interrupt flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
458 #define RCC_IT_CSS ((uint8_t)RCC_CIR_CSSF) /*!< Clock Security System Interrupt flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
459 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
460 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
461 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
462
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
463 /** @defgroup RCC_Flag Flags
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
464 * Elements values convention: XXXYYYYYb
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
465 * - YYYYY : Flag position in the register
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
466 * - XXX : Register index
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
467 * - 001: CR register
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
468 * - 010: BDCR register
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
469 * - 011: CSR register
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
470 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
471 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
472 /* Flags in the CR register */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
473 #define RCC_FLAG_HSIRDY ((uint8_t)((CR_REG_INDEX << 5) | POSITION_VAL(RCC_CR_HSIRDY))) /*!< Internal High Speed clock ready flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
474 #define RCC_FLAG_HSERDY ((uint8_t)((CR_REG_INDEX << 5) | POSITION_VAL(RCC_CR_HSERDY))) /*!< External High Speed clock ready flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
475 #define RCC_FLAG_PLLRDY ((uint8_t)((CR_REG_INDEX << 5) | POSITION_VAL(RCC_CR_PLLRDY))) /*!< PLL clock ready flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
476
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
477 /* Flags in the CSR register */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
478 #define RCC_FLAG_LSIRDY ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_LSIRDY))) /*!< Internal Low Speed oscillator Ready */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
479 #define RCC_FLAG_PINRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_PINRSTF))) /*!< PIN reset flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
480 #define RCC_FLAG_PORRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_PORRSTF))) /*!< POR/PDR reset flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
481 #define RCC_FLAG_SFTRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_SFTRSTF))) /*!< Software Reset flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
482 #define RCC_FLAG_IWDGRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_IWDGRSTF))) /*!< Independent Watchdog reset flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
483 #define RCC_FLAG_WWDGRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_WWDGRSTF))) /*!< Window watchdog reset flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
484 #define RCC_FLAG_LPWRRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_LPWRRSTF))) /*!< Low-Power reset flag */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
485
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
486 /* Flags in the BDCR register */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
487 #define RCC_FLAG_LSERDY ((uint8_t)((BDCR_REG_INDEX << 5) | POSITION_VAL(RCC_BDCR_LSERDY))) /*!< External Low Speed oscillator Ready */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
488
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
489 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
490 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
491 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
492
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
493 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
494 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
495 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
496
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
497 /* Exported macro ------------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
498
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
499 /** @defgroup RCC_Exported_Macros RCC Exported Macros
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
500 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
501 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
502
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
503 /** @defgroup RCC_Peripheral_Clock_Enable_Disable Peripheral Clock Enable Disable
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
504 * @brief Enable or disable the AHB1 peripheral clock.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
505 * @note After reset, the peripheral clock (used for registers read/write access)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
506 * is disabled and the application software has to enable this clock before
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
507 * using it.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
508 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
509 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
510 #define __HAL_RCC_DMA1_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
511 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
512 SET_BIT(RCC->AHBENR, RCC_AHBENR_DMA1EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
513 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
514 tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_DMA1EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
515 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
516 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
517
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
518 #define __HAL_RCC_SRAM_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
519 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
520 SET_BIT(RCC->AHBENR, RCC_AHBENR_SRAMEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
521 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
522 tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_SRAMEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
523 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
524 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
525
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
526 #define __HAL_RCC_FLITF_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
527 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
528 SET_BIT(RCC->AHBENR, RCC_AHBENR_FLITFEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
529 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
530 tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_FLITFEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
531 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
532 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
533
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
534 #define __HAL_RCC_CRC_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
535 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
536 SET_BIT(RCC->AHBENR, RCC_AHBENR_CRCEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
537 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
538 tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_CRCEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
539 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
540 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
541
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
542 #define __HAL_RCC_DMA1_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_DMA1EN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
543 #define __HAL_RCC_SRAM_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_SRAMEN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
544 #define __HAL_RCC_FLITF_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_FLITFEN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
545 #define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_CRCEN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
546
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
547 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
548 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
549 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
550
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
551 /** @defgroup RCC_AHB_Peripheral_Clock_Enable_Disable_Status AHB Peripheral Clock Enable Disable Status
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
552 * @brief Get the enable or disable status of the AHB peripheral clock.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
553 * @note After reset, the peripheral clock (used for registers read/write access)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
554 * is disabled and the application software has to enable this clock before
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
555 * using it.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
556 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
557 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
558
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
559 #define __HAL_RCC_DMA1_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_DMA1EN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
560 #define __HAL_RCC_DMA1_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_DMA1EN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
561 #define __HAL_RCC_SRAM_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_SRAMEN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
562 #define __HAL_RCC_SRAM_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_SRAMEN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
563 #define __HAL_RCC_FLITF_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_FLITFEN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
564 #define __HAL_RCC_FLITF_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_FLITFEN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
565 #define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_CRCEN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
566 #define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_CRCEN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
567
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
568 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
569 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
570 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
571
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
572 /** @defgroup RCC_APB1_Clock_Enable_Disable APB1 Clock Enable Disable
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
573 * @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
574 * @note After reset, the peripheral clock (used for registers read/write access)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
575 * is disabled and the application software has to enable this clock before
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
576 * using it.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
577 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
578 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
579 #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
580 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
581 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
582 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
583 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
584 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
585 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
586
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
587 #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
588 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
589 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
590 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
591 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
592 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
593 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
594
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
595 #define __HAL_RCC_WWDG_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
596 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
597 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_WWDGEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
598 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
599 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_WWDGEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
600 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
601 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
602
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
603 #define __HAL_RCC_USART2_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
604 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
605 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
606 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
607 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
608 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
609 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
610
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
611 #define __HAL_RCC_I2C1_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
612 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
613 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
614 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
615 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
616 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
617 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
618
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
619 #define __HAL_RCC_BKP_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
620 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
621 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_BKPEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
622 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
623 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_BKPEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
624 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
625 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
626
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
627 #define __HAL_RCC_PWR_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
628 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
629 SET_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
630 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
631 tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
632 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
633 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
634
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
635 #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
636 #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
637 #define __HAL_RCC_WWDG_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_WWDGEN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
638 #define __HAL_RCC_USART2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART2EN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
639 #define __HAL_RCC_I2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C1EN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
640
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
641 #define __HAL_RCC_BKP_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_BKPEN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
642 #define __HAL_RCC_PWR_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_PWREN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
643
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
644 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
645 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
646 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
647
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
648 /** @defgroup RCC_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
649 * @brief Get the enable or disable status of the APB1 peripheral clock.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
650 * @note After reset, the peripheral clock (used for registers read/write access)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
651 * is disabled and the application software has to enable this clock before
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
652 * using it.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
653 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
654 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
655
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
656 #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
657 #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
658 #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
659 #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
660 #define __HAL_RCC_WWDG_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_WWDGEN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
661 #define __HAL_RCC_WWDG_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_WWDGEN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
662 #define __HAL_RCC_USART2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
663 #define __HAL_RCC_USART2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
664 #define __HAL_RCC_I2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
665 #define __HAL_RCC_I2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
666 #define __HAL_RCC_BKP_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_BKPEN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
667 #define __HAL_RCC_BKP_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_BKPEN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
668 #define __HAL_RCC_PWR_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_PWREN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
669 #define __HAL_RCC_PWR_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_PWREN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
670
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
671 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
672 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
673 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
674
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
675 /** @defgroup RCC_APB2_Clock_Enable_Disable APB2 Clock Enable Disable
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
676 * @brief Enable or disable the High Speed APB (APB2) peripheral clock.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
677 * @note After reset, the peripheral clock (used for registers read/write access)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
678 * is disabled and the application software has to enable this clock before
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
679 * using it.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
680 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
681 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
682 #define __HAL_RCC_AFIO_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
683 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
684 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_AFIOEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
685 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
686 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_AFIOEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
687 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
688 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
689
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
690 #define __HAL_RCC_GPIOA_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
691 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
692 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPAEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
693 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
694 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPAEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
695 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
696 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
697
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
698 #define __HAL_RCC_GPIOB_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
699 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
700 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPBEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
701 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
702 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPBEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
703 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
704 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
705
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
706 #define __HAL_RCC_GPIOC_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
707 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
708 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPCEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
709 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
710 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPCEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
711 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
712 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
713
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
714 #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
715 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
716 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPDEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
717 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
718 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPDEN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
719 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
720 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
721
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
722 #define __HAL_RCC_ADC1_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
723 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
724 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
725 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
726 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
727 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
728 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
729
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
730 #define __HAL_RCC_TIM1_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
731 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
732 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
733 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
734 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
735 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
736 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
737
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
738 #define __HAL_RCC_SPI1_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
739 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
740 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
741 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
742 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
743 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
744 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
745
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
746 #define __HAL_RCC_USART1_CLK_ENABLE() do { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
747 __IO uint32_t tmpreg; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
748 SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
749 /* Delay after an RCC peripheral clock enabling */\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
750 tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
751 UNUSED(tmpreg); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
752 } while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
753
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
754 #define __HAL_RCC_AFIO_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_AFIOEN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
755 #define __HAL_RCC_GPIOA_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPAEN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
756 #define __HAL_RCC_GPIOB_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPBEN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
757 #define __HAL_RCC_GPIOC_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPCEN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
758 #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_IOPDEN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
759 #define __HAL_RCC_ADC1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC1EN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
760
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
761 #define __HAL_RCC_TIM1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM1EN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
762 #define __HAL_RCC_SPI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI1EN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
763 #define __HAL_RCC_USART1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART1EN))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
764
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
765 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
766 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
767 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
768
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
769 /** @defgroup RCC_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
770 * @brief Get the enable or disable status of the APB2 peripheral clock.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
771 * @note After reset, the peripheral clock (used for registers read/write access)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
772 * is disabled and the application software has to enable this clock before
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
773 * using it.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
774 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
775 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
776
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
777 #define __HAL_RCC_AFIO_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_AFIOEN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
778 #define __HAL_RCC_AFIO_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_AFIOEN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
779 #define __HAL_RCC_GPIOA_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPAEN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
780 #define __HAL_RCC_GPIOA_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPAEN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
781 #define __HAL_RCC_GPIOB_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPBEN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
782 #define __HAL_RCC_GPIOB_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPBEN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
783 #define __HAL_RCC_GPIOC_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPCEN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
784 #define __HAL_RCC_GPIOC_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPCEN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
785 #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPDEN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
786 #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_IOPDEN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
787 #define __HAL_RCC_ADC1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
788 #define __HAL_RCC_ADC1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
789 #define __HAL_RCC_TIM1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM1EN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
790 #define __HAL_RCC_TIM1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM1EN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
791 #define __HAL_RCC_SPI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
792 #define __HAL_RCC_SPI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
793 #define __HAL_RCC_USART1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) != RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
794 #define __HAL_RCC_USART1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) == RESET)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
795
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
796 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
797 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
798 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
799
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
800 /** @defgroup RCC_APB1_Force_Release_Reset APB1 Force Release Reset
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
801 * @brief Force or release APB1 peripheral reset.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
802 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
803 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
804 #define __HAL_RCC_APB1_FORCE_RESET() (RCC->APB2RSTR = 0xFFFFFFFFU)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
805 #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
806 #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
807 #define __HAL_RCC_WWDG_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_WWDGRST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
808 #define __HAL_RCC_USART2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART2RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
809 #define __HAL_RCC_I2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C1RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
810
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
811 #define __HAL_RCC_BKP_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_BKPRST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
812 #define __HAL_RCC_PWR_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_PWRRST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
813
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
814 #define __HAL_RCC_APB1_RELEASE_RESET() (RCC->APB1RSTR = 0x00)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
815 #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
816 #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
817 #define __HAL_RCC_WWDG_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_WWDGRST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
818 #define __HAL_RCC_USART2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART2RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
819 #define __HAL_RCC_I2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C1RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
820
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
821 #define __HAL_RCC_BKP_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_BKPRST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
822 #define __HAL_RCC_PWR_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_PWRRST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
823
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
824 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
825 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
826 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
827
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
828 /** @defgroup RCC_APB2_Force_Release_Reset APB2 Force Release Reset
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
829 * @brief Force or release APB2 peripheral reset.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
830 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
831 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
832 #define __HAL_RCC_APB2_FORCE_RESET() (RCC->APB2RSTR = 0xFFFFFFFFU)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
833 #define __HAL_RCC_AFIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_AFIORST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
834 #define __HAL_RCC_GPIOA_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPARST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
835 #define __HAL_RCC_GPIOB_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPBRST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
836 #define __HAL_RCC_GPIOC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPCRST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
837 #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPDRST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
838 #define __HAL_RCC_ADC1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_ADC1RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
839
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
840 #define __HAL_RCC_TIM1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM1RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
841 #define __HAL_RCC_SPI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI1RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
842 #define __HAL_RCC_USART1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART1RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
843
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
844 #define __HAL_RCC_APB2_RELEASE_RESET() (RCC->APB2RSTR = 0x00)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
845 #define __HAL_RCC_AFIO_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_AFIORST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
846 #define __HAL_RCC_GPIOA_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPARST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
847 #define __HAL_RCC_GPIOB_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPBRST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
848 #define __HAL_RCC_GPIOC_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPCRST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
849 #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_IOPDRST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
850 #define __HAL_RCC_ADC1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_ADC1RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
851
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
852 #define __HAL_RCC_TIM1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM1RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
853 #define __HAL_RCC_SPI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI1RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
854 #define __HAL_RCC_USART1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART1RST))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
855
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
856 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
857 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
858 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
859
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
860 /** @defgroup RCC_HSI_Configuration HSI Configuration
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
861 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
862 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
863
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
864 /** @brief Macros to enable or disable the Internal High Speed oscillator (HSI).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
865 * @note The HSI is stopped by hardware when entering STOP and STANDBY modes.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
866 * @note HSI can not be stopped if it is used as system clock source. In this case,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
867 * you have to select another source of the system clock then stop the HSI.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
868 * @note After enabling the HSI, the application software should wait on HSIRDY
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
869 * flag to be set indicating that HSI clock is stable and can be used as
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
870 * system clock source.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
871 * @note When the HSI is stopped, HSIRDY flag goes low after 6 HSI oscillator
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
872 * clock cycles.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
873 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
874 #define __HAL_RCC_HSI_ENABLE() (*(__IO uint32_t *) RCC_CR_HSION_BB = ENABLE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
875 #define __HAL_RCC_HSI_DISABLE() (*(__IO uint32_t *) RCC_CR_HSION_BB = DISABLE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
876
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
877 /** @brief Macro to adjust the Internal High Speed oscillator (HSI) calibration value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
878 * @note The calibration is used to compensate for the variations in voltage
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
879 * and temperature that influence the frequency of the internal HSI RC.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
880 * @param _HSICALIBRATIONVALUE_ specifies the calibration trimming value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
881 * (default is RCC_HSICALIBRATION_DEFAULT).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
882 * This parameter must be a number between 0 and 0x1F.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
883 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
884 #define __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(_HSICALIBRATIONVALUE_) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
885 (MODIFY_REG(RCC->CR, RCC_CR_HSITRIM, (uint32_t)(_HSICALIBRATIONVALUE_) << POSITION_VAL(RCC_CR_HSITRIM)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
886
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
887 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
888 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
889 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
890
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
891 /** @defgroup RCC_LSI_Configuration LSI Configuration
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
892 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
893 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
894
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
895 /** @brief Macro to enable the Internal Low Speed oscillator (LSI).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
896 * @note After enabling the LSI, the application software should wait on
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
897 * LSIRDY flag to be set indicating that LSI clock is stable and can
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
898 * be used to clock the IWDG and/or the RTC.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
899 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
900 #define __HAL_RCC_LSI_ENABLE() (*(__IO uint32_t *) RCC_CSR_LSION_BB = ENABLE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
901
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
902 /** @brief Macro to disable the Internal Low Speed oscillator (LSI).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
903 * @note LSI can not be disabled if the IWDG is running.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
904 * @note When the LSI is stopped, LSIRDY flag goes low after 6 LSI oscillator
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
905 * clock cycles.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
906 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
907 #define __HAL_RCC_LSI_DISABLE() (*(__IO uint32_t *) RCC_CSR_LSION_BB = DISABLE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
908
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
909 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
910 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
911 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
912
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
913 /** @defgroup RCC_HSE_Configuration HSE Configuration
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
914 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
915 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
916
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
917 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
918 * @brief Macro to configure the External High Speed oscillator (HSE).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
919 * @note Transition HSE Bypass to HSE On and HSE On to HSE Bypass are not
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
920 * supported by this macro. User should request a transition to HSE Off
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
921 * first and then HSE On or HSE Bypass.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
922 * @note After enabling the HSE (RCC_HSE_ON or RCC_HSE_Bypass), the application
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
923 * software should wait on HSERDY flag to be set indicating that HSE clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
924 * is stable and can be used to clock the PLL and/or system clock.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
925 * @note HSE state can not be changed if it is used directly or through the
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
926 * PLL as system clock. In this case, you have to select another source
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
927 * of the system clock then change the HSE state (ex. disable it).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
928 * @note The HSE is stopped by hardware when entering STOP and STANDBY modes.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
929 * @note This function reset the CSSON bit, so if the clock security system(CSS)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
930 * was previously enabled you have to enable it again after calling this
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
931 * function.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
932 * @param __STATE__ specifies the new state of the HSE.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
933 * This parameter can be one of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
934 * @arg @ref RCC_HSE_OFF turn OFF the HSE oscillator, HSERDY flag goes low after
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
935 * 6 HSE oscillator clock cycles.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
936 * @arg @ref RCC_HSE_ON turn ON the HSE oscillator
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
937 * @arg @ref RCC_HSE_BYPASS HSE oscillator bypassed with external clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
938 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
939 #define __HAL_RCC_HSE_CONFIG(__STATE__) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
940 do{ \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
941 if ((__STATE__) == RCC_HSE_ON) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
942 { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
943 SET_BIT(RCC->CR, RCC_CR_HSEON); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
944 } \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
945 else if ((__STATE__) == RCC_HSE_OFF) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
946 { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
947 CLEAR_BIT(RCC->CR, RCC_CR_HSEON); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
948 CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
949 } \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
950 else if ((__STATE__) == RCC_HSE_BYPASS) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
951 { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
952 SET_BIT(RCC->CR, RCC_CR_HSEBYP); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
953 SET_BIT(RCC->CR, RCC_CR_HSEON); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
954 } \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
955 else \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
956 { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
957 CLEAR_BIT(RCC->CR, RCC_CR_HSEON); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
958 CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
959 } \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
960 }while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
961
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
962 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
963 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
964 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
965
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
966 /** @defgroup RCC_LSE_Configuration LSE Configuration
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
967 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
968 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
969
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
970 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
971 * @brief Macro to configure the External Low Speed oscillator (LSE).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
972 * @note Transitions LSE Bypass to LSE On and LSE On to LSE Bypass are not supported by this macro.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
973 * @note As the LSE is in the Backup domain and write access is denied to
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
974 * this domain after reset, you have to enable write access using
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
975 * @ref HAL_PWR_EnableBkUpAccess() function before to configure the LSE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
976 * (to be done once after reset).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
977 * @note After enabling the LSE (RCC_LSE_ON or RCC_LSE_BYPASS), the application
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
978 * software should wait on LSERDY flag to be set indicating that LSE clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
979 * is stable and can be used to clock the RTC.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
980 * @param __STATE__ specifies the new state of the LSE.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
981 * This parameter can be one of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
982 * @arg @ref RCC_LSE_OFF turn OFF the LSE oscillator, LSERDY flag goes low after
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
983 * 6 LSE oscillator clock cycles.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
984 * @arg @ref RCC_LSE_ON turn ON the LSE oscillator.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
985 * @arg @ref RCC_LSE_BYPASS LSE oscillator bypassed with external clock.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
986 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
987 #define __HAL_RCC_LSE_CONFIG(__STATE__) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
988 do{ \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
989 if ((__STATE__) == RCC_LSE_ON) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
990 { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
991 SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
992 } \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
993 else if ((__STATE__) == RCC_LSE_OFF) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
994 { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
995 CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
996 CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
997 } \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
998 else if ((__STATE__) == RCC_LSE_BYPASS) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
999 { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1000 SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1001 SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1002 } \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1003 else \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1004 { \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1005 CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1006 CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1007 } \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1008 }while(0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1009
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1010 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1011 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1012 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1013
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1014 /** @defgroup RCC_PLL_Configuration PLL Configuration
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1015 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1016 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1017
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1018 /** @brief Macro to enable the main PLL.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1019 * @note After enabling the main PLL, the application software should wait on
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1020 * PLLRDY flag to be set indicating that PLL clock is stable and can
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1021 * be used as system clock source.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1022 * @note The main PLL is disabled by hardware when entering STOP and STANDBY modes.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1023 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1024 #define __HAL_RCC_PLL_ENABLE() (*(__IO uint32_t *) RCC_CR_PLLON_BB = ENABLE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1025
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1026 /** @brief Macro to disable the main PLL.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1027 * @note The main PLL can not be disabled if it is used as system clock source
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1028 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1029 #define __HAL_RCC_PLL_DISABLE() (*(__IO uint32_t *) RCC_CR_PLLON_BB = DISABLE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1030
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1031 /** @brief Macro to configure the main PLL clock source and multiplication factors.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1032 * @note This function must be used only when the main PLL is disabled.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1033 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1034 * @param __RCC_PLLSOURCE__ specifies the PLL entry clock source.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1035 * This parameter can be one of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1036 * @arg @ref RCC_PLLSOURCE_HSI_DIV2 HSI oscillator clock selected as PLL clock entry
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1037 * @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL clock entry
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1038 * @param __PLLMUL__ specifies the multiplication factor for PLL VCO output clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1039 * This parameter can be one of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1040 * @arg @ref RCC_PLL_MUL4 PLLVCO = PLL clock entry x 4
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1041 * @arg @ref RCC_PLL_MUL6 PLLVCO = PLL clock entry x 6
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1042 @if STM32F105xC
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1043 * @arg @ref RCC_PLL_MUL6_5 PLLVCO = PLL clock entry x 6.5
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1044 @elseif STM32F107xC
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1045 * @arg @ref RCC_PLL_MUL6_5 PLLVCO = PLL clock entry x 6.5
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1046 @else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1047 * @arg @ref RCC_PLL_MUL2 PLLVCO = PLL clock entry x 2
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1048 * @arg @ref RCC_PLL_MUL3 PLLVCO = PLL clock entry x 3
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1049 * @arg @ref RCC_PLL_MUL10 PLLVCO = PLL clock entry x 10
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1050 * @arg @ref RCC_PLL_MUL11 PLLVCO = PLL clock entry x 11
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1051 * @arg @ref RCC_PLL_MUL12 PLLVCO = PLL clock entry x 12
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1052 * @arg @ref RCC_PLL_MUL13 PLLVCO = PLL clock entry x 13
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1053 * @arg @ref RCC_PLL_MUL14 PLLVCO = PLL clock entry x 14
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1054 * @arg @ref RCC_PLL_MUL15 PLLVCO = PLL clock entry x 15
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1055 * @arg @ref RCC_PLL_MUL16 PLLVCO = PLL clock entry x 16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1056 @endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1057 * @arg @ref RCC_PLL_MUL8 PLLVCO = PLL clock entry x 8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1058 * @arg @ref RCC_PLL_MUL9 PLLVCO = PLL clock entry x 9
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1059 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1060 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1061 #define __HAL_RCC_PLL_CONFIG(__RCC_PLLSOURCE__, __PLLMUL__)\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1062 MODIFY_REG(RCC->CFGR, (RCC_CFGR_PLLSRC | RCC_CFGR_PLLMULL),((__RCC_PLLSOURCE__) | (__PLLMUL__) ))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1063
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1064 /** @brief Get oscillator clock selected as PLL input clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1065 * @retval The clock source used for PLL entry. The returned value can be one
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1066 * of the following:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1067 * @arg @ref RCC_PLLSOURCE_HSI_DIV2 HSI oscillator clock selected as PLL input clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1068 * @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL input clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1069 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1070 #define __HAL_RCC_GET_PLL_OSCSOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PLLSRC)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1071
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1072 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1073 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1074 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1075
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1076 /** @defgroup RCC_Get_Clock_source Get Clock source
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1077 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1078 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1079
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1080 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1081 * @brief Macro to configure the system clock source.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1082 * @param __SYSCLKSOURCE__ specifies the system clock source.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1083 * This parameter can be one of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1084 * @arg @ref RCC_SYSCLKSOURCE_HSI HSI oscillator is used as system clock source.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1085 * @arg @ref RCC_SYSCLKSOURCE_HSE HSE oscillator is used as system clock source.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1086 * @arg @ref RCC_SYSCLKSOURCE_PLLCLK PLL output is used as system clock source.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1087 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1088 #define __HAL_RCC_SYSCLK_CONFIG(__SYSCLKSOURCE__) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1089 MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, (__SYSCLKSOURCE__))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1090
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1091 /** @brief Macro to get the clock source used as system clock.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1092 * @retval The clock source used as system clock. The returned value can be one
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1093 * of the following:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1094 * @arg @ref RCC_SYSCLKSOURCE_STATUS_HSI HSI used as system clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1095 * @arg @ref RCC_SYSCLKSOURCE_STATUS_HSE HSE used as system clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1096 * @arg @ref RCC_SYSCLKSOURCE_STATUS_PLLCLK PLL used as system clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1097 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1098 #define __HAL_RCC_GET_SYSCLK_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR,RCC_CFGR_SWS)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1099
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1100 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1101 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1102 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1103
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1104 /** @defgroup RCCEx_MCOx_Clock_Config RCC Extended MCOx Clock Config
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1105 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1106 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1107
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1108 #if defined(RCC_CFGR_MCO_3)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1109 /** @brief Macro to configure the MCO clock.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1110 * @param __MCOCLKSOURCE__ specifies the MCO clock source.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1111 * This parameter can be one of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1112 * @arg @ref RCC_MCO1SOURCE_NOCLOCK No clock selected as MCO clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1113 * @arg @ref RCC_MCO1SOURCE_SYSCLK System clock (SYSCLK) selected as MCO clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1114 * @arg @ref RCC_MCO1SOURCE_HSI HSI selected as MCO clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1115 * @arg @ref RCC_MCO1SOURCE_HSE HSE selected as MCO clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1116 * @arg @ref RCC_MCO1SOURCE_PLLCLK PLL clock divided by 2 selected as MCO clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1117 * @arg @ref RCC_MCO1SOURCE_PLL2CLK PLL2 clock selected by 2 selected as MCO clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1118 * @arg @ref RCC_MCO1SOURCE_PLL3CLK_DIV2 PLL3 clock divided by 2 selected as MCO clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1119 * @arg @ref RCC_MCO1SOURCE_EXT_HSE XT1 external 3-25 MHz oscillator clock selected (for Ethernet) as MCO clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1120 * @arg @ref RCC_MCO1SOURCE_PLL3CLK PLL3 clock selected (for Ethernet) as MCO clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1121 * @param __MCODIV__ specifies the MCO clock prescaler.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1122 * This parameter can be one of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1123 * @arg @ref RCC_MCODIV_1 No division applied on MCO clock source
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1124 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1125 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1126 /** @brief Macro to configure the MCO clock.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1127 * @param __MCOCLKSOURCE__ specifies the MCO clock source.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1128 * This parameter can be one of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1129 * @arg @ref RCC_MCO1SOURCE_NOCLOCK No clock selected as MCO clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1130 * @arg @ref RCC_MCO1SOURCE_SYSCLK System clock (SYSCLK) selected as MCO clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1131 * @arg @ref RCC_MCO1SOURCE_HSI HSI selected as MCO clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1132 * @arg @ref RCC_MCO1SOURCE_HSE HSE selected as MCO clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1133 * @arg @ref RCC_MCO1SOURCE_PLLCLK PLL clock divided by 2 selected as MCO clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1134 * @param __MCODIV__ specifies the MCO clock prescaler.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1135 * This parameter can be one of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1136 * @arg @ref RCC_MCODIV_1 No division applied on MCO clock source
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1137 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1138 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1139
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1140 #define __HAL_RCC_MCO1_CONFIG(__MCOCLKSOURCE__, __MCODIV__) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1141 MODIFY_REG(RCC->CFGR, RCC_CFGR_MCO, (__MCOCLKSOURCE__))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1142
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1143
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1144 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1145 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1146 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1147
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1148 /** @defgroup RCC_RTC_Clock_Configuration RCC RTC Clock Configuration
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1149 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1150 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1151
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1152 /** @brief Macro to configure the RTC clock (RTCCLK).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1153 * @note As the RTC clock configuration bits are in the Backup domain and write
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1154 * access is denied to this domain after reset, you have to enable write
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1155 * access using the Power Backup Access macro before to configure
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1156 * the RTC clock source (to be done once after reset).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1157 * @note Once the RTC clock is configured it can't be changed unless the
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1158 * Backup domain is reset using @ref __HAL_RCC_BACKUPRESET_FORCE() macro, or by
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1159 * a Power On Reset (POR).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1160 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1161 * @param __RTC_CLKSOURCE__ specifies the RTC clock source.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1162 * This parameter can be one of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1163 * @arg @ref RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1164 * @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1165 * @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1166 * @arg @ref RCC_RTCCLKSOURCE_HSE_DIV128 HSE divided by 128 selected as RTC clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1167 * @note If the LSE or LSI is used as RTC clock source, the RTC continues to
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1168 * work in STOP and STANDBY modes, and can be used as wakeup source.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1169 * However, when the HSE clock is used as RTC clock source, the RTC
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1170 * cannot be used in STOP and STANDBY modes.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1171 * @note The maximum input clock frequency for RTC is 1MHz (when using HSE as
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1172 * RTC clock source).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1173 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1174 #define __HAL_RCC_RTC_CONFIG(__RTC_CLKSOURCE__) MODIFY_REG(RCC->BDCR, RCC_BDCR_RTCSEL, (__RTC_CLKSOURCE__))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1175
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1176 /** @brief Macro to get the RTC clock source.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1177 * @retval The clock source can be one of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1178 * @arg @ref RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1179 * @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1180 * @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1181 * @arg @ref RCC_RTCCLKSOURCE_HSE_DIV128 HSE divided by 128 selected as RTC clock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1182 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1183 #define __HAL_RCC_GET_RTC_SOURCE() (READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1184
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1185 /** @brief Macro to enable the the RTC clock.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1186 * @note These macros must be used only after the RTC clock source was selected.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1187 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1188 #define __HAL_RCC_RTC_ENABLE() (*(__IO uint32_t *) RCC_BDCR_RTCEN_BB = ENABLE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1189
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1190 /** @brief Macro to disable the the RTC clock.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1191 * @note These macros must be used only after the RTC clock source was selected.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1192 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1193 #define __HAL_RCC_RTC_DISABLE() (*(__IO uint32_t *) RCC_BDCR_RTCEN_BB = DISABLE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1194
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1195 /** @brief Macro to force the Backup domain reset.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1196 * @note This function resets the RTC peripheral (including the backup registers)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1197 * and the RTC clock source selection in RCC_BDCR register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1198 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1199 #define __HAL_RCC_BACKUPRESET_FORCE() (*(__IO uint32_t *) RCC_BDCR_BDRST_BB = ENABLE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1200
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1201 /** @brief Macros to release the Backup domain reset.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1202 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1203 #define __HAL_RCC_BACKUPRESET_RELEASE() (*(__IO uint32_t *) RCC_BDCR_BDRST_BB = DISABLE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1204
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1205 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1206 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1207 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1208
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1209 /** @defgroup RCC_Flags_Interrupts_Management Flags Interrupts Management
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1210 * @brief macros to manage the specified RCC Flags and interrupts.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1211 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1212 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1213
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1214 /** @brief Enable RCC interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1215 * @param __INTERRUPT__ specifies the RCC interrupt sources to be enabled.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1216 * This parameter can be any combination of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1217 * @arg @ref RCC_IT_LSIRDY LSI ready interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1218 * @arg @ref RCC_IT_LSERDY LSE ready interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1219 * @arg @ref RCC_IT_HSIRDY HSI ready interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1220 * @arg @ref RCC_IT_HSERDY HSE ready interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1221 * @arg @ref RCC_IT_PLLRDY main PLL ready interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1222 @if STM32F105xx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1223 * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1224 * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1225 @elsif STM32F107xx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1226 * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1227 * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1228 @endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1229 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1230 #define __HAL_RCC_ENABLE_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE1_ADDRESS |= (__INTERRUPT__))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1231
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1232 /** @brief Disable RCC interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1233 * @param __INTERRUPT__ specifies the RCC interrupt sources to be disabled.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1234 * This parameter can be any combination of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1235 * @arg @ref RCC_IT_LSIRDY LSI ready interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1236 * @arg @ref RCC_IT_LSERDY LSE ready interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1237 * @arg @ref RCC_IT_HSIRDY HSI ready interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1238 * @arg @ref RCC_IT_HSERDY HSE ready interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1239 * @arg @ref RCC_IT_PLLRDY main PLL ready interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1240 @if STM32F105xx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1241 * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1242 * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1243 @elsif STM32F107xx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1244 * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1245 * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1246 @endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1247 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1248 #define __HAL_RCC_DISABLE_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE1_ADDRESS &= (uint8_t)(~(__INTERRUPT__)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1249
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1250 /** @brief Clear the RCC's interrupt pending bits.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1251 * @param __INTERRUPT__ specifies the interrupt pending bit to clear.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1252 * This parameter can be any combination of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1253 * @arg @ref RCC_IT_LSIRDY LSI ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1254 * @arg @ref RCC_IT_LSERDY LSE ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1255 * @arg @ref RCC_IT_HSIRDY HSI ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1256 * @arg @ref RCC_IT_HSERDY HSE ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1257 * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1258 @if STM32F105xx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1259 * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1260 * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1261 @elsif STM32F107xx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1262 * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1263 * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1264 @endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1265 * @arg @ref RCC_IT_CSS Clock Security System interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1266 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1267 #define __HAL_RCC_CLEAR_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE2_ADDRESS = (__INTERRUPT__))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1268
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1269 /** @brief Check the RCC's interrupt has occurred or not.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1270 * @param __INTERRUPT__ specifies the RCC interrupt source to check.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1271 * This parameter can be one of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1272 * @arg @ref RCC_IT_LSIRDY LSI ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1273 * @arg @ref RCC_IT_LSERDY LSE ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1274 * @arg @ref RCC_IT_HSIRDY HSI ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1275 * @arg @ref RCC_IT_HSERDY HSE ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1276 * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1277 @if STM32F105xx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1278 * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1279 * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1280 @elsif STM32F107xx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1281 * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1282 * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1283 @endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1284 * @arg @ref RCC_IT_CSS Clock Security System interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1285 * @retval The new state of __INTERRUPT__ (TRUE or FALSE).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1286 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1287 #define __HAL_RCC_GET_IT(__INTERRUPT__) ((RCC->CIR & (__INTERRUPT__)) == (__INTERRUPT__))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1288
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1289 /** @brief Set RMVF bit to clear the reset flags.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1290 * The reset flags are RCC_FLAG_PINRST, RCC_FLAG_PORRST, RCC_FLAG_SFTRST,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1291 * RCC_FLAG_IWDGRST, RCC_FLAG_WWDGRST, RCC_FLAG_LPWRRST
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1292 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1293 #define __HAL_RCC_CLEAR_RESET_FLAGS() (*(__IO uint32_t *)RCC_CSR_RMVF_BB = ENABLE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1294
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1295 /** @brief Check RCC flag is set or not.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1296 * @param __FLAG__ specifies the flag to check.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1297 * This parameter can be one of the following values:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1298 * @arg @ref RCC_FLAG_HSIRDY HSI oscillator clock ready.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1299 * @arg @ref RCC_FLAG_HSERDY HSE oscillator clock ready.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1300 * @arg @ref RCC_FLAG_PLLRDY Main PLL clock ready.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1301 @if STM32F105xx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1302 * @arg @ref RCC_FLAG_PLL2RDY Main PLL2 clock ready.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1303 * @arg @ref RCC_FLAG_PLLI2SRDY Main PLLI2S clock ready.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1304 @elsif STM32F107xx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1305 * @arg @ref RCC_FLAG_PLL2RDY Main PLL2 clock ready.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1306 * @arg @ref RCC_FLAG_PLLI2SRDY Main PLLI2S clock ready.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1307 @endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1308 * @arg @ref RCC_FLAG_LSERDY LSE oscillator clock ready.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1309 * @arg @ref RCC_FLAG_LSIRDY LSI oscillator clock ready.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1310 * @arg @ref RCC_FLAG_PINRST Pin reset.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1311 * @arg @ref RCC_FLAG_PORRST POR/PDR reset.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1312 * @arg @ref RCC_FLAG_SFTRST Software reset.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1313 * @arg @ref RCC_FLAG_IWDGRST Independent Watchdog reset.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1314 * @arg @ref RCC_FLAG_WWDGRST Window Watchdog reset.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1315 * @arg @ref RCC_FLAG_LPWRRST Low Power reset.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1316 * @retval The new state of __FLAG__ (TRUE or FALSE).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1317 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1318 #define __HAL_RCC_GET_FLAG(__FLAG__) (((((__FLAG__) >> 5) == CR_REG_INDEX)? RCC->CR : \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1319 ((((__FLAG__) >> 5) == BDCR_REG_INDEX)? RCC->BDCR : \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1320 RCC->CSR)) & ((uint32_t)1 << ((__FLAG__) & RCC_FLAG_MASK)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1321
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1322 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1323 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1324 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1325
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1326 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1327 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1328 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1329
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1330 /* Include RCC HAL Extension module */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1331 #include "stm32f1xx_hal_rcc_ex.h"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1332
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1333 /* Exported functions --------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1334 /** @addtogroup RCC_Exported_Functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1335 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1336 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1337
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1338 /** @addtogroup RCC_Exported_Functions_Group1
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1339 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1340 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1341
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1342 /* Initialization and de-initialization functions ******************************/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1343 void HAL_RCC_DeInit(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1344 HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1345 HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1346
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1347 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1348 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1349 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1350
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1351 /** @addtogroup RCC_Exported_Functions_Group2
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1352 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1353 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1354
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1355 /* Peripheral Control functions ************************************************/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1356 void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1357 void HAL_RCC_EnableCSS(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1358 void HAL_RCC_DisableCSS(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1359 uint32_t HAL_RCC_GetSysClockFreq(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1360 uint32_t HAL_RCC_GetHCLKFreq(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1361 uint32_t HAL_RCC_GetPCLK1Freq(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1362 uint32_t HAL_RCC_GetPCLK2Freq(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1363 void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1364 void HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t *pFLatency);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1365
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1366 /* CSS NMI IRQ handler */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1367 void HAL_RCC_NMI_IRQHandler(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1368
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1369 /* User Callbacks in non blocking mode (IT mode) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1370 void HAL_RCC_CSSCallback(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1371
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1372 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1373 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1374 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1375
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1376 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1377 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1378 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1379
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1380 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1381 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1382 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1383
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1384 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1385 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1386 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1387
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1388 #ifdef __cplusplus
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1389 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1390 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1391
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1392 #endif /* __STM32F1xx_HAL_RCC_H */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1393
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1394 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1395