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:
80:66393a7b209d
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 stm32l1xx_rcc.h
mbed_official 76:aeb1df146756 4 * @author MCD Application Team
mbed_official 80:66393a7b209d 5 * @version V1.3.0
mbed_official 80:66393a7b209d 6 * @date 31-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 __STM32L1xx_RCC_H
mbed_official 76:aeb1df146756 41 #define __STM32L1xx_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 "stm32l1xx.h"
mbed_official 76:aeb1df146756 49
mbed_official 76:aeb1df146756 50 /** @addtogroup STM32L1xx_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 PCLK1_Frequency;
mbed_official 76:aeb1df146756 65 uint32_t PCLK2_Frequency;
mbed_official 76:aeb1df146756 66 }RCC_ClocksTypeDef;
mbed_official 76:aeb1df146756 67
mbed_official 76:aeb1df146756 68 /* Exported constants --------------------------------------------------------*/
mbed_official 76:aeb1df146756 69
mbed_official 76:aeb1df146756 70 /** @defgroup RCC_Exported_Constants
mbed_official 76:aeb1df146756 71 * @{
mbed_official 76:aeb1df146756 72 */
mbed_official 76:aeb1df146756 73
mbed_official 76:aeb1df146756 74 /** @defgroup RCC_HSE_configuration
mbed_official 76:aeb1df146756 75 * @{
mbed_official 76:aeb1df146756 76 */
mbed_official 76:aeb1df146756 77
mbed_official 76:aeb1df146756 78 #define RCC_HSE_OFF ((uint8_t)0x00)
mbed_official 76:aeb1df146756 79 #define RCC_HSE_ON ((uint8_t)0x01)
mbed_official 76:aeb1df146756 80 #define RCC_HSE_Bypass ((uint8_t)0x05)
mbed_official 76:aeb1df146756 81 #define IS_RCC_HSE(HSE) (((HSE) == RCC_HSE_OFF) || ((HSE) == RCC_HSE_ON) || \
mbed_official 76:aeb1df146756 82 ((HSE) == RCC_HSE_Bypass))
mbed_official 76:aeb1df146756 83
mbed_official 76:aeb1df146756 84 /**
mbed_official 76:aeb1df146756 85 * @}
mbed_official 76:aeb1df146756 86 */
mbed_official 76:aeb1df146756 87
mbed_official 76:aeb1df146756 88 /** @defgroup RCC_MSI_Clock_Range
mbed_official 76:aeb1df146756 89 * @{
mbed_official 76:aeb1df146756 90 */
mbed_official 76:aeb1df146756 91
mbed_official 76:aeb1df146756 92 #define RCC_MSIRange_0 RCC_ICSCR_MSIRANGE_0 /*!< MSI = 65.536 KHz */
mbed_official 76:aeb1df146756 93 #define RCC_MSIRange_1 RCC_ICSCR_MSIRANGE_1 /*!< MSI = 131.072 KHz */
mbed_official 76:aeb1df146756 94 #define RCC_MSIRange_2 RCC_ICSCR_MSIRANGE_2 /*!< MSI = 262.144 KHz */
mbed_official 76:aeb1df146756 95 #define RCC_MSIRange_3 RCC_ICSCR_MSIRANGE_3 /*!< MSI = 524.288 KHz */
mbed_official 76:aeb1df146756 96 #define RCC_MSIRange_4 RCC_ICSCR_MSIRANGE_4 /*!< MSI = 1.048 MHz */
mbed_official 76:aeb1df146756 97 #define RCC_MSIRange_5 RCC_ICSCR_MSIRANGE_5 /*!< MSI = 2.097 MHz */
mbed_official 76:aeb1df146756 98 #define RCC_MSIRange_6 RCC_ICSCR_MSIRANGE_6 /*!< MSI = 4.194 MHz */
mbed_official 76:aeb1df146756 99
mbed_official 76:aeb1df146756 100 #define IS_RCC_MSI_CLOCK_RANGE(RANGE) (((RANGE) == RCC_MSIRange_0) || \
mbed_official 76:aeb1df146756 101 ((RANGE) == RCC_MSIRange_1) || \
mbed_official 76:aeb1df146756 102 ((RANGE) == RCC_MSIRange_2) || \
mbed_official 76:aeb1df146756 103 ((RANGE) == RCC_MSIRange_3) || \
mbed_official 76:aeb1df146756 104 ((RANGE) == RCC_MSIRange_4) || \
mbed_official 76:aeb1df146756 105 ((RANGE) == RCC_MSIRange_5) || \
mbed_official 76:aeb1df146756 106 ((RANGE) == RCC_MSIRange_6))
mbed_official 76:aeb1df146756 107
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_Clock_Source
mbed_official 76:aeb1df146756 113 * @{
mbed_official 76:aeb1df146756 114 */
mbed_official 76:aeb1df146756 115
mbed_official 76:aeb1df146756 116 #define RCC_PLLSource_HSI ((uint8_t)0x00)
mbed_official 76:aeb1df146756 117 #define RCC_PLLSource_HSE ((uint8_t)0x01)
mbed_official 76:aeb1df146756 118
mbed_official 76:aeb1df146756 119 #define IS_RCC_PLL_SOURCE(SOURCE) (((SOURCE) == RCC_PLLSource_HSI) || \
mbed_official 76:aeb1df146756 120 ((SOURCE) == RCC_PLLSource_HSE))
mbed_official 76:aeb1df146756 121 /**
mbed_official 76:aeb1df146756 122 * @}
mbed_official 76:aeb1df146756 123 */
mbed_official 76:aeb1df146756 124
mbed_official 76:aeb1df146756 125 /** @defgroup RCC_PLL_Multiplication_Factor
mbed_official 76:aeb1df146756 126 * @{
mbed_official 76:aeb1df146756 127 */
mbed_official 76:aeb1df146756 128
mbed_official 76:aeb1df146756 129 #define RCC_PLLMul_3 ((uint8_t)0x00)
mbed_official 76:aeb1df146756 130 #define RCC_PLLMul_4 ((uint8_t)0x04)
mbed_official 76:aeb1df146756 131 #define RCC_PLLMul_6 ((uint8_t)0x08)
mbed_official 76:aeb1df146756 132 #define RCC_PLLMul_8 ((uint8_t)0x0C)
mbed_official 76:aeb1df146756 133 #define RCC_PLLMul_12 ((uint8_t)0x10)
mbed_official 76:aeb1df146756 134 #define RCC_PLLMul_16 ((uint8_t)0x14)
mbed_official 76:aeb1df146756 135 #define RCC_PLLMul_24 ((uint8_t)0x18)
mbed_official 76:aeb1df146756 136 #define RCC_PLLMul_32 ((uint8_t)0x1C)
mbed_official 76:aeb1df146756 137 #define RCC_PLLMul_48 ((uint8_t)0x20)
mbed_official 76:aeb1df146756 138
mbed_official 76:aeb1df146756 139
mbed_official 76:aeb1df146756 140 #define IS_RCC_PLL_MUL(MUL) (((MUL) == RCC_PLLMul_3) || ((MUL) == RCC_PLLMul_4) || \
mbed_official 76:aeb1df146756 141 ((MUL) == RCC_PLLMul_6) || ((MUL) == RCC_PLLMul_8) || \
mbed_official 76:aeb1df146756 142 ((MUL) == RCC_PLLMul_12) || ((MUL) == RCC_PLLMul_16) || \
mbed_official 76:aeb1df146756 143 ((MUL) == RCC_PLLMul_24) || ((MUL) == RCC_PLLMul_32) || \
mbed_official 76:aeb1df146756 144 ((MUL) == RCC_PLLMul_48))
mbed_official 76:aeb1df146756 145 /**
mbed_official 76:aeb1df146756 146 * @}
mbed_official 76:aeb1df146756 147 */
mbed_official 76:aeb1df146756 148
mbed_official 76:aeb1df146756 149 /** @defgroup RCC_PLL_Divider_Factor
mbed_official 76:aeb1df146756 150 * @{
mbed_official 76:aeb1df146756 151 */
mbed_official 76:aeb1df146756 152
mbed_official 76:aeb1df146756 153 #define RCC_PLLDiv_2 ((uint8_t)0x40)
mbed_official 76:aeb1df146756 154 #define RCC_PLLDiv_3 ((uint8_t)0x80)
mbed_official 76:aeb1df146756 155 #define RCC_PLLDiv_4 ((uint8_t)0xC0)
mbed_official 76:aeb1df146756 156
mbed_official 76:aeb1df146756 157
mbed_official 76:aeb1df146756 158 #define IS_RCC_PLL_DIV(DIV) (((DIV) == RCC_PLLDiv_2) || ((DIV) == RCC_PLLDiv_3) || \
mbed_official 76:aeb1df146756 159 ((DIV) == RCC_PLLDiv_4))
mbed_official 76:aeb1df146756 160 /**
mbed_official 76:aeb1df146756 161 * @}
mbed_official 76:aeb1df146756 162 */
mbed_official 76:aeb1df146756 163
mbed_official 76:aeb1df146756 164 /** @defgroup RCC_System_Clock_Source
mbed_official 76:aeb1df146756 165 * @{
mbed_official 76:aeb1df146756 166 */
mbed_official 76:aeb1df146756 167
mbed_official 76:aeb1df146756 168 #define RCC_SYSCLKSource_MSI RCC_CFGR_SW_MSI
mbed_official 76:aeb1df146756 169 #define RCC_SYSCLKSource_HSI RCC_CFGR_SW_HSI
mbed_official 76:aeb1df146756 170 #define RCC_SYSCLKSource_HSE RCC_CFGR_SW_HSE
mbed_official 76:aeb1df146756 171 #define RCC_SYSCLKSource_PLLCLK RCC_CFGR_SW_PLL
mbed_official 76:aeb1df146756 172 #define IS_RCC_SYSCLK_SOURCE(SOURCE) (((SOURCE) == RCC_SYSCLKSource_MSI) || \
mbed_official 76:aeb1df146756 173 ((SOURCE) == RCC_SYSCLKSource_HSI) || \
mbed_official 76:aeb1df146756 174 ((SOURCE) == RCC_SYSCLKSource_HSE) || \
mbed_official 76:aeb1df146756 175 ((SOURCE) == RCC_SYSCLKSource_PLLCLK))
mbed_official 76:aeb1df146756 176 /**
mbed_official 76:aeb1df146756 177 * @}
mbed_official 76:aeb1df146756 178 */
mbed_official 76:aeb1df146756 179
mbed_official 76:aeb1df146756 180 /** @defgroup RCC_AHB_Clock_Source
mbed_official 76:aeb1df146756 181 * @{
mbed_official 76:aeb1df146756 182 */
mbed_official 76:aeb1df146756 183
mbed_official 76:aeb1df146756 184 #define RCC_SYSCLK_Div1 RCC_CFGR_HPRE_DIV1
mbed_official 76:aeb1df146756 185 #define RCC_SYSCLK_Div2 RCC_CFGR_HPRE_DIV2
mbed_official 76:aeb1df146756 186 #define RCC_SYSCLK_Div4 RCC_CFGR_HPRE_DIV4
mbed_official 76:aeb1df146756 187 #define RCC_SYSCLK_Div8 RCC_CFGR_HPRE_DIV8
mbed_official 76:aeb1df146756 188 #define RCC_SYSCLK_Div16 RCC_CFGR_HPRE_DIV16
mbed_official 76:aeb1df146756 189 #define RCC_SYSCLK_Div64 RCC_CFGR_HPRE_DIV64
mbed_official 76:aeb1df146756 190 #define RCC_SYSCLK_Div128 RCC_CFGR_HPRE_DIV128
mbed_official 76:aeb1df146756 191 #define RCC_SYSCLK_Div256 RCC_CFGR_HPRE_DIV256
mbed_official 76:aeb1df146756 192 #define RCC_SYSCLK_Div512 RCC_CFGR_HPRE_DIV512
mbed_official 76:aeb1df146756 193 #define IS_RCC_HCLK(HCLK) (((HCLK) == RCC_SYSCLK_Div1) || ((HCLK) == RCC_SYSCLK_Div2) || \
mbed_official 76:aeb1df146756 194 ((HCLK) == RCC_SYSCLK_Div4) || ((HCLK) == RCC_SYSCLK_Div8) || \
mbed_official 76:aeb1df146756 195 ((HCLK) == RCC_SYSCLK_Div16) || ((HCLK) == RCC_SYSCLK_Div64) || \
mbed_official 76:aeb1df146756 196 ((HCLK) == RCC_SYSCLK_Div128) || ((HCLK) == RCC_SYSCLK_Div256) || \
mbed_official 76:aeb1df146756 197 ((HCLK) == RCC_SYSCLK_Div512))
mbed_official 76:aeb1df146756 198 /**
mbed_official 76:aeb1df146756 199 * @}
mbed_official 76:aeb1df146756 200 */
mbed_official 76:aeb1df146756 201
mbed_official 76:aeb1df146756 202 /** @defgroup RCC_APB1_APB2_Clock_Source
mbed_official 76:aeb1df146756 203 * @{
mbed_official 76:aeb1df146756 204 */
mbed_official 76:aeb1df146756 205
mbed_official 76:aeb1df146756 206 #define RCC_HCLK_Div1 RCC_CFGR_PPRE1_DIV1
mbed_official 76:aeb1df146756 207 #define RCC_HCLK_Div2 RCC_CFGR_PPRE1_DIV2
mbed_official 76:aeb1df146756 208 #define RCC_HCLK_Div4 RCC_CFGR_PPRE1_DIV4
mbed_official 76:aeb1df146756 209 #define RCC_HCLK_Div8 RCC_CFGR_PPRE1_DIV8
mbed_official 76:aeb1df146756 210 #define RCC_HCLK_Div16 RCC_CFGR_PPRE1_DIV16
mbed_official 76:aeb1df146756 211 #define IS_RCC_PCLK(PCLK) (((PCLK) == RCC_HCLK_Div1) || ((PCLK) == RCC_HCLK_Div2) || \
mbed_official 76:aeb1df146756 212 ((PCLK) == RCC_HCLK_Div4) || ((PCLK) == RCC_HCLK_Div8) || \
mbed_official 76:aeb1df146756 213 ((PCLK) == RCC_HCLK_Div16))
mbed_official 76:aeb1df146756 214 /**
mbed_official 76:aeb1df146756 215 * @}
mbed_official 76:aeb1df146756 216 */
mbed_official 76:aeb1df146756 217
mbed_official 76:aeb1df146756 218
mbed_official 76:aeb1df146756 219 /** @defgroup RCC_Interrupt_Source
mbed_official 76:aeb1df146756 220 * @{
mbed_official 76:aeb1df146756 221 */
mbed_official 76:aeb1df146756 222
mbed_official 76:aeb1df146756 223 #define RCC_IT_LSIRDY ((uint8_t)0x01)
mbed_official 76:aeb1df146756 224 #define RCC_IT_LSERDY ((uint8_t)0x02)
mbed_official 76:aeb1df146756 225 #define RCC_IT_HSIRDY ((uint8_t)0x04)
mbed_official 76:aeb1df146756 226 #define RCC_IT_HSERDY ((uint8_t)0x08)
mbed_official 76:aeb1df146756 227 #define RCC_IT_PLLRDY ((uint8_t)0x10)
mbed_official 76:aeb1df146756 228 #define RCC_IT_MSIRDY ((uint8_t)0x20)
mbed_official 76:aeb1df146756 229 #define RCC_IT_LSECSS ((uint8_t)0x40)
mbed_official 76:aeb1df146756 230 #define RCC_IT_CSS ((uint8_t)0x80)
mbed_official 76:aeb1df146756 231
mbed_official 76:aeb1df146756 232 #define IS_RCC_IT(IT) ((((IT) & (uint8_t)0x80) == 0x00) && ((IT) != 0x00))
mbed_official 76:aeb1df146756 233
mbed_official 76:aeb1df146756 234 #define IS_RCC_GET_IT(IT) (((IT) == RCC_IT_LSIRDY) || ((IT) == RCC_IT_LSERDY) || \
mbed_official 76:aeb1df146756 235 ((IT) == RCC_IT_HSIRDY) || ((IT) == RCC_IT_HSERDY) || \
mbed_official 76:aeb1df146756 236 ((IT) == RCC_IT_PLLRDY) || ((IT) == RCC_IT_MSIRDY) || \
mbed_official 76:aeb1df146756 237 ((IT) == RCC_IT_CSS) || ((IT) == RCC_IT_LSECSS))
mbed_official 76:aeb1df146756 238
mbed_official 76:aeb1df146756 239 #define IS_RCC_CLEAR_IT(IT) ((((IT) & (uint8_t)0x00) == 0x00) && ((IT) != 0x00))
mbed_official 76:aeb1df146756 240
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 /** @defgroup RCC_LSE_Configuration
mbed_official 76:aeb1df146756 246 * @{
mbed_official 76:aeb1df146756 247 */
mbed_official 76:aeb1df146756 248
mbed_official 76:aeb1df146756 249 #define RCC_LSE_OFF ((uint8_t)0x00)
mbed_official 76:aeb1df146756 250 #define RCC_LSE_ON ((uint8_t)0x01)
mbed_official 76:aeb1df146756 251 #define RCC_LSE_Bypass ((uint8_t)0x05)
mbed_official 76:aeb1df146756 252 #define IS_RCC_LSE(LSE) (((LSE) == RCC_LSE_OFF) || ((LSE) == RCC_LSE_ON) || \
mbed_official 76:aeb1df146756 253 ((LSE) == RCC_LSE_Bypass))
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 /** @defgroup RCC_RTC_Clock_Source
mbed_official 76:aeb1df146756 259 * @{
mbed_official 76:aeb1df146756 260 */
mbed_official 76:aeb1df146756 261
mbed_official 76:aeb1df146756 262 #define RCC_RTCCLKSource_LSE RCC_CSR_RTCSEL_LSE
mbed_official 76:aeb1df146756 263 #define RCC_RTCCLKSource_LSI RCC_CSR_RTCSEL_LSI
mbed_official 76:aeb1df146756 264 #define RCC_RTCCLKSource_HSE_Div2 RCC_CSR_RTCSEL_HSE
mbed_official 76:aeb1df146756 265 #define RCC_RTCCLKSource_HSE_Div4 ((uint32_t)RCC_CSR_RTCSEL_HSE | RCC_CR_RTCPRE_0)
mbed_official 76:aeb1df146756 266 #define RCC_RTCCLKSource_HSE_Div8 ((uint32_t)RCC_CSR_RTCSEL_HSE | RCC_CR_RTCPRE_1)
mbed_official 76:aeb1df146756 267 #define RCC_RTCCLKSource_HSE_Div16 ((uint32_t)RCC_CSR_RTCSEL_HSE | RCC_CR_RTCPRE)
mbed_official 76:aeb1df146756 268 #define IS_RCC_RTCCLK_SOURCE(SOURCE) (((SOURCE) == RCC_RTCCLKSource_LSE) || \
mbed_official 76:aeb1df146756 269 ((SOURCE) == RCC_RTCCLKSource_LSI) || \
mbed_official 76:aeb1df146756 270 ((SOURCE) == RCC_RTCCLKSource_HSE_Div2) || \
mbed_official 76:aeb1df146756 271 ((SOURCE) == RCC_RTCCLKSource_HSE_Div4) || \
mbed_official 76:aeb1df146756 272 ((SOURCE) == RCC_RTCCLKSource_HSE_Div8) || \
mbed_official 76:aeb1df146756 273 ((SOURCE) == RCC_RTCCLKSource_HSE_Div16))
mbed_official 76:aeb1df146756 274 /**
mbed_official 76:aeb1df146756 275 * @}
mbed_official 76:aeb1df146756 276 */
mbed_official 76:aeb1df146756 277
mbed_official 76:aeb1df146756 278 /** @defgroup RCC_AHB_Peripherals
mbed_official 76:aeb1df146756 279 * @{
mbed_official 76:aeb1df146756 280 */
mbed_official 76:aeb1df146756 281
mbed_official 76:aeb1df146756 282 #define RCC_AHBPeriph_GPIOA RCC_AHBENR_GPIOAEN
mbed_official 76:aeb1df146756 283 #define RCC_AHBPeriph_GPIOB RCC_AHBENR_GPIOBEN
mbed_official 76:aeb1df146756 284 #define RCC_AHBPeriph_GPIOC RCC_AHBENR_GPIOCEN
mbed_official 76:aeb1df146756 285 #define RCC_AHBPeriph_GPIOD RCC_AHBENR_GPIODEN
mbed_official 76:aeb1df146756 286 #define RCC_AHBPeriph_GPIOE RCC_AHBENR_GPIOEEN
mbed_official 76:aeb1df146756 287 #define RCC_AHBPeriph_GPIOH RCC_AHBENR_GPIOHEN
mbed_official 76:aeb1df146756 288 #define RCC_AHBPeriph_GPIOF RCC_AHBENR_GPIOFEN
mbed_official 76:aeb1df146756 289 #define RCC_AHBPeriph_GPIOG RCC_AHBENR_GPIOGEN
mbed_official 76:aeb1df146756 290 #define RCC_AHBPeriph_CRC RCC_AHBENR_CRCEN
mbed_official 76:aeb1df146756 291 #define RCC_AHBPeriph_FLITF RCC_AHBENR_FLITFEN
mbed_official 76:aeb1df146756 292 #define RCC_AHBPeriph_SRAM RCC_AHBLPENR_SRAMLPEN
mbed_official 76:aeb1df146756 293 #define RCC_AHBPeriph_DMA1 RCC_AHBENR_DMA1EN
mbed_official 76:aeb1df146756 294 #define RCC_AHBPeriph_DMA2 RCC_AHBENR_DMA2EN
mbed_official 76:aeb1df146756 295 #define RCC_AHBPeriph_AES RCC_AHBENR_AESEN
mbed_official 76:aeb1df146756 296 #define RCC_AHBPeriph_FSMC RCC_AHBENR_FSMCEN
mbed_official 76:aeb1df146756 297
mbed_official 76:aeb1df146756 298 #define IS_RCC_AHB_PERIPH(PERIPH) ((((PERIPH) & 0xB4FF6F00) == 0x00) && ((PERIPH) != 0x00))
mbed_official 76:aeb1df146756 299 #define IS_RCC_AHB_LPMODE_PERIPH(PERIPH) ((((PERIPH) & 0xB4FF6F00) == 0x00) && ((PERIPH) != 0x00))
mbed_official 76:aeb1df146756 300
mbed_official 76:aeb1df146756 301 /**
mbed_official 76:aeb1df146756 302 * @}
mbed_official 76:aeb1df146756 303 */
mbed_official 76:aeb1df146756 304
mbed_official 76:aeb1df146756 305 /** @defgroup RCC_APB2_Peripherals
mbed_official 76:aeb1df146756 306 * @{
mbed_official 76:aeb1df146756 307 */
mbed_official 76:aeb1df146756 308
mbed_official 76:aeb1df146756 309 #define RCC_APB2Periph_SYSCFG RCC_APB2ENR_SYSCFGEN
mbed_official 76:aeb1df146756 310 #define RCC_APB2Periph_TIM9 RCC_APB2ENR_TIM9EN
mbed_official 76:aeb1df146756 311 #define RCC_APB2Periph_TIM10 RCC_APB2ENR_TIM10EN
mbed_official 76:aeb1df146756 312 #define RCC_APB2Periph_TIM11 RCC_APB2ENR_TIM11EN
mbed_official 76:aeb1df146756 313 #define RCC_APB2Periph_ADC1 RCC_APB2ENR_ADC1EN
mbed_official 76:aeb1df146756 314 #define RCC_APB2Periph_SDIO RCC_APB2ENR_SDIOEN
mbed_official 76:aeb1df146756 315 #define RCC_APB2Periph_SPI1 RCC_APB2ENR_SPI1EN
mbed_official 76:aeb1df146756 316 #define RCC_APB2Periph_USART1 RCC_APB2ENR_USART1EN
mbed_official 76:aeb1df146756 317
mbed_official 76:aeb1df146756 318 #define IS_RCC_APB2_PERIPH(PERIPH) ((((PERIPH) & 0xFFFFA5E2) == 0x00) && ((PERIPH) != 0x00))
mbed_official 76:aeb1df146756 319 /**
mbed_official 76:aeb1df146756 320 * @}
mbed_official 76:aeb1df146756 321 */
mbed_official 76:aeb1df146756 322
mbed_official 76:aeb1df146756 323 /** @defgroup RCC_APB1_Peripherals
mbed_official 76:aeb1df146756 324 * @{
mbed_official 76:aeb1df146756 325 */
mbed_official 76:aeb1df146756 326
mbed_official 76:aeb1df146756 327 #define RCC_APB1Periph_TIM2 RCC_APB1ENR_TIM2EN
mbed_official 76:aeb1df146756 328 #define RCC_APB1Periph_TIM3 RCC_APB1ENR_TIM3EN
mbed_official 76:aeb1df146756 329 #define RCC_APB1Periph_TIM4 RCC_APB1ENR_TIM4EN
mbed_official 76:aeb1df146756 330 #define RCC_APB1Periph_TIM5 RCC_APB1ENR_TIM5EN
mbed_official 76:aeb1df146756 331 #define RCC_APB1Periph_TIM6 RCC_APB1ENR_TIM6EN
mbed_official 76:aeb1df146756 332 #define RCC_APB1Periph_TIM7 RCC_APB1ENR_TIM7EN
mbed_official 76:aeb1df146756 333 #define RCC_APB1Periph_LCD RCC_APB1ENR_LCDEN
mbed_official 76:aeb1df146756 334 #define RCC_APB1Periph_WWDG RCC_APB1ENR_WWDGEN
mbed_official 76:aeb1df146756 335 #define RCC_APB1Periph_SPI2 RCC_APB1ENR_SPI2EN
mbed_official 76:aeb1df146756 336 #define RCC_APB1Periph_SPI3 RCC_APB1ENR_SPI3EN
mbed_official 76:aeb1df146756 337 #define RCC_APB1Periph_USART2 RCC_APB1ENR_USART2EN
mbed_official 76:aeb1df146756 338 #define RCC_APB1Periph_USART3 RCC_APB1ENR_USART3EN
mbed_official 76:aeb1df146756 339 #define RCC_APB1Periph_UART4 RCC_APB1ENR_UART4EN
mbed_official 76:aeb1df146756 340 #define RCC_APB1Periph_UART5 RCC_APB1ENR_UART5EN
mbed_official 76:aeb1df146756 341 #define RCC_APB1Periph_I2C1 RCC_APB1ENR_I2C1EN
mbed_official 76:aeb1df146756 342 #define RCC_APB1Periph_I2C2 RCC_APB1ENR_I2C2EN
mbed_official 76:aeb1df146756 343 #define RCC_APB1Periph_USB RCC_APB1ENR_USBEN
mbed_official 76:aeb1df146756 344 #define RCC_APB1Periph_PWR RCC_APB1ENR_PWREN
mbed_official 76:aeb1df146756 345 #define RCC_APB1Periph_DAC RCC_APB1ENR_DACEN
mbed_official 76:aeb1df146756 346 #define RCC_APB1Periph_COMP RCC_APB1ENR_COMPEN
mbed_official 76:aeb1df146756 347
mbed_official 76:aeb1df146756 348
mbed_official 76:aeb1df146756 349 #define IS_RCC_APB1_PERIPH(PERIPH) ((((PERIPH) & 0x4F0135C0) == 0x00) && ((PERIPH) != 0x00))
mbed_official 76:aeb1df146756 350 /**
mbed_official 76:aeb1df146756 351 * @}
mbed_official 76:aeb1df146756 352 */
mbed_official 76:aeb1df146756 353
mbed_official 76:aeb1df146756 354 /** @defgroup RCC_MCO_Clock_Source
mbed_official 76:aeb1df146756 355 * @{
mbed_official 76:aeb1df146756 356 */
mbed_official 76:aeb1df146756 357
mbed_official 76:aeb1df146756 358 #define RCC_MCOSource_NoClock ((uint8_t)0x00)
mbed_official 76:aeb1df146756 359 #define RCC_MCOSource_SYSCLK ((uint8_t)0x01)
mbed_official 76:aeb1df146756 360 #define RCC_MCOSource_HSI ((uint8_t)0x02)
mbed_official 76:aeb1df146756 361 #define RCC_MCOSource_MSI ((uint8_t)0x03)
mbed_official 76:aeb1df146756 362 #define RCC_MCOSource_HSE ((uint8_t)0x04)
mbed_official 76:aeb1df146756 363 #define RCC_MCOSource_PLLCLK ((uint8_t)0x05)
mbed_official 76:aeb1df146756 364 #define RCC_MCOSource_LSI ((uint8_t)0x06)
mbed_official 76:aeb1df146756 365 #define RCC_MCOSource_LSE ((uint8_t)0x07)
mbed_official 76:aeb1df146756 366
mbed_official 76:aeb1df146756 367 #define IS_RCC_MCO_SOURCE(SOURCE) (((SOURCE) == RCC_MCOSource_NoClock) || ((SOURCE) == RCC_MCOSource_SYSCLK) || \
mbed_official 76:aeb1df146756 368 ((SOURCE) == RCC_MCOSource_HSI) || ((SOURCE) == RCC_MCOSource_MSI) || \
mbed_official 76:aeb1df146756 369 ((SOURCE) == RCC_MCOSource_HSE) || ((SOURCE) == RCC_MCOSource_PLLCLK) || \
mbed_official 76:aeb1df146756 370 ((SOURCE) == RCC_MCOSource_LSI) || ((SOURCE) == RCC_MCOSource_LSE))
mbed_official 76:aeb1df146756 371 /**
mbed_official 76:aeb1df146756 372 * @}
mbed_official 76:aeb1df146756 373 */
mbed_official 76:aeb1df146756 374
mbed_official 76:aeb1df146756 375 /** @defgroup RCC_MCO_Output_Divider
mbed_official 76:aeb1df146756 376 * @{
mbed_official 76:aeb1df146756 377 */
mbed_official 76:aeb1df146756 378
mbed_official 76:aeb1df146756 379 #define RCC_MCODiv_1 ((uint8_t)0x00)
mbed_official 76:aeb1df146756 380 #define RCC_MCODiv_2 ((uint8_t)0x10)
mbed_official 76:aeb1df146756 381 #define RCC_MCODiv_4 ((uint8_t)0x20)
mbed_official 76:aeb1df146756 382 #define RCC_MCODiv_8 ((uint8_t)0x30)
mbed_official 76:aeb1df146756 383 #define RCC_MCODiv_16 ((uint8_t)0x40)
mbed_official 76:aeb1df146756 384
mbed_official 76:aeb1df146756 385 #define IS_RCC_MCO_DIV(DIV) (((DIV) == RCC_MCODiv_1) || ((DIV) == RCC_MCODiv_2) || \
mbed_official 76:aeb1df146756 386 ((DIV) == RCC_MCODiv_4) || ((DIV) == RCC_MCODiv_8) || \
mbed_official 76:aeb1df146756 387 ((DIV) == RCC_MCODiv_16))
mbed_official 76:aeb1df146756 388 /**
mbed_official 76:aeb1df146756 389 * @}
mbed_official 76:aeb1df146756 390 */
mbed_official 76:aeb1df146756 391
mbed_official 76:aeb1df146756 392 /** @defgroup RCC_Flag
mbed_official 76:aeb1df146756 393 * @{
mbed_official 76:aeb1df146756 394 */
mbed_official 76:aeb1df146756 395
mbed_official 76:aeb1df146756 396 #define RCC_FLAG_HSIRDY ((uint8_t)0x21)
mbed_official 76:aeb1df146756 397 #define RCC_FLAG_MSIRDY ((uint8_t)0x29)
mbed_official 76:aeb1df146756 398 #define RCC_FLAG_HSERDY ((uint8_t)0x31)
mbed_official 76:aeb1df146756 399 #define RCC_FLAG_PLLRDY ((uint8_t)0x39)
mbed_official 76:aeb1df146756 400 #define RCC_FLAG_LSERDY ((uint8_t)0x49)
mbed_official 76:aeb1df146756 401 #define RCC_FLAG_LSECSS ((uint8_t)0x4A)
mbed_official 76:aeb1df146756 402 #define RCC_FLAG_LSIRDY ((uint8_t)0x41)
mbed_official 76:aeb1df146756 403 #define RCC_FLAG_OBLRST ((uint8_t)0x59)
mbed_official 76:aeb1df146756 404 #define RCC_FLAG_PINRST ((uint8_t)0x5A)
mbed_official 76:aeb1df146756 405 #define RCC_FLAG_PORRST ((uint8_t)0x5B)
mbed_official 76:aeb1df146756 406 #define RCC_FLAG_SFTRST ((uint8_t)0x5C)
mbed_official 76:aeb1df146756 407 #define RCC_FLAG_IWDGRST ((uint8_t)0x5D)
mbed_official 76:aeb1df146756 408 #define RCC_FLAG_WWDGRST ((uint8_t)0x5E)
mbed_official 76:aeb1df146756 409 #define RCC_FLAG_LPWRRST ((uint8_t)0x5F)
mbed_official 76:aeb1df146756 410
mbed_official 76:aeb1df146756 411 #define IS_RCC_FLAG(FLAG) (((FLAG) == RCC_FLAG_HSIRDY) || ((FLAG) == RCC_FLAG_HSERDY) || \
mbed_official 76:aeb1df146756 412 ((FLAG) == RCC_FLAG_MSIRDY) || ((FLAG) == RCC_FLAG_PLLRDY) || \
mbed_official 76:aeb1df146756 413 ((FLAG) == RCC_FLAG_LSERDY) || ((FLAG) == RCC_FLAG_LSIRDY) || \
mbed_official 76:aeb1df146756 414 ((FLAG) == RCC_FLAG_PINRST) || ((FLAG) == RCC_FLAG_PORRST) || \
mbed_official 76:aeb1df146756 415 ((FLAG) == RCC_FLAG_SFTRST) || ((FLAG) == RCC_FLAG_IWDGRST)|| \
mbed_official 76:aeb1df146756 416 ((FLAG) == RCC_FLAG_WWDGRST)|| ((FLAG) == RCC_FLAG_LPWRRST)|| \
mbed_official 80:66393a7b209d 417 ((FLAG) == RCC_FLAG_OBLRST)|| ((FLAG) == RCC_FLAG_LSECSS))
mbed_official 76:aeb1df146756 418
mbed_official 76:aeb1df146756 419 #define IS_RCC_HSI_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x1F)
mbed_official 76:aeb1df146756 420 #define IS_RCC_MSI_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x3F)
mbed_official 76:aeb1df146756 421
mbed_official 76:aeb1df146756 422 /**
mbed_official 76:aeb1df146756 423 * @}
mbed_official 76:aeb1df146756 424 */
mbed_official 76:aeb1df146756 425
mbed_official 76:aeb1df146756 426 /**
mbed_official 76:aeb1df146756 427 * @}
mbed_official 76:aeb1df146756 428 */
mbed_official 76:aeb1df146756 429
mbed_official 76:aeb1df146756 430 /* Exported macro ------------------------------------------------------------*/
mbed_official 76:aeb1df146756 431 /* Exported functions ------------------------------------------------------- */
mbed_official 76:aeb1df146756 432
mbed_official 76:aeb1df146756 433 /* Function used to set the RCC clock configuration to the default reset state */
mbed_official 76:aeb1df146756 434 void RCC_DeInit(void);
mbed_official 76:aeb1df146756 435
mbed_official 76:aeb1df146756 436 /* Internal/external clocks, PLL, CSS and MCO configuration functions *********/
mbed_official 76:aeb1df146756 437 void RCC_HSEConfig(uint8_t RCC_HSE);
mbed_official 76:aeb1df146756 438 ErrorStatus RCC_WaitForHSEStartUp(void);
mbed_official 76:aeb1df146756 439 void RCC_MSIRangeConfig(uint32_t RCC_MSIRange);
mbed_official 76:aeb1df146756 440 void RCC_AdjustMSICalibrationValue(uint8_t MSICalibrationValue);
mbed_official 76:aeb1df146756 441 void RCC_MSICmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 442 void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue);
mbed_official 76:aeb1df146756 443 void RCC_HSICmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 444 void RCC_LSEConfig(uint8_t RCC_LSE);
mbed_official 76:aeb1df146756 445 void RCC_LSICmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 446 void RCC_PLLConfig(uint8_t RCC_PLLSource, uint8_t RCC_PLLMul, uint8_t RCC_PLLDiv);
mbed_official 76:aeb1df146756 447 void RCC_PLLCmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 448 void RCC_ClockSecuritySystemCmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 449 void RCC_LSEClockSecuritySystemCmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 450 void RCC_MCOConfig(uint8_t RCC_MCOSource, uint8_t RCC_MCODiv);
mbed_official 76:aeb1df146756 451
mbed_official 76:aeb1df146756 452 /* System, AHB and APB busses clocks configuration functions ******************/
mbed_official 76:aeb1df146756 453 void RCC_SYSCLKConfig(uint32_t RCC_SYSCLKSource);
mbed_official 76:aeb1df146756 454 uint8_t RCC_GetSYSCLKSource(void);
mbed_official 76:aeb1df146756 455 void RCC_HCLKConfig(uint32_t RCC_SYSCLK);
mbed_official 76:aeb1df146756 456 void RCC_PCLK1Config(uint32_t RCC_HCLK);
mbed_official 76:aeb1df146756 457 void RCC_PCLK2Config(uint32_t RCC_HCLK);
mbed_official 76:aeb1df146756 458 void RCC_GetClocksFreq(RCC_ClocksTypeDef* RCC_Clocks);
mbed_official 76:aeb1df146756 459
mbed_official 76:aeb1df146756 460 /* Peripheral clocks configuration functions **********************************/
mbed_official 76:aeb1df146756 461 void RCC_RTCCLKConfig(uint32_t RCC_RTCCLKSource);
mbed_official 76:aeb1df146756 462 void RCC_RTCCLKCmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 463 void RCC_RTCResetCmd(FunctionalState NewState);
mbed_official 76:aeb1df146756 464
mbed_official 76:aeb1df146756 465 void RCC_AHBPeriphClockCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState);
mbed_official 76:aeb1df146756 466 void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);
mbed_official 76:aeb1df146756 467 void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
mbed_official 76:aeb1df146756 468
mbed_official 76:aeb1df146756 469 void RCC_AHBPeriphResetCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState);
mbed_official 76:aeb1df146756 470 void RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);
mbed_official 76:aeb1df146756 471 void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
mbed_official 76:aeb1df146756 472
mbed_official 76:aeb1df146756 473 void RCC_AHBPeriphClockLPModeCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState);
mbed_official 76:aeb1df146756 474 void RCC_APB2PeriphClockLPModeCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);
mbed_official 76:aeb1df146756 475 void RCC_APB1PeriphClockLPModeCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
mbed_official 76:aeb1df146756 476
mbed_official 76:aeb1df146756 477 /* Interrupts and flags management functions **********************************/
mbed_official 76:aeb1df146756 478 void RCC_ITConfig(uint8_t RCC_IT, FunctionalState NewState);
mbed_official 76:aeb1df146756 479 FlagStatus RCC_GetFlagStatus(uint8_t RCC_FLAG);
mbed_official 76:aeb1df146756 480 void RCC_ClearFlag(void);
mbed_official 76:aeb1df146756 481 ITStatus RCC_GetITStatus(uint8_t RCC_IT);
mbed_official 76:aeb1df146756 482 void RCC_ClearITPendingBit(uint8_t RCC_IT);
mbed_official 76:aeb1df146756 483
mbed_official 76:aeb1df146756 484 #ifdef __cplusplus
mbed_official 76:aeb1df146756 485 }
mbed_official 76:aeb1df146756 486 #endif
mbed_official 76:aeb1df146756 487
mbed_official 76:aeb1df146756 488 #endif /* __STM32L1xx_RCC_H */
mbed_official 76:aeb1df146756 489
mbed_official 76:aeb1df146756 490 /**
mbed_official 76:aeb1df146756 491 * @}
mbed_official 76:aeb1df146756 492 */
mbed_official 76:aeb1df146756 493
mbed_official 76:aeb1df146756 494 /**
mbed_official 76:aeb1df146756 495 * @}
mbed_official 76:aeb1df146756 496 */
mbed_official 76:aeb1df146756 497
mbed_official 76:aeb1df146756 498 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/