mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Tue Jan 07 11:00:05 2014 +0000
Revision:
70:c1fbde68b492
Parent:
52:a51c77007319
Child:
84:f54042cbc282
Synchronized with git revision 3f438a307904431f2782db3c8fa49946b9fc1d85

Full URL: https://github.com/mbedmicro/mbed/commit/3f438a307904431f2782db3c8fa49946b9fc1d85/

[NUCLEO_F103RB] license text changed + sleep hal updated

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