|
2 | 2 | ******************************************************************************
|
3 | 3 | * @file system_stm32f0xx.c
|
4 | 4 | * @author MCD Application Team
|
5 |
| - * @version V2.2.2 |
6 |
| - * @date 26-June-2015 |
| 5 | + * @version V2.2.3 |
| 6 | + * @date 29-January-2016 |
7 | 7 | * @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File.
|
8 | 8 | *
|
9 | 9 | * 1. This file provides two functions and one global variable to be called from
|
|
42 | 42 | ******************************************************************************
|
43 | 43 | * @attention
|
44 | 44 | *
|
45 |
| - * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
| 45 | + * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
46 | 46 | *
|
47 | 47 | * Redistribution and use in source and binary forms, with or without modification,
|
48 | 48 | * are permitted provided that the following conditions are met:
|
|
82 | 82 | */
|
83 | 83 |
|
84 | 84 | #include "stm32f0xx.h"
|
| 85 | + |
85 | 86 | /**
|
86 | 87 | * @}
|
87 | 88 | */
|
|
107 | 108 | This value can be provided and adapted by the user application. */
|
108 | 109 | #endif /* HSI_VALUE */
|
109 | 110 |
|
| 111 | +#if !defined (HSI48_VALUE) |
| 112 | +#define HSI48_VALUE ((uint32_t)48000000) /*!< Default value of the HSI48 Internal oscillator in Hz. |
| 113 | + This value can be provided and adapted by the user application. */ |
| 114 | +#endif /* HSI48_VALUE */ |
110 | 115 | /**
|
111 | 116 | * @}
|
112 | 117 | */
|
@@ -171,60 +176,60 @@ void SystemInit(void)
|
171 | 176 | {
|
172 | 177 | /* Reset the RCC clock configuration to the default reset state ------------*/
|
173 | 178 | /* Set HSION bit */
|
174 |
| - RCC->CR |= (uint32_t)0x00000001; |
| 179 | + RCC->CR |= (uint32_t)0x00000001U; |
175 | 180 |
|
176 | 181 | #if defined (STM32F051x8) || defined (STM32F058x8)
|
177 | 182 | /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */
|
178 |
| - RCC->CFGR &= (uint32_t)0xF8FFB80C; |
| 183 | + RCC->CFGR &= (uint32_t)0xF8FFB80CU; |
179 | 184 | #else
|
180 | 185 | /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */
|
181 |
| - RCC->CFGR &= (uint32_t)0x08FFB80C; |
| 186 | + RCC->CFGR &= (uint32_t)0x08FFB80CU; |
182 | 187 | #endif /* STM32F051x8 or STM32F058x8 */
|
183 | 188 |
|
184 | 189 | /* Reset HSEON, CSSON and PLLON bits */
|
185 |
| - RCC->CR &= (uint32_t)0xFEF6FFFF; |
| 190 | + RCC->CR &= (uint32_t)0xFEF6FFFFU; |
186 | 191 |
|
187 | 192 | /* Reset HSEBYP bit */
|
188 |
| - RCC->CR &= (uint32_t)0xFFFBFFFF; |
| 193 | + RCC->CR &= (uint32_t)0xFFFBFFFFU; |
189 | 194 |
|
190 | 195 | /* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
|
191 |
| - RCC->CFGR &= (uint32_t)0xFFC0FFFF; |
| 196 | + RCC->CFGR &= (uint32_t)0xFFC0FFFFU; |
192 | 197 |
|
193 | 198 | /* Reset PREDIV[3:0] bits */
|
194 |
| - RCC->CFGR2 &= (uint32_t)0xFFFFFFF0; |
| 199 | + RCC->CFGR2 &= (uint32_t)0xFFFFFFF0U; |
195 | 200 |
|
196 | 201 | #if defined (STM32F072xB) || defined (STM32F078xx)
|
197 | 202 | /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
|
198 |
| - RCC->CFGR3 &= (uint32_t)0xFFFCFE2C; |
| 203 | + RCC->CFGR3 &= (uint32_t)0xFFFCFE2CU; |
199 | 204 | #elif defined (STM32F071xB)
|
200 | 205 | /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
201 |
| - RCC->CFGR3 &= (uint32_t)0xFFFFCEAC; |
| 206 | + RCC->CFGR3 &= (uint32_t)0xFFFFCEACU; |
202 | 207 | #elif defined (STM32F091xC) || defined (STM32F098xx)
|
203 | 208 | /* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
204 |
| - RCC->CFGR3 &= (uint32_t)0xFFF0FEAC; |
| 209 | + RCC->CFGR3 &= (uint32_t)0xFFF0FEACU; |
205 | 210 | #elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC)
|
206 | 211 | /* Reset USART1SW[1:0], I2C1SW and ADCSW bits */
|
207 |
| - RCC->CFGR3 &= (uint32_t)0xFFFFFEEC; |
| 212 | + RCC->CFGR3 &= (uint32_t)0xFFFFFEECU; |
208 | 213 | #elif defined (STM32F051x8) || defined (STM32F058xx)
|
209 | 214 | /* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
210 |
| - RCC->CFGR3 &= (uint32_t)0xFFFFFEAC; |
| 215 | + RCC->CFGR3 &= (uint32_t)0xFFFFFEACU; |
211 | 216 | #elif defined (STM32F042x6) || defined (STM32F048xx)
|
212 | 217 | /* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
|
213 |
| - RCC->CFGR3 &= (uint32_t)0xFFFFFE2C; |
| 218 | + RCC->CFGR3 &= (uint32_t)0xFFFFFE2CU; |
214 | 219 | #elif defined (STM32F070x6) || defined (STM32F070xB)
|
215 | 220 | /* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */
|
216 |
| - RCC->CFGR3 &= (uint32_t)0xFFFFFE6C; |
| 221 | + RCC->CFGR3 &= (uint32_t)0xFFFFFE6CU; |
217 | 222 | /* Set default USB clock to PLLCLK, since there is no HSI48 */
|
218 |
| - RCC->CFGR3 |= (uint32_t)0x00000080; |
| 223 | + RCC->CFGR3 |= (uint32_t)0x00000080U; |
219 | 224 | #else
|
220 | 225 | #warning "No target selected"
|
221 | 226 | #endif
|
222 | 227 |
|
223 | 228 | /* Reset HSI14 bit */
|
224 |
| - RCC->CR2 &= (uint32_t)0xFFFFFFFE; |
| 229 | + RCC->CR2 &= (uint32_t)0xFFFFFFFEU; |
225 | 230 |
|
226 | 231 | /* Disable all interrupts */
|
227 |
| - RCC->CIR = 0x00000000; |
| 232 | + RCC->CIR = 0x00000000U; |
228 | 233 |
|
229 | 234 | /* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */
|
230 | 235 | RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
|
|
0 commit comments