Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 5 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /** |
1 | /** |
| 2 | ****************************************************************************** |
2 | ****************************************************************************** |
| 3 | * @file stm32f1xx_hal_rcc.h |
3 | * @file stm32f1xx_hal_rcc.h |
| 4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
| 5 | * @version V1.0.1 |
5 | * @version V1.0.4 |
| 6 | * @date 31-July-2015 |
6 | * @date 29-April-2016 |
| 7 | * @brief Header file of RCC HAL module. |
7 | * @brief Header file of RCC HAL module. |
| 8 | ****************************************************************************** |
8 | ****************************************************************************** |
| 9 | * @attention |
9 | * @attention |
| 10 | * |
10 | * |
| 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
| 12 | * |
12 | * |
| 13 | * Redistribution and use in source and binary forms, with or without modification, |
13 | * Redistribution and use in source and binary forms, with or without modification, |
| 14 | * are permitted provided that the following conditions are met: |
14 | * are permitted provided that the following conditions are met: |
| 15 | * 1. Redistributions of source code must retain the above copyright notice, |
15 | * 1. Redistributions of source code must retain the above copyright notice, |
| 16 | * this list of conditions and the following disclaimer. |
16 | * this list of conditions and the following disclaimer. |
| Line 66... | Line 66... | ||
| 66 | #define RCC_DBP_TIMEOUT_VALUE ((uint32_t)100) /* 100 ms */ |
66 | #define RCC_DBP_TIMEOUT_VALUE ((uint32_t)100) /* 100 ms */ |
| 67 | /* LSE state change timeout */ |
67 | /* LSE state change timeout */ |
| 68 | #define RCC_LSE_TIMEOUT_VALUE LSE_STARTUP_TIMEOUT |
68 | #define RCC_LSE_TIMEOUT_VALUE LSE_STARTUP_TIMEOUT |
| 69 | #define CLOCKSWITCH_TIMEOUT_VALUE ((uint32_t)5000) /* 5 s */ |
69 | #define CLOCKSWITCH_TIMEOUT_VALUE ((uint32_t)5000) /* 5 s */ |
| 70 | #define HSE_TIMEOUT_VALUE HSE_STARTUP_TIMEOUT |
70 | #define HSE_TIMEOUT_VALUE HSE_STARTUP_TIMEOUT |
| 71 | #define HSI_TIMEOUT_VALUE ((uint32_t)100) /* 100 ms */ |
71 | #define HSI_TIMEOUT_VALUE ((uint32_t)2) /* 2 ms (minimum Tick + 1) */ |
| 72 | #define LSI_TIMEOUT_VALUE ((uint32_t)100) /* 100 ms */ |
72 | #define LSI_TIMEOUT_VALUE ((uint32_t)2) /* 2 ms (minimum Tick + 1) */ |
| 73 | #define PLL_TIMEOUT_VALUE ((uint32_t)100) /* 100 ms */ |
73 | #define PLL_TIMEOUT_VALUE ((uint32_t)2) /* 2 ms (minimum Tick + 1) */ |
| 74 | #define LSI_VALUE ((uint32_t)40000) /* 40kHz */ |
74 | #define LSI_VALUE ((uint32_t)40000) /* 40kHz */ |
| 75 | - | ||
| 76 | /** |
75 | /** |
| 77 | * @} |
76 | * @} |
| 78 | */ |
77 | */ |
| 79 | 78 | ||
| 80 | /** @defgroup RCC_Register_Offset Register offsets |
79 | /** @defgroup RCC_Register_Offset Register offsets |
| Line 244... | Line 243... | ||
| 244 | 243 | ||
| 245 | uint32_t PLLMUL; /*!< PLLMUL: Multiplication factor for PLL VCO input clock |
244 | uint32_t PLLMUL; /*!< PLLMUL: Multiplication factor for PLL VCO input clock |
| 246 | This parameter must be a value of @ref RCCEx_PLL_Multiplication_Factor */ |
245 | This parameter must be a value of @ref RCCEx_PLL_Multiplication_Factor */ |
| 247 | } RCC_PLLInitTypeDef; |
246 | } RCC_PLLInitTypeDef; |
| 248 | 247 | ||
| 249 | /** |
248 | /** |
| 250 | * @brief RCC System, AHB and APB busses clock configuration structure definition |
249 | * @brief RCC System, AHB and APB busses clock configuration structure definition |
| 251 | */ |
250 | */ |
| 252 | typedef struct |
251 | typedef struct |
| 253 | { |
252 | { |
| 254 | uint32_t ClockType; /*!< The clock to be configured. |
253 | uint32_t ClockType; /*!< The clock to be configured. |
| 255 | This parameter can be a value of @ref RCC_System_Clock_Type */ |
254 | This parameter can be a value of @ref RCC_System_Clock_Type */ |
| 256 | 255 | ||
| 257 | uint32_t SYSCLKSource; /*!< The clock source (SYSCLKS) used as system clock. |
256 | uint32_t SYSCLKSource; /*!< The clock source (SYSCLKS) used as system clock. |
| 258 | This parameter can be a value of @ref RCC_System_Clock_Source */ |
257 | This parameter can be a value of @ref RCC_System_Clock_Source */ |
| 259 | 258 | ||
| 260 | uint32_t AHBCLKDivider; /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK). |
259 | uint32_t AHBCLKDivider; /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK). |
| 261 | This parameter can be a value of @ref RCC_AHB_Clock_Source */ |
260 | This parameter can be a value of @ref RCC_AHB_Clock_Source */ |
| 262 | 261 | ||
| 263 | uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK). |
262 | uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK). |
| 264 | This parameter can be a value of @ref RCC_APB1_APB2_Clock_Source */ |
263 | This parameter can be a value of @ref RCC_APB1_APB2_Clock_Source */ |
| 265 | 264 | ||
| 266 | uint32_t APB2CLKDivider; /*!< The APB2 clock (PCLK2) divider. This clock is derived from the AHB clock (HCLK). |
265 | uint32_t APB2CLKDivider; /*!< The APB2 clock (PCLK2) divider. This clock is derived from the AHB clock (HCLK). |
| 267 | This parameter can be a value of @ref RCC_APB1_APB2_Clock_Source */ |
266 | This parameter can be a value of @ref RCC_APB1_APB2_Clock_Source */ |
| 268 | } RCC_ClkInitTypeDef; |
267 | } RCC_ClkInitTypeDef; |
| 269 | 268 | ||
| 270 | /** |
269 | /** |
| Line 321... | Line 320... | ||
| 321 | */ |
320 | */ |
| 322 | 321 | ||
| 323 | /** @defgroup RCC_HSI_Config HSI Config |
322 | /** @defgroup RCC_HSI_Config HSI Config |
| 324 | * @{ |
323 | * @{ |
| 325 | */ |
324 | */ |
| 326 | #define RCC_HSI_OFF ((uint32_t)0x00000000) /*!< HSI clock deactivation */ |
325 | #define RCC_HSI_OFF ((uint32_t)0x00000000) /*!< HSI clock deactivation */ |
| 327 | #define RCC_HSI_ON RCC_CR_HSION /*!< HSI clock activation */ |
326 | #define RCC_HSI_ON RCC_CR_HSION /*!< HSI clock activation */ |
| 328 | 327 | ||
| 329 | #define RCC_HSICALIBRATION_DEFAULT ((uint32_t)0x10) /* Default HSI calibration trimming value */ |
328 | #define RCC_HSICALIBRATION_DEFAULT ((uint32_t)0x10) /* Default HSI calibration trimming value */ |
| 330 | 329 | ||
| 331 | /** |
330 | /** |
| 332 | * @} |
331 | * @} |
| Line 419... | Line 418... | ||
| 419 | 418 | ||
| 420 | /** @defgroup RCC_RTC_Clock_Source RTC Clock Source |
419 | /** @defgroup RCC_RTC_Clock_Source RTC Clock Source |
| 421 | * @{ |
420 | * @{ |
| 422 | */ |
421 | */ |
| 423 | #define RCC_RTCCLKSOURCE_NO_CLK ((uint32_t)0x00000000) /*!< No clock */ |
422 | #define RCC_RTCCLKSOURCE_NO_CLK ((uint32_t)0x00000000) /*!< No clock */ |
| 424 | #define RCC_RTCCLKSOURCE_LSE RCC_BDCR_RTCSEL_LSE /*!< LSE oscillator clock used as RTC clock */ |
423 | #define RCC_RTCCLKSOURCE_LSE RCC_BDCR_RTCSEL_LSE /*!< LSE oscillator clock used as RTC clock */ |
| 425 | #define RCC_RTCCLKSOURCE_LSI RCC_BDCR_RTCSEL_LSI /*!< LSI oscillator clock used as RTC clock */ |
424 | #define RCC_RTCCLKSOURCE_LSI RCC_BDCR_RTCSEL_LSI /*!< LSI oscillator clock used as RTC clock */ |
| 426 | #define RCC_RTCCLKSOURCE_HSE_DIV128 RCC_BDCR_RTCSEL_HSE /*!< HSE oscillator clock divided by 128 used as RTC clock */ |
425 | #define RCC_RTCCLKSOURCE_HSE_DIV128 RCC_BDCR_RTCSEL_HSE /*!< HSE oscillator clock divided by 128 used as RTC clock */ |
| 427 | /** |
426 | /** |
| 428 | * @} |
427 | * @} |
| 429 | */ |
428 | */ |
| 430 | 429 | ||
| Line 449... | Line 448... | ||
| 449 | */ |
448 | */ |
| 450 | 449 | ||
| 451 | /** @defgroup RCC_Interrupt Interrupts |
450 | /** @defgroup RCC_Interrupt Interrupts |
| 452 | * @{ |
451 | * @{ |
| 453 | */ |
452 | */ |
| 454 | #define RCC_IT_LSIRDY ((uint8_t)RCC_CIR_LSIRDYF) /*!< LSI Ready Interrupt flag */ |
453 | #define RCC_IT_LSIRDY ((uint8_t)RCC_CIR_LSIRDYF) /*!< LSI Ready Interrupt flag */ |
| 455 | #define RCC_IT_LSERDY ((uint8_t)RCC_CIR_LSERDYF) /*!< LSE Ready Interrupt flag */ |
454 | #define RCC_IT_LSERDY ((uint8_t)RCC_CIR_LSERDYF) /*!< LSE Ready Interrupt flag */ |
| 456 | #define RCC_IT_HSIRDY ((uint8_t)RCC_CIR_HSIRDYF) /*!< HSI Ready Interrupt flag */ |
455 | #define RCC_IT_HSIRDY ((uint8_t)RCC_CIR_HSIRDYF) /*!< HSI Ready Interrupt flag */ |
| 457 | #define RCC_IT_HSERDY ((uint8_t)RCC_CIR_HSERDYF) /*!< HSE Ready Interrupt flag */ |
456 | #define RCC_IT_HSERDY ((uint8_t)RCC_CIR_HSERDYF) /*!< HSE Ready Interrupt flag */ |
| 458 | #define RCC_IT_PLLRDY ((uint8_t)RCC_CIR_PLLRDYF) /*!< PLL Ready Interrupt flag */ |
457 | #define RCC_IT_PLLRDY ((uint8_t)RCC_CIR_PLLRDYF) /*!< PLL Ready Interrupt flag */ |
| 459 | #define RCC_IT_CSS ((uint8_t)RCC_CIR_CSSF) /*!< Clock Security System Interrupt flag */ |
458 | #define RCC_IT_CSS ((uint8_t)RCC_CIR_CSSF) /*!< Clock Security System Interrupt flag */ |
| 460 | /** |
459 | /** |
| 461 | * @} |
460 | * @} |
| 462 | */ |
461 | */ |
| 463 | 462 | ||
| 464 | /** @defgroup RCC_Flag Flags |
463 | /** @defgroup RCC_Flag Flags |
| Line 475... | Line 474... | ||
| 475 | #define RCC_FLAG_HSERDY ((uint8_t)((CR_REG_INDEX << 5) | POSITION_VAL(RCC_CR_HSERDY))) /*!< External High Speed clock ready flag */ |
474 | #define RCC_FLAG_HSERDY ((uint8_t)((CR_REG_INDEX << 5) | POSITION_VAL(RCC_CR_HSERDY))) /*!< External High Speed clock ready flag */ |
| 476 | #define RCC_FLAG_PLLRDY ((uint8_t)((CR_REG_INDEX << 5) | POSITION_VAL(RCC_CR_PLLRDY))) /*!< PLL clock ready flag */ |
475 | #define RCC_FLAG_PLLRDY ((uint8_t)((CR_REG_INDEX << 5) | POSITION_VAL(RCC_CR_PLLRDY))) /*!< PLL clock ready flag */ |
| 477 | 476 | ||
| 478 | /* Flags in the CSR register */ |
477 | /* Flags in the CSR register */ |
| 479 | #define RCC_FLAG_LSIRDY ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_LSIRDY))) /*!< Internal Low Speed oscillator Ready */ |
478 | #define RCC_FLAG_LSIRDY ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_LSIRDY))) /*!< Internal Low Speed oscillator Ready */ |
| 480 | #define RCC_FLAG_RMV ((uint8_t)((CSR_REG_INDEX << 5) | RCC_RMVF_BIT_NUMBER)) /*!< Remove reset flag */ |
- | |
| 481 | #define RCC_FLAG_PINRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_PINRSTF))) /*!< PIN reset flag */ |
479 | #define RCC_FLAG_PINRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_PINRSTF))) /*!< PIN reset flag */ |
| 482 | #define RCC_FLAG_PORRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_PORRSTF))) /*!< POR/PDR reset flag */ |
480 | #define RCC_FLAG_PORRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_PORRSTF))) /*!< POR/PDR reset flag */ |
| 483 | #define RCC_FLAG_SFTRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_SFTRSTF))) /*!< Software Reset flag */ |
481 | #define RCC_FLAG_SFTRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_SFTRSTF))) /*!< Software Reset flag */ |
| 484 | #define RCC_FLAG_IWDGRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_IWDGRSTF))) /*!< Independent Watchdog reset flag */ |
482 | #define RCC_FLAG_IWDGRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_IWDGRSTF))) /*!< Independent Watchdog reset flag */ |
| 485 | #define RCC_FLAG_WWDGRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_WWDGRSTF))) /*!< Window watchdog reset flag */ |
483 | #define RCC_FLAG_WWDGRST ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_WWDGRSTF))) /*!< Window watchdog reset flag */ |
| Line 801... | Line 799... | ||
| 801 | 799 | ||
| 802 | /** @defgroup RCC_APB1_Force_Release_Reset APB1 Force Release Reset |
800 | /** @defgroup RCC_APB1_Force_Release_Reset APB1 Force Release Reset |
| 803 | * @brief Force or release APB1 peripheral reset. |
801 | * @brief Force or release APB1 peripheral reset. |
| 804 | * @{ |
802 | * @{ |
| 805 | */ |
803 | */ |
| 806 | #define __HAL_RCC_APB1_FORCE_RESET() (RCC->APB2RSTR = 0xFFFFFFFF) |
804 | #define __HAL_RCC_APB1_FORCE_RESET() (RCC->APB2RSTR = 0xFFFFFFFFU) |
| 807 | #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST)) |
805 | #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST)) |
| 808 | #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST)) |
806 | #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST)) |
| 809 | #define __HAL_RCC_WWDG_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_WWDGRST)) |
807 | #define __HAL_RCC_WWDG_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_WWDGRST)) |
| 810 | #define __HAL_RCC_USART2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART2RST)) |
808 | #define __HAL_RCC_USART2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART2RST)) |
| 811 | #define __HAL_RCC_I2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C1RST)) |
809 | #define __HAL_RCC_I2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C1RST)) |
| Line 829... | Line 827... | ||
| 829 | 827 | ||
| 830 | /** @defgroup RCC_APB2_Force_Release_Reset APB2 Force Release Reset |
828 | /** @defgroup RCC_APB2_Force_Release_Reset APB2 Force Release Reset |
| 831 | * @brief Force or release APB2 peripheral reset. |
829 | * @brief Force or release APB2 peripheral reset. |
| 832 | * @{ |
830 | * @{ |
| 833 | */ |
831 | */ |
| 834 | #define __HAL_RCC_APB2_FORCE_RESET() (RCC->APB2RSTR = 0xFFFFFFFF) |
832 | #define __HAL_RCC_APB2_FORCE_RESET() (RCC->APB2RSTR = 0xFFFFFFFFU) |
| 835 | #define __HAL_RCC_AFIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_AFIORST)) |
833 | #define __HAL_RCC_AFIO_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_AFIORST)) |
| 836 | #define __HAL_RCC_GPIOA_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPARST)) |
834 | #define __HAL_RCC_GPIOA_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPARST)) |
| 837 | #define __HAL_RCC_GPIOB_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPBRST)) |
835 | #define __HAL_RCC_GPIOB_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPBRST)) |
| 838 | #define __HAL_RCC_GPIOC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPCRST)) |
836 | #define __HAL_RCC_GPIOC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPCRST)) |
| 839 | #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPDRST)) |
837 | #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_IOPDRST)) |
| Line 926... | Line 924... | ||
| 926 | * is stable and can be used to clock the PLL and/or system clock. |
924 | * is stable and can be used to clock the PLL and/or system clock. |
| 927 | * @note HSE state can not be changed if it is used directly or through the |
925 | * @note HSE state can not be changed if it is used directly or through the |
| 928 | * PLL as system clock. In this case, you have to select another source |
926 | * PLL as system clock. In this case, you have to select another source |
| 929 | * of the system clock then change the HSE state (ex. disable it). |
927 | * of the system clock then change the HSE state (ex. disable it). |
| 930 | * @note The HSE is stopped by hardware when entering STOP and STANDBY modes. |
928 | * @note The HSE is stopped by hardware when entering STOP and STANDBY modes. |
| 931 | * @note This function reset the CSSON bit, so if the Clock security system(CSS) |
929 | * @note This function reset the CSSON bit, so if the clock security system(CSS) |
| 932 | * was previously enabled you have to enable it again after calling this |
930 | * was previously enabled you have to enable it again after calling this |
| 933 | * function. |
931 | * function. |
| 934 | * @param __STATE__ specifies the new state of the HSE. |
932 | * @param __STATE__ specifies the new state of the HSE. |
| 935 | * This parameter can be one of the following values: |
933 | * This parameter can be one of the following values: |
| 936 | * @arg RCC_HSE_OFF turn OFF the HSE oscillator, HSERDY flag goes low after |
934 | * @arg @ref RCC_HSE_OFF turn OFF the HSE oscillator, HSERDY flag goes low after |
| 937 | * 6 HSE oscillator clock cycles. |
935 | * 6 HSE oscillator clock cycles. |
| 938 | * @arg RCC_HSE_ON turn ON the HSE oscillator |
936 | * @arg @ref RCC_HSE_ON turn ON the HSE oscillator |
| 939 | * @arg RCC_HSE_BYPASS HSE oscillator bypassed with external clock |
937 | * @arg @ref RCC_HSE_BYPASS HSE oscillator bypassed with external clock |
| 940 | */ |
938 | */ |
| 941 | #define __HAL_RCC_HSE_CONFIG(__STATE__) \ |
939 | #define __HAL_RCC_HSE_CONFIG(__STATE__) \ |
| 942 | do{ \ |
940 | do{ \ |
| 943 | if ((__STATE__) == RCC_HSE_ON) \ |
941 | if ((__STATE__) == RCC_HSE_ON) \ |
| 944 | { \ |
942 | { \ |
| Line 979... | Line 977... | ||
| 979 | * @note After enabling the LSE (RCC_LSE_ON or RCC_LSE_BYPASS), the application |
977 | * @note After enabling the LSE (RCC_LSE_ON or RCC_LSE_BYPASS), the application |
| 980 | * software should wait on LSERDY flag to be set indicating that LSE clock |
978 | * software should wait on LSERDY flag to be set indicating that LSE clock |
| 981 | * is stable and can be used to clock the RTC. |
979 | * is stable and can be used to clock the RTC. |
| 982 | * @param __STATE__ specifies the new state of the LSE. |
980 | * @param __STATE__ specifies the new state of the LSE. |
| 983 | * This parameter can be one of the following values: |
981 | * This parameter can be one of the following values: |
| 984 | * @arg RCC_LSE_OFF turn OFF the LSE oscillator, LSERDY flag goes low after |
982 | * @arg @ref RCC_LSE_OFF turn OFF the LSE oscillator, LSERDY flag goes low after |
| 985 | * 6 LSE oscillator clock cycles. |
983 | * 6 LSE oscillator clock cycles. |
| 986 | * @arg RCC_LSE_ON turn ON the LSE oscillator. |
984 | * @arg @ref RCC_LSE_ON turn ON the LSE oscillator. |
| 987 | * @arg RCC_LSE_BYPASS LSE oscillator bypassed with external clock. |
985 | * @arg @ref RCC_LSE_BYPASS LSE oscillator bypassed with external clock. |
| 988 | */ |
986 | */ |
| 989 | #define __HAL_RCC_LSE_CONFIG(__STATE__) \ |
987 | #define __HAL_RCC_LSE_CONFIG(__STATE__) \ |
| 990 | do{ \ |
988 | do{ \ |
| 991 | if ((__STATE__) == RCC_LSE_ON) \ |
989 | if ((__STATE__) == RCC_LSE_ON) \ |
| 992 | { \ |
990 | { \ |
| Line 1033... | Line 1031... | ||
| 1033 | /** @brief Macro to configure the main PLL clock source and multiplication factors. |
1031 | /** @brief Macro to configure the main PLL clock source and multiplication factors. |
| 1034 | * @note This function must be used only when the main PLL is disabled. |
1032 | * @note This function must be used only when the main PLL is disabled. |
| 1035 | * |
1033 | * |
| 1036 | * @param __RCC_PLLSOURCE__ specifies the PLL entry clock source. |
1034 | * @param __RCC_PLLSOURCE__ specifies the PLL entry clock source. |
| 1037 | * This parameter can be one of the following values: |
1035 | * This parameter can be one of the following values: |
| 1038 | * @arg RCC_PLLSOURCE_HSI_DIV2 HSI oscillator clock selected as PLL clock entry |
1036 | * @arg @ref RCC_PLLSOURCE_HSI_DIV2 HSI oscillator clock selected as PLL clock entry |
| 1039 | * @arg RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL clock entry |
1037 | * @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL clock entry |
| 1040 | * @param __PLLMUL__ specifies the multiplication factor for PLL VCO output clock |
1038 | * @param __PLLMUL__ specifies the multiplication factor for PLL VCO output clock |
| 1041 | * This parameter can be one of the following values: |
1039 | * This parameter can be one of the following values: |
| 1042 | * @arg RCC_PLL_MUL2 PLLVCO = PLL clock entry x 2 (*) |
1040 | * @arg @ref RCC_PLL_MUL4 PLLVCO = PLL clock entry x 4 |
| 1043 | * @arg RCC_PLL_MUL3 PLLVCO = PLL clock entry x 3 (*) |
1041 | * @arg @ref RCC_PLL_MUL6 PLLVCO = PLL clock entry x 6 |
| - | 1042 | @if STM32F105xC |
|
| 1044 | * @arg RCC_PLL_MUL4 PLLVCO = PLL clock entry x 4 |
1043 | * @arg @ref RCC_PLL_MUL6_5 PLLVCO = PLL clock entry x 6.5 |
| - | 1044 | @elseif STM32F107xC |
|
| 1045 | * @arg RCC_PLL_MUL6 PLLVCO = PLL clock entry x 6 |
1045 | * @arg @ref RCC_PLL_MUL6_5 PLLVCO = PLL clock entry x 6.5 |
| - | 1046 | @else |
|
| 1046 | * @arg RCC_PLL_MUL6_5 PLLVCO = PLL clock entry x 6.5 (**) |
1047 | * @arg @ref RCC_PLL_MUL2 PLLVCO = PLL clock entry x 2 |
| 1047 | * @arg RCC_PLL_MUL8 PLLVCO = PLL clock entry x 8 |
1048 | * @arg @ref RCC_PLL_MUL3 PLLVCO = PLL clock entry x 3 |
| 1048 | * @arg RCC_PLL_MUL9 PLLVCO = PLL clock entry x 9 |
1049 | * @arg @ref RCC_PLL_MUL10 PLLVCO = PLL clock entry x 10 |
| 1049 | * @arg RCC_PLL_MUL10 PLLVCO = PLL clock entry x 10 (*) |
1050 | * @arg @ref RCC_PLL_MUL11 PLLVCO = PLL clock entry x 11 |
| 1050 | * @arg RCC_PLL_MUL11 PLLVCO = PLL clock entry x 11 (*) |
1051 | * @arg @ref RCC_PLL_MUL12 PLLVCO = PLL clock entry x 12 |
| 1051 | * @arg RCC_PLL_MUL12 PLLVCO = PLL clock entry x 12 (*) |
1052 | * @arg @ref RCC_PLL_MUL13 PLLVCO = PLL clock entry x 13 |
| 1052 | * @arg RCC_PLL_MUL13 PLLVCO = PLL clock entry x 13 (*) |
1053 | * @arg @ref RCC_PLL_MUL14 PLLVCO = PLL clock entry x 14 |
| 1053 | * @arg RCC_PLL_MUL14 PLLVCO = PLL clock entry x 14 (*) |
1054 | * @arg @ref RCC_PLL_MUL15 PLLVCO = PLL clock entry x 15 |
| 1054 | * @arg RCC_PLL_MUL15 PLLVCO = PLL clock entry x 15 (*) |
1055 | * @arg @ref RCC_PLL_MUL16 PLLVCO = PLL clock entry x 16 |
| - | 1056 | @endif |
|
| 1055 | * @arg RCC_PLL_MUL16 PLLVCO = PLL clock entry x 16 (*) |
1057 | * @arg @ref RCC_PLL_MUL8 PLLVCO = PLL clock entry x 8 |
| 1056 | * @note (*) These values are not available in STM32F105xx & STM32F107xx devices. |
1058 | * @arg @ref RCC_PLL_MUL9 PLLVCO = PLL clock entry x 9 |
| 1057 | * @note (**) This value is available in STM32F105xx & STM32F107xx devices only. |
- | |
| 1058 | * |
1059 | * |
| 1059 | */ |
1060 | */ |
| 1060 | #define __HAL_RCC_PLL_CONFIG(__RCC_PLLSOURCE__, __PLLMUL__)\ |
1061 | #define __HAL_RCC_PLL_CONFIG(__RCC_PLLSOURCE__, __PLLMUL__)\ |
| 1061 | MODIFY_REG(RCC->CFGR, (RCC_CFGR_PLLSRC | RCC_CFGR_PLLMULL),((__RCC_PLLSOURCE__) | (__PLLMUL__) )) |
1062 | MODIFY_REG(RCC->CFGR, (RCC_CFGR_PLLSRC | RCC_CFGR_PLLMULL),((__RCC_PLLSOURCE__) | (__PLLMUL__) )) |
| 1062 | 1063 | ||
| 1063 | /** @brief Get oscillator clock selected as PLL input clock |
1064 | /** @brief Get oscillator clock selected as PLL input clock |
| 1064 | * @retval The clock source used for PLL entry. The returned value can be one |
1065 | * @retval The clock source used for PLL entry. The returned value can be one |
| 1065 | * of the following: |
1066 | * of the following: |
| 1066 | * @arg RCC_PLLSOURCE_HSI_DIV2 HSI oscillator clock selected as PLL input clock |
1067 | * @arg @ref RCC_PLLSOURCE_HSI_DIV2 HSI oscillator clock selected as PLL input clock |
| 1067 | * @arg RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL input clock |
1068 | * @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL input clock |
| 1068 | */ |
1069 | */ |
| 1069 | #define __HAL_RCC_GET_PLL_OSCSOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PLLSRC))) |
1070 | #define __HAL_RCC_GET_PLL_OSCSOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PLLSRC))) |
| 1070 | 1071 | ||
| 1071 | /** |
1072 | /** |
| 1072 | * @} |
1073 | * @} |
| Line 1076... | Line 1077... | ||
| 1076 | * @{ |
1077 | * @{ |
| 1077 | */ |
1078 | */ |
| 1078 | 1079 | ||
| 1079 | /** |
1080 | /** |
| 1080 | * @brief Macro to configure the system clock source. |
1081 | * @brief Macro to configure the system clock source. |
| 1081 | * @param __RCC_SYSCLKSOURCE__ specifies the system clock source. |
1082 | * @param __SYSCLKSOURCE__ specifies the system clock source. |
| 1082 | * This parameter can be one of the following values: |
1083 | * This parameter can be one of the following values: |
| 1083 | * @arg RCC_SYSCLKSOURCE_HSI HSI oscillator is used as system clock source. |
1084 | * @arg @ref RCC_SYSCLKSOURCE_HSI HSI oscillator is used as system clock source. |
| 1084 | * @arg RCC_SYSCLKSOURCE_HSE HSE oscillator is used as system clock source. |
1085 | * @arg @ref RCC_SYSCLKSOURCE_HSE HSE oscillator is used as system clock source. |
| 1085 | * @arg RCC_SYSCLKSOURCE_PLLCLK PLL output is used as system clock source. |
1086 | * @arg @ref RCC_SYSCLKSOURCE_PLLCLK PLL output is used as system clock source. |
| 1086 | */ |
1087 | */ |
| 1087 | #define __HAL_RCC_SYSCLK_CONFIG(__RCC_SYSCLKSOURCE__) \ |
1088 | #define __HAL_RCC_SYSCLK_CONFIG(__SYSCLKSOURCE__) \ |
| 1088 | MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, (__RCC_SYSCLKSOURCE__)) |
1089 | MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, (__SYSCLKSOURCE__)) |
| 1089 | 1090 | ||
| 1090 | /** @brief Macro to get the clock source used as system clock. |
1091 | /** @brief Macro to get the clock source used as system clock. |
| 1091 | * @retval The clock source used as system clock. The returned value can be one |
1092 | * @retval The clock source used as system clock. The returned value can be one |
| 1092 | * of the following: |
1093 | * of the following: |
| 1093 | * @arg RCC_SYSCLKSOURCE_STATUS_HSI HSI used as system clock |
1094 | * @arg @ref RCC_SYSCLKSOURCE_STATUS_HSI HSI used as system clock |
| 1094 | * @arg RCC_SYSCLKSOURCE_STATUS_HSE HSE used as system clock |
1095 | * @arg @ref RCC_SYSCLKSOURCE_STATUS_HSE HSE used as system clock |
| 1095 | * @arg RCC_SYSCLKSOURCE_STATUS_PLLCLK PLL used as system clock |
1096 | * @arg @ref RCC_SYSCLKSOURCE_STATUS_PLLCLK PLL used as system clock |
| 1096 | */ |
1097 | */ |
| 1097 | #define __HAL_RCC_GET_SYSCLK_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR,RCC_CFGR_SWS))) |
1098 | #define __HAL_RCC_GET_SYSCLK_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR,RCC_CFGR_SWS))) |
| 1098 | 1099 | ||
| 1099 | /** |
1100 | /** |
| 1100 | * @} |
1101 | * @} |
| Line 1106... | Line 1107... | ||
| 1106 | 1107 | ||
| 1107 | #if defined(RCC_CFGR_MCO_3) |
1108 | #if defined(RCC_CFGR_MCO_3) |
| 1108 | /** @brief Macro to configure the MCO clock. |
1109 | /** @brief Macro to configure the MCO clock. |
| 1109 | * @param __MCOCLKSOURCE__ specifies the MCO clock source. |
1110 | * @param __MCOCLKSOURCE__ specifies the MCO clock source. |
| 1110 | * This parameter can be one of the following values: |
1111 | * This parameter can be one of the following values: |
| 1111 | * @arg RCC_MCO1SOURCE_NOCLOCK: No clock |
1112 | * @arg @ref RCC_MCO1SOURCE_NOCLOCK No clock selected as MCO clock |
| 1112 | * @arg RCC_MCO1SOURCE_SYSCLK: System clock (SYSCLK) selected as MCO clock |
1113 | * @arg @ref RCC_MCO1SOURCE_SYSCLK System clock (SYSCLK) selected as MCO clock |
| 1113 | * @arg RCC_MCO1SOURCE_HSI: HSI selected as MCO clock |
1114 | * @arg @ref RCC_MCO1SOURCE_HSI HSI selected as MCO clock |
| 1114 | * @arg RCC_MCO1SOURCE_HSE: HSE selected as MCO clock |
1115 | * @arg @ref RCC_MCO1SOURCE_HSE HSE selected as MCO clock |
| 1115 | * @arg RCC_MCO1SOURCE_PLLCLK: PLL clock divided by 2 selected as MCO clock |
1116 | * @arg @ref RCC_MCO1SOURCE_PLLCLK PLL clock divided by 2 selected as MCO clock |
| 1116 | * @arg RCC_MCO1SOURCE_PLL2CLK: PLL2 clock selected by 2 selected as MCO clock |
1117 | * @arg @ref RCC_MCO1SOURCE_PLL2CLK PLL2 clock selected by 2 selected as MCO clock |
| 1117 | * @arg RCC_MCO1SOURCE_PLL3CLK_DIV2: PLL3 clock divided by 2 selected as MCO clock |
1118 | * @arg @ref RCC_MCO1SOURCE_PLL3CLK_DIV2 PLL3 clock divided by 2 selected as MCO clock |
| 1118 | * @arg RCC_MCO1SOURCE_EXT_HSE: XT1 external 3-25 MHz oscillator clock selected (for Ethernet) as MCO clock |
1119 | * @arg @ref RCC_MCO1SOURCE_EXT_HSE XT1 external 3-25 MHz oscillator clock selected (for Ethernet) as MCO clock |
| 1119 | * @arg RCC_MCO1SOURCE_PLL3CLK: PLL3 clock selected (for Ethernet) as MCO clock |
1120 | * @arg @ref RCC_MCO1SOURCE_PLL3CLK PLL3 clock selected (for Ethernet) as MCO clock |
| 1120 | * @param __MCODIV__ specifies the MCO clock prescaler. |
1121 | * @param __MCODIV__ specifies the MCO clock prescaler. |
| 1121 | * This parameter can be one of the following values: |
1122 | * This parameter can be one of the following values: |
| 1122 | * @arg RCC_MCODIV_1: No division applied on MCO clock source |
1123 | * @arg @ref RCC_MCODIV_1 No division applied on MCO clock source |
| 1123 | */ |
1124 | */ |
| 1124 | #else |
1125 | #else |
| 1125 | /** @brief Macro to configure the MCO clock. |
1126 | /** @brief Macro to configure the MCO clock. |
| 1126 | * @param __MCOCLKSOURCE__ specifies the MCO clock source. |
1127 | * @param __MCOCLKSOURCE__ specifies the MCO clock source. |
| 1127 | * This parameter can be one of the following values: |
1128 | * This parameter can be one of the following values: |
| 1128 | * @arg RCC_MCO1SOURCE_NOCLOCK: No clock |
1129 | * @arg @ref RCC_MCO1SOURCE_NOCLOCK No clock selected as MCO clock |
| 1129 | * @arg RCC_MCO1SOURCE_SYSCLK: System clock (SYSCLK) selected as MCO clock |
1130 | * @arg @ref RCC_MCO1SOURCE_SYSCLK System clock (SYSCLK) selected as MCO clock |
| 1130 | * @arg RCC_MCO1SOURCE_HSI: HSI selected as MCO clock |
1131 | * @arg @ref RCC_MCO1SOURCE_HSI HSI selected as MCO clock |
| 1131 | * @arg RCC_MCO1SOURCE_HSE: HSE selected as MCO clock |
1132 | * @arg @ref RCC_MCO1SOURCE_HSE HSE selected as MCO clock |
| 1132 | * @arg RCC_MCO1SOURCE_PLLCLK: PLL clock divided by 2 selected as MCO clock |
1133 | * @arg @ref RCC_MCO1SOURCE_PLLCLK PLL clock divided by 2 selected as MCO clock |
| 1133 | * @param __MCODIV__ specifies the MCO clock prescaler. |
1134 | * @param __MCODIV__ specifies the MCO clock prescaler. |
| 1134 | * This parameter can be one of the following values: |
1135 | * This parameter can be one of the following values: |
| 1135 | * @arg RCC_MCODIV_1: No division applied on MCO clock source |
1136 | * @arg @ref RCC_MCODIV_1 No division applied on MCO clock source |
| 1136 | */ |
1137 | */ |
| 1137 | #endif |
1138 | #endif |
| 1138 | 1139 | ||
| 1139 | #define __HAL_RCC_MCO1_CONFIG(__MCOCLKSOURCE__, __MCODIV__) \ |
1140 | #define __HAL_RCC_MCO1_CONFIG(__MCOCLKSOURCE__, __MCODIV__) \ |
| 1140 | MODIFY_REG(RCC->CFGR, RCC_CFGR_MCO, (__MCOCLKSOURCE__)) |
1141 | MODIFY_REG(RCC->CFGR, RCC_CFGR_MCO, (__MCOCLKSOURCE__)) |
| Line 1157... | Line 1158... | ||
| 1157 | * Backup domain is reset using @ref __HAL_RCC_BACKUPRESET_FORCE() macro, or by |
1158 | * Backup domain is reset using @ref __HAL_RCC_BACKUPRESET_FORCE() macro, or by |
| 1158 | * a Power On Reset (POR). |
1159 | * a Power On Reset (POR). |
| 1159 | * |
1160 | * |
| 1160 | * @param __RTC_CLKSOURCE__ specifies the RTC clock source. |
1161 | * @param __RTC_CLKSOURCE__ specifies the RTC clock source. |
| 1161 | * This parameter can be one of the following values: |
1162 | * This parameter can be one of the following values: |
| 1162 | * @arg RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock |
1163 | * @arg @ref RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock |
| 1163 | * @arg RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock |
1164 | * @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock |
| 1164 | * @arg RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock |
1165 | * @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock |
| 1165 | * @arg RCC_RTCCLKSOURCE_HSE_DIV128 HSE divided by 128 selected as RTC clock |
1166 | * @arg @ref RCC_RTCCLKSOURCE_HSE_DIV128 HSE divided by 128 selected as RTC clock |
| 1166 | * @note If the LSE or LSI is used as RTC clock source, the RTC continues to |
1167 | * @note If the LSE or LSI is used as RTC clock source, the RTC continues to |
| 1167 | * work in STOP and STANDBY modes, and can be used as wakeup source. |
1168 | * work in STOP and STANDBY modes, and can be used as wakeup source. |
| 1168 | * However, when the HSE clock is used as RTC clock source, the RTC |
1169 | * However, when the HSE clock is used as RTC clock source, the RTC |
| 1169 | * cannot be used in STOP and STANDBY modes. |
1170 | * cannot be used in STOP and STANDBY modes. |
| 1170 | * @note The maximum input clock frequency for RTC is 1MHz (when using HSE as |
1171 | * @note The maximum input clock frequency for RTC is 1MHz (when using HSE as |
| Line 1172... | Line 1173... | ||
| 1172 | */ |
1173 | */ |
| 1173 | #define __HAL_RCC_RTC_CONFIG(__RTC_CLKSOURCE__) MODIFY_REG(RCC->BDCR, RCC_BDCR_RTCSEL, (__RTC_CLKSOURCE__)) |
1174 | #define __HAL_RCC_RTC_CONFIG(__RTC_CLKSOURCE__) MODIFY_REG(RCC->BDCR, RCC_BDCR_RTCSEL, (__RTC_CLKSOURCE__)) |
| 1174 | 1175 | ||
| 1175 | /** @brief Macro to get the RTC clock source. |
1176 | /** @brief Macro to get the RTC clock source. |
| 1176 | * @retval The clock source can be one of the following values: |
1177 | * @retval The clock source can be one of the following values: |
| 1177 | * @arg RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock |
1178 | * @arg @ref RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock |
| 1178 | * @arg RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock |
1179 | * @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock |
| 1179 | * @arg RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock |
1180 | * @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock |
| 1180 | * @arg RCC_RTCCLKSOURCE_HSE_DIV128 HSE divided by 128 selected as RTC clock |
1181 | * @arg @ref RCC_RTCCLKSOURCE_HSE_DIV128 HSE divided by 128 selected as RTC clock |
| 1181 | */ |
1182 | */ |
| 1182 | #define __HAL_RCC_GET_RTC_SOURCE() (READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL)) |
1183 | #define __HAL_RCC_GET_RTC_SOURCE() (READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL)) |
| 1183 | 1184 | ||
| 1184 | /** @brief Macro to enable the the RTC clock. |
1185 | /** @brief Macro to enable the the RTC clock. |
| 1185 | * @note These macros must be used only after the RTC clock source was selected. |
1186 | * @note These macros must be used only after the RTC clock source was selected. |
| Line 1211... | Line 1212... | ||
| 1211 | */ |
1212 | */ |
| 1212 | 1213 | ||
| 1213 | /** @brief Enable RCC interrupt. |
1214 | /** @brief Enable RCC interrupt. |
| 1214 | * @param __INTERRUPT__ specifies the RCC interrupt sources to be enabled. |
1215 | * @param __INTERRUPT__ specifies the RCC interrupt sources to be enabled. |
| 1215 | * This parameter can be any combination of the following values: |
1216 | * This parameter can be any combination of the following values: |
| 1216 | * @arg RCC_IT_LSIRDY LSI ready interrupt |
1217 | * @arg @ref RCC_IT_LSIRDY LSI ready interrupt |
| 1217 | * @arg RCC_IT_LSERDY LSE ready interrupt |
1218 | * @arg @ref RCC_IT_LSERDY LSE ready interrupt |
| 1218 | * @arg RCC_IT_HSIRDY HSI ready interrupt |
1219 | * @arg @ref RCC_IT_HSIRDY HSI ready interrupt |
| 1219 | * @arg RCC_IT_HSERDY HSE ready interrupt |
1220 | * @arg @ref RCC_IT_HSERDY HSE ready interrupt |
| 1220 | * @arg RCC_IT_PLLRDY main PLL ready interrupt |
1221 | * @arg @ref RCC_IT_PLLRDY main PLL ready interrupt |
| - | 1222 | @if STM32F105xx |
|
| 1221 | * @arg RCC_IT_PLL2RDY Main PLL2 ready interrupt.(*) |
1223 | * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. |
| 1222 | * @arg RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt.(*) |
1224 | * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. |
| - | 1225 | @elsif STM32F107xx |
|
| - | 1226 | * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. |
|
| 1223 | * @note (*) This bit is available in STM32F105xx & STM32F107xx devices only. |
1227 | * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. |
| - | 1228 | @endif |
|
| 1224 | */ |
1229 | */ |
| 1225 | #define __HAL_RCC_ENABLE_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE1_ADDRESS |= (__INTERRUPT__)) |
1230 | #define __HAL_RCC_ENABLE_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE1_ADDRESS |= (__INTERRUPT__)) |
| 1226 | 1231 | ||
| 1227 | /** @brief Disable RCC interrupt. |
1232 | /** @brief Disable RCC interrupt. |
| 1228 | * @param __INTERRUPT__ specifies the RCC interrupt sources to be disabled. |
1233 | * @param __INTERRUPT__ specifies the RCC interrupt sources to be disabled. |
| 1229 | * This parameter can be any combination of the following values: |
1234 | * This parameter can be any combination of the following values: |
| 1230 | * @arg RCC_IT_LSIRDY LSI ready interrupt |
1235 | * @arg @ref RCC_IT_LSIRDY LSI ready interrupt |
| 1231 | * @arg RCC_IT_LSERDY LSE ready interrupt |
1236 | * @arg @ref RCC_IT_LSERDY LSE ready interrupt |
| 1232 | * @arg RCC_IT_HSIRDY HSI ready interrupt |
1237 | * @arg @ref RCC_IT_HSIRDY HSI ready interrupt |
| 1233 | * @arg RCC_IT_HSERDY HSE ready interrupt |
1238 | * @arg @ref RCC_IT_HSERDY HSE ready interrupt |
| 1234 | * @arg RCC_IT_PLLRDY main PLL ready interrupt |
1239 | * @arg @ref RCC_IT_PLLRDY main PLL ready interrupt |
| - | 1240 | @if STM32F105xx |
|
| 1235 | * @arg RCC_IT_PLL2RDY Main PLL2 ready interrupt.(*) |
1241 | * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. |
| 1236 | * @arg RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt.(*) |
1242 | * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. |
| - | 1243 | @elsif STM32F107xx |
|
| - | 1244 | * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. |
|
| 1237 | * @note (*) This bit is available in STM32F105xx & STM32F107xx devices only. |
1245 | * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. |
| - | 1246 | @endif |
|
| 1238 | */ |
1247 | */ |
| 1239 | #define __HAL_RCC_DISABLE_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE1_ADDRESS &= ~(__INTERRUPT__)) |
1248 | #define __HAL_RCC_DISABLE_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE1_ADDRESS &= (uint8_t)(~(__INTERRUPT__))) |
| 1240 | 1249 | ||
| 1241 | /** @brief Clear the RCC's interrupt pending bits. |
1250 | /** @brief Clear the RCC's interrupt pending bits. |
| 1242 | * @param __INTERRUPT__ specifies the interrupt pending bit to clear. |
1251 | * @param __INTERRUPT__ specifies the interrupt pending bit to clear. |
| 1243 | * This parameter can be any combination of the following values: |
1252 | * This parameter can be any combination of the following values: |
| 1244 | * @arg RCC_IT_LSIRDY LSI ready interrupt. |
1253 | * @arg @ref RCC_IT_LSIRDY LSI ready interrupt. |
| 1245 | * @arg RCC_IT_LSERDY LSE ready interrupt. |
1254 | * @arg @ref RCC_IT_LSERDY LSE ready interrupt. |
| 1246 | * @arg RCC_IT_HSIRDY HSI ready interrupt. |
1255 | * @arg @ref RCC_IT_HSIRDY HSI ready interrupt. |
| 1247 | * @arg RCC_IT_HSERDY HSE ready interrupt. |
1256 | * @arg @ref RCC_IT_HSERDY HSE ready interrupt. |
| 1248 | * @arg RCC_IT_PLLRDY Main PLL ready interrupt. |
1257 | * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt. |
| - | 1258 | @if STM32F105xx |
|
| 1249 | * @arg RCC_IT_PLL2RDY Main PLL2 ready interrupt.(*) |
1259 | * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. |
| 1250 | * @arg RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt.(*) |
1260 | * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. |
| - | 1261 | @elsif STM32F107xx |
|
| 1251 | * @arg RCC_IT_CSS Clock Security System interrupt |
1262 | * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. |
| 1252 | * @note (*) This bit is available in STM32F105xx & STM32F107xx devices only. |
1263 | * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. |
| - | 1264 | @endif |
|
| - | 1265 | * @arg @ref RCC_IT_CSS Clock Security System interrupt |
|
| 1253 | */ |
1266 | */ |
| 1254 | #define __HAL_RCC_CLEAR_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE2_ADDRESS = (__INTERRUPT__)) |
1267 | #define __HAL_RCC_CLEAR_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE2_ADDRESS = (__INTERRUPT__)) |
| 1255 | 1268 | ||
| 1256 | /** @brief Check the RCC's interrupt has occurred or not. |
1269 | /** @brief Check the RCC's interrupt has occurred or not. |
| 1257 | * @param __INTERRUPT__ specifies the RCC interrupt source to check. |
1270 | * @param __INTERRUPT__ specifies the RCC interrupt source to check. |
| 1258 | * This parameter can be one of the following values: |
1271 | * This parameter can be one of the following values: |
| 1259 | * @arg RCC_IT_LSIRDY LSI ready interrupt. |
1272 | * @arg @ref RCC_IT_LSIRDY LSI ready interrupt. |
| 1260 | * @arg RCC_IT_LSERDY LSE ready interrupt. |
1273 | * @arg @ref RCC_IT_LSERDY LSE ready interrupt. |
| 1261 | * @arg RCC_IT_HSIRDY HSI ready interrupt. |
1274 | * @arg @ref RCC_IT_HSIRDY HSI ready interrupt. |
| 1262 | * @arg RCC_IT_HSERDY HSE ready interrupt. |
1275 | * @arg @ref RCC_IT_HSERDY HSE ready interrupt. |
| 1263 | * @arg RCC_IT_PLLRDY Main PLL ready interrupt. |
1276 | * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt. |
| - | 1277 | @if STM32F105xx |
|
| 1264 | * @arg RCC_IT_PLL2RDY Main PLL2 ready interrupt.(*) |
1278 | * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. |
| 1265 | * @arg RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt.(*) |
1279 | * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. |
| - | 1280 | @elsif STM32F107xx |
|
| 1266 | * @arg RCC_IT_CSS Clock Security System interrupt |
1281 | * @arg @ref RCC_IT_PLL2RDY Main PLL2 ready interrupt. |
| 1267 | * @note (*) This bit is available in STM32F105xx & STM32F107xx devices only. |
1282 | * @arg @ref RCC_IT_PLLI2S2RDY Main PLLI2S ready interrupt. |
| - | 1283 | @endif |
|
| - | 1284 | * @arg @ref RCC_IT_CSS Clock Security System interrupt |
|
| 1268 | * @retval The new state of __INTERRUPT__ (TRUE or FALSE). |
1285 | * @retval The new state of __INTERRUPT__ (TRUE or FALSE). |
| 1269 | */ |
1286 | */ |
| 1270 | #define __HAL_RCC_GET_IT(__INTERRUPT__) ((RCC->CIR & (__INTERRUPT__)) == (__INTERRUPT__)) |
1287 | #define __HAL_RCC_GET_IT(__INTERRUPT__) ((RCC->CIR & (__INTERRUPT__)) == (__INTERRUPT__)) |
| 1271 | 1288 | ||
| 1272 | /** @brief Set RMVF bit to clear the reset flags. |
1289 | /** @brief Set RMVF bit to clear the reset flags. |
| Line 1276... | Line 1293... | ||
| 1276 | #define __HAL_RCC_CLEAR_RESET_FLAGS() (*(__IO uint32_t *)RCC_CSR_RMVF_BB = ENABLE) |
1293 | #define __HAL_RCC_CLEAR_RESET_FLAGS() (*(__IO uint32_t *)RCC_CSR_RMVF_BB = ENABLE) |
| 1277 | 1294 | ||
| 1278 | /** @brief Check RCC flag is set or not. |
1295 | /** @brief Check RCC flag is set or not. |
| 1279 | * @param __FLAG__ specifies the flag to check. |
1296 | * @param __FLAG__ specifies the flag to check. |
| 1280 | * This parameter can be one of the following values: |
1297 | * This parameter can be one of the following values: |
| 1281 | * @arg RCC_FLAG_HSIRDY HSI oscillator clock ready. |
1298 | * @arg @ref RCC_FLAG_HSIRDY HSI oscillator clock ready. |
| 1282 | * @arg RCC_FLAG_HSERDY HSE oscillator clock ready. |
1299 | * @arg @ref RCC_FLAG_HSERDY HSE oscillator clock ready. |
| 1283 | * @arg RCC_FLAG_PLLRDY Main PLL clock ready. |
1300 | * @arg @ref RCC_FLAG_PLLRDY Main PLL clock ready. |
| - | 1301 | @if STM32F105xx |
|
| - | 1302 | * @arg @ref RCC_FLAG_PLL2RDY Main PLL2 clock ready. |
|
| - | 1303 | * @arg @ref RCC_FLAG_PLLI2SRDY Main PLLI2S clock ready. |
|
| - | 1304 | @elsif STM32F107xx |
|
| 1284 | * @arg RCC_FLAG_PLL2RDY Main PLL2 clock ready.(*) |
1305 | * @arg @ref RCC_FLAG_PLL2RDY Main PLL2 clock ready. |
| 1285 | * @arg RCC_FLAG_PLLI2SRDY Main PLLI2S clock ready.(*) |
1306 | * @arg @ref RCC_FLAG_PLLI2SRDY Main PLLI2S clock ready. |
| - | 1307 | @endif |
|
| 1286 | * @arg RCC_FLAG_LSERDY LSE oscillator clock ready. |
1308 | * @arg @ref RCC_FLAG_LSERDY LSE oscillator clock ready. |
| 1287 | * @arg RCC_FLAG_LSIRDY LSI oscillator clock ready. |
1309 | * @arg @ref RCC_FLAG_LSIRDY LSI oscillator clock ready. |
| 1288 | * @arg RCC_FLAG_PINRST Pin reset. |
1310 | * @arg @ref RCC_FLAG_PINRST Pin reset. |
| 1289 | * @arg RCC_FLAG_PORRST POR/PDR reset. |
1311 | * @arg @ref RCC_FLAG_PORRST POR/PDR reset. |
| 1290 | * @arg RCC_FLAG_SFTRST Software reset. |
1312 | * @arg @ref RCC_FLAG_SFTRST Software reset. |
| 1291 | * @arg RCC_FLAG_IWDGRST Independent Watchdog reset. |
1313 | * @arg @ref RCC_FLAG_IWDGRST Independent Watchdog reset. |
| 1292 | * @arg RCC_FLAG_WWDGRST Window Watchdog reset. |
1314 | * @arg @ref RCC_FLAG_WWDGRST Window Watchdog reset. |
| 1293 | * @arg RCC_FLAG_LPWRRST Low Power reset. |
1315 | * @arg @ref RCC_FLAG_LPWRRST Low Power reset. |
| 1294 | * @note (*) This bit is available in STM32F105xx & STM32F107xx devices only. |
- | |
| 1295 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
1316 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
| 1296 | */ |
1317 | */ |
| 1297 | #define __HAL_RCC_GET_FLAG(__FLAG__) (((((__FLAG__) >> 5) == CR_REG_INDEX)? RCC->CR : \ |
1318 | #define __HAL_RCC_GET_FLAG(__FLAG__) (((((__FLAG__) >> 5) == CR_REG_INDEX)? RCC->CR : \ |
| 1298 | ((((__FLAG__) >> 5) == BDCR_REG_INDEX)? RCC->BDCR : \ |
1319 | ((((__FLAG__) >> 5) == BDCR_REG_INDEX)? RCC->BDCR : \ |
| 1299 | RCC->CSR)) & ((uint32_t)1 << ((__FLAG__) & RCC_FLAG_MASK))) |
1320 | RCC->CSR)) & ((uint32_t)1 << ((__FLAG__) & RCC_FLAG_MASK))) |
| 1300 | 1321 | ||
| 1301 | /** |
1322 | /** |
| 1302 | * @} |
1323 | * @} |
| 1303 | */ |
1324 | */ |
| 1304 | 1325 | ||