STM32 Bootloader
Customizable Bootloader for STM32 microcontrollers
rcc.c
Go to the documentation of this file.
1 
26 /* Includes ------------------------------------------------------------------*/
27 #include "rcc.h"
28 
29 #include "mcu_hal.h"
30 
31 /* Functions -----------------------------------------------------------------*/
32 void RccEnableCrc(void)
33 {
34  __HAL_RCC_CRC_CLK_ENABLE();
35 }
36 
37 void RccDisableCrc(void)
38 {
39  __HAL_RCC_CRC_CLK_DISABLE();
40 }
41 
42 void RccEnableDma2(void)
43 {
44  __HAL_RCC_DMA2_CLK_ENABLE();
45 }
46 
47 void RccDisableDma2(void)
48 {
49  __HAL_RCC_DMA2_CLK_DISABLE();
50 }
51 
52 void RccEnableFlash(void)
53 {
54  __HAL_RCC_FLASH_CLK_ENABLE();
55 }
56 
57 void RccDisableFlash(void)
58 {
59  __HAL_RCC_FLASH_CLK_DISABLE();
60 }
61 
62 void RccEnablePortA(void)
63 {
64  __HAL_RCC_GPIOA_CLK_ENABLE();
65 }
66 
67 void RccDisablePortA(void)
68 {
69  __HAL_RCC_GPIOA_CLK_DISABLE();
70 }
71 
72 void RccEnablePortB(void)
73 {
74  __HAL_RCC_GPIOB_CLK_ENABLE();
75 }
76 
77 void RccDisablePortB(void)
78 {
79  __HAL_RCC_GPIOB_CLK_DISABLE();
80 }
81 
82 void RccEnablePortC(void)
83 {
84  __HAL_RCC_GPIOC_CLK_ENABLE();
85 }
86 
87 void RccDisablePortC(void)
88 {
89  __HAL_RCC_GPIOC_CLK_DISABLE();
90 }
91 
92 void RccEnablePortD(void)
93 {
94  __HAL_RCC_GPIOD_CLK_ENABLE();
95 }
96 
97 void RccDisablePortD(void)
98 {
99  __HAL_RCC_GPIOD_CLK_DISABLE();
100 }
101 
102 void RccEnablePwr(void)
103 {
104  __HAL_RCC_PWR_CLK_ENABLE();
105 }
106 
107 void RccDisablePwr(void)
108 {
109  __HAL_RCC_PWR_CLK_DISABLE();
110 }
111 
112 void RccEnableSdmmc1(void)
113 {
114  __HAL_RCC_SDMMC1_CLK_ENABLE();
115 }
116 
118 {
119  __HAL_RCC_SDMMC1_CLK_DISABLE();
120 }
121 
122 void RccEnableSysCfg(void)
123 {
124  __HAL_RCC_SYSCFG_CLK_ENABLE();
125 }
126 
128 {
129  __HAL_RCC_SYSCFG_CLK_DISABLE();
130 }
131 
132 void RccEnableUart2(void)
133 {
134  __HAL_RCC_USART2_CLK_ENABLE();
135 }
136 
137 void RccDisableUart2(void)
138 {
139  __HAL_RCC_USART2_CLK_DISABLE();
140 }
141 
143 {
144  // Message: The right hand operand of a shift operator shall lie in the
145  // range zero to one less than the width in bits of the
146  // essential type of the left hand operand [misra-c2012-12.2]
147  // Reason: The expression is part of the microcontroller vendor library
148  // (HAL). The macro has been reviewed and is known to operate
149  // correctly for the target device and compiler configuration.
150  // Risk: Theoretical risk of undefined behavior if the shift operand
151  // were outside the valid range. However, the values are fixed
152  // and controlled by the HAL definitions, so the risk is
153  // negligible.
154  // Prevention: Code reviews and testing.
155  // cppcheck-suppress [misra-c2012-12.2]
156  return (__HAL_RCC_GET_FLAG(RCC_FLAG_OBLRST) == 1U);
157 }
158 
160 {
161  __HAL_RCC_CLEAR_RESET_FLAGS();
162 }
163 
void RccDisablePortD(void)
Disable the GPIO port D clock.
Definition: rcc.c:97
void RccEnablePortB(void)
Enable the GPIO port B clock.
Definition: rcc.c:72
void RccEnablePwr(void)
Enable the PWR clock.
Definition: rcc.c:102
void RccResetFlagsClear(void)
Clear all RCC reset flags.
Definition: rcc.c:159
void RccEnableSysCfg(void)
Enable the SYSCFG clock.
Definition: rcc.c:122
void RccDisablePortA(void)
Disable the GPIO port A clock.
Definition: rcc.c:67
void RccDisableDma2(void)
Disable the DMA2 peripheral clock.
Definition: rcc.c:47
void RccDisableSysCfg(void)
Disable the SYSCFG clock.
Definition: rcc.c:127
void RccDisableCrc(void)
Disable the CRC peripheral clock.
Definition: rcc.c:37
void RccDisablePortC(void)
Disable the GPIO port C clock.
Definition: rcc.c:87
void RccEnableFlash(void)
Enable the flash interface clock.
Definition: rcc.c:52
void RccDisableFlash(void)
Disable the flash interface clock.
Definition: rcc.c:57
void RccEnablePortA(void)
Enable the GPIO port A clock.
Definition: rcc.c:62
void RccEnablePortD(void)
Enable the GPIO port D clock.
Definition: rcc.c:92
void RccEnableCrc(void)
Enable the CRC peripheral clock.
Definition: rcc.c:32
void RccDisablePwr(void)
Disable the PWR clock.
Definition: rcc.c:107
void RccEnablePortC(void)
Enable the GPIO port C clock.
Definition: rcc.c:82
void RccEnableUart2(void)
Enable the USART2 peripheral clock.
Definition: rcc.c:132
bool RccResetFlagOblIsSet(void)
Check if the option byte loader reset flag is set.
Definition: rcc.c:142
void RccEnableSdmmc1(void)
Enable the SDMMC1 peripheral clock.
Definition: rcc.c:112
void RccEnableDma2(void)
Enable the DMA2 peripheral clock.
Definition: rcc.c:42
void RccDisableSdmmc1(void)
Disable the SDMMC1 peripheral clock.
Definition: rcc.c:117
void RccDisablePortB(void)
Disable the GPIO port B clock.
Definition: rcc.c:77
void RccDisableUart2(void)
Disable the USART2 peripheral clock.
Definition: rcc.c:137
This file includes the microcontroller-specific HAL header files.
This file contains the RCC (Reset and Clock Control) driver function prototypes for enabling and disa...