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