mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F334R8/stm32f3xx_hal_rcc_ex.c@323:9e901b0a5aa1, 2014-09-13 (annotated)
- Committer:
- shaoziyang
- Date:
- Sat Sep 13 14:25:46 2014 +0000
- Revision:
- 323:9e901b0a5aa1
- Parent:
- 237:f3da66175598
test with CLOCK_SETUP = 0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 237:f3da66175598 | 1 | /** |
mbed_official | 237:f3da66175598 | 2 | ****************************************************************************** |
mbed_official | 237:f3da66175598 | 3 | * @file stm32f3xx_hal_rcc_ex.c |
mbed_official | 237:f3da66175598 | 4 | * @author MCD Application Team |
mbed_official | 237:f3da66175598 | 5 | * @version V1.0.1 |
mbed_official | 237:f3da66175598 | 6 | * @date 18-June-2014 |
mbed_official | 237:f3da66175598 | 7 | * @brief Extended RCC HAL module driver |
mbed_official | 237:f3da66175598 | 8 | * This file provides firmware functions to manage the following |
mbed_official | 237:f3da66175598 | 9 | * functionalities RCC extension peripheral: |
mbed_official | 237:f3da66175598 | 10 | * + Extended Clock Source configuration functions |
mbed_official | 237:f3da66175598 | 11 | * |
mbed_official | 237:f3da66175598 | 12 | ****************************************************************************** |
mbed_official | 237:f3da66175598 | 13 | * @attention |
mbed_official | 237:f3da66175598 | 14 | * |
mbed_official | 237:f3da66175598 | 15 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 237:f3da66175598 | 16 | * |
mbed_official | 237:f3da66175598 | 17 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 237:f3da66175598 | 18 | * are permitted provided that the following conditions are met: |
mbed_official | 237:f3da66175598 | 19 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 237:f3da66175598 | 20 | * this list of conditions and the following disclaimer. |
mbed_official | 237:f3da66175598 | 21 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 237:f3da66175598 | 22 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 237:f3da66175598 | 23 | * and/or other materials provided with the distribution. |
mbed_official | 237:f3da66175598 | 24 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 237:f3da66175598 | 25 | * may be used to endorse or promote products derived from this software |
mbed_official | 237:f3da66175598 | 26 | * without specific prior written permission. |
mbed_official | 237:f3da66175598 | 27 | * |
mbed_official | 237:f3da66175598 | 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 237:f3da66175598 | 29 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 237:f3da66175598 | 30 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 237:f3da66175598 | 31 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 237:f3da66175598 | 32 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 237:f3da66175598 | 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 237:f3da66175598 | 34 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 237:f3da66175598 | 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 237:f3da66175598 | 36 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 237:f3da66175598 | 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 237:f3da66175598 | 38 | * |
mbed_official | 237:f3da66175598 | 39 | ****************************************************************************** |
mbed_official | 237:f3da66175598 | 40 | */ |
mbed_official | 237:f3da66175598 | 41 | |
mbed_official | 237:f3da66175598 | 42 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 43 | #include "stm32f3xx_hal.h" |
mbed_official | 237:f3da66175598 | 44 | |
mbed_official | 237:f3da66175598 | 45 | /** @addtogroup STM32F3xx_HAL_Driver |
mbed_official | 237:f3da66175598 | 46 | * @{ |
mbed_official | 237:f3da66175598 | 47 | */ |
mbed_official | 237:f3da66175598 | 48 | |
mbed_official | 237:f3da66175598 | 49 | /** @defgroup RCCEx |
mbed_official | 237:f3da66175598 | 50 | * @brief RCC Extended HAL module driver. |
mbed_official | 237:f3da66175598 | 51 | * @{ |
mbed_official | 237:f3da66175598 | 52 | */ |
mbed_official | 237:f3da66175598 | 53 | |
mbed_official | 237:f3da66175598 | 54 | #ifdef HAL_RCC_MODULE_ENABLED |
mbed_official | 237:f3da66175598 | 55 | |
mbed_official | 237:f3da66175598 | 56 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 57 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 58 | /* Private macro -------------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 59 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 60 | /* Private function prototypes -----------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 61 | /* Private functions ---------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 62 | |
mbed_official | 237:f3da66175598 | 63 | /** @defgroup RCCEx_Private_Functions |
mbed_official | 237:f3da66175598 | 64 | * @{ |
mbed_official | 237:f3da66175598 | 65 | */ |
mbed_official | 237:f3da66175598 | 66 | |
mbed_official | 237:f3da66175598 | 67 | /** @defgroup RCCEx_Group1 Extended Peripheral Control functions |
mbed_official | 237:f3da66175598 | 68 | * @brief Extended Peripheral Control functions |
mbed_official | 237:f3da66175598 | 69 | * |
mbed_official | 237:f3da66175598 | 70 | @verbatim |
mbed_official | 237:f3da66175598 | 71 | =============================================================================== |
mbed_official | 237:f3da66175598 | 72 | ##### Extended Peripheral Control functions ##### |
mbed_official | 237:f3da66175598 | 73 | =============================================================================== |
mbed_official | 237:f3da66175598 | 74 | [..] |
mbed_official | 237:f3da66175598 | 75 | This subsection provides a set of functions allowing to control the RCC Clocks |
mbed_official | 237:f3da66175598 | 76 | frequencies. |
mbed_official | 237:f3da66175598 | 77 | [..] |
mbed_official | 237:f3da66175598 | 78 | (@) Important note: Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to |
mbed_official | 237:f3da66175598 | 79 | select the RTC clock source; in this case the Backup domain will be reset in |
mbed_official | 237:f3da66175598 | 80 | order to modify the RTC Clock source, as consequence RTC registers (including |
mbed_official | 237:f3da66175598 | 81 | the backup registers) and RCC_BDCR register are set to their reset values. |
mbed_official | 237:f3da66175598 | 82 | |
mbed_official | 237:f3da66175598 | 83 | @endverbatim |
mbed_official | 237:f3da66175598 | 84 | * @{ |
mbed_official | 237:f3da66175598 | 85 | */ |
mbed_official | 237:f3da66175598 | 86 | |
mbed_official | 237:f3da66175598 | 87 | /** |
mbed_official | 237:f3da66175598 | 88 | * @brief Initializes the RCC extended peripherals clocks according to the specified |
mbed_official | 237:f3da66175598 | 89 | * parameters in the RCC_PeriphCLKInitTypeDef. |
mbed_official | 237:f3da66175598 | 90 | * @param PeriphClkInit: pointer to an RCC_PeriphCLKInitTypeDef structure that |
mbed_official | 237:f3da66175598 | 91 | * contains the configuration information for the Extended Peripherals clocks |
mbed_official | 237:f3da66175598 | 92 | * (ADC, CEC, I2C, I2S, SDADC, HRTIM, TIM, USART, RTC and USB). |
mbed_official | 237:f3da66175598 | 93 | * |
mbed_official | 237:f3da66175598 | 94 | * @note Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select |
mbed_official | 237:f3da66175598 | 95 | * the RTC clock source; in this case the Backup domain will be reset in |
mbed_official | 237:f3da66175598 | 96 | * order to modify the RTC Clock source, as consequence RTC registers (including |
mbed_official | 237:f3da66175598 | 97 | * the backup registers) and RCC_BDCR register are set to their reset values. |
mbed_official | 237:f3da66175598 | 98 | * |
mbed_official | 237:f3da66175598 | 99 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 100 | */ |
mbed_official | 237:f3da66175598 | 101 | HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) |
mbed_official | 237:f3da66175598 | 102 | { |
mbed_official | 237:f3da66175598 | 103 | uint32_t tickstart = 0; |
mbed_official | 237:f3da66175598 | 104 | uint32_t tmpreg = 0; |
mbed_official | 237:f3da66175598 | 105 | |
mbed_official | 237:f3da66175598 | 106 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 107 | assert_param(IS_RCC_PERIPHCLK(PeriphClkInit->PeriphClockSelection)); |
mbed_official | 237:f3da66175598 | 108 | |
mbed_official | 237:f3da66175598 | 109 | |
mbed_official | 237:f3da66175598 | 110 | /*---------------------------- RTC configuration -------------------------------*/ |
mbed_official | 237:f3da66175598 | 111 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_RTC) == (RCC_PERIPHCLK_RTC)) |
mbed_official | 237:f3da66175598 | 112 | { |
mbed_official | 237:f3da66175598 | 113 | /* Enable Power Clock*/ |
mbed_official | 237:f3da66175598 | 114 | __PWR_CLK_ENABLE(); |
mbed_official | 237:f3da66175598 | 115 | |
mbed_official | 237:f3da66175598 | 116 | /* Enable write access to Backup domain */ |
mbed_official | 237:f3da66175598 | 117 | SET_BIT(PWR->CR, PWR_CR_DBP); |
mbed_official | 237:f3da66175598 | 118 | |
mbed_official | 237:f3da66175598 | 119 | /* Wait for Backup domain Write protection disable */ |
mbed_official | 237:f3da66175598 | 120 | tickstart = HAL_GetTick(); |
mbed_official | 237:f3da66175598 | 121 | |
mbed_official | 237:f3da66175598 | 122 | while((PWR->CR & PWR_CR_DBP) == RESET) |
mbed_official | 237:f3da66175598 | 123 | { |
mbed_official | 237:f3da66175598 | 124 | if((HAL_GetTick()-tickstart) > DBP_TIMEOUT_VALUE) |
mbed_official | 237:f3da66175598 | 125 | { |
mbed_official | 237:f3da66175598 | 126 | return HAL_TIMEOUT; |
mbed_official | 237:f3da66175598 | 127 | } |
mbed_official | 237:f3da66175598 | 128 | } |
mbed_official | 237:f3da66175598 | 129 | |
mbed_official | 237:f3da66175598 | 130 | /* Reset the Backup domain only if the RTC Clock source selction is modified */ |
mbed_official | 237:f3da66175598 | 131 | if((RCC->BDCR & RCC_BDCR_RTCSEL) != (PeriphClkInit->RTCClockSelection & RCC_BDCR_RTCSEL)) |
mbed_official | 237:f3da66175598 | 132 | { |
mbed_official | 237:f3da66175598 | 133 | /* Store the content of BDCR register before the reset of Backup Domain */ |
mbed_official | 237:f3da66175598 | 134 | tmpreg = (RCC->BDCR & ~(RCC_BDCR_RTCSEL)); |
mbed_official | 237:f3da66175598 | 135 | /* RTC Clock selection can be changed only if the Backup Domain is reset */ |
mbed_official | 237:f3da66175598 | 136 | __HAL_RCC_BACKUPRESET_FORCE(); |
mbed_official | 237:f3da66175598 | 137 | __HAL_RCC_BACKUPRESET_RELEASE(); |
mbed_official | 237:f3da66175598 | 138 | /* Restore the Content of BDCR register */ |
mbed_official | 237:f3da66175598 | 139 | RCC->BDCR = tmpreg; |
mbed_official | 237:f3da66175598 | 140 | } |
mbed_official | 237:f3da66175598 | 141 | |
mbed_official | 237:f3da66175598 | 142 | /* If LSE is selected as RTC clock source, wait for LSE reactivation */ |
mbed_official | 237:f3da66175598 | 143 | if(PeriphClkInit->RTCClockSelection == RCC_RTCCLKSOURCE_LSE) |
mbed_official | 237:f3da66175598 | 144 | { |
mbed_official | 237:f3da66175598 | 145 | /* Get timeout */ |
mbed_official | 237:f3da66175598 | 146 | tickstart = HAL_GetTick(); |
mbed_official | 237:f3da66175598 | 147 | |
mbed_official | 237:f3da66175598 | 148 | /* Wait till LSE is ready */ |
mbed_official | 237:f3da66175598 | 149 | while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) |
mbed_official | 237:f3da66175598 | 150 | { |
mbed_official | 237:f3da66175598 | 151 | if((HAL_GetTick()-tickstart) > LSE_TIMEOUT_VALUE) |
mbed_official | 237:f3da66175598 | 152 | { |
mbed_official | 237:f3da66175598 | 153 | return HAL_TIMEOUT; |
mbed_official | 237:f3da66175598 | 154 | } |
mbed_official | 237:f3da66175598 | 155 | } |
mbed_official | 237:f3da66175598 | 156 | } |
mbed_official | 237:f3da66175598 | 157 | __HAL_RCC_RTC_CONFIG(PeriphClkInit->RTCClockSelection); |
mbed_official | 237:f3da66175598 | 158 | } |
mbed_official | 237:f3da66175598 | 159 | |
mbed_official | 237:f3da66175598 | 160 | /*------------------------------- USART1 Configuration ------------------------*/ |
mbed_official | 237:f3da66175598 | 161 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) |
mbed_official | 237:f3da66175598 | 162 | { |
mbed_official | 237:f3da66175598 | 163 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 164 | assert_param(IS_RCC_USART1CLKSOURCE(PeriphClkInit->Usart1ClockSelection)); |
mbed_official | 237:f3da66175598 | 165 | |
mbed_official | 237:f3da66175598 | 166 | /* Configure the USART1 clock source */ |
mbed_official | 237:f3da66175598 | 167 | __HAL_RCC_USART1_CONFIG(PeriphClkInit->Usart1ClockSelection); |
mbed_official | 237:f3da66175598 | 168 | } |
mbed_official | 237:f3da66175598 | 169 | |
mbed_official | 237:f3da66175598 | 170 | /*----------------------------- USART2 Configuration --------------------------*/ |
mbed_official | 237:f3da66175598 | 171 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) |
mbed_official | 237:f3da66175598 | 172 | { |
mbed_official | 237:f3da66175598 | 173 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 174 | assert_param(IS_RCC_USART2CLKSOURCE(PeriphClkInit->Usart2ClockSelection)); |
mbed_official | 237:f3da66175598 | 175 | |
mbed_official | 237:f3da66175598 | 176 | /* Configure the USART2 clock source */ |
mbed_official | 237:f3da66175598 | 177 | __HAL_RCC_USART2_CONFIG(PeriphClkInit->Usart2ClockSelection); |
mbed_official | 237:f3da66175598 | 178 | } |
mbed_official | 237:f3da66175598 | 179 | |
mbed_official | 237:f3da66175598 | 180 | /*------------------------------ USART3 Configuration ------------------------*/ |
mbed_official | 237:f3da66175598 | 181 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) |
mbed_official | 237:f3da66175598 | 182 | { |
mbed_official | 237:f3da66175598 | 183 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 184 | assert_param(IS_RCC_USART3CLKSOURCE(PeriphClkInit->Usart3ClockSelection)); |
mbed_official | 237:f3da66175598 | 185 | |
mbed_official | 237:f3da66175598 | 186 | /* Configure the USART3 clock source */ |
mbed_official | 237:f3da66175598 | 187 | __HAL_RCC_USART3_CONFIG(PeriphClkInit->Usart3ClockSelection); |
mbed_official | 237:f3da66175598 | 188 | } |
mbed_official | 237:f3da66175598 | 189 | |
mbed_official | 237:f3da66175598 | 190 | /*------------------------------ I2C1 Configuration ------------------------*/ |
mbed_official | 237:f3da66175598 | 191 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) |
mbed_official | 237:f3da66175598 | 192 | { |
mbed_official | 237:f3da66175598 | 193 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 194 | assert_param(IS_RCC_I2C1CLKSOURCE(PeriphClkInit->I2c1ClockSelection)); |
mbed_official | 237:f3da66175598 | 195 | |
mbed_official | 237:f3da66175598 | 196 | /* Configure the I2C1 clock source */ |
mbed_official | 237:f3da66175598 | 197 | __HAL_RCC_I2C1_CONFIG(PeriphClkInit->I2c1ClockSelection); |
mbed_official | 237:f3da66175598 | 198 | } |
mbed_official | 237:f3da66175598 | 199 | |
mbed_official | 237:f3da66175598 | 200 | #if defined(STM32F302x8) || defined(STM32F302xC) || \ |
mbed_official | 237:f3da66175598 | 201 | defined(STM32F303xC) || defined(STM32F373xC) |
mbed_official | 237:f3da66175598 | 202 | |
mbed_official | 237:f3da66175598 | 203 | /*------------------------------ USB Configuration ------------------------*/ |
mbed_official | 237:f3da66175598 | 204 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB) |
mbed_official | 237:f3da66175598 | 205 | { |
mbed_official | 237:f3da66175598 | 206 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 207 | assert_param(IS_RCC_USBCLKSOURCE(PeriphClkInit->USBClockSelection)); |
mbed_official | 237:f3da66175598 | 208 | |
mbed_official | 237:f3da66175598 | 209 | /* Configure the USB clock source */ |
mbed_official | 237:f3da66175598 | 210 | __HAL_RCC_USB_CONFIG(PeriphClkInit->USBClockSelection); |
mbed_official | 237:f3da66175598 | 211 | } |
mbed_official | 237:f3da66175598 | 212 | |
mbed_official | 237:f3da66175598 | 213 | #endif /* STM32F302x8 || STM32F302xC || */ |
mbed_official | 237:f3da66175598 | 214 | /* STM32F303xC || STM32F373xC */ |
mbed_official | 237:f3da66175598 | 215 | |
mbed_official | 237:f3da66175598 | 216 | #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) || \ |
mbed_official | 237:f3da66175598 | 217 | defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \ |
mbed_official | 237:f3da66175598 | 218 | defined(STM32F373xC) || defined(STM32F378xx) |
mbed_official | 237:f3da66175598 | 219 | |
mbed_official | 237:f3da66175598 | 220 | /*------------------------------ I2C2 Configuration ------------------------*/ |
mbed_official | 237:f3da66175598 | 221 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) |
mbed_official | 237:f3da66175598 | 222 | { |
mbed_official | 237:f3da66175598 | 223 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 224 | assert_param(IS_RCC_I2C2CLKSOURCE(PeriphClkInit->I2c2ClockSelection)); |
mbed_official | 237:f3da66175598 | 225 | |
mbed_official | 237:f3da66175598 | 226 | /* Configure the I2C2 clock source */ |
mbed_official | 237:f3da66175598 | 227 | __HAL_RCC_I2C2_CONFIG(PeriphClkInit->I2c2ClockSelection); |
mbed_official | 237:f3da66175598 | 228 | } |
mbed_official | 237:f3da66175598 | 229 | |
mbed_official | 237:f3da66175598 | 230 | #endif |
mbed_official | 237:f3da66175598 | 231 | |
mbed_official | 237:f3da66175598 | 232 | #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) |
mbed_official | 237:f3da66175598 | 233 | |
mbed_official | 237:f3da66175598 | 234 | /*------------------------------ I2C3 Configuration ------------------------*/ |
mbed_official | 237:f3da66175598 | 235 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) |
mbed_official | 237:f3da66175598 | 236 | { |
mbed_official | 237:f3da66175598 | 237 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 238 | assert_param(IS_RCC_I2C3CLKSOURCE(PeriphClkInit->I2c3ClockSelection)); |
mbed_official | 237:f3da66175598 | 239 | |
mbed_official | 237:f3da66175598 | 240 | /* Configure the I2C3 clock source */ |
mbed_official | 237:f3da66175598 | 241 | __HAL_RCC_I2C3_CONFIG(PeriphClkInit->I2c3ClockSelection); |
mbed_official | 237:f3da66175598 | 242 | } |
mbed_official | 237:f3da66175598 | 243 | |
mbed_official | 237:f3da66175598 | 244 | #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */ |
mbed_official | 237:f3da66175598 | 245 | |
mbed_official | 237:f3da66175598 | 246 | #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 247 | |
mbed_official | 237:f3da66175598 | 248 | /*------------------------------ UART4 Configuration ------------------------*/ |
mbed_official | 237:f3da66175598 | 249 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) |
mbed_official | 237:f3da66175598 | 250 | { |
mbed_official | 237:f3da66175598 | 251 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 252 | assert_param(IS_RCC_UART4CLKSOURCE(PeriphClkInit->Uart4ClockSelection)); |
mbed_official | 237:f3da66175598 | 253 | |
mbed_official | 237:f3da66175598 | 254 | /* Configure the UART4 clock source */ |
mbed_official | 237:f3da66175598 | 255 | __HAL_RCC_UART4_CONFIG(PeriphClkInit->Uart4ClockSelection); |
mbed_official | 237:f3da66175598 | 256 | } |
mbed_official | 237:f3da66175598 | 257 | |
mbed_official | 237:f3da66175598 | 258 | /*------------------------------ UART5 Configuration ------------------------*/ |
mbed_official | 237:f3da66175598 | 259 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) |
mbed_official | 237:f3da66175598 | 260 | { |
mbed_official | 237:f3da66175598 | 261 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 262 | assert_param(IS_RCC_UART5CLKSOURCE(PeriphClkInit->Uart5ClockSelection)); |
mbed_official | 237:f3da66175598 | 263 | |
mbed_official | 237:f3da66175598 | 264 | /* Configure the UART5 clock source */ |
mbed_official | 237:f3da66175598 | 265 | __HAL_RCC_UART5_CONFIG(PeriphClkInit->Uart5ClockSelection); |
mbed_official | 237:f3da66175598 | 266 | } |
mbed_official | 237:f3da66175598 | 267 | |
mbed_official | 237:f3da66175598 | 268 | #endif /* STM32F302xC || STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 269 | |
mbed_official | 237:f3da66175598 | 270 | #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) || \ |
mbed_official | 237:f3da66175598 | 271 | defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 272 | |
mbed_official | 237:f3da66175598 | 273 | /*------------------------------ I2S Configuration ------------------------*/ |
mbed_official | 237:f3da66175598 | 274 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) |
mbed_official | 237:f3da66175598 | 275 | { |
mbed_official | 237:f3da66175598 | 276 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 277 | assert_param(IS_RCC_I2SCLKSOURCE(PeriphClkInit->I2sClockSelection)); |
mbed_official | 237:f3da66175598 | 278 | |
mbed_official | 237:f3da66175598 | 279 | /* Configure the I2S clock source */ |
mbed_official | 237:f3da66175598 | 280 | __HAL_RCC_I2S_CONFIG(PeriphClkInit->I2sClockSelection); |
mbed_official | 237:f3da66175598 | 281 | } |
mbed_official | 237:f3da66175598 | 282 | |
mbed_official | 237:f3da66175598 | 283 | #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx || STM32F302xC || STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 284 | |
mbed_official | 237:f3da66175598 | 285 | #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) |
mbed_official | 237:f3da66175598 | 286 | |
mbed_official | 237:f3da66175598 | 287 | /*------------------------------ ADC1 clock Configuration ------------------*/ |
mbed_official | 237:f3da66175598 | 288 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_ADC1) == RCC_PERIPHCLK_ADC1) |
mbed_official | 237:f3da66175598 | 289 | { |
mbed_official | 237:f3da66175598 | 290 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 291 | assert_param(IS_RCC_ADC1PLLCLK_DIV(PeriphClkInit->Adc1ClockSelection)); |
mbed_official | 237:f3da66175598 | 292 | |
mbed_official | 237:f3da66175598 | 293 | /* Configure the ADC1 clock source */ |
mbed_official | 237:f3da66175598 | 294 | __HAL_RCC_ADC1_CONFIG(PeriphClkInit->Adc1ClockSelection); |
mbed_official | 237:f3da66175598 | 295 | } |
mbed_official | 237:f3da66175598 | 296 | |
mbed_official | 237:f3da66175598 | 297 | #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */ |
mbed_official | 237:f3da66175598 | 298 | |
mbed_official | 237:f3da66175598 | 299 | #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \ |
mbed_official | 237:f3da66175598 | 300 | defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) |
mbed_official | 237:f3da66175598 | 301 | |
mbed_official | 237:f3da66175598 | 302 | /*------------------------------ ADC1 & ADC2 clock Configuration -------------*/ |
mbed_official | 237:f3da66175598 | 303 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_ADC12) == RCC_PERIPHCLK_ADC12) |
mbed_official | 237:f3da66175598 | 304 | { |
mbed_official | 237:f3da66175598 | 305 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 306 | assert_param(IS_RCC_ADC12PLLCLK_DIV(PeriphClkInit->Adc12ClockSelection)); |
mbed_official | 237:f3da66175598 | 307 | |
mbed_official | 237:f3da66175598 | 308 | /* Configure the ADC12 clock source */ |
mbed_official | 237:f3da66175598 | 309 | __HAL_RCC_ADC12_CONFIG(PeriphClkInit->Adc12ClockSelection); |
mbed_official | 237:f3da66175598 | 310 | } |
mbed_official | 237:f3da66175598 | 311 | |
mbed_official | 237:f3da66175598 | 312 | #endif /* STM32F302xC || STM32F303xC || STM32F358xx || */ |
mbed_official | 237:f3da66175598 | 313 | /* STM32F303x8 || STM32F334x8 || STM32F328xx */ |
mbed_official | 237:f3da66175598 | 314 | |
mbed_official | 237:f3da66175598 | 315 | #if defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 316 | |
mbed_official | 237:f3da66175598 | 317 | /*------------------------------ ADC3 & ADC4 clock Configuration -------------*/ |
mbed_official | 237:f3da66175598 | 318 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_ADC34) == RCC_PERIPHCLK_ADC34) |
mbed_official | 237:f3da66175598 | 319 | { |
mbed_official | 237:f3da66175598 | 320 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 321 | assert_param(IS_RCC_ADC34PLLCLK_DIV(PeriphClkInit->Adc34ClockSelection)); |
mbed_official | 237:f3da66175598 | 322 | |
mbed_official | 237:f3da66175598 | 323 | /* Configure the ADC34 clock source */ |
mbed_official | 237:f3da66175598 | 324 | __HAL_RCC_ADC34_CONFIG(PeriphClkInit->Adc34ClockSelection); |
mbed_official | 237:f3da66175598 | 325 | } |
mbed_official | 237:f3da66175598 | 326 | |
mbed_official | 237:f3da66175598 | 327 | #endif /* STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 328 | |
mbed_official | 237:f3da66175598 | 329 | #if defined(STM32F373xC) || defined(STM32F378xx) |
mbed_official | 237:f3da66175598 | 330 | |
mbed_official | 237:f3da66175598 | 331 | /*------------------------------ ADC1 clock Configuration ------------------*/ |
mbed_official | 237:f3da66175598 | 332 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_ADC1) == RCC_PERIPHCLK_ADC1) |
mbed_official | 237:f3da66175598 | 333 | { |
mbed_official | 237:f3da66175598 | 334 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 335 | assert_param(IS_RCC_ADC1PCLK2_DIV(PeriphClkInit->Adc1ClockSelection)); |
mbed_official | 237:f3da66175598 | 336 | |
mbed_official | 237:f3da66175598 | 337 | /* Configure the ADC1 clock source */ |
mbed_official | 237:f3da66175598 | 338 | __HAL_RCC_ADC1_CONFIG(PeriphClkInit->Adc1ClockSelection); |
mbed_official | 237:f3da66175598 | 339 | } |
mbed_official | 237:f3da66175598 | 340 | |
mbed_official | 237:f3da66175598 | 341 | #endif /* STM32F373xC || STM32F378xx */ |
mbed_official | 237:f3da66175598 | 342 | |
mbed_official | 237:f3da66175598 | 343 | #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) || \ |
mbed_official | 237:f3da66175598 | 344 | defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \ |
mbed_official | 237:f3da66175598 | 345 | defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) |
mbed_official | 237:f3da66175598 | 346 | |
mbed_official | 237:f3da66175598 | 347 | /*------------------------------ TIM1 clock Configuration ----------------*/ |
mbed_official | 237:f3da66175598 | 348 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_TIM1) == RCC_PERIPHCLK_TIM1) |
mbed_official | 237:f3da66175598 | 349 | { |
mbed_official | 237:f3da66175598 | 350 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 351 | assert_param(IS_RCC_TIM1CLKSOURCE(PeriphClkInit->Tim1ClockSelection)); |
mbed_official | 237:f3da66175598 | 352 | |
mbed_official | 237:f3da66175598 | 353 | /* Configure the TIM1 clock source */ |
mbed_official | 237:f3da66175598 | 354 | __HAL_RCC_TIM1_CONFIG(PeriphClkInit->Tim1ClockSelection); |
mbed_official | 237:f3da66175598 | 355 | } |
mbed_official | 237:f3da66175598 | 356 | |
mbed_official | 237:f3da66175598 | 357 | #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx || */ |
mbed_official | 237:f3da66175598 | 358 | /* STM32F302xC || STM32F303xC || STM32F358xx || */ |
mbed_official | 237:f3da66175598 | 359 | /* STM32F303x8 || STM32F334x8 || STM32F328xx */ |
mbed_official | 237:f3da66175598 | 360 | |
mbed_official | 237:f3da66175598 | 361 | #if defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 362 | |
mbed_official | 237:f3da66175598 | 363 | /*------------------------------ TIM8 clock Configuration ----------------*/ |
mbed_official | 237:f3da66175598 | 364 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_TIM8) == RCC_PERIPHCLK_TIM8) |
mbed_official | 237:f3da66175598 | 365 | { |
mbed_official | 237:f3da66175598 | 366 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 367 | assert_param(IS_RCC_TIM8CLKSOURCE(PeriphClkInit->Tim8ClockSelection)); |
mbed_official | 237:f3da66175598 | 368 | |
mbed_official | 237:f3da66175598 | 369 | /* Configure the TIM8 clock source */ |
mbed_official | 237:f3da66175598 | 370 | __HAL_RCC_TIM8_CONFIG(PeriphClkInit->Tim8ClockSelection); |
mbed_official | 237:f3da66175598 | 371 | } |
mbed_official | 237:f3da66175598 | 372 | |
mbed_official | 237:f3da66175598 | 373 | #endif /* STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 374 | |
mbed_official | 237:f3da66175598 | 375 | #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) |
mbed_official | 237:f3da66175598 | 376 | |
mbed_official | 237:f3da66175598 | 377 | /*------------------------------ TIM15 clock Configuration ----------------*/ |
mbed_official | 237:f3da66175598 | 378 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_TIM15) == RCC_PERIPHCLK_TIM15) |
mbed_official | 237:f3da66175598 | 379 | { |
mbed_official | 237:f3da66175598 | 380 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 381 | assert_param(IS_RCC_TIM15CLKSOURCE(PeriphClkInit->Tim15ClockSelection)); |
mbed_official | 237:f3da66175598 | 382 | |
mbed_official | 237:f3da66175598 | 383 | /* Configure the TIM15 clock source */ |
mbed_official | 237:f3da66175598 | 384 | __HAL_RCC_TIM15_CONFIG(PeriphClkInit->Tim15ClockSelection); |
mbed_official | 237:f3da66175598 | 385 | } |
mbed_official | 237:f3da66175598 | 386 | |
mbed_official | 237:f3da66175598 | 387 | /*------------------------------ TIM16 clock Configuration ----------------*/ |
mbed_official | 237:f3da66175598 | 388 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_TIM16) == RCC_PERIPHCLK_TIM16) |
mbed_official | 237:f3da66175598 | 389 | { |
mbed_official | 237:f3da66175598 | 390 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 391 | assert_param(IS_RCC_TIM16CLKSOURCE(PeriphClkInit->Tim16ClockSelection)); |
mbed_official | 237:f3da66175598 | 392 | |
mbed_official | 237:f3da66175598 | 393 | /* Configure the TIM16 clock source */ |
mbed_official | 237:f3da66175598 | 394 | __HAL_RCC_TIM16_CONFIG(PeriphClkInit->Tim16ClockSelection); |
mbed_official | 237:f3da66175598 | 395 | } |
mbed_official | 237:f3da66175598 | 396 | |
mbed_official | 237:f3da66175598 | 397 | /*------------------------------ TIM17 clock Configuration ----------------*/ |
mbed_official | 237:f3da66175598 | 398 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_TIM17) == RCC_PERIPHCLK_TIM17) |
mbed_official | 237:f3da66175598 | 399 | { |
mbed_official | 237:f3da66175598 | 400 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 401 | assert_param(IS_RCC_TIM17CLKSOURCE(PeriphClkInit->Tim17ClockSelection)); |
mbed_official | 237:f3da66175598 | 402 | |
mbed_official | 237:f3da66175598 | 403 | /* Configure the TIM17 clock source */ |
mbed_official | 237:f3da66175598 | 404 | __HAL_RCC_TIM17_CONFIG(PeriphClkInit->Tim17ClockSelection); |
mbed_official | 237:f3da66175598 | 405 | } |
mbed_official | 237:f3da66175598 | 406 | |
mbed_official | 237:f3da66175598 | 407 | #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */ |
mbed_official | 237:f3da66175598 | 408 | |
mbed_official | 237:f3da66175598 | 409 | #if defined(STM32F334x8) |
mbed_official | 237:f3da66175598 | 410 | |
mbed_official | 237:f3da66175598 | 411 | /*------------------------------ HRTIM1 clock Configuration ----------------*/ |
mbed_official | 237:f3da66175598 | 412 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_HRTIM1) == RCC_PERIPHCLK_HRTIM1) |
mbed_official | 237:f3da66175598 | 413 | { |
mbed_official | 237:f3da66175598 | 414 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 415 | assert_param(IS_RCC_HRTIM1CLKSOURCE(PeriphClkInit->Hrtim1ClockSelection)); |
mbed_official | 237:f3da66175598 | 416 | |
mbed_official | 237:f3da66175598 | 417 | /* Configure the HRTIM1 clock source */ |
mbed_official | 237:f3da66175598 | 418 | __HAL_RCC_HRTIM1_CONFIG(PeriphClkInit->Hrtim1ClockSelection); |
mbed_official | 237:f3da66175598 | 419 | } |
mbed_official | 237:f3da66175598 | 420 | |
mbed_official | 237:f3da66175598 | 421 | #endif /* STM32F334x8 */ |
mbed_official | 237:f3da66175598 | 422 | |
mbed_official | 237:f3da66175598 | 423 | #if defined(STM32F373xC) || defined(STM32F378xx) |
mbed_official | 237:f3da66175598 | 424 | |
mbed_official | 237:f3da66175598 | 425 | /*------------------------------ SDADC clock Configuration -------------------*/ |
mbed_official | 237:f3da66175598 | 426 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_SDADC) == RCC_PERIPHCLK_SDADC) |
mbed_official | 237:f3da66175598 | 427 | { |
mbed_official | 237:f3da66175598 | 428 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 429 | assert_param(IS_RCC_SDADCSYSCLK_DIV(PeriphClkInit->SdadcClockSelection)); |
mbed_official | 237:f3da66175598 | 430 | |
mbed_official | 237:f3da66175598 | 431 | /* Configure the SDADC clock prescaler */ |
mbed_official | 237:f3da66175598 | 432 | __HAL_RCC_SDADC_CONFIG(PeriphClkInit->SdadcClockSelection); |
mbed_official | 237:f3da66175598 | 433 | } |
mbed_official | 237:f3da66175598 | 434 | |
mbed_official | 237:f3da66175598 | 435 | /*------------------------------ CEC clock Configuration -------------------*/ |
mbed_official | 237:f3da66175598 | 436 | if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_CEC) == RCC_PERIPHCLK_CEC) |
mbed_official | 237:f3da66175598 | 437 | { |
mbed_official | 237:f3da66175598 | 438 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 439 | assert_param(IS_RCC_CECCLKSOURCE(PeriphClkInit->CecClockSelection)); |
mbed_official | 237:f3da66175598 | 440 | |
mbed_official | 237:f3da66175598 | 441 | /* Configure the CEC clock source */ |
mbed_official | 237:f3da66175598 | 442 | __HAL_RCC_CEC_CONFIG(PeriphClkInit->CecClockSelection); |
mbed_official | 237:f3da66175598 | 443 | } |
mbed_official | 237:f3da66175598 | 444 | |
mbed_official | 237:f3da66175598 | 445 | #endif /* STM32F373xC || STM32F378xx */ |
mbed_official | 237:f3da66175598 | 446 | |
mbed_official | 237:f3da66175598 | 447 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 448 | } |
mbed_official | 237:f3da66175598 | 449 | |
mbed_official | 237:f3da66175598 | 450 | /** |
mbed_official | 237:f3da66175598 | 451 | * @brief Get the RCC_ClkInitStruct according to the internal |
mbed_official | 237:f3da66175598 | 452 | * RCC configuration registers. |
mbed_official | 237:f3da66175598 | 453 | * @param PeriphClkInit: pointer to an RCC_PeriphCLKInitTypeDef structure that |
mbed_official | 237:f3da66175598 | 454 | * returns the configuration information for the Extended Peripherals clocks |
mbed_official | 237:f3da66175598 | 455 | * (ADC, CEC, I2C, I2S, SDADC, HRTIM, TIM, USART, RTC and USB clocks). |
mbed_official | 237:f3da66175598 | 456 | * @retval None |
mbed_official | 237:f3da66175598 | 457 | */ |
mbed_official | 237:f3da66175598 | 458 | void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) |
mbed_official | 237:f3da66175598 | 459 | { |
mbed_official | 237:f3da66175598 | 460 | /* Set all possible values for the extended clock type parameter------------*/ |
mbed_official | 237:f3da66175598 | 461 | /* Common part first */ |
mbed_official | 237:f3da66175598 | 462 | PeriphClkInit->PeriphClockSelection = RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_USART2 | RCC_PERIPHCLK_USART3 | \ |
mbed_official | 237:f3da66175598 | 463 | RCC_PERIPHCLK_I2C1 | RCC_PERIPHCLK_RTC; |
mbed_official | 237:f3da66175598 | 464 | |
mbed_official | 237:f3da66175598 | 465 | /* Get the RTC configuration --------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 466 | PeriphClkInit->RTCClockSelection = __HAL_RCC_GET_RTC_SOURCE(); |
mbed_official | 237:f3da66175598 | 467 | /* Get the USART1 clock configuration --------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 468 | PeriphClkInit->Usart1ClockSelection = __HAL_RCC_GET_USART1_SOURCE(); |
mbed_official | 237:f3da66175598 | 469 | /* Get the USART2 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 470 | PeriphClkInit->Usart2ClockSelection = __HAL_RCC_GET_USART2_SOURCE(); |
mbed_official | 237:f3da66175598 | 471 | /* Get the USART3 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 472 | PeriphClkInit->Usart3ClockSelection = __HAL_RCC_GET_USART3_SOURCE(); |
mbed_official | 237:f3da66175598 | 473 | /* Get the I2C1 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 474 | PeriphClkInit->I2c1ClockSelection = __HAL_RCC_GET_I2C1_SOURCE(); |
mbed_official | 237:f3da66175598 | 475 | |
mbed_official | 237:f3da66175598 | 476 | #if defined(STM32F302x8) || defined(STM32F302xC) || \ |
mbed_official | 237:f3da66175598 | 477 | defined(STM32F303xC) || defined(STM32F373xC) |
mbed_official | 237:f3da66175598 | 478 | |
mbed_official | 237:f3da66175598 | 479 | PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_USB; |
mbed_official | 237:f3da66175598 | 480 | /* Get the USB clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 481 | PeriphClkInit->USBClockSelection = __HAL_RCC_GET_USB_SOURCE(); |
mbed_official | 237:f3da66175598 | 482 | |
mbed_official | 237:f3da66175598 | 483 | #endif /* STM32F302x8 || STM32F302xC || */ |
mbed_official | 237:f3da66175598 | 484 | /* STM32F303xC || STM32F373xC */ |
mbed_official | 237:f3da66175598 | 485 | |
mbed_official | 237:f3da66175598 | 486 | #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) || \ |
mbed_official | 237:f3da66175598 | 487 | defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \ |
mbed_official | 237:f3da66175598 | 488 | defined(STM32F373xC) || defined(STM32F378xx) |
mbed_official | 237:f3da66175598 | 489 | |
mbed_official | 237:f3da66175598 | 490 | PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_I2C2; |
mbed_official | 237:f3da66175598 | 491 | /* Get the I2C2 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 492 | PeriphClkInit->I2c2ClockSelection = __HAL_RCC_GET_I2C2_SOURCE(); |
mbed_official | 237:f3da66175598 | 493 | |
mbed_official | 237:f3da66175598 | 494 | #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx || STM32F302xC || STM32F303xC || STM32F358xx || */ |
mbed_official | 237:f3da66175598 | 495 | /* STM32F373xC || STM32F378xx */ |
mbed_official | 237:f3da66175598 | 496 | |
mbed_official | 237:f3da66175598 | 497 | #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) |
mbed_official | 237:f3da66175598 | 498 | |
mbed_official | 237:f3da66175598 | 499 | PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_I2C3; |
mbed_official | 237:f3da66175598 | 500 | /* Get the I2C3 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 501 | PeriphClkInit->I2c3ClockSelection = __HAL_RCC_GET_I2C3_SOURCE(); |
mbed_official | 237:f3da66175598 | 502 | |
mbed_official | 237:f3da66175598 | 503 | #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */ |
mbed_official | 237:f3da66175598 | 504 | |
mbed_official | 237:f3da66175598 | 505 | #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 506 | |
mbed_official | 237:f3da66175598 | 507 | PeriphClkInit->PeriphClockSelection |= (RCC_PERIPHCLK_UART4 | RCC_PERIPHCLK_UART5); |
mbed_official | 237:f3da66175598 | 508 | /* Get the UART4 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 509 | PeriphClkInit->Uart4ClockSelection = __HAL_RCC_GET_UART4_SOURCE(); |
mbed_official | 237:f3da66175598 | 510 | /* Get the UART5 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 511 | PeriphClkInit->Uart5ClockSelection = __HAL_RCC_GET_UART5_SOURCE(); |
mbed_official | 237:f3da66175598 | 512 | |
mbed_official | 237:f3da66175598 | 513 | #endif /* STM32F302xC || STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 514 | |
mbed_official | 237:f3da66175598 | 515 | #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) || \ |
mbed_official | 237:f3da66175598 | 516 | defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 517 | |
mbed_official | 237:f3da66175598 | 518 | PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_I2S; |
mbed_official | 237:f3da66175598 | 519 | /* Get the I2S clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 520 | PeriphClkInit->I2sClockSelection = __HAL_RCC_GET_I2S_SOURCE(); |
mbed_official | 237:f3da66175598 | 521 | |
mbed_official | 237:f3da66175598 | 522 | #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx || STM32F302xC || STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 523 | |
mbed_official | 237:f3da66175598 | 524 | #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) || \ |
mbed_official | 237:f3da66175598 | 525 | defined(STM32F373xC) || defined(STM32F378xx) |
mbed_official | 237:f3da66175598 | 526 | |
mbed_official | 237:f3da66175598 | 527 | PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_ADC1; |
mbed_official | 237:f3da66175598 | 528 | /* Get the ADC1 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 529 | PeriphClkInit->Adc1ClockSelection = __HAL_RCC_GET_ADC1_SOURCE(); |
mbed_official | 237:f3da66175598 | 530 | |
mbed_official | 237:f3da66175598 | 531 | #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx || STM32F373xC || STM32F378xx */ |
mbed_official | 237:f3da66175598 | 532 | |
mbed_official | 237:f3da66175598 | 533 | #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \ |
mbed_official | 237:f3da66175598 | 534 | defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) |
mbed_official | 237:f3da66175598 | 535 | |
mbed_official | 237:f3da66175598 | 536 | PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_ADC12; |
mbed_official | 237:f3da66175598 | 537 | /* Get the ADC1 & ADC2 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 538 | PeriphClkInit->Adc12ClockSelection = __HAL_RCC_GET_ADC12_SOURCE(); |
mbed_official | 237:f3da66175598 | 539 | |
mbed_official | 237:f3da66175598 | 540 | #endif /* STM32F302xC || STM32F303xC || STM32F358xx || */ |
mbed_official | 237:f3da66175598 | 541 | /* STM32F303x8 || STM32F334x8 || STM32F328xx */ |
mbed_official | 237:f3da66175598 | 542 | |
mbed_official | 237:f3da66175598 | 543 | #if defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 544 | |
mbed_official | 237:f3da66175598 | 545 | PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_ADC34; |
mbed_official | 237:f3da66175598 | 546 | /* Get the ADC3 & ADC4 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 547 | PeriphClkInit->Adc34ClockSelection = __HAL_RCC_GET_ADC34_SOURCE(); |
mbed_official | 237:f3da66175598 | 548 | |
mbed_official | 237:f3da66175598 | 549 | #endif /* STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 550 | |
mbed_official | 237:f3da66175598 | 551 | #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) || \ |
mbed_official | 237:f3da66175598 | 552 | defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \ |
mbed_official | 237:f3da66175598 | 553 | defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) |
mbed_official | 237:f3da66175598 | 554 | |
mbed_official | 237:f3da66175598 | 555 | PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_TIM1; |
mbed_official | 237:f3da66175598 | 556 | /* Get the TIM1 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 557 | PeriphClkInit->Tim1ClockSelection = __HAL_RCC_GET_TIM1_SOURCE(); |
mbed_official | 237:f3da66175598 | 558 | |
mbed_official | 237:f3da66175598 | 559 | #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx || */ |
mbed_official | 237:f3da66175598 | 560 | /* STM32F302xC || STM32F303xC || STM32F358xx || */ |
mbed_official | 237:f3da66175598 | 561 | /* STM32F303x8 || STM32F334x8 || STM32F328xx */ |
mbed_official | 237:f3da66175598 | 562 | |
mbed_official | 237:f3da66175598 | 563 | #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) |
mbed_official | 237:f3da66175598 | 564 | |
mbed_official | 237:f3da66175598 | 565 | PeriphClkInit->PeriphClockSelection |= (RCC_PERIPHCLK_TIM15 | RCC_PERIPHCLK_TIM16 | RCC_PERIPHCLK_TIM17); |
mbed_official | 237:f3da66175598 | 566 | /* Get the TIM15 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 567 | PeriphClkInit->Tim15ClockSelection = __HAL_RCC_GET_TIM15_SOURCE(); |
mbed_official | 237:f3da66175598 | 568 | /* Get the TIM16 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 569 | PeriphClkInit->Tim16ClockSelection = __HAL_RCC_GET_TIM16_SOURCE(); |
mbed_official | 237:f3da66175598 | 570 | /* Get the TIM17 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 571 | PeriphClkInit->Tim17ClockSelection = __HAL_RCC_GET_TIM17_SOURCE(); |
mbed_official | 237:f3da66175598 | 572 | |
mbed_official | 237:f3da66175598 | 573 | #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */ |
mbed_official | 237:f3da66175598 | 574 | |
mbed_official | 237:f3da66175598 | 575 | #if defined(STM32F303xC) || defined(STM32F358xx) |
mbed_official | 237:f3da66175598 | 576 | |
mbed_official | 237:f3da66175598 | 577 | PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_TIM8; |
mbed_official | 237:f3da66175598 | 578 | /* Get the TIM8 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 579 | PeriphClkInit->Tim8ClockSelection = __HAL_RCC_GET_TIM8_SOURCE(); |
mbed_official | 237:f3da66175598 | 580 | |
mbed_official | 237:f3da66175598 | 581 | #endif /* STM32F303xC || STM32F358xx */ |
mbed_official | 237:f3da66175598 | 582 | |
mbed_official | 237:f3da66175598 | 583 | #if defined(STM32F334x8) |
mbed_official | 237:f3da66175598 | 584 | |
mbed_official | 237:f3da66175598 | 585 | PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_HRTIM1; |
mbed_official | 237:f3da66175598 | 586 | /* Get the HRTIM1 clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 587 | PeriphClkInit->Hrtim1ClockSelection = __HAL_RCC_GET_HRTIM1_SOURCE(); |
mbed_official | 237:f3da66175598 | 588 | |
mbed_official | 237:f3da66175598 | 589 | #endif /* STM32F334x8 */ |
mbed_official | 237:f3da66175598 | 590 | |
mbed_official | 237:f3da66175598 | 591 | #if defined(STM32F373xC) || defined(STM32F378xx) |
mbed_official | 237:f3da66175598 | 592 | |
mbed_official | 237:f3da66175598 | 593 | PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_SDADC; |
mbed_official | 237:f3da66175598 | 594 | /* Get the SDADC clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 595 | PeriphClkInit->SdadcClockSelection = __HAL_RCC_GET_SDADC_SOURCE(); |
mbed_official | 237:f3da66175598 | 596 | |
mbed_official | 237:f3da66175598 | 597 | PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_CEC; |
mbed_official | 237:f3da66175598 | 598 | /* Get the CEC clock configuration -----------------------------------------*/ |
mbed_official | 237:f3da66175598 | 599 | PeriphClkInit->CecClockSelection = __HAL_RCC_GET_CEC_SOURCE(); |
mbed_official | 237:f3da66175598 | 600 | |
mbed_official | 237:f3da66175598 | 601 | #endif /* STM32F373xC || STM32F378xx */ |
mbed_official | 237:f3da66175598 | 602 | |
mbed_official | 237:f3da66175598 | 603 | } |
mbed_official | 237:f3da66175598 | 604 | |
mbed_official | 237:f3da66175598 | 605 | /** |
mbed_official | 237:f3da66175598 | 606 | * @} |
mbed_official | 237:f3da66175598 | 607 | */ |
mbed_official | 237:f3da66175598 | 608 | |
mbed_official | 237:f3da66175598 | 609 | /** |
mbed_official | 237:f3da66175598 | 610 | * @} |
mbed_official | 237:f3da66175598 | 611 | */ |
mbed_official | 237:f3da66175598 | 612 | |
mbed_official | 237:f3da66175598 | 613 | #endif /* HAL_RCC_MODULE_ENABLED */ |
mbed_official | 237:f3da66175598 | 614 | /** |
mbed_official | 237:f3da66175598 | 615 | * @} |
mbed_official | 237:f3da66175598 | 616 | */ |
mbed_official | 237:f3da66175598 | 617 | |
mbed_official | 237:f3da66175598 | 618 | /** |
mbed_official | 237:f3da66175598 | 619 | * @} |
mbed_official | 237:f3da66175598 | 620 | */ |
mbed_official | 237:f3da66175598 | 621 | |
mbed_official | 237:f3da66175598 | 622 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |