mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Wed Feb 26 09:45:12 2014 +0000
Revision:
106:ced8cbb51063
Parent:
76:aeb1df146756
Synchronized with git revision 4222735eff5868389433f0e9271976b39c8115cd

Full URL: https://github.com/mbedmicro/mbed/commit/4222735eff5868389433f0e9271976b39c8115cd/

[NUCLEO_xxx] Update STM32CubeF4 driver V1.0.0 + update license

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 76:aeb1df146756 1 /**
mbed_official 76:aeb1df146756 2 ******************************************************************************
mbed_official 76:aeb1df146756 3 * @file stm32f0xx_rcc.h
mbed_official 76:aeb1df146756 4 * @author MCD Application Team
mbed_official 76:aeb1df146756 5 * @version V1.3.0
mbed_official 76:aeb1df146756 6 * @date 16-January-2014
mbed_official 76:aeb1df146756 7 * @brief This file contains all the functions prototypes for the RCC
mbed_official 76:aeb1df146756 8 * firmware library.
mbed_official 76:aeb1df146756 9 ******************************************************************************
mbed_official 76:aeb1df146756 10 * @attention
mbed_official 76:aeb1df146756 11 *
mbed_official 106:ced8cbb51063 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 76:aeb1df146756 13 *
mbed_official 106:ced8cbb51063 14 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 106:ced8cbb51063 15 * are permitted provided that the following conditions are met:
mbed_official 106:ced8cbb51063 16 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 106:ced8cbb51063 17 * this list of conditions and the following disclaimer.
mbed_official 106:ced8cbb51063 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 106:ced8cbb51063 19 * this list of conditions and the following disclaimer in the documentation
mbed_official 106:ced8cbb51063 20 * and/or other materials provided with the distribution.
mbed_official 106:ced8cbb51063 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 106:ced8cbb51063 22 * may be used to endorse or promote products derived from this software
mbed_official 106:ced8cbb51063 23 * without specific prior written permission.
mbed_official 76:aeb1df146756 24 *
mbed_official 106:ced8cbb51063 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 106:ced8cbb51063 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 106:ced8cbb51063 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 106:ced8cbb51063 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 106:ced8cbb51063 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 106:ced8cbb51063 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 106:ced8cbb51063 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 106:ced8cbb51063 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 106:ced8cbb51063 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 106:ced8cbb51063 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 76:aeb1df146756 35 *
mbed_official 76:aeb1df146756 36 ******************************************************************************
mbed_official 76:aeb1df146756 37 */
mbed_official 76:aeb1df146756 38
mbed_official 76:aeb1df146756 39 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 76:aeb1df146756 40 #ifndef __STM32F0XX_RCC_H
mbed_official 76:aeb1df146756 41 #define __STM32F0XX_RCC_H
mbed_official 76:aeb1df146756 42
mbed_official 76:aeb1df146756 43 #ifdef __cplusplus
mbed_official 76:aeb1df146756 44 extern "C" {
mbed_official 76:aeb1df146756 45 #endif
mbed_official 76:aeb1df146756 46
mbed_official 76:aeb1df146756 47 /* Includes ------------------------------------------------------------------*/
mbed_official 76:aeb1df146756 48 #include "stm32f0xx.h"
mbed_official 76:aeb1df146756 49
mbed_official 76:aeb1df146756 50 /** @addtogroup STM32F0xx_StdPeriph_Driver
mbed_official 76:aeb1df146756 51 * @{
mbed_official 76:aeb1df146756 52 */
mbed_official 76:aeb1df146756 53
mbed_official 76:aeb1df146756 54 /** @addtogroup RCC
mbed_official 76:aeb1df146756 55 * @{
mbed_official 76:aeb1df146756 56 */
mbed_official 76:aeb1df146756 57
mbed_official 76:aeb1df146756 58 /* Exported types ------------------------------------------------------------*/
mbed_official 76:aeb1df146756 59
mbed_official 76:aeb1df146756 60 typedef struct
mbed_official 76:aeb1df146756 61 {
mbed_official 76:aeb1df146756 62 uint32_t SYSCLK_Frequency;
mbed_official 76:aeb1df146756 63 uint32_t HCLK_Frequency;
mbed_official 76:aeb1df146756 64 uint32_t PCLK_Frequency;
mbed_official 76:aeb1df146756 65 uint32_t ADCCLK_Frequency;
mbed_official 76:aeb1df146756 66 uint32_t CECCLK_Frequency;
mbed_official 76:aeb1df146756 67 uint32_t I2C1CLK_Frequency;
mbed_official 76:aeb1df146756 68 uint32_t USART1CLK_Frequency;
mbed_official 76:aeb1df146756 69 uint32_t USART2CLK_Frequency; /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 70 uint32_t USBCLK_Frequency; /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 71 }RCC_ClocksTypeDef;
mbed_official 76:aeb1df146756 72
mbed_official 76:aeb1df146756 73 /* Exported constants --------------------------------------------------------*/
mbed_official 76:aeb1df146756 74
mbed_official 76:aeb1df146756 75 /** @defgroup RCC_Exported_Constants
mbed_official 76:aeb1df146756 76 * @{
mbed_official 76:aeb1df146756 77 */
mbed_official 76:aeb1df146756 78
mbed_official 76:aeb1df146756 79 /** @defgroup RCC_HSE_configuration
mbed_official 76:aeb1df146756 80 * @{
mbed_official 76:aeb1df146756 81 */
mbed_official 76:aeb1df146756 82
mbed_official 76:aeb1df146756 83 #define RCC_HSE_OFF ((uint8_t)0x00)
mbed_official 76:aeb1df146756 84 #define RCC_HSE_ON ((uint8_t)0x01)
mbed_official 76:aeb1df146756 85 #define RCC_HSE_Bypass ((uint8_t)0x05)
mbed_official 76:aeb1df146756 86 #define IS_RCC_HSE(HSE) (((HSE) == RCC_HSE_OFF) || ((HSE) == RCC_HSE_ON) || \
mbed_official 76:aeb1df146756 87 ((HSE) == RCC_HSE_Bypass))
mbed_official 76:aeb1df146756 88
mbed_official 76:aeb1df146756 89 /**
mbed_official 76:aeb1df146756 90 * @}
mbed_official 76:aeb1df146756 91 */
mbed_official 76:aeb1df146756 92
mbed_official 76:aeb1df146756 93 /** @defgroup RCC_PLL_Clock_Source
mbed_official 76:aeb1df146756 94 * @{
mbed_official 76:aeb1df146756 95 */
mbed_official 76:aeb1df146756 96
mbed_official 76:aeb1df146756 97 #define RCC_PLLSource_HSI_Div2 RCC_CFGR_PLLSRC_HSI_Div2
mbed_official 76:aeb1df146756 98 #define RCC_PLLSource_PREDIV1 RCC_CFGR_PLLSRC_HSE_PREDIV /* Old HSEPREDIV1 bit definition, maintained for legacy purpose */
mbed_official 76:aeb1df146756 99 #define RCC_PLLSource_HSE RCC_CFGR_PLLSRC_HSE_PREDIV /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 100 #define RCC_PLLSource_HSI48 RCC_CFGR_PLLSRC_HSI48_PREDIV /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 101 #define RCC_PLLSource_HSI RCC_CFGR_PLLSRC_HSI_PREDIV /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 102
mbed_official 76:aeb1df146756 103 #define IS_RCC_PLL_SOURCE(SOURCE) (((SOURCE) == RCC_PLLSource_HSI_Div2) || \
mbed_official 76:aeb1df146756 104 ((SOURCE) == RCC_PLLSource_HSI48) || \
mbed_official 76:aeb1df146756 105 ((SOURCE) == RCC_PLLSource_HSI) || \
mbed_official 76:aeb1df146756 106 ((SOURCE) == RCC_PLLSource_HSE) || \
mbed_official 76:aeb1df146756 107 ((SOURCE) == RCC_PLLSource_PREDIV1))
mbed_official 76:aeb1df146756 108 /**
mbed_official 76:aeb1df146756 109 * @}
mbed_official 76:aeb1df146756 110 */
mbed_official 76:aeb1df146756 111
mbed_official 76:aeb1df146756 112 /** @defgroup RCC_PLL_Multiplication_Factor
mbed_official 76:aeb1df146756 113 * @{
mbed_official 76:aeb1df146756 114 */
mbed_official 76:aeb1df146756 115
mbed_official 76:aeb1df146756 116 #define RCC_PLLMul_2 RCC_CFGR_PLLMULL2
mbed_official 76:aeb1df146756 117 #define RCC_PLLMul_3 RCC_CFGR_PLLMULL3
mbed_official 76:aeb1df146756 118 #define RCC_PLLMul_4 RCC_CFGR_PLLMULL4
mbed_official 76:aeb1df146756 119 #define RCC_PLLMul_5 RCC_CFGR_PLLMULL5
mbed_official 76:aeb1df146756 120 #define RCC_PLLMul_6 RCC_CFGR_PLLMULL6
mbed_official 76:aeb1df146756 121 #define RCC_PLLMul_7 RCC_CFGR_PLLMULL7
mbed_official 76:aeb1df146756 122 #define RCC_PLLMul_8 RCC_CFGR_PLLMULL8
mbed_official 76:aeb1df146756 123 #define RCC_PLLMul_9 RCC_CFGR_PLLMULL9
mbed_official 76:aeb1df146756 124 #define RCC_PLLMul_10 RCC_CFGR_PLLMULL10
mbed_official 76:aeb1df146756 125 #define RCC_PLLMul_11 RCC_CFGR_PLLMULL11
mbed_official 76:aeb1df146756 126 #define RCC_PLLMul_12 RCC_CFGR_PLLMULL12
mbed_official 76:aeb1df146756 127 #define RCC_PLLMul_13 RCC_CFGR_PLLMULL13
mbed_official 76:aeb1df146756 128 #define RCC_PLLMul_14 RCC_CFGR_PLLMULL14
mbed_official 76:aeb1df146756 129 #define RCC_PLLMul_15 RCC_CFGR_PLLMULL15
mbed_official 76:aeb1df146756 130 #define RCC_PLLMul_16 RCC_CFGR_PLLMULL16
mbed_official 76:aeb1df146756 131 #define IS_RCC_PLL_MUL(MUL) (((MUL) == RCC_PLLMul_2) || ((MUL) == RCC_PLLMul_3) || \
mbed_official 76:aeb1df146756 132 ((MUL) == RCC_PLLMul_4) || ((MUL) == RCC_PLLMul_5) || \
mbed_official 76:aeb1df146756 133 ((MUL) == RCC_PLLMul_6) || ((MUL) == RCC_PLLMul_7) || \
mbed_official 76:aeb1df146756 134 ((MUL) == RCC_PLLMul_8) || ((MUL) == RCC_PLLMul_9) || \
mbed_official 76:aeb1df146756 135 ((MUL) == RCC_PLLMul_10) || ((MUL) == RCC_PLLMul_11) || \
mbed_official 76:aeb1df146756 136 ((MUL) == RCC_PLLMul_12) || ((MUL) == RCC_PLLMul_13) || \
mbed_official 76:aeb1df146756 137 ((MUL) == RCC_PLLMul_14) || ((MUL) == RCC_PLLMul_15) || \
mbed_official 76:aeb1df146756 138 ((MUL) == RCC_PLLMul_16))
mbed_official 76:aeb1df146756 139 /**
mbed_official 76:aeb1df146756 140 * @}
mbed_official 76:aeb1df146756 141 */
mbed_official 76:aeb1df146756 142
mbed_official 76:aeb1df146756 143 /** @defgroup RCC_PREDIV1_division_factor
mbed_official 76:aeb1df146756 144 * @{
mbed_official 76:aeb1df146756 145 */
mbed_official 76:aeb1df146756 146 #define RCC_PREDIV1_Div1 RCC_CFGR2_PREDIV1_DIV1
mbed_official 76:aeb1df146756 147 #define RCC_PREDIV1_Div2 RCC_CFGR2_PREDIV1_DIV2
mbed_official 76:aeb1df146756 148 #define RCC_PREDIV1_Div3 RCC_CFGR2_PREDIV1_DIV3
mbed_official 76:aeb1df146756 149 #define RCC_PREDIV1_Div4 RCC_CFGR2_PREDIV1_DIV4
mbed_official 76:aeb1df146756 150 #define RCC_PREDIV1_Div5 RCC_CFGR2_PREDIV1_DIV5
mbed_official 76:aeb1df146756 151 #define RCC_PREDIV1_Div6 RCC_CFGR2_PREDIV1_DIV6
mbed_official 76:aeb1df146756 152 #define RCC_PREDIV1_Div7 RCC_CFGR2_PREDIV1_DIV7
mbed_official 76:aeb1df146756 153 #define RCC_PREDIV1_Div8 RCC_CFGR2_PREDIV1_DIV8
mbed_official 76:aeb1df146756 154 #define RCC_PREDIV1_Div9 RCC_CFGR2_PREDIV1_DIV9
mbed_official 76:aeb1df146756 155 #define RCC_PREDIV1_Div10 RCC_CFGR2_PREDIV1_DIV10
mbed_official 76:aeb1df146756 156 #define RCC_PREDIV1_Div11 RCC_CFGR2_PREDIV1_DIV11
mbed_official 76:aeb1df146756 157 #define RCC_PREDIV1_Div12 RCC_CFGR2_PREDIV1_DIV12
mbed_official 76:aeb1df146756 158 #define RCC_PREDIV1_Div13 RCC_CFGR2_PREDIV1_DIV13
mbed_official 76:aeb1df146756 159 #define RCC_PREDIV1_Div14 RCC_CFGR2_PREDIV1_DIV14
mbed_official 76:aeb1df146756 160 #define RCC_PREDIV1_Div15 RCC_CFGR2_PREDIV1_DIV15
mbed_official 76:aeb1df146756 161 #define RCC_PREDIV1_Div16 RCC_CFGR2_PREDIV1_DIV16
mbed_official 76:aeb1df146756 162
mbed_official 76:aeb1df146756 163 #define IS_RCC_PREDIV1(PREDIV1) (((PREDIV1) == RCC_PREDIV1_Div1) || ((PREDIV1) == RCC_PREDIV1_Div2) || \
mbed_official 76:aeb1df146756 164 ((PREDIV1) == RCC_PREDIV1_Div3) || ((PREDIV1) == RCC_PREDIV1_Div4) || \
mbed_official 76:aeb1df146756 165 ((PREDIV1) == RCC_PREDIV1_Div5) || ((PREDIV1) == RCC_PREDIV1_Div6) || \
mbed_official 76:aeb1df146756 166 ((PREDIV1) == RCC_PREDIV1_Div7) || ((PREDIV1) == RCC_PREDIV1_Div8) || \
mbed_official 76:aeb1df146756 167 ((PREDIV1) == RCC_PREDIV1_Div9) || ((PREDIV1) == RCC_PREDIV1_Div10) || \
mbed_official 76:aeb1df146756 168 ((PREDIV1) == RCC_PREDIV1_Div11) || ((PREDIV1) == RCC_PREDIV1_Div12) || \
mbed_official 76:aeb1df146756 169 ((PREDIV1) == RCC_PREDIV1_Div13) || ((PREDIV1) == RCC_PREDIV1_Div14) || \
mbed_official 76:aeb1df146756 170 ((PREDIV1) == RCC_PREDIV1_Div15) || ((PREDIV1) == RCC_PREDIV1_Div16))
mbed_official 76:aeb1df146756 171 /**
mbed_official 76:aeb1df146756 172 * @}
mbed_official 76:aeb1df146756 173 */
mbed_official 76:aeb1df146756 174
mbed_official 76:aeb1df146756 175 /** @defgroup RCC_System_Clock_Source
mbed_official 76:aeb1df146756 176 * @{
mbed_official 76:aeb1df146756 177 */
mbed_official 76:aeb1df146756 178
mbed_official 76:aeb1df146756 179 #define RCC_SYSCLKSource_HSI RCC_CFGR_SW_HSI
mbed_official 76:aeb1df146756 180 #define RCC_SYSCLKSource_HSE RCC_CFGR_SW_HSE
mbed_official 76:aeb1df146756 181 #define RCC_SYSCLKSource_PLLCLK RCC_CFGR_SW_PLL
mbed_official 76:aeb1df146756 182 #define RCC_SYSCLKSource_HSI48 RCC_CFGR_SW_HSI48 /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 183
mbed_official 76:aeb1df146756 184 #define IS_RCC_SYSCLK_SOURCE(SOURCE) (((SOURCE) == RCC_SYSCLKSource_HSI) || \
mbed_official 76:aeb1df146756 185 ((SOURCE) == RCC_SYSCLKSource_HSE) || \
mbed_official 76:aeb1df146756 186 ((SOURCE) == RCC_SYSCLKSource_HSI48) || \
mbed_official 76:aeb1df146756 187 ((SOURCE) == RCC_SYSCLKSource_PLLCLK))
mbed_official 76:aeb1df146756 188 /**
mbed_official 76:aeb1df146756 189 * @}
mbed_official 76:aeb1df146756 190 */
mbed_official 76:aeb1df146756 191
mbed_official 76:aeb1df146756 192 /** @defgroup RCC_AHB_Clock_Source
mbed_official 76:aeb1df146756 193 * @{
mbed_official 76:aeb1df146756 194 */
mbed_official 76:aeb1df146756 195
mbed_official 76:aeb1df146756 196 #define RCC_SYSCLK_Div1 RCC_CFGR_HPRE_DIV1
mbed_official 76:aeb1df146756 197 #define RCC_SYSCLK_Div2 RCC_CFGR_HPRE_DIV2
mbed_official 76:aeb1df146756 198 #define RCC_SYSCLK_Div4 RCC_CFGR_HPRE_DIV4
mbed_official 76:aeb1df146756 199 #define RCC_SYSCLK_Div8 RCC_CFGR_HPRE_DIV8
mbed_official 76:aeb1df146756 200 #define RCC_SYSCLK_Div16 RCC_CFGR_HPRE_DIV16
mbed_official 76:aeb1df146756 201 #define RCC_SYSCLK_Div64 RCC_CFGR_HPRE_DIV64
mbed_official 76:aeb1df146756 202 #define RCC_SYSCLK_Div128 RCC_CFGR_HPRE_DIV128
mbed_official 76:aeb1df146756 203 #define RCC_SYSCLK_Div256 RCC_CFGR_HPRE_DIV256
mbed_official 76:aeb1df146756 204 #define RCC_SYSCLK_Div512 RCC_CFGR_HPRE_DIV512
mbed_official 76:aeb1df146756 205 #define IS_RCC_HCLK(HCLK) (((HCLK) == RCC_SYSCLK_Div1) || ((HCLK) == RCC_SYSCLK_Div2) || \
mbed_official 76:aeb1df146756 206 ((HCLK) == RCC_SYSCLK_Div4) || ((HCLK) == RCC_SYSCLK_Div8) || \
mbed_official 76:aeb1df146756 207 ((HCLK) == RCC_SYSCLK_Div16) || ((HCLK) == RCC_SYSCLK_Div64) || \
mbed_official 76:aeb1df146756 208 ((HCLK) == RCC_SYSCLK_Div128) || ((HCLK) == RCC_SYSCLK_Div256) || \
mbed_official 76:aeb1df146756 209 ((HCLK) == RCC_SYSCLK_Div512))
mbed_official 76:aeb1df146756 210 /**
mbed_official 76:aeb1df146756 211 * @}
mbed_official 76:aeb1df146756 212 */
mbed_official 76:aeb1df146756 213
mbed_official 76:aeb1df146756 214 /** @defgroup RCC_APB_Clock_Source
mbed_official 76:aeb1df146756 215 * @{
mbed_official 76:aeb1df146756 216 */
mbed_official 76:aeb1df146756 217
mbed_official 76:aeb1df146756 218 #define RCC_HCLK_Div1 RCC_CFGR_PPRE_DIV1
mbed_official 76:aeb1df146756 219 #define RCC_HCLK_Div2 RCC_CFGR_PPRE_DIV2
mbed_official 76:aeb1df146756 220 #define RCC_HCLK_Div4 RCC_CFGR_PPRE_DIV4
mbed_official 76:aeb1df146756 221 #define RCC_HCLK_Div8 RCC_CFGR_PPRE_DIV8
mbed_official 76:aeb1df146756 222 #define RCC_HCLK_Div16 RCC_CFGR_PPRE_DIV16
mbed_official 76:aeb1df146756 223 #define IS_RCC_PCLK(PCLK) (((PCLK) == RCC_HCLK_Div1) || ((PCLK) == RCC_HCLK_Div2) || \
mbed_official 76:aeb1df146756 224 ((PCLK) == RCC_HCLK_Div4) || ((PCLK) == RCC_HCLK_Div8) || \
mbed_official 76:aeb1df146756 225 ((PCLK) == RCC_HCLK_Div16))
mbed_official 76:aeb1df146756 226 /**
mbed_official 76:aeb1df146756 227 * @}
mbed_official 76:aeb1df146756 228 */
mbed_official 76:aeb1df146756 229
mbed_official 76:aeb1df146756 230 /** @defgroup RCC_ADC_clock_source
mbed_official 76:aeb1df146756 231 * @{
mbed_official 76:aeb1df146756 232 */
mbed_official 76:aeb1df146756 233 /* These defines are obsolete and kept for legacy purpose only.
mbed_official 76:aeb1df146756 234 Proper ADC clock selection is done within ADC driver by mean of the ADC_ClockModeConfig() function */
mbed_official 76:aeb1df146756 235 #define RCC_ADCCLK_HSI14 ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 236 #define RCC_ADCCLK_PCLK_Div2 ((uint32_t)0x01000000)
mbed_official 76:aeb1df146756 237 #define RCC_ADCCLK_PCLK_Div4 ((uint32_t)0x01004000)
mbed_official 76:aeb1df146756 238
mbed_official 76:aeb1df146756 239 #define IS_RCC_ADCCLK(ADCCLK) (((ADCCLK) == RCC_ADCCLK_HSI14) || ((ADCCLK) == RCC_ADCCLK_PCLK_Div2) || \
mbed_official 76:aeb1df146756 240 ((ADCCLK) == RCC_ADCCLK_PCLK_Div4))
mbed_official 76:aeb1df146756 241
mbed_official 76:aeb1df146756 242 /**
mbed_official 76:aeb1df146756 243 * @}
mbed_official 76:aeb1df146756 244 */
mbed_official 76:aeb1df146756 245
mbed_official 76:aeb1df146756 246 /** @defgroup RCC_CEC_clock_source
mbed_official 76:aeb1df146756 247 * @{
mbed_official 76:aeb1df146756 248 */
mbed_official 76:aeb1df146756 249
mbed_official 76:aeb1df146756 250 #define RCC_CECCLK_HSI_Div244 ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 251 #define RCC_CECCLK_LSE RCC_CFGR3_CECSW
mbed_official 76:aeb1df146756 252
mbed_official 76:aeb1df146756 253 #define IS_RCC_CECCLK(CECCLK) (((CECCLK) == RCC_CECCLK_HSI_Div244) || ((CECCLK) == RCC_CECCLK_LSE))
mbed_official 76:aeb1df146756 254
mbed_official 76:aeb1df146756 255 /**
mbed_official 76:aeb1df146756 256 * @}
mbed_official 76:aeb1df146756 257 */
mbed_official 76:aeb1df146756 258
mbed_official 76:aeb1df146756 259 /** @defgroup RCC_I2C_clock_source
mbed_official 76:aeb1df146756 260 * @{
mbed_official 76:aeb1df146756 261 */
mbed_official 76:aeb1df146756 262
mbed_official 76:aeb1df146756 263 #define RCC_I2C1CLK_HSI ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 264 #define RCC_I2C1CLK_SYSCLK RCC_CFGR3_I2C1SW
mbed_official 76:aeb1df146756 265
mbed_official 76:aeb1df146756 266 #define IS_RCC_I2CCLK(I2CCLK) (((I2CCLK) == RCC_I2C1CLK_HSI) || ((I2CCLK) == RCC_I2C1CLK_SYSCLK))
mbed_official 76:aeb1df146756 267
mbed_official 76:aeb1df146756 268 /**
mbed_official 76:aeb1df146756 269 * @}
mbed_official 76:aeb1df146756 270 */
mbed_official 76:aeb1df146756 271
mbed_official 76:aeb1df146756 272 /** @defgroup RCC_USB_clock_source
mbed_official 76:aeb1df146756 273 * @brief Applicable only for STM32F072 devices
mbed_official 76:aeb1df146756 274 * @{
mbed_official 76:aeb1df146756 275 */
mbed_official 76:aeb1df146756 276
mbed_official 76:aeb1df146756 277 #define RCC_USBCLK_HSI48 ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 278 #define RCC_USBCLK_PLLCLK RCC_CFGR3_USBSW
mbed_official 76:aeb1df146756 279
mbed_official 76:aeb1df146756 280 #define IS_RCC_USBCLK(USBCLK) (((USBCLK) == RCC_USBCLK_HSI48) || ((USBCLK) == RCC_USBCLK_PLLCLK))
mbed_official 76:aeb1df146756 281
mbed_official 76:aeb1df146756 282 /**
mbed_official 76:aeb1df146756 283 * @}
mbed_official 76:aeb1df146756 284 */
mbed_official 76:aeb1df146756 285
mbed_official 76:aeb1df146756 286 /** @defgroup RCC_USART_clock_source
mbed_official 76:aeb1df146756 287 * @{
mbed_official 76:aeb1df146756 288 */
mbed_official 76:aeb1df146756 289
mbed_official 76:aeb1df146756 290 #define RCC_USART1CLK_PCLK ((uint32_t)0x10000000)
mbed_official 76:aeb1df146756 291 #define RCC_USART1CLK_SYSCLK ((uint32_t)0x10000001)
mbed_official 76:aeb1df146756 292 #define RCC_USART1CLK_LSE ((uint32_t)0x10000002)
mbed_official 76:aeb1df146756 293 #define RCC_USART1CLK_HSI ((uint32_t)0x10000003)
mbed_official 76:aeb1df146756 294
mbed_official 76:aeb1df146756 295 #define RCC_USART2CLK_PCLK ((uint32_t)0x20000000) /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 296 #define RCC_USART2CLK_SYSCLK ((uint32_t)0x20010000) /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 297 #define RCC_USART2CLK_LSE ((uint32_t)0x20020000) /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 298 #define RCC_USART2CLK_HSI ((uint32_t)0x20030000) /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 299
mbed_official 76:aeb1df146756 300 #define IS_RCC_USARTCLK(USARTCLK) (((USARTCLK) == RCC_USART1CLK_PCLK) || \
mbed_official 76:aeb1df146756 301 ((USARTCLK) == RCC_USART1CLK_SYSCLK) || \
mbed_official 76:aeb1df146756 302 ((USARTCLK) == RCC_USART1CLK_LSE) || \
mbed_official 76:aeb1df146756 303 ((USARTCLK) == RCC_USART1CLK_HSI) || \
mbed_official 76:aeb1df146756 304 ((USARTCLK) == RCC_USART2CLK_PCLK) || \
mbed_official 76:aeb1df146756 305 ((USARTCLK) == RCC_USART2CLK_SYSCLK) || \
mbed_official 76:aeb1df146756 306 ((USARTCLK) == RCC_USART2CLK_LSE) || \
mbed_official 76:aeb1df146756 307 ((USARTCLK) == RCC_USART2CLK_HSI))
mbed_official 76:aeb1df146756 308
mbed_official 76:aeb1df146756 309 /**
mbed_official 76:aeb1df146756 310 * @}
mbed_official 76:aeb1df146756 311 */
mbed_official 76:aeb1df146756 312
mbed_official 76:aeb1df146756 313 /** @defgroup RCC_Interrupt_Source
mbed_official 76:aeb1df146756 314 * @{
mbed_official 76:aeb1df146756 315 */
mbed_official 76:aeb1df146756 316
mbed_official 76:aeb1df146756 317 #define RCC_IT_LSIRDY ((uint8_t)0x01)
mbed_official 76:aeb1df146756 318 #define RCC_IT_LSERDY ((uint8_t)0x02)
mbed_official 76:aeb1df146756 319 #define RCC_IT_HSIRDY ((uint8_t)0x04)
mbed_official 76:aeb1df146756 320 #define RCC_IT_HSERDY ((uint8_t)0x08)
mbed_official 76:aeb1df146756 321 #define RCC_IT_PLLRDY ((uint8_t)0x10)
mbed_official 76:aeb1df146756 322 #define RCC_IT_HSI14RDY ((uint8_t)0x20)
mbed_official 76:aeb1df146756 323 #define RCC_IT_HSI48RDY ((uint8_t)0x40) /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 324 #define RCC_IT_CSS ((uint8_t)0x80)
mbed_official 76:aeb1df146756 325
mbed_official 76:aeb1df146756 326 #define IS_RCC_IT(IT) ((((IT) & (uint8_t)0x80) == 0x00) && ((IT) != 0x00))
mbed_official 76:aeb1df146756 327
mbed_official 76:aeb1df146756 328 #define IS_RCC_GET_IT(IT) (((IT) == RCC_IT_LSIRDY) || ((IT) == RCC_IT_LSERDY) || \
mbed_official 76:aeb1df146756 329 ((IT) == RCC_IT_HSIRDY) || ((IT) == RCC_IT_HSERDY) || \
mbed_official 76:aeb1df146756 330 ((IT) == RCC_IT_PLLRDY) || ((IT) == RCC_IT_HSI14RDY) || \
mbed_official 76:aeb1df146756 331 ((IT) == RCC_IT_CSS) || ((IT) == RCC_IT_HSI48RDY))
mbed_official 76:aeb1df146756 332
mbed_official 76:aeb1df146756 333 #define IS_RCC_CLEAR_IT(IT) ((IT) != 0x00)
mbed_official 76:aeb1df146756 334
mbed_official 76:aeb1df146756 335 /**
mbed_official 76:aeb1df146756 336 * @}
mbed_official 76:aeb1df146756 337 */
mbed_official 76:aeb1df146756 338
mbed_official 76:aeb1df146756 339 /** @defgroup RCC_LSE_Configuration
mbed_official 76:aeb1df146756 340 * @{
mbed_official 76:aeb1df146756 341 */
mbed_official 76:aeb1df146756 342
mbed_official 76:aeb1df146756 343 #define RCC_LSE_OFF ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 344 #define RCC_LSE_ON RCC_BDCR_LSEON
mbed_official 76:aeb1df146756 345 #define RCC_LSE_Bypass ((uint32_t)(RCC_BDCR_LSEON | RCC_BDCR_LSEBYP))
mbed_official 76:aeb1df146756 346 #define IS_RCC_LSE(LSE) (((LSE) == RCC_LSE_OFF) || ((LSE) == RCC_LSE_ON) || \
mbed_official 76:aeb1df146756 347 ((LSE) == RCC_LSE_Bypass))
mbed_official 76:aeb1df146756 348 /**
mbed_official 76:aeb1df146756 349 * @}
mbed_official 76:aeb1df146756 350 */
mbed_official 76:aeb1df146756 351
mbed_official 76:aeb1df146756 352 /** @defgroup RCC_RTC_Clock_Source
mbed_official 76:aeb1df146756 353 * @{
mbed_official 76:aeb1df146756 354 */
mbed_official 76:aeb1df146756 355
mbed_official 76:aeb1df146756 356 #define RCC_RTCCLKSource_LSE RCC_BDCR_RTCSEL_LSE
mbed_official 76:aeb1df146756 357 #define RCC_RTCCLKSource_LSI RCC_BDCR_RTCSEL_LSI
mbed_official 76:aeb1df146756 358 #define RCC_RTCCLKSource_HSE_Div32 RCC_BDCR_RTCSEL_HSE
mbed_official 76:aeb1df146756 359
mbed_official 76:aeb1df146756 360 #define IS_RCC_RTCCLK_SOURCE(SOURCE) (((SOURCE) == RCC_RTCCLKSource_LSE) || \
mbed_official 76:aeb1df146756 361 ((SOURCE) == RCC_RTCCLKSource_LSI) || \
mbed_official 76:aeb1df146756 362 ((SOURCE) == RCC_RTCCLKSource_HSE_Div32))
mbed_official 76:aeb1df146756 363 /**
mbed_official 76:aeb1df146756 364 * @}
mbed_official 76:aeb1df146756 365 */
mbed_official 76:aeb1df146756 366
mbed_official 76:aeb1df146756 367 /** @defgroup RCC_LSE_Drive_Configuration
mbed_official 76:aeb1df146756 368 * @{
mbed_official 76:aeb1df146756 369 */
mbed_official 76:aeb1df146756 370
mbed_official 76:aeb1df146756 371 #define RCC_LSEDrive_Low ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 372 #define RCC_LSEDrive_MediumLow RCC_BDCR_LSEDRV_0
mbed_official 76:aeb1df146756 373 #define RCC_LSEDrive_MediumHigh RCC_BDCR_LSEDRV_1
mbed_official 76:aeb1df146756 374 #define RCC_LSEDrive_High RCC_BDCR_LSEDRV
mbed_official 76:aeb1df146756 375 #define IS_RCC_LSE_DRIVE(DRIVE) (((DRIVE) == RCC_LSEDrive_Low) || ((DRIVE) == RCC_LSEDrive_MediumLow) || \
mbed_official 76:aeb1df146756 376 ((DRIVE) == RCC_LSEDrive_MediumHigh) || ((DRIVE) == RCC_LSEDrive_High))
mbed_official 76:aeb1df146756 377 /**
mbed_official 76:aeb1df146756 378 * @}
mbed_official 76:aeb1df146756 379 */
mbed_official 76:aeb1df146756 380
mbed_official 76:aeb1df146756 381 /** @defgroup RCC_AHB_Peripherals
mbed_official 76:aeb1df146756 382 * @{
mbed_official 76:aeb1df146756 383 */
mbed_official 76:aeb1df146756 384
mbed_official 76:aeb1df146756 385 #define RCC_AHBPeriph_GPIOA RCC_AHBENR_GPIOAEN
mbed_official 76:aeb1df146756 386 #define RCC_AHBPeriph_GPIOB RCC_AHBENR_GPIOBEN
mbed_official 76:aeb1df146756 387 #define RCC_AHBPeriph_GPIOC RCC_AHBENR_GPIOCEN
mbed_official 76:aeb1df146756 388 #define RCC_AHBPeriph_GPIOD RCC_AHBENR_GPIODEN
mbed_official 76:aeb1df146756 389 #define RCC_AHBPeriph_GPIOE RCC_AHBENR_GPIOEEN /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 390 #define RCC_AHBPeriph_GPIOF RCC_AHBENR_GPIOFEN
mbed_official 76:aeb1df146756 391 #define RCC_AHBPeriph_TS RCC_AHBENR_TSEN
mbed_official 76:aeb1df146756 392 #define RCC_AHBPeriph_CRC RCC_AHBENR_CRCEN
mbed_official 76:aeb1df146756 393 #define RCC_AHBPeriph_FLITF RCC_AHBENR_FLITFEN
mbed_official 76:aeb1df146756 394 #define RCC_AHBPeriph_SRAM RCC_AHBENR_SRAMEN
mbed_official 76:aeb1df146756 395 #define RCC_AHBPeriph_DMA1 RCC_AHBENR_DMA1EN
mbed_official 76:aeb1df146756 396
mbed_official 76:aeb1df146756 397 #define IS_RCC_AHB_PERIPH(PERIPH) ((((PERIPH) & 0xFE81FFAA) == 0x00) && ((PERIPH) != 0x00))
mbed_official 76:aeb1df146756 398 #define IS_RCC_AHB_RST_PERIPH(PERIPH) ((((PERIPH) & 0xFE81FFFF) == 0x00) && ((PERIPH) != 0x00))
mbed_official 76:aeb1df146756 399
mbed_official 76:aeb1df146756 400 /**
mbed_official 76:aeb1df146756 401 * @}
mbed_official 76:aeb1df146756 402 */
mbed_official 76:aeb1df146756 403
mbed_official 76:aeb1df146756 404 /** @defgroup RCC_APB2_Peripherals
mbed_official 76:aeb1df146756 405 * @{
mbed_official 76:aeb1df146756 406 */
mbed_official 76:aeb1df146756 407
mbed_official 76:aeb1df146756 408 #define RCC_APB2Periph_SYSCFG RCC_APB2ENR_SYSCFGEN
mbed_official 76:aeb1df146756 409 #define RCC_APB2Periph_ADC1 RCC_APB2ENR_ADC1EN
mbed_official 76:aeb1df146756 410 #define RCC_APB2Periph_TIM1 RCC_APB2ENR_TIM1EN
mbed_official 76:aeb1df146756 411 #define RCC_APB2Periph_SPI1 RCC_APB2ENR_SPI1EN
mbed_official 76:aeb1df146756 412 #define RCC_APB2Periph_USART1 RCC_APB2ENR_USART1EN
mbed_official 76:aeb1df146756 413 #define RCC_APB2Periph_TIM15 RCC_APB2ENR_TIM15EN
mbed_official 76:aeb1df146756 414 #define RCC_APB2Periph_TIM16 RCC_APB2ENR_TIM16EN
mbed_official 76:aeb1df146756 415 #define RCC_APB2Periph_TIM17 RCC_APB2ENR_TIM17EN
mbed_official 76:aeb1df146756 416 #define RCC_APB2Periph_DBGMCU RCC_APB2ENR_DBGMCUEN
mbed_official 76:aeb1df146756 417
mbed_official 76:aeb1df146756 418 #define IS_RCC_APB2_PERIPH(PERIPH) ((((PERIPH) & 0xFFB8A5FE) == 0x00) && ((PERIPH) != 0x00))
mbed_official 76:aeb1df146756 419
mbed_official 76:aeb1df146756 420 /**
mbed_official 76:aeb1df146756 421 * @}
mbed_official 76:aeb1df146756 422 */
mbed_official 76:aeb1df146756 423
mbed_official 76:aeb1df146756 424 /** @defgroup RCC_APB1_Peripherals
mbed_official 76:aeb1df146756 425 * @{
mbed_official 76:aeb1df146756 426 */
mbed_official 76:aeb1df146756 427
mbed_official 76:aeb1df146756 428 #define RCC_APB1Periph_TIM2 RCC_APB1ENR_TIM2EN /*!< Only applicable for STM32F051 and STM32F072 devices */
mbed_official 76:aeb1df146756 429 #define RCC_APB1Periph_TIM3 RCC_APB1ENR_TIM3EN
mbed_official 76:aeb1df146756 430 #define RCC_APB1Periph_TIM6 RCC_APB1ENR_TIM6EN
mbed_official 76:aeb1df146756 431 #define RCC_APB1Periph_TIM7 RCC_APB1ENR_TIM7EN /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 432 #define RCC_APB1Periph_TIM14 RCC_APB1ENR_TIM14EN
mbed_official 76:aeb1df146756 433 #define RCC_APB1Periph_WWDG RCC_APB1ENR_WWDGEN
mbed_official 76:aeb1df146756 434 #define RCC_APB1Periph_SPI2 RCC_APB1ENR_SPI2EN
mbed_official 76:aeb1df146756 435 #define RCC_APB1Periph_USART2 RCC_APB1ENR_USART2EN
mbed_official 76:aeb1df146756 436 #define RCC_APB1Periph_USART3 RCC_APB1ENR_USART3EN /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 437 #define RCC_APB1Periph_USART4 RCC_APB1ENR_USART4EN /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 438 #define RCC_APB1Periph_I2C1 RCC_APB1ENR_I2C1EN
mbed_official 76:aeb1df146756 439 #define RCC_APB1Periph_I2C2 RCC_APB1ENR_I2C2EN
mbed_official 76:aeb1df146756 440 #define RCC_APB1Periph_USB RCC_APB1ENR_USBEN /*!< Only applicable for STM32F072 and STM32F042 devices */
mbed_official 76:aeb1df146756 441 #define RCC_APB1Periph_CAN RCC_APB1ENR_CANEN /*!< Only applicable for STM32F072 and STM32F042 devices */
mbed_official 76:aeb1df146756 442 #define RCC_APB1Periph_CRS RCC_APB1ENR_CRSEN /*!< Only applicable for STM32F072 and STM32F042 devices*/
mbed_official 76:aeb1df146756 443 #define RCC_APB1Periph_PWR RCC_APB1ENR_PWREN
mbed_official 76:aeb1df146756 444 #define RCC_APB1Periph_DAC RCC_APB1ENR_DACEN /*!< Only applicable for STM32F051 and STM32F072 devices */
mbed_official 76:aeb1df146756 445 #define RCC_APB1Periph_CEC RCC_APB1ENR_CECEN /*!< Only applicable for STM32F051, STM32F042 and STM32F072 devices */
mbed_official 76:aeb1df146756 446
mbed_official 76:aeb1df146756 447 #define IS_RCC_APB1_PERIPH(PERIPH) ((((PERIPH) & 0x8511B6CC) == 0x00) && ((PERIPH) != 0x00))
mbed_official 76:aeb1df146756 448 /**
mbed_official 76:aeb1df146756 449 * @}
mbed_official 76:aeb1df146756 450 */
mbed_official 76:aeb1df146756 451
mbed_official 76:aeb1df146756 452 /** @defgroup RCC_MCO_Clock_Source
mbed_official 76:aeb1df146756 453 * @{
mbed_official 76:aeb1df146756 454 */
mbed_official 76:aeb1df146756 455
mbed_official 76:aeb1df146756 456 #define RCC_MCOSource_NoClock ((uint8_t)0x00)
mbed_official 76:aeb1df146756 457 #define RCC_MCOSource_HSI14 ((uint8_t)0x01)
mbed_official 76:aeb1df146756 458 #define RCC_MCOSource_LSI ((uint8_t)0x02)
mbed_official 76:aeb1df146756 459 #define RCC_MCOSource_LSE ((uint8_t)0x03)
mbed_official 76:aeb1df146756 460 #define RCC_MCOSource_SYSCLK ((uint8_t)0x04)
mbed_official 76:aeb1df146756 461 #define RCC_MCOSource_HSI ((uint8_t)0x05)
mbed_official 76:aeb1df146756 462 #define RCC_MCOSource_HSE ((uint8_t)0x06)
mbed_official 76:aeb1df146756 463 #define RCC_MCOSource_PLLCLK_Div2 ((uint8_t)0x07)
mbed_official 76:aeb1df146756 464 #define RCC_MCOSource_HSI48 ((uint8_t)0x08) /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 465 #define RCC_MCOSource_PLLCLK ((uint8_t)0x87)
mbed_official 76:aeb1df146756 466
mbed_official 76:aeb1df146756 467 #define IS_RCC_MCO_SOURCE(SOURCE) (((SOURCE) == RCC_MCOSource_NoClock) || ((SOURCE) == RCC_MCOSource_HSI14) || \
mbed_official 76:aeb1df146756 468 ((SOURCE) == RCC_MCOSource_SYSCLK) || ((SOURCE) == RCC_MCOSource_HSI) || \
mbed_official 76:aeb1df146756 469 ((SOURCE) == RCC_MCOSource_HSE) || ((SOURCE) == RCC_MCOSource_PLLCLK_Div2)|| \
mbed_official 76:aeb1df146756 470 ((SOURCE) == RCC_MCOSource_LSI) || ((SOURCE) == RCC_MCOSource_HSI48) || \
mbed_official 76:aeb1df146756 471 ((SOURCE) == RCC_MCOSource_PLLCLK) || ((SOURCE) == RCC_MCOSource_LSE))
mbed_official 76:aeb1df146756 472 /**
mbed_official 76:aeb1df146756 473 * @}
mbed_official 76:aeb1df146756 474 */
mbed_official 76:aeb1df146756 475
mbed_official 76:aeb1df146756 476 /** @defgroup RCC_MCOPrescaler
mbed_official 76:aeb1df146756 477 * @{
mbed_official 76:aeb1df146756 478 */
mbed_official 76:aeb1df146756 479 #if !defined (STM32F051)
mbed_official 76:aeb1df146756 480 #define RCC_MCOPrescaler_1 RCC_CFGR_MCO_PRE_1
mbed_official 76:aeb1df146756 481 #define RCC_MCOPrescaler_2 RCC_CFGR_MCO_PRE_2
mbed_official 76:aeb1df146756 482 #define RCC_MCOPrescaler_4 RCC_CFGR_MCO_PRE_4
mbed_official 76:aeb1df146756 483 #define RCC_MCOPrescaler_8 RCC_CFGR_MCO_PRE_8
mbed_official 76:aeb1df146756 484 #define RCC_MCOPrescaler_16 RCC_CFGR_MCO_PRE_16
mbed_official 76:aeb1df146756 485 #define RCC_MCOPrescaler_32 RCC_CFGR_MCO_PRE_32
mbed_official 76:aeb1df146756 486 #define RCC_MCOPrescaler_64 RCC_CFGR_MCO_PRE_64
mbed_official 76:aeb1df146756 487 #define RCC_MCOPrescaler_128 RCC_CFGR_MCO_PRE_128
mbed_official 76:aeb1df146756 488
mbed_official 76:aeb1df146756 489 #define IS_RCC_MCO_PRESCALER(PRESCALER) (((PRESCALER) == RCC_MCOPrescaler_1) || \
mbed_official 76:aeb1df146756 490 ((PRESCALER) == RCC_MCOPrescaler_2) || \
mbed_official 76:aeb1df146756 491 ((PRESCALER) == RCC_MCOPrescaler_4) || \
mbed_official 76:aeb1df146756 492 ((PRESCALER) == RCC_MCOPrescaler_8) || \
mbed_official 76:aeb1df146756 493 ((PRESCALER) == RCC_MCOPrescaler_16) || \
mbed_official 76:aeb1df146756 494 ((PRESCALER) == RCC_MCOPrescaler_32) || \
mbed_official 76:aeb1df146756 495 ((PRESCALER) == RCC_MCOPrescaler_64) || \
mbed_official 76:aeb1df146756 496 ((PRESCALER) == RCC_MCOPrescaler_128))
mbed_official 76:aeb1df146756 497 #endif /* STM32F051 */
mbed_official 76:aeb1df146756 498 /**
mbed_official 76:aeb1df146756 499 * @}
mbed_official 76:aeb1df146756 500 */
mbed_official 76:aeb1df146756 501
mbed_official 76:aeb1df146756 502 /** @defgroup RCC_Flag
mbed_official 76:aeb1df146756 503 * @{
mbed_official 76:aeb1df146756 504 */
mbed_official 76:aeb1df146756 505 #define RCC_FLAG_HSIRDY ((uint8_t)0x01)
mbed_official 76:aeb1df146756 506 #define RCC_FLAG_HSERDY ((uint8_t)0x11)
mbed_official 76:aeb1df146756 507 #define RCC_FLAG_PLLRDY ((uint8_t)0x19)
mbed_official 76:aeb1df146756 508 #define RCC_FLAG_LSERDY ((uint8_t)0x21)
mbed_official 76:aeb1df146756 509 #define RCC_FLAG_LSIRDY ((uint8_t)0x41)
mbed_official 76:aeb1df146756 510 #define RCC_FLAG_V18PWRRSTF ((uint8_t)0x57)
mbed_official 76:aeb1df146756 511 #define RCC_FLAG_OBLRST ((uint8_t)0x59)
mbed_official 76:aeb1df146756 512 #define RCC_FLAG_PINRST ((uint8_t)0x5A)
mbed_official 76:aeb1df146756 513 #define RCC_FLAG_PORRST ((uint8_t)0x5B)
mbed_official 76:aeb1df146756 514 #define RCC_FLAG_SFTRST ((uint8_t)0x5C)
mbed_official 76:aeb1df146756 515 #define RCC_FLAG_IWDGRST ((uint8_t)0x5D)
mbed_official 76:aeb1df146756 516 #define RCC_FLAG_WWDGRST ((uint8_t)0x5E)
mbed_official 76:aeb1df146756 517 #define RCC_FLAG_LPWRRST ((uint8_t)0x5F)
mbed_official 76:aeb1df146756 518 #define RCC_FLAG_HSI14RDY ((uint8_t)0x61)
mbed_official 76:aeb1df146756 519 #define RCC_FLAG_HSI48RDY ((uint8_t)0x71) /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 520
mbed_official 76:aeb1df146756 521 #define IS_RCC_FLAG(FLAG) (((FLAG) == RCC_FLAG_HSIRDY) || ((FLAG) == RCC_FLAG_HSERDY) || \
mbed_official 76:aeb1df146756 522 ((FLAG) == RCC_FLAG_PLLRDY) || ((FLAG) == RCC_FLAG_LSERDY) || \
mbed_official 76:aeb1df146756 523 ((FLAG) == RCC_FLAG_LSIRDY) || ((FLAG) == RCC_FLAG_OBLRST) || \
mbed_official 76:aeb1df146756 524 ((FLAG) == RCC_FLAG_PINRST) || ((FLAG) == RCC_FLAG_PORRST) || \
mbed_official 76:aeb1df146756 525 ((FLAG) == RCC_FLAG_SFTRST) || ((FLAG) == RCC_FLAG_IWDGRST) || \
mbed_official 76:aeb1df146756 526 ((FLAG) == RCC_FLAG_WWDGRST) || ((FLAG) == RCC_FLAG_LPWRRST) || \
mbed_official 76:aeb1df146756 527 ((FLAG) == RCC_FLAG_HSI14RDY)|| ((FLAG) == RCC_FLAG_HSI48RDY)|| \
mbed_official 76:aeb1df146756 528 ((FLAG) == RCC_FLAG_V18PWRRSTF))
mbed_official 76:aeb1df146756 529
mbed_official 76:aeb1df146756 530 #define IS_RCC_HSI_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x1F)
mbed_official 76:aeb1df146756 531 #define IS_RCC_HSI14_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x1F)
mbed_official 76:aeb1df146756 532
mbed_official 76:aeb1df146756 533 /**
mbed_official 76:aeb1df146756 534 * @}
mbed_official 76:aeb1df146756 535 */
mbed_official 76:aeb1df146756 536
mbed_official 76:aeb1df146756 537 /**
mbed_official 76:aeb1df146756 538 * @}
mbed_official 76:aeb1df146756 539 */
mbed_official 76:aeb1df146756 540
mbed_official 76:aeb1df146756 541 /* Exported macro ------------------------------------------------------------*/
mbed_official 76:aeb1df146756 542 /* Exported functions ------------------------------------------------------- */
mbed_official 76:aeb1df146756 543
mbed_official 76:aeb1df146756 544 /* Function used to set the RCC clock configuration to the default reset state */
mbed_official 76:aeb1df146756 545 void RCC_DeInit(void);
mbed_official 76:aeb1df146756 546
mbed_official 76:aeb1df146756 547 /* Internal/external clocks, PLL, CSS and MCO configuration functions *********/
mbed_official 76:aeb1df146756 548 void RCC_HSEConfig(uint8_t RCC_HSE);
mbed_official 76:aeb1df146756 549 ErrorStatus RCC_WaitForHSEStartUp(void);
mbed_official 76:aeb1df146756 550 void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue);
mbed_official 76:aeb1df146756 551 void RCC_HSICmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 552 void RCC_AdjustHSI14CalibrationValue(uint8_t HSI14CalibrationValue);
mbed_official 76:aeb1df146756 553 void RCC_HSI14Cmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 554 void RCC_HSI14ADCRequestCmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 555 void RCC_LSEConfig(uint32_t RCC_LSE);
mbed_official 76:aeb1df146756 556 void RCC_LSEDriveConfig(uint32_t RCC_LSEDrive);
mbed_official 76:aeb1df146756 557 void RCC_LSICmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 558 void RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t RCC_PLLMul);
mbed_official 76:aeb1df146756 559 void RCC_PLLCmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 560 void RCC_HSI48Cmd(FunctionalState NewState); /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 561 uint32_t RCC_GetHSI48CalibrationValue(void); /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 562 void RCC_PREDIV1Config(uint32_t RCC_PREDIV1_Div);
mbed_official 76:aeb1df146756 563 void RCC_ClockSecuritySystemCmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 564 #ifdef STM32F051
mbed_official 76:aeb1df146756 565 void RCC_MCOConfig(uint8_t RCC_MCOSource);
mbed_official 76:aeb1df146756 566 #else
mbed_official 76:aeb1df146756 567 void RCC_MCOConfig(uint8_t RCC_MCOSource,uint32_t RCC_MCOPrescaler);
mbed_official 76:aeb1df146756 568 #endif /* STM32F051 */
mbed_official 76:aeb1df146756 569
mbed_official 76:aeb1df146756 570 /* System, AHB and APB busses clocks configuration functions ******************/
mbed_official 76:aeb1df146756 571 void RCC_SYSCLKConfig(uint32_t RCC_SYSCLKSource);
mbed_official 76:aeb1df146756 572 uint8_t RCC_GetSYSCLKSource(void);
mbed_official 76:aeb1df146756 573 void RCC_HCLKConfig(uint32_t RCC_SYSCLK);
mbed_official 76:aeb1df146756 574 void RCC_PCLKConfig(uint32_t RCC_HCLK);
mbed_official 76:aeb1df146756 575 void RCC_ADCCLKConfig(uint32_t RCC_ADCCLK); /* This function is obsolete.
mbed_official 76:aeb1df146756 576 For proper ADC clock selection, refer to
mbed_official 76:aeb1df146756 577 ADC_ClockModeConfig() in the ADC driver */
mbed_official 76:aeb1df146756 578 void RCC_CECCLKConfig(uint32_t RCC_CECCLK);
mbed_official 76:aeb1df146756 579 void RCC_I2CCLKConfig(uint32_t RCC_I2CCLK);
mbed_official 76:aeb1df146756 580 void RCC_USARTCLKConfig(uint32_t RCC_USARTCLK);
mbed_official 76:aeb1df146756 581 void RCC_USBCLKConfig(uint32_t RCC_USBCLK); /*!< Only applicable for STM32F042 and STM32F072 devices */
mbed_official 76:aeb1df146756 582 void RCC_GetClocksFreq(RCC_ClocksTypeDef* RCC_Clocks);
mbed_official 76:aeb1df146756 583
mbed_official 76:aeb1df146756 584 /* Peripheral clocks configuration functions **********************************/
mbed_official 76:aeb1df146756 585 void RCC_RTCCLKConfig(uint32_t RCC_RTCCLKSource);
mbed_official 76:aeb1df146756 586 void RCC_RTCCLKCmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 587 void RCC_BackupResetCmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 588
mbed_official 76:aeb1df146756 589 void RCC_AHBPeriphClockCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState);
mbed_official 76:aeb1df146756 590 void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);
mbed_official 76:aeb1df146756 591 void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
mbed_official 76:aeb1df146756 592
mbed_official 76:aeb1df146756 593 void RCC_AHBPeriphResetCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState);
mbed_official 76:aeb1df146756 594 void RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);
mbed_official 76:aeb1df146756 595 void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
mbed_official 76:aeb1df146756 596
mbed_official 76:aeb1df146756 597 /* Interrupts and flags management functions **********************************/
mbed_official 76:aeb1df146756 598 void RCC_ITConfig(uint8_t RCC_IT, FunctionalState NewState);
mbed_official 76:aeb1df146756 599 FlagStatus RCC_GetFlagStatus(uint8_t RCC_FLAG);
mbed_official 76:aeb1df146756 600 void RCC_ClearFlag(void);
mbed_official 76:aeb1df146756 601 ITStatus RCC_GetITStatus(uint8_t RCC_IT);
mbed_official 76:aeb1df146756 602 void RCC_ClearITPendingBit(uint8_t RCC_IT);
mbed_official 76:aeb1df146756 603
mbed_official 76:aeb1df146756 604 #ifdef __cplusplus
mbed_official 76:aeb1df146756 605 }
mbed_official 76:aeb1df146756 606 #endif
mbed_official 76:aeb1df146756 607
mbed_official 76:aeb1df146756 608 #endif /* __STM32F0XX_RCC_H */
mbed_official 76:aeb1df146756 609
mbed_official 76:aeb1df146756 610 /**
mbed_official 76:aeb1df146756 611 * @}
mbed_official 76:aeb1df146756 612 */
mbed_official 76:aeb1df146756 613
mbed_official 76:aeb1df146756 614 /**
mbed_official 76:aeb1df146756 615 * @}
mbed_official 76:aeb1df146756 616 */
mbed_official 76:aeb1df146756 617
mbed_official 76:aeb1df146756 618 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/