mbed library sources modified for open wear

Dependents:   openwear-lifelogger-example

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Dec 02 11:30:05 2013 +0000
Revision:
52:a51c77007319
Child:
70:c1fbde68b492
Synchronized with git revision 49df530ae72ce97ccc773d1f2c13b38e868e6abd

Full URL: https://github.com/mbedmicro/mbed/commit/49df530ae72ce97ccc773d1f2c13b38e868e6abd/

Add STMicroelectronics NUCLEO_F103RB target

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 52:a51c77007319 1 /**
mbed_official 52:a51c77007319 2 ******************************************************************************
mbed_official 52:a51c77007319 3 * @file stm32f10x_rcc.h
mbed_official 52:a51c77007319 4 * @author MCD Application Team
mbed_official 52:a51c77007319 5 * @version V3.5.0
mbed_official 52:a51c77007319 6 * @date 11-March-2011
mbed_official 52:a51c77007319 7 * @brief This file contains all the functions prototypes for the RCC firmware
mbed_official 52:a51c77007319 8 * library.
mbed_official 52:a51c77007319 9 ******************************************************************************
mbed_official 52:a51c77007319 10 * @attention
mbed_official 52:a51c77007319 11 *
mbed_official 52:a51c77007319 12 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
mbed_official 52:a51c77007319 13 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
mbed_official 52:a51c77007319 14 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
mbed_official 52:a51c77007319 15 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
mbed_official 52:a51c77007319 16 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
mbed_official 52:a51c77007319 17 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
mbed_official 52:a51c77007319 18 *
mbed_official 52:a51c77007319 19 * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
mbed_official 52:a51c77007319 20 ******************************************************************************
mbed_official 52:a51c77007319 21 */
mbed_official 52:a51c77007319 22
mbed_official 52:a51c77007319 23 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 52:a51c77007319 24 #ifndef __STM32F10x_RCC_H
mbed_official 52:a51c77007319 25 #define __STM32F10x_RCC_H
mbed_official 52:a51c77007319 26
mbed_official 52:a51c77007319 27 #ifdef __cplusplus
mbed_official 52:a51c77007319 28 extern "C" {
mbed_official 52:a51c77007319 29 #endif
mbed_official 52:a51c77007319 30
mbed_official 52:a51c77007319 31 /* Includes ------------------------------------------------------------------*/
mbed_official 52:a51c77007319 32 #include "stm32f10x.h"
mbed_official 52:a51c77007319 33
mbed_official 52:a51c77007319 34 /** @addtogroup STM32F10x_StdPeriph_Driver
mbed_official 52:a51c77007319 35 * @{
mbed_official 52:a51c77007319 36 */
mbed_official 52:a51c77007319 37
mbed_official 52:a51c77007319 38 /** @addtogroup RCC
mbed_official 52:a51c77007319 39 * @{
mbed_official 52:a51c77007319 40 */
mbed_official 52:a51c77007319 41
mbed_official 52:a51c77007319 42 /** @defgroup RCC_Exported_Types
mbed_official 52:a51c77007319 43 * @{
mbed_official 52:a51c77007319 44 */
mbed_official 52:a51c77007319 45
mbed_official 52:a51c77007319 46 typedef struct
mbed_official 52:a51c77007319 47 {
mbed_official 52:a51c77007319 48 uint32_t SYSCLK_Frequency; /*!< returns SYSCLK clock frequency expressed in Hz */
mbed_official 52:a51c77007319 49 uint32_t HCLK_Frequency; /*!< returns HCLK clock frequency expressed in Hz */
mbed_official 52:a51c77007319 50 uint32_t PCLK1_Frequency; /*!< returns PCLK1 clock frequency expressed in Hz */
mbed_official 52:a51c77007319 51 uint32_t PCLK2_Frequency; /*!< returns PCLK2 clock frequency expressed in Hz */
mbed_official 52:a51c77007319 52 uint32_t ADCCLK_Frequency; /*!< returns ADCCLK clock frequency expressed in Hz */
mbed_official 52:a51c77007319 53 }RCC_ClocksTypeDef;
mbed_official 52:a51c77007319 54
mbed_official 52:a51c77007319 55 /**
mbed_official 52:a51c77007319 56 * @}
mbed_official 52:a51c77007319 57 */
mbed_official 52:a51c77007319 58
mbed_official 52:a51c77007319 59 /** @defgroup RCC_Exported_Constants
mbed_official 52:a51c77007319 60 * @{
mbed_official 52:a51c77007319 61 */
mbed_official 52:a51c77007319 62
mbed_official 52:a51c77007319 63 /** @defgroup HSE_configuration
mbed_official 52:a51c77007319 64 * @{
mbed_official 52:a51c77007319 65 */
mbed_official 52:a51c77007319 66
mbed_official 52:a51c77007319 67 #define RCC_HSE_OFF ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 68 #define RCC_HSE_ON ((uint32_t)0x00010000)
mbed_official 52:a51c77007319 69 #define RCC_HSE_Bypass ((uint32_t)0x00040000)
mbed_official 52:a51c77007319 70 #define IS_RCC_HSE(HSE) (((HSE) == RCC_HSE_OFF) || ((HSE) == RCC_HSE_ON) || \
mbed_official 52:a51c77007319 71 ((HSE) == RCC_HSE_Bypass))
mbed_official 52:a51c77007319 72
mbed_official 52:a51c77007319 73 /**
mbed_official 52:a51c77007319 74 * @}
mbed_official 52:a51c77007319 75 */
mbed_official 52:a51c77007319 76
mbed_official 52:a51c77007319 77 /** @defgroup PLL_entry_clock_source
mbed_official 52:a51c77007319 78 * @{
mbed_official 52:a51c77007319 79 */
mbed_official 52:a51c77007319 80
mbed_official 52:a51c77007319 81 #define RCC_PLLSource_HSI_Div2 ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 82
mbed_official 52:a51c77007319 83 #if !defined (STM32F10X_LD_VL) && !defined (STM32F10X_MD_VL) && !defined (STM32F10X_HD_VL) && !defined (STM32F10X_CL)
mbed_official 52:a51c77007319 84 #define RCC_PLLSource_HSE_Div1 ((uint32_t)0x00010000)
mbed_official 52:a51c77007319 85 #define RCC_PLLSource_HSE_Div2 ((uint32_t)0x00030000)
mbed_official 52:a51c77007319 86 #define IS_RCC_PLL_SOURCE(SOURCE) (((SOURCE) == RCC_PLLSource_HSI_Div2) || \
mbed_official 52:a51c77007319 87 ((SOURCE) == RCC_PLLSource_HSE_Div1) || \
mbed_official 52:a51c77007319 88 ((SOURCE) == RCC_PLLSource_HSE_Div2))
mbed_official 52:a51c77007319 89 #else
mbed_official 52:a51c77007319 90 #define RCC_PLLSource_PREDIV1 ((uint32_t)0x00010000)
mbed_official 52:a51c77007319 91 #define IS_RCC_PLL_SOURCE(SOURCE) (((SOURCE) == RCC_PLLSource_HSI_Div2) || \
mbed_official 52:a51c77007319 92 ((SOURCE) == RCC_PLLSource_PREDIV1))
mbed_official 52:a51c77007319 93 #endif /* STM32F10X_CL */
mbed_official 52:a51c77007319 94
mbed_official 52:a51c77007319 95 /**
mbed_official 52:a51c77007319 96 * @}
mbed_official 52:a51c77007319 97 */
mbed_official 52:a51c77007319 98
mbed_official 52:a51c77007319 99 /** @defgroup PLL_multiplication_factor
mbed_official 52:a51c77007319 100 * @{
mbed_official 52:a51c77007319 101 */
mbed_official 52:a51c77007319 102 #ifndef STM32F10X_CL
mbed_official 52:a51c77007319 103 #define RCC_PLLMul_2 ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 104 #define RCC_PLLMul_3 ((uint32_t)0x00040000)
mbed_official 52:a51c77007319 105 #define RCC_PLLMul_4 ((uint32_t)0x00080000)
mbed_official 52:a51c77007319 106 #define RCC_PLLMul_5 ((uint32_t)0x000C0000)
mbed_official 52:a51c77007319 107 #define RCC_PLLMul_6 ((uint32_t)0x00100000)
mbed_official 52:a51c77007319 108 #define RCC_PLLMul_7 ((uint32_t)0x00140000)
mbed_official 52:a51c77007319 109 #define RCC_PLLMul_8 ((uint32_t)0x00180000)
mbed_official 52:a51c77007319 110 #define RCC_PLLMul_9 ((uint32_t)0x001C0000)
mbed_official 52:a51c77007319 111 #define RCC_PLLMul_10 ((uint32_t)0x00200000)
mbed_official 52:a51c77007319 112 #define RCC_PLLMul_11 ((uint32_t)0x00240000)
mbed_official 52:a51c77007319 113 #define RCC_PLLMul_12 ((uint32_t)0x00280000)
mbed_official 52:a51c77007319 114 #define RCC_PLLMul_13 ((uint32_t)0x002C0000)
mbed_official 52:a51c77007319 115 #define RCC_PLLMul_14 ((uint32_t)0x00300000)
mbed_official 52:a51c77007319 116 #define RCC_PLLMul_15 ((uint32_t)0x00340000)
mbed_official 52:a51c77007319 117 #define RCC_PLLMul_16 ((uint32_t)0x00380000)
mbed_official 52:a51c77007319 118 #define IS_RCC_PLL_MUL(MUL) (((MUL) == RCC_PLLMul_2) || ((MUL) == RCC_PLLMul_3) || \
mbed_official 52:a51c77007319 119 ((MUL) == RCC_PLLMul_4) || ((MUL) == RCC_PLLMul_5) || \
mbed_official 52:a51c77007319 120 ((MUL) == RCC_PLLMul_6) || ((MUL) == RCC_PLLMul_7) || \
mbed_official 52:a51c77007319 121 ((MUL) == RCC_PLLMul_8) || ((MUL) == RCC_PLLMul_9) || \
mbed_official 52:a51c77007319 122 ((MUL) == RCC_PLLMul_10) || ((MUL) == RCC_PLLMul_11) || \
mbed_official 52:a51c77007319 123 ((MUL) == RCC_PLLMul_12) || ((MUL) == RCC_PLLMul_13) || \
mbed_official 52:a51c77007319 124 ((MUL) == RCC_PLLMul_14) || ((MUL) == RCC_PLLMul_15) || \
mbed_official 52:a51c77007319 125 ((MUL) == RCC_PLLMul_16))
mbed_official 52:a51c77007319 126
mbed_official 52:a51c77007319 127 #else
mbed_official 52:a51c77007319 128 #define RCC_PLLMul_4 ((uint32_t)0x00080000)
mbed_official 52:a51c77007319 129 #define RCC_PLLMul_5 ((uint32_t)0x000C0000)
mbed_official 52:a51c77007319 130 #define RCC_PLLMul_6 ((uint32_t)0x00100000)
mbed_official 52:a51c77007319 131 #define RCC_PLLMul_7 ((uint32_t)0x00140000)
mbed_official 52:a51c77007319 132 #define RCC_PLLMul_8 ((uint32_t)0x00180000)
mbed_official 52:a51c77007319 133 #define RCC_PLLMul_9 ((uint32_t)0x001C0000)
mbed_official 52:a51c77007319 134 #define RCC_PLLMul_6_5 ((uint32_t)0x00340000)
mbed_official 52:a51c77007319 135
mbed_official 52:a51c77007319 136 #define IS_RCC_PLL_MUL(MUL) (((MUL) == RCC_PLLMul_4) || ((MUL) == RCC_PLLMul_5) || \
mbed_official 52:a51c77007319 137 ((MUL) == RCC_PLLMul_6) || ((MUL) == RCC_PLLMul_7) || \
mbed_official 52:a51c77007319 138 ((MUL) == RCC_PLLMul_8) || ((MUL) == RCC_PLLMul_9) || \
mbed_official 52:a51c77007319 139 ((MUL) == RCC_PLLMul_6_5))
mbed_official 52:a51c77007319 140 #endif /* STM32F10X_CL */
mbed_official 52:a51c77007319 141 /**
mbed_official 52:a51c77007319 142 * @}
mbed_official 52:a51c77007319 143 */
mbed_official 52:a51c77007319 144
mbed_official 52:a51c77007319 145 /** @defgroup PREDIV1_division_factor
mbed_official 52:a51c77007319 146 * @{
mbed_official 52:a51c77007319 147 */
mbed_official 52:a51c77007319 148 #if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL) || defined (STM32F10X_CL)
mbed_official 52:a51c77007319 149 #define RCC_PREDIV1_Div1 ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 150 #define RCC_PREDIV1_Div2 ((uint32_t)0x00000001)
mbed_official 52:a51c77007319 151 #define RCC_PREDIV1_Div3 ((uint32_t)0x00000002)
mbed_official 52:a51c77007319 152 #define RCC_PREDIV1_Div4 ((uint32_t)0x00000003)
mbed_official 52:a51c77007319 153 #define RCC_PREDIV1_Div5 ((uint32_t)0x00000004)
mbed_official 52:a51c77007319 154 #define RCC_PREDIV1_Div6 ((uint32_t)0x00000005)
mbed_official 52:a51c77007319 155 #define RCC_PREDIV1_Div7 ((uint32_t)0x00000006)
mbed_official 52:a51c77007319 156 #define RCC_PREDIV1_Div8 ((uint32_t)0x00000007)
mbed_official 52:a51c77007319 157 #define RCC_PREDIV1_Div9 ((uint32_t)0x00000008)
mbed_official 52:a51c77007319 158 #define RCC_PREDIV1_Div10 ((uint32_t)0x00000009)
mbed_official 52:a51c77007319 159 #define RCC_PREDIV1_Div11 ((uint32_t)0x0000000A)
mbed_official 52:a51c77007319 160 #define RCC_PREDIV1_Div12 ((uint32_t)0x0000000B)
mbed_official 52:a51c77007319 161 #define RCC_PREDIV1_Div13 ((uint32_t)0x0000000C)
mbed_official 52:a51c77007319 162 #define RCC_PREDIV1_Div14 ((uint32_t)0x0000000D)
mbed_official 52:a51c77007319 163 #define RCC_PREDIV1_Div15 ((uint32_t)0x0000000E)
mbed_official 52:a51c77007319 164 #define RCC_PREDIV1_Div16 ((uint32_t)0x0000000F)
mbed_official 52:a51c77007319 165
mbed_official 52:a51c77007319 166 #define IS_RCC_PREDIV1(PREDIV1) (((PREDIV1) == RCC_PREDIV1_Div1) || ((PREDIV1) == RCC_PREDIV1_Div2) || \
mbed_official 52:a51c77007319 167 ((PREDIV1) == RCC_PREDIV1_Div3) || ((PREDIV1) == RCC_PREDIV1_Div4) || \
mbed_official 52:a51c77007319 168 ((PREDIV1) == RCC_PREDIV1_Div5) || ((PREDIV1) == RCC_PREDIV1_Div6) || \
mbed_official 52:a51c77007319 169 ((PREDIV1) == RCC_PREDIV1_Div7) || ((PREDIV1) == RCC_PREDIV1_Div8) || \
mbed_official 52:a51c77007319 170 ((PREDIV1) == RCC_PREDIV1_Div9) || ((PREDIV1) == RCC_PREDIV1_Div10) || \
mbed_official 52:a51c77007319 171 ((PREDIV1) == RCC_PREDIV1_Div11) || ((PREDIV1) == RCC_PREDIV1_Div12) || \
mbed_official 52:a51c77007319 172 ((PREDIV1) == RCC_PREDIV1_Div13) || ((PREDIV1) == RCC_PREDIV1_Div14) || \
mbed_official 52:a51c77007319 173 ((PREDIV1) == RCC_PREDIV1_Div15) || ((PREDIV1) == RCC_PREDIV1_Div16))
mbed_official 52:a51c77007319 174 #endif
mbed_official 52:a51c77007319 175 /**
mbed_official 52:a51c77007319 176 * @}
mbed_official 52:a51c77007319 177 */
mbed_official 52:a51c77007319 178
mbed_official 52:a51c77007319 179
mbed_official 52:a51c77007319 180 /** @defgroup PREDIV1_clock_source
mbed_official 52:a51c77007319 181 * @{
mbed_official 52:a51c77007319 182 */
mbed_official 52:a51c77007319 183 #ifdef STM32F10X_CL
mbed_official 52:a51c77007319 184 /* PREDIV1 clock source (for STM32 connectivity line devices) */
mbed_official 52:a51c77007319 185 #define RCC_PREDIV1_Source_HSE ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 186 #define RCC_PREDIV1_Source_PLL2 ((uint32_t)0x00010000)
mbed_official 52:a51c77007319 187
mbed_official 52:a51c77007319 188 #define IS_RCC_PREDIV1_SOURCE(SOURCE) (((SOURCE) == RCC_PREDIV1_Source_HSE) || \
mbed_official 52:a51c77007319 189 ((SOURCE) == RCC_PREDIV1_Source_PLL2))
mbed_official 52:a51c77007319 190 #elif defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL)
mbed_official 52:a51c77007319 191 /* PREDIV1 clock source (for STM32 Value line devices) */
mbed_official 52:a51c77007319 192 #define RCC_PREDIV1_Source_HSE ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 193
mbed_official 52:a51c77007319 194 #define IS_RCC_PREDIV1_SOURCE(SOURCE) (((SOURCE) == RCC_PREDIV1_Source_HSE))
mbed_official 52:a51c77007319 195 #endif
mbed_official 52:a51c77007319 196 /**
mbed_official 52:a51c77007319 197 * @}
mbed_official 52:a51c77007319 198 */
mbed_official 52:a51c77007319 199
mbed_official 52:a51c77007319 200 #ifdef STM32F10X_CL
mbed_official 52:a51c77007319 201 /** @defgroup PREDIV2_division_factor
mbed_official 52:a51c77007319 202 * @{
mbed_official 52:a51c77007319 203 */
mbed_official 52:a51c77007319 204
mbed_official 52:a51c77007319 205 #define RCC_PREDIV2_Div1 ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 206 #define RCC_PREDIV2_Div2 ((uint32_t)0x00000010)
mbed_official 52:a51c77007319 207 #define RCC_PREDIV2_Div3 ((uint32_t)0x00000020)
mbed_official 52:a51c77007319 208 #define RCC_PREDIV2_Div4 ((uint32_t)0x00000030)
mbed_official 52:a51c77007319 209 #define RCC_PREDIV2_Div5 ((uint32_t)0x00000040)
mbed_official 52:a51c77007319 210 #define RCC_PREDIV2_Div6 ((uint32_t)0x00000050)
mbed_official 52:a51c77007319 211 #define RCC_PREDIV2_Div7 ((uint32_t)0x00000060)
mbed_official 52:a51c77007319 212 #define RCC_PREDIV2_Div8 ((uint32_t)0x00000070)
mbed_official 52:a51c77007319 213 #define RCC_PREDIV2_Div9 ((uint32_t)0x00000080)
mbed_official 52:a51c77007319 214 #define RCC_PREDIV2_Div10 ((uint32_t)0x00000090)
mbed_official 52:a51c77007319 215 #define RCC_PREDIV2_Div11 ((uint32_t)0x000000A0)
mbed_official 52:a51c77007319 216 #define RCC_PREDIV2_Div12 ((uint32_t)0x000000B0)
mbed_official 52:a51c77007319 217 #define RCC_PREDIV2_Div13 ((uint32_t)0x000000C0)
mbed_official 52:a51c77007319 218 #define RCC_PREDIV2_Div14 ((uint32_t)0x000000D0)
mbed_official 52:a51c77007319 219 #define RCC_PREDIV2_Div15 ((uint32_t)0x000000E0)
mbed_official 52:a51c77007319 220 #define RCC_PREDIV2_Div16 ((uint32_t)0x000000F0)
mbed_official 52:a51c77007319 221
mbed_official 52:a51c77007319 222 #define IS_RCC_PREDIV2(PREDIV2) (((PREDIV2) == RCC_PREDIV2_Div1) || ((PREDIV2) == RCC_PREDIV2_Div2) || \
mbed_official 52:a51c77007319 223 ((PREDIV2) == RCC_PREDIV2_Div3) || ((PREDIV2) == RCC_PREDIV2_Div4) || \
mbed_official 52:a51c77007319 224 ((PREDIV2) == RCC_PREDIV2_Div5) || ((PREDIV2) == RCC_PREDIV2_Div6) || \
mbed_official 52:a51c77007319 225 ((PREDIV2) == RCC_PREDIV2_Div7) || ((PREDIV2) == RCC_PREDIV2_Div8) || \
mbed_official 52:a51c77007319 226 ((PREDIV2) == RCC_PREDIV2_Div9) || ((PREDIV2) == RCC_PREDIV2_Div10) || \
mbed_official 52:a51c77007319 227 ((PREDIV2) == RCC_PREDIV2_Div11) || ((PREDIV2) == RCC_PREDIV2_Div12) || \
mbed_official 52:a51c77007319 228 ((PREDIV2) == RCC_PREDIV2_Div13) || ((PREDIV2) == RCC_PREDIV2_Div14) || \
mbed_official 52:a51c77007319 229 ((PREDIV2) == RCC_PREDIV2_Div15) || ((PREDIV2) == RCC_PREDIV2_Div16))
mbed_official 52:a51c77007319 230 /**
mbed_official 52:a51c77007319 231 * @}
mbed_official 52:a51c77007319 232 */
mbed_official 52:a51c77007319 233
mbed_official 52:a51c77007319 234
mbed_official 52:a51c77007319 235 /** @defgroup PLL2_multiplication_factor
mbed_official 52:a51c77007319 236 * @{
mbed_official 52:a51c77007319 237 */
mbed_official 52:a51c77007319 238
mbed_official 52:a51c77007319 239 #define RCC_PLL2Mul_8 ((uint32_t)0x00000600)
mbed_official 52:a51c77007319 240 #define RCC_PLL2Mul_9 ((uint32_t)0x00000700)
mbed_official 52:a51c77007319 241 #define RCC_PLL2Mul_10 ((uint32_t)0x00000800)
mbed_official 52:a51c77007319 242 #define RCC_PLL2Mul_11 ((uint32_t)0x00000900)
mbed_official 52:a51c77007319 243 #define RCC_PLL2Mul_12 ((uint32_t)0x00000A00)
mbed_official 52:a51c77007319 244 #define RCC_PLL2Mul_13 ((uint32_t)0x00000B00)
mbed_official 52:a51c77007319 245 #define RCC_PLL2Mul_14 ((uint32_t)0x00000C00)
mbed_official 52:a51c77007319 246 #define RCC_PLL2Mul_16 ((uint32_t)0x00000E00)
mbed_official 52:a51c77007319 247 #define RCC_PLL2Mul_20 ((uint32_t)0x00000F00)
mbed_official 52:a51c77007319 248
mbed_official 52:a51c77007319 249 #define IS_RCC_PLL2_MUL(MUL) (((MUL) == RCC_PLL2Mul_8) || ((MUL) == RCC_PLL2Mul_9) || \
mbed_official 52:a51c77007319 250 ((MUL) == RCC_PLL2Mul_10) || ((MUL) == RCC_PLL2Mul_11) || \
mbed_official 52:a51c77007319 251 ((MUL) == RCC_PLL2Mul_12) || ((MUL) == RCC_PLL2Mul_13) || \
mbed_official 52:a51c77007319 252 ((MUL) == RCC_PLL2Mul_14) || ((MUL) == RCC_PLL2Mul_16) || \
mbed_official 52:a51c77007319 253 ((MUL) == RCC_PLL2Mul_20))
mbed_official 52:a51c77007319 254 /**
mbed_official 52:a51c77007319 255 * @}
mbed_official 52:a51c77007319 256 */
mbed_official 52:a51c77007319 257
mbed_official 52:a51c77007319 258
mbed_official 52:a51c77007319 259 /** @defgroup PLL3_multiplication_factor
mbed_official 52:a51c77007319 260 * @{
mbed_official 52:a51c77007319 261 */
mbed_official 52:a51c77007319 262
mbed_official 52:a51c77007319 263 #define RCC_PLL3Mul_8 ((uint32_t)0x00006000)
mbed_official 52:a51c77007319 264 #define RCC_PLL3Mul_9 ((uint32_t)0x00007000)
mbed_official 52:a51c77007319 265 #define RCC_PLL3Mul_10 ((uint32_t)0x00008000)
mbed_official 52:a51c77007319 266 #define RCC_PLL3Mul_11 ((uint32_t)0x00009000)
mbed_official 52:a51c77007319 267 #define RCC_PLL3Mul_12 ((uint32_t)0x0000A000)
mbed_official 52:a51c77007319 268 #define RCC_PLL3Mul_13 ((uint32_t)0x0000B000)
mbed_official 52:a51c77007319 269 #define RCC_PLL3Mul_14 ((uint32_t)0x0000C000)
mbed_official 52:a51c77007319 270 #define RCC_PLL3Mul_16 ((uint32_t)0x0000E000)
mbed_official 52:a51c77007319 271 #define RCC_PLL3Mul_20 ((uint32_t)0x0000F000)
mbed_official 52:a51c77007319 272
mbed_official 52:a51c77007319 273 #define IS_RCC_PLL3_MUL(MUL) (((MUL) == RCC_PLL3Mul_8) || ((MUL) == RCC_PLL3Mul_9) || \
mbed_official 52:a51c77007319 274 ((MUL) == RCC_PLL3Mul_10) || ((MUL) == RCC_PLL3Mul_11) || \
mbed_official 52:a51c77007319 275 ((MUL) == RCC_PLL3Mul_12) || ((MUL) == RCC_PLL3Mul_13) || \
mbed_official 52:a51c77007319 276 ((MUL) == RCC_PLL3Mul_14) || ((MUL) == RCC_PLL3Mul_16) || \
mbed_official 52:a51c77007319 277 ((MUL) == RCC_PLL3Mul_20))
mbed_official 52:a51c77007319 278 /**
mbed_official 52:a51c77007319 279 * @}
mbed_official 52:a51c77007319 280 */
mbed_official 52:a51c77007319 281
mbed_official 52:a51c77007319 282 #endif /* STM32F10X_CL */
mbed_official 52:a51c77007319 283
mbed_official 52:a51c77007319 284
mbed_official 52:a51c77007319 285 /** @defgroup System_clock_source
mbed_official 52:a51c77007319 286 * @{
mbed_official 52:a51c77007319 287 */
mbed_official 52:a51c77007319 288
mbed_official 52:a51c77007319 289 #define RCC_SYSCLKSource_HSI ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 290 #define RCC_SYSCLKSource_HSE ((uint32_t)0x00000001)
mbed_official 52:a51c77007319 291 #define RCC_SYSCLKSource_PLLCLK ((uint32_t)0x00000002)
mbed_official 52:a51c77007319 292 #define IS_RCC_SYSCLK_SOURCE(SOURCE) (((SOURCE) == RCC_SYSCLKSource_HSI) || \
mbed_official 52:a51c77007319 293 ((SOURCE) == RCC_SYSCLKSource_HSE) || \
mbed_official 52:a51c77007319 294 ((SOURCE) == RCC_SYSCLKSource_PLLCLK))
mbed_official 52:a51c77007319 295 /**
mbed_official 52:a51c77007319 296 * @}
mbed_official 52:a51c77007319 297 */
mbed_official 52:a51c77007319 298
mbed_official 52:a51c77007319 299 /** @defgroup AHB_clock_source
mbed_official 52:a51c77007319 300 * @{
mbed_official 52:a51c77007319 301 */
mbed_official 52:a51c77007319 302
mbed_official 52:a51c77007319 303 #define RCC_SYSCLK_Div1 ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 304 #define RCC_SYSCLK_Div2 ((uint32_t)0x00000080)
mbed_official 52:a51c77007319 305 #define RCC_SYSCLK_Div4 ((uint32_t)0x00000090)
mbed_official 52:a51c77007319 306 #define RCC_SYSCLK_Div8 ((uint32_t)0x000000A0)
mbed_official 52:a51c77007319 307 #define RCC_SYSCLK_Div16 ((uint32_t)0x000000B0)
mbed_official 52:a51c77007319 308 #define RCC_SYSCLK_Div64 ((uint32_t)0x000000C0)
mbed_official 52:a51c77007319 309 #define RCC_SYSCLK_Div128 ((uint32_t)0x000000D0)
mbed_official 52:a51c77007319 310 #define RCC_SYSCLK_Div256 ((uint32_t)0x000000E0)
mbed_official 52:a51c77007319 311 #define RCC_SYSCLK_Div512 ((uint32_t)0x000000F0)
mbed_official 52:a51c77007319 312 #define IS_RCC_HCLK(HCLK) (((HCLK) == RCC_SYSCLK_Div1) || ((HCLK) == RCC_SYSCLK_Div2) || \
mbed_official 52:a51c77007319 313 ((HCLK) == RCC_SYSCLK_Div4) || ((HCLK) == RCC_SYSCLK_Div8) || \
mbed_official 52:a51c77007319 314 ((HCLK) == RCC_SYSCLK_Div16) || ((HCLK) == RCC_SYSCLK_Div64) || \
mbed_official 52:a51c77007319 315 ((HCLK) == RCC_SYSCLK_Div128) || ((HCLK) == RCC_SYSCLK_Div256) || \
mbed_official 52:a51c77007319 316 ((HCLK) == RCC_SYSCLK_Div512))
mbed_official 52:a51c77007319 317 /**
mbed_official 52:a51c77007319 318 * @}
mbed_official 52:a51c77007319 319 */
mbed_official 52:a51c77007319 320
mbed_official 52:a51c77007319 321 /** @defgroup APB1_APB2_clock_source
mbed_official 52:a51c77007319 322 * @{
mbed_official 52:a51c77007319 323 */
mbed_official 52:a51c77007319 324
mbed_official 52:a51c77007319 325 #define RCC_HCLK_Div1 ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 326 #define RCC_HCLK_Div2 ((uint32_t)0x00000400)
mbed_official 52:a51c77007319 327 #define RCC_HCLK_Div4 ((uint32_t)0x00000500)
mbed_official 52:a51c77007319 328 #define RCC_HCLK_Div8 ((uint32_t)0x00000600)
mbed_official 52:a51c77007319 329 #define RCC_HCLK_Div16 ((uint32_t)0x00000700)
mbed_official 52:a51c77007319 330 #define IS_RCC_PCLK(PCLK) (((PCLK) == RCC_HCLK_Div1) || ((PCLK) == RCC_HCLK_Div2) || \
mbed_official 52:a51c77007319 331 ((PCLK) == RCC_HCLK_Div4) || ((PCLK) == RCC_HCLK_Div8) || \
mbed_official 52:a51c77007319 332 ((PCLK) == RCC_HCLK_Div16))
mbed_official 52:a51c77007319 333 /**
mbed_official 52:a51c77007319 334 * @}
mbed_official 52:a51c77007319 335 */
mbed_official 52:a51c77007319 336
mbed_official 52:a51c77007319 337 /** @defgroup RCC_Interrupt_source
mbed_official 52:a51c77007319 338 * @{
mbed_official 52:a51c77007319 339 */
mbed_official 52:a51c77007319 340
mbed_official 52:a51c77007319 341 #define RCC_IT_LSIRDY ((uint8_t)0x01)
mbed_official 52:a51c77007319 342 #define RCC_IT_LSERDY ((uint8_t)0x02)
mbed_official 52:a51c77007319 343 #define RCC_IT_HSIRDY ((uint8_t)0x04)
mbed_official 52:a51c77007319 344 #define RCC_IT_HSERDY ((uint8_t)0x08)
mbed_official 52:a51c77007319 345 #define RCC_IT_PLLRDY ((uint8_t)0x10)
mbed_official 52:a51c77007319 346 #define RCC_IT_CSS ((uint8_t)0x80)
mbed_official 52:a51c77007319 347
mbed_official 52:a51c77007319 348 #ifndef STM32F10X_CL
mbed_official 52:a51c77007319 349 #define IS_RCC_IT(IT) ((((IT) & (uint8_t)0xE0) == 0x00) && ((IT) != 0x00))
mbed_official 52:a51c77007319 350 #define IS_RCC_GET_IT(IT) (((IT) == RCC_IT_LSIRDY) || ((IT) == RCC_IT_LSERDY) || \
mbed_official 52:a51c77007319 351 ((IT) == RCC_IT_HSIRDY) || ((IT) == RCC_IT_HSERDY) || \
mbed_official 52:a51c77007319 352 ((IT) == RCC_IT_PLLRDY) || ((IT) == RCC_IT_CSS))
mbed_official 52:a51c77007319 353 #define IS_RCC_CLEAR_IT(IT) ((((IT) & (uint8_t)0x60) == 0x00) && ((IT) != 0x00))
mbed_official 52:a51c77007319 354 #else
mbed_official 52:a51c77007319 355 #define RCC_IT_PLL2RDY ((uint8_t)0x20)
mbed_official 52:a51c77007319 356 #define RCC_IT_PLL3RDY ((uint8_t)0x40)
mbed_official 52:a51c77007319 357 #define IS_RCC_IT(IT) ((((IT) & (uint8_t)0x80) == 0x00) && ((IT) != 0x00))
mbed_official 52:a51c77007319 358 #define IS_RCC_GET_IT(IT) (((IT) == RCC_IT_LSIRDY) || ((IT) == RCC_IT_LSERDY) || \
mbed_official 52:a51c77007319 359 ((IT) == RCC_IT_HSIRDY) || ((IT) == RCC_IT_HSERDY) || \
mbed_official 52:a51c77007319 360 ((IT) == RCC_IT_PLLRDY) || ((IT) == RCC_IT_CSS) || \
mbed_official 52:a51c77007319 361 ((IT) == RCC_IT_PLL2RDY) || ((IT) == RCC_IT_PLL3RDY))
mbed_official 52:a51c77007319 362 #define IS_RCC_CLEAR_IT(IT) ((IT) != 0x00)
mbed_official 52:a51c77007319 363 #endif /* STM32F10X_CL */
mbed_official 52:a51c77007319 364
mbed_official 52:a51c77007319 365
mbed_official 52:a51c77007319 366 /**
mbed_official 52:a51c77007319 367 * @}
mbed_official 52:a51c77007319 368 */
mbed_official 52:a51c77007319 369
mbed_official 52:a51c77007319 370 #ifndef STM32F10X_CL
mbed_official 52:a51c77007319 371 /** @defgroup USB_Device_clock_source
mbed_official 52:a51c77007319 372 * @{
mbed_official 52:a51c77007319 373 */
mbed_official 52:a51c77007319 374
mbed_official 52:a51c77007319 375 #define RCC_USBCLKSource_PLLCLK_1Div5 ((uint8_t)0x00)
mbed_official 52:a51c77007319 376 #define RCC_USBCLKSource_PLLCLK_Div1 ((uint8_t)0x01)
mbed_official 52:a51c77007319 377
mbed_official 52:a51c77007319 378 #define IS_RCC_USBCLK_SOURCE(SOURCE) (((SOURCE) == RCC_USBCLKSource_PLLCLK_1Div5) || \
mbed_official 52:a51c77007319 379 ((SOURCE) == RCC_USBCLKSource_PLLCLK_Div1))
mbed_official 52:a51c77007319 380 /**
mbed_official 52:a51c77007319 381 * @}
mbed_official 52:a51c77007319 382 */
mbed_official 52:a51c77007319 383 #else
mbed_official 52:a51c77007319 384 /** @defgroup USB_OTG_FS_clock_source
mbed_official 52:a51c77007319 385 * @{
mbed_official 52:a51c77007319 386 */
mbed_official 52:a51c77007319 387 #define RCC_OTGFSCLKSource_PLLVCO_Div3 ((uint8_t)0x00)
mbed_official 52:a51c77007319 388 #define RCC_OTGFSCLKSource_PLLVCO_Div2 ((uint8_t)0x01)
mbed_official 52:a51c77007319 389
mbed_official 52:a51c77007319 390 #define IS_RCC_OTGFSCLK_SOURCE(SOURCE) (((SOURCE) == RCC_OTGFSCLKSource_PLLVCO_Div3) || \
mbed_official 52:a51c77007319 391 ((SOURCE) == RCC_OTGFSCLKSource_PLLVCO_Div2))
mbed_official 52:a51c77007319 392 /**
mbed_official 52:a51c77007319 393 * @}
mbed_official 52:a51c77007319 394 */
mbed_official 52:a51c77007319 395 #endif /* STM32F10X_CL */
mbed_official 52:a51c77007319 396
mbed_official 52:a51c77007319 397
mbed_official 52:a51c77007319 398 #ifdef STM32F10X_CL
mbed_official 52:a51c77007319 399 /** @defgroup I2S2_clock_source
mbed_official 52:a51c77007319 400 * @{
mbed_official 52:a51c77007319 401 */
mbed_official 52:a51c77007319 402 #define RCC_I2S2CLKSource_SYSCLK ((uint8_t)0x00)
mbed_official 52:a51c77007319 403 #define RCC_I2S2CLKSource_PLL3_VCO ((uint8_t)0x01)
mbed_official 52:a51c77007319 404
mbed_official 52:a51c77007319 405 #define IS_RCC_I2S2CLK_SOURCE(SOURCE) (((SOURCE) == RCC_I2S2CLKSource_SYSCLK) || \
mbed_official 52:a51c77007319 406 ((SOURCE) == RCC_I2S2CLKSource_PLL3_VCO))
mbed_official 52:a51c77007319 407 /**
mbed_official 52:a51c77007319 408 * @}
mbed_official 52:a51c77007319 409 */
mbed_official 52:a51c77007319 410
mbed_official 52:a51c77007319 411 /** @defgroup I2S3_clock_source
mbed_official 52:a51c77007319 412 * @{
mbed_official 52:a51c77007319 413 */
mbed_official 52:a51c77007319 414 #define RCC_I2S3CLKSource_SYSCLK ((uint8_t)0x00)
mbed_official 52:a51c77007319 415 #define RCC_I2S3CLKSource_PLL3_VCO ((uint8_t)0x01)
mbed_official 52:a51c77007319 416
mbed_official 52:a51c77007319 417 #define IS_RCC_I2S3CLK_SOURCE(SOURCE) (((SOURCE) == RCC_I2S3CLKSource_SYSCLK) || \
mbed_official 52:a51c77007319 418 ((SOURCE) == RCC_I2S3CLKSource_PLL3_VCO))
mbed_official 52:a51c77007319 419 /**
mbed_official 52:a51c77007319 420 * @}
mbed_official 52:a51c77007319 421 */
mbed_official 52:a51c77007319 422 #endif /* STM32F10X_CL */
mbed_official 52:a51c77007319 423
mbed_official 52:a51c77007319 424
mbed_official 52:a51c77007319 425 /** @defgroup ADC_clock_source
mbed_official 52:a51c77007319 426 * @{
mbed_official 52:a51c77007319 427 */
mbed_official 52:a51c77007319 428
mbed_official 52:a51c77007319 429 #define RCC_PCLK2_Div2 ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 430 #define RCC_PCLK2_Div4 ((uint32_t)0x00004000)
mbed_official 52:a51c77007319 431 #define RCC_PCLK2_Div6 ((uint32_t)0x00008000)
mbed_official 52:a51c77007319 432 #define RCC_PCLK2_Div8 ((uint32_t)0x0000C000)
mbed_official 52:a51c77007319 433 #define IS_RCC_ADCCLK(ADCCLK) (((ADCCLK) == RCC_PCLK2_Div2) || ((ADCCLK) == RCC_PCLK2_Div4) || \
mbed_official 52:a51c77007319 434 ((ADCCLK) == RCC_PCLK2_Div6) || ((ADCCLK) == RCC_PCLK2_Div8))
mbed_official 52:a51c77007319 435 /**
mbed_official 52:a51c77007319 436 * @}
mbed_official 52:a51c77007319 437 */
mbed_official 52:a51c77007319 438
mbed_official 52:a51c77007319 439 /** @defgroup LSE_configuration
mbed_official 52:a51c77007319 440 * @{
mbed_official 52:a51c77007319 441 */
mbed_official 52:a51c77007319 442
mbed_official 52:a51c77007319 443 #define RCC_LSE_OFF ((uint8_t)0x00)
mbed_official 52:a51c77007319 444 #define RCC_LSE_ON ((uint8_t)0x01)
mbed_official 52:a51c77007319 445 #define RCC_LSE_Bypass ((uint8_t)0x04)
mbed_official 52:a51c77007319 446 #define IS_RCC_LSE(LSE) (((LSE) == RCC_LSE_OFF) || ((LSE) == RCC_LSE_ON) || \
mbed_official 52:a51c77007319 447 ((LSE) == RCC_LSE_Bypass))
mbed_official 52:a51c77007319 448 /**
mbed_official 52:a51c77007319 449 * @}
mbed_official 52:a51c77007319 450 */
mbed_official 52:a51c77007319 451
mbed_official 52:a51c77007319 452 /** @defgroup RTC_clock_source
mbed_official 52:a51c77007319 453 * @{
mbed_official 52:a51c77007319 454 */
mbed_official 52:a51c77007319 455
mbed_official 52:a51c77007319 456 #define RCC_RTCCLKSource_LSE ((uint32_t)0x00000100)
mbed_official 52:a51c77007319 457 #define RCC_RTCCLKSource_LSI ((uint32_t)0x00000200)
mbed_official 52:a51c77007319 458 #define RCC_RTCCLKSource_HSE_Div128 ((uint32_t)0x00000300)
mbed_official 52:a51c77007319 459 #define IS_RCC_RTCCLK_SOURCE(SOURCE) (((SOURCE) == RCC_RTCCLKSource_LSE) || \
mbed_official 52:a51c77007319 460 ((SOURCE) == RCC_RTCCLKSource_LSI) || \
mbed_official 52:a51c77007319 461 ((SOURCE) == RCC_RTCCLKSource_HSE_Div128))
mbed_official 52:a51c77007319 462 /**
mbed_official 52:a51c77007319 463 * @}
mbed_official 52:a51c77007319 464 */
mbed_official 52:a51c77007319 465
mbed_official 52:a51c77007319 466 /** @defgroup AHB_peripheral
mbed_official 52:a51c77007319 467 * @{
mbed_official 52:a51c77007319 468 */
mbed_official 52:a51c77007319 469
mbed_official 52:a51c77007319 470 #define RCC_AHBPeriph_DMA1 ((uint32_t)0x00000001)
mbed_official 52:a51c77007319 471 #define RCC_AHBPeriph_DMA2 ((uint32_t)0x00000002)
mbed_official 52:a51c77007319 472 #define RCC_AHBPeriph_SRAM ((uint32_t)0x00000004)
mbed_official 52:a51c77007319 473 #define RCC_AHBPeriph_FLITF ((uint32_t)0x00000010)
mbed_official 52:a51c77007319 474 #define RCC_AHBPeriph_CRC ((uint32_t)0x00000040)
mbed_official 52:a51c77007319 475
mbed_official 52:a51c77007319 476 #ifndef STM32F10X_CL
mbed_official 52:a51c77007319 477 #define RCC_AHBPeriph_FSMC ((uint32_t)0x00000100)
mbed_official 52:a51c77007319 478 #define RCC_AHBPeriph_SDIO ((uint32_t)0x00000400)
mbed_official 52:a51c77007319 479 #define IS_RCC_AHB_PERIPH(PERIPH) ((((PERIPH) & 0xFFFFFAA8) == 0x00) && ((PERIPH) != 0x00))
mbed_official 52:a51c77007319 480 #else
mbed_official 52:a51c77007319 481 #define RCC_AHBPeriph_OTG_FS ((uint32_t)0x00001000)
mbed_official 52:a51c77007319 482 #define RCC_AHBPeriph_ETH_MAC ((uint32_t)0x00004000)
mbed_official 52:a51c77007319 483 #define RCC_AHBPeriph_ETH_MAC_Tx ((uint32_t)0x00008000)
mbed_official 52:a51c77007319 484 #define RCC_AHBPeriph_ETH_MAC_Rx ((uint32_t)0x00010000)
mbed_official 52:a51c77007319 485
mbed_official 52:a51c77007319 486 #define IS_RCC_AHB_PERIPH(PERIPH) ((((PERIPH) & 0xFFFE2FA8) == 0x00) && ((PERIPH) != 0x00))
mbed_official 52:a51c77007319 487 #define IS_RCC_AHB_PERIPH_RESET(PERIPH) ((((PERIPH) & 0xFFFFAFFF) == 0x00) && ((PERIPH) != 0x00))
mbed_official 52:a51c77007319 488 #endif /* STM32F10X_CL */
mbed_official 52:a51c77007319 489 /**
mbed_official 52:a51c77007319 490 * @}
mbed_official 52:a51c77007319 491 */
mbed_official 52:a51c77007319 492
mbed_official 52:a51c77007319 493 /** @defgroup APB2_peripheral
mbed_official 52:a51c77007319 494 * @{
mbed_official 52:a51c77007319 495 */
mbed_official 52:a51c77007319 496
mbed_official 52:a51c77007319 497 #define RCC_APB2Periph_AFIO ((uint32_t)0x00000001)
mbed_official 52:a51c77007319 498 #define RCC_APB2Periph_GPIOA ((uint32_t)0x00000004)
mbed_official 52:a51c77007319 499 #define RCC_APB2Periph_GPIOB ((uint32_t)0x00000008)
mbed_official 52:a51c77007319 500 #define RCC_APB2Periph_GPIOC ((uint32_t)0x00000010)
mbed_official 52:a51c77007319 501 #define RCC_APB2Periph_GPIOD ((uint32_t)0x00000020)
mbed_official 52:a51c77007319 502 #define RCC_APB2Periph_GPIOE ((uint32_t)0x00000040)
mbed_official 52:a51c77007319 503 #define RCC_APB2Periph_GPIOF ((uint32_t)0x00000080)
mbed_official 52:a51c77007319 504 #define RCC_APB2Periph_GPIOG ((uint32_t)0x00000100)
mbed_official 52:a51c77007319 505 #define RCC_APB2Periph_ADC1 ((uint32_t)0x00000200)
mbed_official 52:a51c77007319 506 #define RCC_APB2Periph_ADC2 ((uint32_t)0x00000400)
mbed_official 52:a51c77007319 507 #define RCC_APB2Periph_TIM1 ((uint32_t)0x00000800)
mbed_official 52:a51c77007319 508 #define RCC_APB2Periph_SPI1 ((uint32_t)0x00001000)
mbed_official 52:a51c77007319 509 #define RCC_APB2Periph_TIM8 ((uint32_t)0x00002000)
mbed_official 52:a51c77007319 510 #define RCC_APB2Periph_USART1 ((uint32_t)0x00004000)
mbed_official 52:a51c77007319 511 #define RCC_APB2Periph_ADC3 ((uint32_t)0x00008000)
mbed_official 52:a51c77007319 512 #define RCC_APB2Periph_TIM15 ((uint32_t)0x00010000)
mbed_official 52:a51c77007319 513 #define RCC_APB2Periph_TIM16 ((uint32_t)0x00020000)
mbed_official 52:a51c77007319 514 #define RCC_APB2Periph_TIM17 ((uint32_t)0x00040000)
mbed_official 52:a51c77007319 515 #define RCC_APB2Periph_TIM9 ((uint32_t)0x00080000)
mbed_official 52:a51c77007319 516 #define RCC_APB2Periph_TIM10 ((uint32_t)0x00100000)
mbed_official 52:a51c77007319 517 #define RCC_APB2Periph_TIM11 ((uint32_t)0x00200000)
mbed_official 52:a51c77007319 518
mbed_official 52:a51c77007319 519 #define IS_RCC_APB2_PERIPH(PERIPH) ((((PERIPH) & 0xFFC00002) == 0x00) && ((PERIPH) != 0x00))
mbed_official 52:a51c77007319 520 /**
mbed_official 52:a51c77007319 521 * @}
mbed_official 52:a51c77007319 522 */
mbed_official 52:a51c77007319 523
mbed_official 52:a51c77007319 524 /** @defgroup APB1_peripheral
mbed_official 52:a51c77007319 525 * @{
mbed_official 52:a51c77007319 526 */
mbed_official 52:a51c77007319 527
mbed_official 52:a51c77007319 528 #define RCC_APB1Periph_TIM2 ((uint32_t)0x00000001)
mbed_official 52:a51c77007319 529 #define RCC_APB1Periph_TIM3 ((uint32_t)0x00000002)
mbed_official 52:a51c77007319 530 #define RCC_APB1Periph_TIM4 ((uint32_t)0x00000004)
mbed_official 52:a51c77007319 531 #define RCC_APB1Periph_TIM5 ((uint32_t)0x00000008)
mbed_official 52:a51c77007319 532 #define RCC_APB1Periph_TIM6 ((uint32_t)0x00000010)
mbed_official 52:a51c77007319 533 #define RCC_APB1Periph_TIM7 ((uint32_t)0x00000020)
mbed_official 52:a51c77007319 534 #define RCC_APB1Periph_TIM12 ((uint32_t)0x00000040)
mbed_official 52:a51c77007319 535 #define RCC_APB1Periph_TIM13 ((uint32_t)0x00000080)
mbed_official 52:a51c77007319 536 #define RCC_APB1Periph_TIM14 ((uint32_t)0x00000100)
mbed_official 52:a51c77007319 537 #define RCC_APB1Periph_WWDG ((uint32_t)0x00000800)
mbed_official 52:a51c77007319 538 #define RCC_APB1Periph_SPI2 ((uint32_t)0x00004000)
mbed_official 52:a51c77007319 539 #define RCC_APB1Periph_SPI3 ((uint32_t)0x00008000)
mbed_official 52:a51c77007319 540 #define RCC_APB1Periph_USART2 ((uint32_t)0x00020000)
mbed_official 52:a51c77007319 541 #define RCC_APB1Periph_USART3 ((uint32_t)0x00040000)
mbed_official 52:a51c77007319 542 #define RCC_APB1Periph_UART4 ((uint32_t)0x00080000)
mbed_official 52:a51c77007319 543 #define RCC_APB1Periph_UART5 ((uint32_t)0x00100000)
mbed_official 52:a51c77007319 544 #define RCC_APB1Periph_I2C1 ((uint32_t)0x00200000)
mbed_official 52:a51c77007319 545 #define RCC_APB1Periph_I2C2 ((uint32_t)0x00400000)
mbed_official 52:a51c77007319 546 #define RCC_APB1Periph_USB ((uint32_t)0x00800000)
mbed_official 52:a51c77007319 547 #define RCC_APB1Periph_CAN1 ((uint32_t)0x02000000)
mbed_official 52:a51c77007319 548 #define RCC_APB1Periph_CAN2 ((uint32_t)0x04000000)
mbed_official 52:a51c77007319 549 #define RCC_APB1Periph_BKP ((uint32_t)0x08000000)
mbed_official 52:a51c77007319 550 #define RCC_APB1Periph_PWR ((uint32_t)0x10000000)
mbed_official 52:a51c77007319 551 #define RCC_APB1Periph_DAC ((uint32_t)0x20000000)
mbed_official 52:a51c77007319 552 #define RCC_APB1Periph_CEC ((uint32_t)0x40000000)
mbed_official 52:a51c77007319 553
mbed_official 52:a51c77007319 554 #define IS_RCC_APB1_PERIPH(PERIPH) ((((PERIPH) & 0x81013600) == 0x00) && ((PERIPH) != 0x00))
mbed_official 52:a51c77007319 555
mbed_official 52:a51c77007319 556 /**
mbed_official 52:a51c77007319 557 * @}
mbed_official 52:a51c77007319 558 */
mbed_official 52:a51c77007319 559
mbed_official 52:a51c77007319 560 /** @defgroup Clock_source_to_output_on_MCO_pin
mbed_official 52:a51c77007319 561 * @{
mbed_official 52:a51c77007319 562 */
mbed_official 52:a51c77007319 563
mbed_official 52:a51c77007319 564 #define RCC_MCO_NoClock ((uint8_t)0x00)
mbed_official 52:a51c77007319 565 #define RCC_MCO_SYSCLK ((uint8_t)0x04)
mbed_official 52:a51c77007319 566 #define RCC_MCO_HSI ((uint8_t)0x05)
mbed_official 52:a51c77007319 567 #define RCC_MCO_HSE ((uint8_t)0x06)
mbed_official 52:a51c77007319 568 #define RCC_MCO_PLLCLK_Div2 ((uint8_t)0x07)
mbed_official 52:a51c77007319 569
mbed_official 52:a51c77007319 570 #ifndef STM32F10X_CL
mbed_official 52:a51c77007319 571 #define IS_RCC_MCO(MCO) (((MCO) == RCC_MCO_NoClock) || ((MCO) == RCC_MCO_HSI) || \
mbed_official 52:a51c77007319 572 ((MCO) == RCC_MCO_SYSCLK) || ((MCO) == RCC_MCO_HSE) || \
mbed_official 52:a51c77007319 573 ((MCO) == RCC_MCO_PLLCLK_Div2))
mbed_official 52:a51c77007319 574 #else
mbed_official 52:a51c77007319 575 #define RCC_MCO_PLL2CLK ((uint8_t)0x08)
mbed_official 52:a51c77007319 576 #define RCC_MCO_PLL3CLK_Div2 ((uint8_t)0x09)
mbed_official 52:a51c77007319 577 #define RCC_MCO_XT1 ((uint8_t)0x0A)
mbed_official 52:a51c77007319 578 #define RCC_MCO_PLL3CLK ((uint8_t)0x0B)
mbed_official 52:a51c77007319 579
mbed_official 52:a51c77007319 580 #define IS_RCC_MCO(MCO) (((MCO) == RCC_MCO_NoClock) || ((MCO) == RCC_MCO_HSI) || \
mbed_official 52:a51c77007319 581 ((MCO) == RCC_MCO_SYSCLK) || ((MCO) == RCC_MCO_HSE) || \
mbed_official 52:a51c77007319 582 ((MCO) == RCC_MCO_PLLCLK_Div2) || ((MCO) == RCC_MCO_PLL2CLK) || \
mbed_official 52:a51c77007319 583 ((MCO) == RCC_MCO_PLL3CLK_Div2) || ((MCO) == RCC_MCO_XT1) || \
mbed_official 52:a51c77007319 584 ((MCO) == RCC_MCO_PLL3CLK))
mbed_official 52:a51c77007319 585 #endif /* STM32F10X_CL */
mbed_official 52:a51c77007319 586
mbed_official 52:a51c77007319 587 /**
mbed_official 52:a51c77007319 588 * @}
mbed_official 52:a51c77007319 589 */
mbed_official 52:a51c77007319 590
mbed_official 52:a51c77007319 591 /** @defgroup RCC_Flag
mbed_official 52:a51c77007319 592 * @{
mbed_official 52:a51c77007319 593 */
mbed_official 52:a51c77007319 594
mbed_official 52:a51c77007319 595 #define RCC_FLAG_HSIRDY ((uint8_t)0x21)
mbed_official 52:a51c77007319 596 #define RCC_FLAG_HSERDY ((uint8_t)0x31)
mbed_official 52:a51c77007319 597 #define RCC_FLAG_PLLRDY ((uint8_t)0x39)
mbed_official 52:a51c77007319 598 #define RCC_FLAG_LSERDY ((uint8_t)0x41)
mbed_official 52:a51c77007319 599 #define RCC_FLAG_LSIRDY ((uint8_t)0x61)
mbed_official 52:a51c77007319 600 #define RCC_FLAG_PINRST ((uint8_t)0x7A)
mbed_official 52:a51c77007319 601 #define RCC_FLAG_PORRST ((uint8_t)0x7B)
mbed_official 52:a51c77007319 602 #define RCC_FLAG_SFTRST ((uint8_t)0x7C)
mbed_official 52:a51c77007319 603 #define RCC_FLAG_IWDGRST ((uint8_t)0x7D)
mbed_official 52:a51c77007319 604 #define RCC_FLAG_WWDGRST ((uint8_t)0x7E)
mbed_official 52:a51c77007319 605 #define RCC_FLAG_LPWRRST ((uint8_t)0x7F)
mbed_official 52:a51c77007319 606
mbed_official 52:a51c77007319 607 #ifndef STM32F10X_CL
mbed_official 52:a51c77007319 608 #define IS_RCC_FLAG(FLAG) (((FLAG) == RCC_FLAG_HSIRDY) || ((FLAG) == RCC_FLAG_HSERDY) || \
mbed_official 52:a51c77007319 609 ((FLAG) == RCC_FLAG_PLLRDY) || ((FLAG) == RCC_FLAG_LSERDY) || \
mbed_official 52:a51c77007319 610 ((FLAG) == RCC_FLAG_LSIRDY) || ((FLAG) == RCC_FLAG_PINRST) || \
mbed_official 52:a51c77007319 611 ((FLAG) == RCC_FLAG_PORRST) || ((FLAG) == RCC_FLAG_SFTRST) || \
mbed_official 52:a51c77007319 612 ((FLAG) == RCC_FLAG_IWDGRST)|| ((FLAG) == RCC_FLAG_WWDGRST)|| \
mbed_official 52:a51c77007319 613 ((FLAG) == RCC_FLAG_LPWRRST))
mbed_official 52:a51c77007319 614 #else
mbed_official 52:a51c77007319 615 #define RCC_FLAG_PLL2RDY ((uint8_t)0x3B)
mbed_official 52:a51c77007319 616 #define RCC_FLAG_PLL3RDY ((uint8_t)0x3D)
mbed_official 52:a51c77007319 617 #define IS_RCC_FLAG(FLAG) (((FLAG) == RCC_FLAG_HSIRDY) || ((FLAG) == RCC_FLAG_HSERDY) || \
mbed_official 52:a51c77007319 618 ((FLAG) == RCC_FLAG_PLLRDY) || ((FLAG) == RCC_FLAG_LSERDY) || \
mbed_official 52:a51c77007319 619 ((FLAG) == RCC_FLAG_PLL2RDY) || ((FLAG) == RCC_FLAG_PLL3RDY) || \
mbed_official 52:a51c77007319 620 ((FLAG) == RCC_FLAG_LSIRDY) || ((FLAG) == RCC_FLAG_PINRST) || \
mbed_official 52:a51c77007319 621 ((FLAG) == RCC_FLAG_PORRST) || ((FLAG) == RCC_FLAG_SFTRST) || \
mbed_official 52:a51c77007319 622 ((FLAG) == RCC_FLAG_IWDGRST)|| ((FLAG) == RCC_FLAG_WWDGRST)|| \
mbed_official 52:a51c77007319 623 ((FLAG) == RCC_FLAG_LPWRRST))
mbed_official 52:a51c77007319 624 #endif /* STM32F10X_CL */
mbed_official 52:a51c77007319 625
mbed_official 52:a51c77007319 626 #define IS_RCC_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x1F)
mbed_official 52:a51c77007319 627 /**
mbed_official 52:a51c77007319 628 * @}
mbed_official 52:a51c77007319 629 */
mbed_official 52:a51c77007319 630
mbed_official 52:a51c77007319 631 /**
mbed_official 52:a51c77007319 632 * @}
mbed_official 52:a51c77007319 633 */
mbed_official 52:a51c77007319 634
mbed_official 52:a51c77007319 635 /** @defgroup RCC_Exported_Macros
mbed_official 52:a51c77007319 636 * @{
mbed_official 52:a51c77007319 637 */
mbed_official 52:a51c77007319 638
mbed_official 52:a51c77007319 639 /**
mbed_official 52:a51c77007319 640 * @}
mbed_official 52:a51c77007319 641 */
mbed_official 52:a51c77007319 642
mbed_official 52:a51c77007319 643 /** @defgroup RCC_Exported_Functions
mbed_official 52:a51c77007319 644 * @{
mbed_official 52:a51c77007319 645 */
mbed_official 52:a51c77007319 646
mbed_official 52:a51c77007319 647 void RCC_DeInit(void);
mbed_official 52:a51c77007319 648 void RCC_HSEConfig(uint32_t RCC_HSE);
mbed_official 52:a51c77007319 649 ErrorStatus RCC_WaitForHSEStartUp(void);
mbed_official 52:a51c77007319 650 void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue);
mbed_official 52:a51c77007319 651 void RCC_HSICmd(FunctionalState NewState);
mbed_official 52:a51c77007319 652 void RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t RCC_PLLMul);
mbed_official 52:a51c77007319 653 void RCC_PLLCmd(FunctionalState NewState);
mbed_official 52:a51c77007319 654
mbed_official 52:a51c77007319 655 #if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL) || defined (STM32F10X_CL)
mbed_official 52:a51c77007319 656 void RCC_PREDIV1Config(uint32_t RCC_PREDIV1_Source, uint32_t RCC_PREDIV1_Div);
mbed_official 52:a51c77007319 657 #endif
mbed_official 52:a51c77007319 658
mbed_official 52:a51c77007319 659 #ifdef STM32F10X_CL
mbed_official 52:a51c77007319 660 void RCC_PREDIV2Config(uint32_t RCC_PREDIV2_Div);
mbed_official 52:a51c77007319 661 void RCC_PLL2Config(uint32_t RCC_PLL2Mul);
mbed_official 52:a51c77007319 662 void RCC_PLL2Cmd(FunctionalState NewState);
mbed_official 52:a51c77007319 663 void RCC_PLL3Config(uint32_t RCC_PLL3Mul);
mbed_official 52:a51c77007319 664 void RCC_PLL3Cmd(FunctionalState NewState);
mbed_official 52:a51c77007319 665 #endif /* STM32F10X_CL */
mbed_official 52:a51c77007319 666
mbed_official 52:a51c77007319 667 void RCC_SYSCLKConfig(uint32_t RCC_SYSCLKSource);
mbed_official 52:a51c77007319 668 uint8_t RCC_GetSYSCLKSource(void);
mbed_official 52:a51c77007319 669 void RCC_HCLKConfig(uint32_t RCC_SYSCLK);
mbed_official 52:a51c77007319 670 void RCC_PCLK1Config(uint32_t RCC_HCLK);
mbed_official 52:a51c77007319 671 void RCC_PCLK2Config(uint32_t RCC_HCLK);
mbed_official 52:a51c77007319 672 void RCC_ITConfig(uint8_t RCC_IT, FunctionalState NewState);
mbed_official 52:a51c77007319 673
mbed_official 52:a51c77007319 674 #ifndef STM32F10X_CL
mbed_official 52:a51c77007319 675 void RCC_USBCLKConfig(uint32_t RCC_USBCLKSource);
mbed_official 52:a51c77007319 676 #else
mbed_official 52:a51c77007319 677 void RCC_OTGFSCLKConfig(uint32_t RCC_OTGFSCLKSource);
mbed_official 52:a51c77007319 678 #endif /* STM32F10X_CL */
mbed_official 52:a51c77007319 679
mbed_official 52:a51c77007319 680 void RCC_ADCCLKConfig(uint32_t RCC_PCLK2);
mbed_official 52:a51c77007319 681
mbed_official 52:a51c77007319 682 #ifdef STM32F10X_CL
mbed_official 52:a51c77007319 683 void RCC_I2S2CLKConfig(uint32_t RCC_I2S2CLKSource);
mbed_official 52:a51c77007319 684 void RCC_I2S3CLKConfig(uint32_t RCC_I2S3CLKSource);
mbed_official 52:a51c77007319 685 #endif /* STM32F10X_CL */
mbed_official 52:a51c77007319 686
mbed_official 52:a51c77007319 687 void RCC_LSEConfig(uint8_t RCC_LSE);
mbed_official 52:a51c77007319 688 void RCC_LSICmd(FunctionalState NewState);
mbed_official 52:a51c77007319 689 void RCC_RTCCLKConfig(uint32_t RCC_RTCCLKSource);
mbed_official 52:a51c77007319 690 void RCC_RTCCLKCmd(FunctionalState NewState);
mbed_official 52:a51c77007319 691 void RCC_GetClocksFreq(RCC_ClocksTypeDef* RCC_Clocks);
mbed_official 52:a51c77007319 692 void RCC_AHBPeriphClockCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState);
mbed_official 52:a51c77007319 693 void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);
mbed_official 52:a51c77007319 694 void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
mbed_official 52:a51c77007319 695
mbed_official 52:a51c77007319 696 #ifdef STM32F10X_CL
mbed_official 52:a51c77007319 697 void RCC_AHBPeriphResetCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState);
mbed_official 52:a51c77007319 698 #endif /* STM32F10X_CL */
mbed_official 52:a51c77007319 699
mbed_official 52:a51c77007319 700 void RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);
mbed_official 52:a51c77007319 701 void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
mbed_official 52:a51c77007319 702 void RCC_BackupResetCmd(FunctionalState NewState);
mbed_official 52:a51c77007319 703 void RCC_ClockSecuritySystemCmd(FunctionalState NewState);
mbed_official 52:a51c77007319 704 void RCC_MCOConfig(uint8_t RCC_MCO);
mbed_official 52:a51c77007319 705 FlagStatus RCC_GetFlagStatus(uint8_t RCC_FLAG);
mbed_official 52:a51c77007319 706 void RCC_ClearFlag(void);
mbed_official 52:a51c77007319 707 ITStatus RCC_GetITStatus(uint8_t RCC_IT);
mbed_official 52:a51c77007319 708 void RCC_ClearITPendingBit(uint8_t RCC_IT);
mbed_official 52:a51c77007319 709
mbed_official 52:a51c77007319 710 #ifdef __cplusplus
mbed_official 52:a51c77007319 711 }
mbed_official 52:a51c77007319 712 #endif
mbed_official 52:a51c77007319 713
mbed_official 52:a51c77007319 714 #endif /* __STM32F10x_RCC_H */
mbed_official 52:a51c77007319 715 /**
mbed_official 52:a51c77007319 716 * @}
mbed_official 52:a51c77007319 717 */
mbed_official 52:a51c77007319 718
mbed_official 52:a51c77007319 719 /**
mbed_official 52:a51c77007319 720 * @}
mbed_official 52:a51c77007319 721 */
mbed_official 52:a51c77007319 722
mbed_official 52:a51c77007319 723 /**
mbed_official 52:a51c77007319 724 * @}
mbed_official 52:a51c77007319 725 */
mbed_official 52:a51c77007319 726
mbed_official 52:a51c77007319 727 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/