diff options
Diffstat (limited to 'lib/chibios/os/hal/ports/STM32/STM32L1xx/stm32_rcc.h')
-rw-r--r-- | lib/chibios/os/hal/ports/STM32/STM32L1xx/stm32_rcc.h | 795 |
1 files changed, 795 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/ports/STM32/STM32L1xx/stm32_rcc.h b/lib/chibios/os/hal/ports/STM32/STM32L1xx/stm32_rcc.h new file mode 100644 index 000000000..5c0d318d2 --- /dev/null +++ b/lib/chibios/os/hal/ports/STM32/STM32L1xx/stm32_rcc.h | |||
@@ -0,0 +1,795 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * @file STM32L1xx/stm32_rcc.h | ||
19 | * @brief RCC helper driver header. | ||
20 | * @note This file requires definitions from the ST header file | ||
21 | * @p stm32l1xx.h. | ||
22 | * | ||
23 | * @addtogroup STM32L1xx_RCC | ||
24 | * @{ | ||
25 | */ | ||
26 | |||
27 | #ifndef STM32_RCC_H | ||
28 | #define STM32_RCC_H | ||
29 | |||
30 | /*===========================================================================*/ | ||
31 | /* Driver constants. */ | ||
32 | /*===========================================================================*/ | ||
33 | |||
34 | /*===========================================================================*/ | ||
35 | /* Driver pre-compile time settings. */ | ||
36 | /*===========================================================================*/ | ||
37 | |||
38 | /*===========================================================================*/ | ||
39 | /* Derived constants and error checks. */ | ||
40 | /*===========================================================================*/ | ||
41 | |||
42 | /*===========================================================================*/ | ||
43 | /* Driver data structures and types. */ | ||
44 | /*===========================================================================*/ | ||
45 | |||
46 | /*===========================================================================*/ | ||
47 | /* Driver macros. */ | ||
48 | /*===========================================================================*/ | ||
49 | |||
50 | /** | ||
51 | * @name Generic RCC operations | ||
52 | * @{ | ||
53 | */ | ||
54 | /** | ||
55 | * @brief Enables the clock of one or more peripheral on the APB1 bus. | ||
56 | * | ||
57 | * @param[in] mask APB1 peripherals mask | ||
58 | * @param[in] lp low power enable flag | ||
59 | * | ||
60 | * @api | ||
61 | */ | ||
62 | #define rccEnableAPB1(mask, lp) { \ | ||
63 | RCC->APB1ENR |= (mask); \ | ||
64 | if (lp) \ | ||
65 | RCC->APB1LPENR |= (mask); \ | ||
66 | else \ | ||
67 | RCC->APB1LPENR &= ~(mask); \ | ||
68 | (void)RCC->APB1LPENR; \ | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * @brief Disables the clock of one or more peripheral on the APB1 bus. | ||
73 | * | ||
74 | * @param[in] mask APB1 peripherals mask | ||
75 | * | ||
76 | * @api | ||
77 | */ | ||
78 | #define rccDisableAPB1(mask) { \ | ||
79 | RCC->APB1ENR &= ~(mask); \ | ||
80 | RCC->APB1LPENR &= ~(mask); \ | ||
81 | (void)RCC->APB1LPENR; \ | ||
82 | } | ||
83 | |||
84 | /** | ||
85 | * @brief Resets one or more peripheral on the APB1 bus. | ||
86 | * | ||
87 | * @param[in] mask APB1 peripherals mask | ||
88 | * | ||
89 | * @api | ||
90 | */ | ||
91 | #define rccResetAPB1(mask) { \ | ||
92 | RCC->APB1RSTR |= (mask); \ | ||
93 | RCC->APB1RSTR &= ~(mask); \ | ||
94 | (void)RCC->APB1RSTR; \ | ||
95 | } | ||
96 | |||
97 | /** | ||
98 | * @brief Enables the clock of one or more peripheral on the APB2 bus. | ||
99 | * | ||
100 | * @param[in] mask APB2 peripherals mask | ||
101 | * @param[in] lp low power enable flag | ||
102 | * | ||
103 | * @api | ||
104 | */ | ||
105 | #define rccEnableAPB2(mask, lp) { \ | ||
106 | RCC->APB2ENR |= (mask); \ | ||
107 | if (lp) \ | ||
108 | RCC->APB2LPENR |= (mask); \ | ||
109 | else \ | ||
110 | RCC->APB2LPENR &= ~(mask); \ | ||
111 | (void)RCC->APB2LPENR; \ | ||
112 | } | ||
113 | |||
114 | /** | ||
115 | * @brief Disables the clock of one or more peripheral on the APB2 bus. | ||
116 | * | ||
117 | * @param[in] mask APB2 peripherals mask | ||
118 | * | ||
119 | * @api | ||
120 | */ | ||
121 | #define rccDisableAPB2(mask) { \ | ||
122 | RCC->APB2ENR &= ~(mask); \ | ||
123 | RCC->APB2LPENR &= ~(mask); \ | ||
124 | (void)RCC->APB2LPENR; \ | ||
125 | } | ||
126 | |||
127 | /** | ||
128 | * @brief Resets one or more peripheral on the APB2 bus. | ||
129 | * | ||
130 | * @param[in] mask APB2 peripherals mask | ||
131 | * | ||
132 | * @api | ||
133 | */ | ||
134 | #define rccResetAPB2(mask) { \ | ||
135 | RCC->APB2RSTR |= (mask); \ | ||
136 | RCC->APB2RSTR &= ~(mask); \ | ||
137 | (void)RCC->APB2RSTR; \ | ||
138 | } | ||
139 | |||
140 | /** | ||
141 | * @brief Enables the clock of one or more peripheral on the AHB bus. | ||
142 | * | ||
143 | * @param[in] mask AHB peripherals mask | ||
144 | * @param[in] lp low power enable flag | ||
145 | * | ||
146 | * @api | ||
147 | */ | ||
148 | #define rccEnableAHB(mask, lp) { \ | ||
149 | RCC->AHBENR |= (mask); \ | ||
150 | if (lp) \ | ||
151 | RCC->AHBLPENR |= (mask); \ | ||
152 | else \ | ||
153 | RCC->AHBLPENR &= ~(mask); \ | ||
154 | (void)RCC->AHBLPENR; \ | ||
155 | } | ||
156 | |||
157 | /** | ||
158 | * @brief Disables the clock of one or more peripheral on the AHB bus. | ||
159 | * | ||
160 | * @param[in] mask AHB peripherals mask | ||
161 | * | ||
162 | * @api | ||
163 | */ | ||
164 | #define rccDisableAHB(mask) { \ | ||
165 | RCC->AHBENR &= ~(mask); \ | ||
166 | RCC->AHBLPENR &= ~(mask); \ | ||
167 | (void)RCC->AHBLPENR; \ | ||
168 | } | ||
169 | |||
170 | /** | ||
171 | * @brief Resets one or more peripheral on the AHB bus. | ||
172 | * | ||
173 | * @param[in] mask AHB peripherals mask | ||
174 | * | ||
175 | * @api | ||
176 | */ | ||
177 | #define rccResetAHB(mask) { \ | ||
178 | RCC->AHBRSTR |= (mask); \ | ||
179 | RCC->AHBRSTR &= ~(mask); \ | ||
180 | (void)RCC->AHBRSTR; \ | ||
181 | } | ||
182 | /** @} */ | ||
183 | |||
184 | /** | ||
185 | * @name ADC peripherals specific RCC operations | ||
186 | * @{ | ||
187 | */ | ||
188 | /** | ||
189 | * @brief Enables the ADC1 peripheral clock. | ||
190 | * | ||
191 | * @param[in] lp low power enable flag | ||
192 | * | ||
193 | * @api | ||
194 | */ | ||
195 | #define rccEnableADC1(lp) rccEnableAPB2(RCC_APB2ENR_ADC1EN, lp) | ||
196 | |||
197 | /** | ||
198 | * @brief Disables the ADC1 peripheral clock. | ||
199 | * | ||
200 | * @api | ||
201 | */ | ||
202 | #define rccDisableADC1() rccDisableAPB2(RCC_APB2ENR_ADC1EN) | ||
203 | |||
204 | /** | ||
205 | * @brief Resets the ADC1 peripheral. | ||
206 | * | ||
207 | * @api | ||
208 | */ | ||
209 | #define rccResetADC1() rccResetAPB2(RCC_APB2RSTR_ADC1RST) | ||
210 | /** @} */ | ||
211 | |||
212 | /** | ||
213 | * @name DAC peripheral specific RCC operations | ||
214 | * @{ | ||
215 | */ | ||
216 | /** | ||
217 | * @brief Enables the DAC1 peripheral clock. | ||
218 | * | ||
219 | * @param[in] lp low power enable flag | ||
220 | * | ||
221 | * @api | ||
222 | */ | ||
223 | #define rccEnableDAC1(lp) rccEnableAPB1(RCC_APB1ENR_DACEN, lp) | ||
224 | |||
225 | /** | ||
226 | * @brief Disables the DAC1 peripheral clock. | ||
227 | * | ||
228 | * @api | ||
229 | */ | ||
230 | #define rccDisableDAC1() rccDisableAPB1(RCC_APB1ENR_DACEN) | ||
231 | |||
232 | /** | ||
233 | * @brief Resets the DAC1 peripheral. | ||
234 | * | ||
235 | * @api | ||
236 | */ | ||
237 | #define rccResetDAC1() rccResetAPB1(RCC_APB1RSTR_DACRST) | ||
238 | /** @} */ | ||
239 | |||
240 | /** | ||
241 | * @name DMA peripheral specific RCC operations | ||
242 | * @{ | ||
243 | */ | ||
244 | /** | ||
245 | * @brief Enables the DMA1 peripheral clock. | ||
246 | * | ||
247 | * @param[in] lp low power enable flag | ||
248 | * | ||
249 | * @api | ||
250 | */ | ||
251 | #define rccEnableDMA1(lp) rccEnableAHB(RCC_AHBENR_DMA1EN, lp) | ||
252 | |||
253 | /** | ||
254 | * @brief Disables the DMA1 peripheral clock. | ||
255 | * | ||
256 | * @api | ||
257 | */ | ||
258 | #define rccDisableDMA1() rccDisableAHB(RCC_AHBENR_DMA1EN) | ||
259 | |||
260 | /** | ||
261 | * @brief Resets the DMA1 peripheral. | ||
262 | * | ||
263 | * @api | ||
264 | */ | ||
265 | #define rccResetDMA1() rccResetAHB(RCC_AHBRSTR_DMA1RST) | ||
266 | |||
267 | /** | ||
268 | * @brief Enables the DMA2 peripheral clock. | ||
269 | * | ||
270 | * @param[in] lp low power enable flag | ||
271 | * | ||
272 | * @api | ||
273 | */ | ||
274 | #define rccEnableDMA2(lp) rccEnableAHB(RCC_AHBENR_DMA2EN, lp) | ||
275 | |||
276 | /** | ||
277 | * @brief Disables the DMA2 peripheral clock. | ||
278 | * | ||
279 | * @api | ||
280 | */ | ||
281 | #define rccDisableDMA2() rccDisableAHB(RCC_AHBENR_DMA2EN) | ||
282 | |||
283 | /** | ||
284 | * @brief Resets the DMA2 peripheral. | ||
285 | * | ||
286 | * @api | ||
287 | */ | ||
288 | #define rccResetDMA2() rccResetAHB(RCC_AHBRSTR_DMA2RST) | ||
289 | /** @} */ | ||
290 | |||
291 | /** | ||
292 | * @name PWR interface specific RCC operations | ||
293 | * @{ | ||
294 | */ | ||
295 | /** | ||
296 | * @brief Enables the PWR interface clock. | ||
297 | * | ||
298 | * @param[in] lp low power enable flag | ||
299 | * | ||
300 | * @api | ||
301 | */ | ||
302 | #define rccEnablePWRInterface(lp) rccEnableAPB1(RCC_APB1ENR_PWREN, lp) | ||
303 | |||
304 | /** | ||
305 | * @brief Disables PWR interface clock. | ||
306 | * | ||
307 | * @api | ||
308 | */ | ||
309 | #define rccDisablePWRInterface() rccDisableAPB1(RCC_APB1ENR_PWREN) | ||
310 | |||
311 | /** | ||
312 | * @brief Resets the PWR interface. | ||
313 | * | ||
314 | * @api | ||
315 | */ | ||
316 | #define rccResetPWRInterface() rccResetAPB1(RCC_APB1RSTR_PWRRST) | ||
317 | /** @} */ | ||
318 | |||
319 | /** | ||
320 | * @name I2C peripherals specific RCC operations | ||
321 | * @{ | ||
322 | */ | ||
323 | /** | ||
324 | * @brief Enables the I2C1 peripheral clock. | ||
325 | * | ||
326 | * @param[in] lp low power enable flag | ||
327 | * | ||
328 | * @api | ||
329 | */ | ||
330 | #define rccEnableI2C1(lp) rccEnableAPB1(RCC_APB1ENR_I2C1EN, lp) | ||
331 | |||
332 | /** | ||
333 | * @brief Disables the I2C1 peripheral clock. | ||
334 | * | ||
335 | * @api | ||
336 | */ | ||
337 | #define rccDisableI2C1() rccDisableAPB1(RCC_APB1ENR_I2C1EN) | ||
338 | |||
339 | /** | ||
340 | * @brief Resets the I2C1 peripheral. | ||
341 | * | ||
342 | * @api | ||
343 | */ | ||
344 | #define rccResetI2C1() rccResetAPB1(RCC_APB1RSTR_I2C1RST) | ||
345 | |||
346 | /** | ||
347 | * @brief Enables the I2C2 peripheral clock. | ||
348 | * | ||
349 | * @param[in] lp low power enable flag | ||
350 | * | ||
351 | * @api | ||
352 | */ | ||
353 | #define rccEnableI2C2(lp) rccEnableAPB1(RCC_APB1ENR_I2C2EN, lp) | ||
354 | |||
355 | /** | ||
356 | * @brief Disables the I2C2 peripheral clock. | ||
357 | * | ||
358 | * @api | ||
359 | */ | ||
360 | #define rccDisableI2C2() rccDisableAPB1(RCC_APB1ENR_I2C2EN) | ||
361 | |||
362 | /** | ||
363 | * @brief Resets the I2C2 peripheral. | ||
364 | * | ||
365 | * @api | ||
366 | */ | ||
367 | #define rccResetI2C2() rccResetAPB1(RCC_APB1RSTR_I2C2RST) | ||
368 | /** @} */ | ||
369 | |||
370 | /** | ||
371 | * @name SPI peripherals specific RCC operations | ||
372 | * @{ | ||
373 | */ | ||
374 | /** | ||
375 | * @brief Enables the SPI1 peripheral clock. | ||
376 | * | ||
377 | * @param[in] lp low power enable flag | ||
378 | * | ||
379 | * @api | ||
380 | */ | ||
381 | #define rccEnableSPI1(lp) rccEnableAPB2(RCC_APB2ENR_SPI1EN, lp) | ||
382 | |||
383 | /** | ||
384 | * @brief Disables the SPI1 peripheral clock. | ||
385 | * | ||
386 | * @api | ||
387 | */ | ||
388 | #define rccDisableSPI1() rccDisableAPB2(RCC_APB2ENR_SPI1EN) | ||
389 | |||
390 | /** | ||
391 | * @brief Resets the SPI1 peripheral. | ||
392 | * | ||
393 | * @api | ||
394 | */ | ||
395 | #define rccResetSPI1() rccResetAPB2(RCC_APB2RSTR_SPI1RST) | ||
396 | |||
397 | /** | ||
398 | * @brief Enables the SPI2 peripheral clock. | ||
399 | * | ||
400 | * @param[in] lp low power enable flag | ||
401 | * | ||
402 | * @api | ||
403 | */ | ||
404 | #define rccEnableSPI2(lp) rccEnableAPB1(RCC_APB1ENR_SPI2EN, lp) | ||
405 | |||
406 | /** | ||
407 | * @brief Disables the SPI2 peripheral clock. | ||
408 | * | ||
409 | * @api | ||
410 | */ | ||
411 | #define rccDisableSPI2() rccDisableAPB1(RCC_APB1ENR_SPI2EN) | ||
412 | |||
413 | /** | ||
414 | * @brief Resets the SPI2 peripheral. | ||
415 | * | ||
416 | * @api | ||
417 | */ | ||
418 | #define rccResetSPI2() rccResetAPB1(RCC_APB1RSTR_SPI2RST) | ||
419 | /** @} */ | ||
420 | |||
421 | /** | ||
422 | * @name TIM peripherals specific RCC operations | ||
423 | * @{ | ||
424 | */ | ||
425 | /** | ||
426 | * @brief Enables the TIM2 peripheral clock. | ||
427 | * | ||
428 | * @param[in] lp low power enable flag | ||
429 | * | ||
430 | * @api | ||
431 | */ | ||
432 | #define rccEnableTIM2(lp) rccEnableAPB1(RCC_APB1ENR_TIM2EN, lp) | ||
433 | |||
434 | /** | ||
435 | * @brief Disables the TIM2 peripheral clock. | ||
436 | * | ||
437 | * @api | ||
438 | */ | ||
439 | #define rccDisableTIM2() rccDisableAPB1(RCC_APB1ENR_TIM2EN) | ||
440 | |||
441 | /** | ||
442 | * @brief Resets the TIM2 peripheral. | ||
443 | * | ||
444 | * @api | ||
445 | */ | ||
446 | #define rccResetTIM2() rccResetAPB1(RCC_APB1RSTR_TIM2RST) | ||
447 | |||
448 | /** | ||
449 | * @brief Enables the TIM3 peripheral clock. | ||
450 | * | ||
451 | * @param[in] lp low power enable flag | ||
452 | * | ||
453 | * @api | ||
454 | */ | ||
455 | #define rccEnableTIM3(lp) rccEnableAPB1(RCC_APB1ENR_TIM3EN, lp) | ||
456 | |||
457 | /** | ||
458 | * @brief Disables the TIM3 peripheral clock. | ||
459 | * | ||
460 | * @api | ||
461 | */ | ||
462 | #define rccDisableTIM3() rccDisableAPB1(RCC_APB1ENR_TIM3EN) | ||
463 | |||
464 | /** | ||
465 | * @brief Resets the TIM3 peripheral. | ||
466 | * | ||
467 | * @api | ||
468 | */ | ||
469 | #define rccResetTIM3() rccResetAPB1(RCC_APB1RSTR_TIM3RST) | ||
470 | |||
471 | /** | ||
472 | * @brief Enables the TIM4 peripheral clock. | ||
473 | * | ||
474 | * @param[in] lp low power enable flag | ||
475 | * | ||
476 | * @api | ||
477 | */ | ||
478 | #define rccEnableTIM4(lp) rccEnableAPB1(RCC_APB1ENR_TIM4EN, lp) | ||
479 | |||
480 | /** | ||
481 | * @brief Disables the TIM4 peripheral clock. | ||
482 | * | ||
483 | * @api | ||
484 | */ | ||
485 | #define rccDisableTIM4() rccDisableAPB1(RCC_APB1ENR_TIM4EN) | ||
486 | |||
487 | /** | ||
488 | * @brief Resets the TIM4 peripheral. | ||
489 | * | ||
490 | * @api | ||
491 | */ | ||
492 | #define rccResetTIM4() rccResetAPB1(RCC_APB1RSTR_TIM4RST) | ||
493 | |||
494 | /** | ||
495 | * @brief Enables the TIM5 peripheral clock. | ||
496 | * | ||
497 | * @param[in] lp low power enable flag | ||
498 | * | ||
499 | * @api | ||
500 | */ | ||
501 | #define rccEnableTIM5(lp) rccEnableAPB1(RCC_APB1ENR_TIM5EN, lp) | ||
502 | |||
503 | /** | ||
504 | * @brief Disables the TIM5 peripheral clock. | ||
505 | * | ||
506 | * @api | ||
507 | */ | ||
508 | #define rccDisableTIM5() rccDisableAPB1(RCC_APB1ENR_TIM5EN) | ||
509 | |||
510 | /** | ||
511 | * @brief Resets the TIM5 peripheral. | ||
512 | * | ||
513 | * @api | ||
514 | */ | ||
515 | #define rccResetTIM5() rccResetAPB1(RCC_APB1RSTR_TIM5RST) | ||
516 | |||
517 | /** | ||
518 | * @brief Enables the TIM6 peripheral clock. | ||
519 | * | ||
520 | * @param[in] lp low power enable flag | ||
521 | * | ||
522 | * @api | ||
523 | */ | ||
524 | #define rccEnableTIM6(lp) rccEnableAPB1(RCC_APB1ENR_TIM6EN, lp) | ||
525 | |||
526 | /** | ||
527 | * @brief Disables the TIM6 peripheral clock. | ||
528 | * | ||
529 | * @api | ||
530 | */ | ||
531 | #define rccDisableTIM6() rccDisableAPB1(RCC_APB1ENR_TIM6EN) | ||
532 | |||
533 | /** | ||
534 | * @brief Resets the TIM6 peripheral. | ||
535 | * | ||
536 | * @api | ||
537 | */ | ||
538 | #define rccResetTIM6() rccResetAPB1(RCC_APB1RSTR_TIM6RST) | ||
539 | |||
540 | /** | ||
541 | * @brief Enables the TIM7 peripheral clock. | ||
542 | * | ||
543 | * @param[in] lp low power enable flag | ||
544 | * | ||
545 | * @api | ||
546 | */ | ||
547 | #define rccEnableTIM7(lp) rccEnableAPB1(RCC_APB1ENR_TIM7EN, lp) | ||
548 | |||
549 | /** | ||
550 | * @brief Disables the TIM7 peripheral clock. | ||
551 | * | ||
552 | * @api | ||
553 | */ | ||
554 | #define rccDisableTIM7() rccDisableAPB1(RCC_APB1ENR_TIM7EN) | ||
555 | |||
556 | /** | ||
557 | * @brief Resets the TIM7 peripheral. | ||
558 | * | ||
559 | * @api | ||
560 | */ | ||
561 | #define rccResetTIM7() rccResetAPB1(RCC_APB1RSTR_TIM7RST) | ||
562 | |||
563 | /** | ||
564 | * @brief Enables the TIM9 peripheral clock. | ||
565 | * | ||
566 | * @param[in] lp low power enable flag | ||
567 | * | ||
568 | * @api | ||
569 | */ | ||
570 | #define rccEnableTIM9(lp) rccEnableAPB2(RCC_APB2ENR_TIM9EN, lp) | ||
571 | |||
572 | /** | ||
573 | * @brief Disables the TIM9 peripheral clock. | ||
574 | * | ||
575 | * @api | ||
576 | */ | ||
577 | #define rccDisableTIM9() rccDisableAPB2(RCC_APB2ENR_TIM9EN) | ||
578 | |||
579 | /** | ||
580 | * @brief Resets the TIM9 peripheral. | ||
581 | * | ||
582 | * @api | ||
583 | */ | ||
584 | #define rccResetTIM9() rccResetAPB2(RCC_APB2RSTR_TIM9RST) | ||
585 | |||
586 | /** | ||
587 | * @brief Enables the TIM10 peripheral clock. | ||
588 | * | ||
589 | * @param[in] lp low power enable flag | ||
590 | * | ||
591 | * @api | ||
592 | */ | ||
593 | #define rccEnableTIM10(lp) rccEnableAPB2(RCC_APB2ENR_TIM10EN, lp) | ||
594 | |||
595 | /** | ||
596 | * @brief Disables the TIM10 peripheral clock. | ||
597 | * | ||
598 | * @api | ||
599 | */ | ||
600 | #define rccDisableTIM10() rccDisableAPB2(RCC_APB2ENR_TIM10EN) | ||
601 | |||
602 | /** | ||
603 | * @brief Resets the TIM10 peripheral. | ||
604 | * | ||
605 | * @api | ||
606 | */ | ||
607 | #define rccResetTIM10() rccResetAPB2(RCC_APB2RSTR_TIM10RST) | ||
608 | |||
609 | /** | ||
610 | * @brief Enables the TIM10 peripheral clock. | ||
611 | * | ||
612 | * @param[in] lp low power enable flag | ||
613 | * | ||
614 | * @api | ||
615 | */ | ||
616 | #define rccEnableTIM11(lp) rccEnableAPB2(RCC_APB2ENR_TIM11EN, lp) | ||
617 | |||
618 | /** | ||
619 | * @brief Disables the TIM11 peripheral clock. | ||
620 | * | ||
621 | * @api | ||
622 | */ | ||
623 | #define rccDisableTIM11() rccDisableAPB2(RCC_APB2ENR_TIM11EN) | ||
624 | |||
625 | /** | ||
626 | * @brief Resets the TIM11 peripheral. | ||
627 | * | ||
628 | * @api | ||
629 | */ | ||
630 | #define rccResetTIM11() rccResetAPB2(RCC_APB2RSTR_TIM11RST) | ||
631 | |||
632 | /** @} */ | ||
633 | |||
634 | /** | ||
635 | * @name USART/UART peripherals specific RCC operations | ||
636 | * @{ | ||
637 | */ | ||
638 | /** | ||
639 | * @brief Enables the USART1 peripheral clock. | ||
640 | * | ||
641 | * @param[in] lp low power enable flag | ||
642 | * | ||
643 | * @api | ||
644 | */ | ||
645 | #define rccEnableUSART1(lp) rccEnableAPB2(RCC_APB2ENR_USART1EN, lp) | ||
646 | |||
647 | /** | ||
648 | * @brief Disables the USART1 peripheral clock. | ||
649 | * | ||
650 | * @api | ||
651 | */ | ||
652 | #define rccDisableUSART1() rccDisableAPB2(RCC_APB2ENR_USART1EN) | ||
653 | |||
654 | /** | ||
655 | * @brief Resets the USART1 peripheral. | ||
656 | * | ||
657 | * @api | ||
658 | */ | ||
659 | #define rccResetUSART1() rccResetAPB2(RCC_APB2RSTR_USART1RST) | ||
660 | |||
661 | /** | ||
662 | * @brief Enables the USART2 peripheral clock. | ||
663 | * | ||
664 | * @param[in] lp low power enable flag | ||
665 | * | ||
666 | * @api | ||
667 | */ | ||
668 | #define rccEnableUSART2(lp) rccEnableAPB1(RCC_APB1ENR_USART2EN, lp) | ||
669 | |||
670 | /** | ||
671 | * @brief Disables the USART2 peripheral clock. | ||
672 | * | ||
673 | * @api | ||
674 | */ | ||
675 | #define rccDisableUSART2() rccDisableAPB1(RCC_APB1ENR_USART2EN) | ||
676 | |||
677 | /** | ||
678 | * @brief Resets the USART2 peripheral. | ||
679 | * | ||
680 | * @api | ||
681 | */ | ||
682 | #define rccResetUSART2() rccResetAPB1(RCC_APB1RSTR_USART2RST) | ||
683 | |||
684 | /** | ||
685 | * @brief Enables the USART3 peripheral clock. | ||
686 | * | ||
687 | * @param[in] lp low power enable flag | ||
688 | * | ||
689 | * @api | ||
690 | */ | ||
691 | #define rccEnableUSART3(lp) rccEnableAPB1(RCC_APB1ENR_USART3EN, lp) | ||
692 | |||
693 | /** | ||
694 | * @brief Disables the USART3 peripheral clock. | ||
695 | * | ||
696 | * @api | ||
697 | */ | ||
698 | #define rccDisableUSART3() rccDisableAPB1(RCC_APB1ENR_USART3EN) | ||
699 | |||
700 | /** | ||
701 | * @brief Resets the USART3 peripheral. | ||
702 | * | ||
703 | * @api | ||
704 | */ | ||
705 | #define rccResetUSART3() rccResetAPB1(RCC_APB1RSTR_USART3RST) | ||
706 | |||
707 | /** | ||
708 | * @brief Enables the UART4 peripheral clock. | ||
709 | * | ||
710 | * @param[in] lp low power enable flag | ||
711 | * | ||
712 | * @api | ||
713 | */ | ||
714 | #define rccEnableUART4(lp) rccEnableAPB1(RCC_APB1ENR_UART4EN, lp) | ||
715 | |||
716 | /** | ||
717 | * @brief Disables the UART4 peripheral clock. | ||
718 | * | ||
719 | * @api | ||
720 | */ | ||
721 | #define rccDisableUART4() rccDisableAPB1(RCC_APB1ENR_UART4EN) | ||
722 | |||
723 | /** | ||
724 | * @brief Resets the UART4 peripheral. | ||
725 | * | ||
726 | * @api | ||
727 | */ | ||
728 | #define rccResetUART4() rccResetAPB1(RCC_APB1RSTR_UART4RST) | ||
729 | |||
730 | /** | ||
731 | * @brief Enables the UART5 peripheral clock. | ||
732 | * | ||
733 | * @param[in] lp low power enable flag | ||
734 | * | ||
735 | * @api | ||
736 | */ | ||
737 | #define rccEnableUART5(lp) rccEnableAPB1(RCC_APB1ENR_UART5EN, lp) | ||
738 | |||
739 | /** | ||
740 | * @brief Disables the UART5 peripheral clock. | ||
741 | * | ||
742 | * @api | ||
743 | */ | ||
744 | #define rccDisableUART5() rccDisableAPB1(RCC_APB1ENR_UART5EN) | ||
745 | |||
746 | /** | ||
747 | * @brief Resets the UART5 peripheral. | ||
748 | * | ||
749 | * @api | ||
750 | */ | ||
751 | #define rccResetUART5() rccResetAPB1(RCC_APB1RSTR_UART5RST) | ||
752 | /** @} */ | ||
753 | |||
754 | /** | ||
755 | * @name USB peripheral specific RCC operations | ||
756 | * @{ | ||
757 | */ | ||
758 | /** | ||
759 | * @brief Enables the USB peripheral clock. | ||
760 | * | ||
761 | * @param[in] lp low power enable flag | ||
762 | * | ||
763 | * @api | ||
764 | */ | ||
765 | #define rccEnableUSB(lp) rccEnableAPB1(RCC_APB1ENR_USBEN, lp) | ||
766 | |||
767 | /** | ||
768 | * @brief Disables the USB peripheral clock. | ||
769 | * | ||
770 | * @api | ||
771 | */ | ||
772 | #define rccDisableUSB() rccDisableAPB1(RCC_APB1ENR_USBEN) | ||
773 | |||
774 | /** | ||
775 | * @brief Resets the USB peripheral. | ||
776 | * | ||
777 | * @api | ||
778 | */ | ||
779 | #define rccResetUSB() rccResetAPB1(RCC_APB1RSTR_USBRST) | ||
780 | /** @} */ | ||
781 | |||
782 | /*===========================================================================*/ | ||
783 | /* External declarations. */ | ||
784 | /*===========================================================================*/ | ||
785 | |||
786 | #ifdef __cplusplus | ||
787 | extern "C" { | ||
788 | #endif | ||
789 | #ifdef __cplusplus | ||
790 | } | ||
791 | #endif | ||
792 | |||
793 | #endif /* STM32_RCC_H */ | ||
794 | |||
795 | /** @} */ | ||