RTEMS 6.1-rc4
Loading...
Searching...
No Matches
rcc.h
Go to the documentation of this file.
1
7/*
8 * Copyright (c) 2012 Sebastian Huber. All rights reserved.
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifndef LIBBSP_ARM_STM32F4_RCC_H
16#define LIBBSP_ARM_STM32F4_RCC_H
17
18#include <stdbool.h>
19#include <bspopts.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif /* __cplusplus */
24
32#define STM32F4_RCC_INDEX(reg, idx) (((reg) << 5) | (idx))
33
34typedef enum {
35#ifdef STM32F4_FAMILY_F4XXXX
36
42 STM32F4_RCC_OTGHS = STM32F4_RCC_INDEX(0, 29),
43 STM32F4_RCC_ETHMAC = STM32F4_RCC_INDEX(0, 25),
44 STM32F4_RCC_DMA2 = STM32F4_RCC_INDEX(0, 22),
45 STM32F4_RCC_DMA1 = STM32F4_RCC_INDEX(0, 21),
46 STM32F4_RCC_CRC = STM32F4_RCC_INDEX(0, 12),
47 STM32F4_RCC_GPIOI = STM32F4_RCC_INDEX(0, 8),
48 STM32F4_RCC_GPIOH = STM32F4_RCC_INDEX(0, 7),
49 STM32F4_RCC_GPIOG = STM32F4_RCC_INDEX(0, 6),
50 STM32F4_RCC_GPIOF = STM32F4_RCC_INDEX(0, 5),
51 STM32F4_RCC_GPIOE = STM32F4_RCC_INDEX(0, 4),
52 STM32F4_RCC_GPIOD = STM32F4_RCC_INDEX(0, 3),
53 STM32F4_RCC_GPIOC = STM32F4_RCC_INDEX(0, 2),
54 STM32F4_RCC_GPIOB = STM32F4_RCC_INDEX(0, 1),
55 STM32F4_RCC_GPIOA = STM32F4_RCC_INDEX(0, 0),
56
57 STM32F4_RCC_OTGFS = STM32F4_RCC_INDEX(1, 7),
58 STM32F4_RCC_RNG = STM32F4_RCC_INDEX(1, 6),
59 STM32F4_RCC_HASH = STM32F4_RCC_INDEX(1, 5),
60 STM32F4_RCC_CRYP = STM32F4_RCC_INDEX(1, 4),
61 STM32F4_RCC_DCMI = STM32F4_RCC_INDEX(1, 0),
62
63 STM32F4_RCC_FSMCR = STM32F4_RCC_INDEX(2, 0),
64
65 STM32F4_RCC_DAC = STM32F4_RCC_INDEX(4, 29),
66 STM32F4_RCC_PWR = STM32F4_RCC_INDEX(4, 28),
67 STM32F4_RCC_CAN2 = STM32F4_RCC_INDEX(4, 26),
68 STM32F4_RCC_CAN1 = STM32F4_RCC_INDEX(4, 25),
69 STM32F4_RCC_I2C3 = STM32F4_RCC_INDEX(4, 23),
70 STM32F4_RCC_I2C2 = STM32F4_RCC_INDEX(4, 22),
71 STM32F4_RCC_I2C1 = STM32F4_RCC_INDEX(4, 21),
72 STM32F4_RCC_UART5 = STM32F4_RCC_INDEX(4, 20),
73 STM32F4_RCC_UART4 = STM32F4_RCC_INDEX(4, 19),
74 STM32F4_RCC_USART3 = STM32F4_RCC_INDEX(4, 18),
75 STM32F4_RCC_USART2 = STM32F4_RCC_INDEX(4, 17),
76 STM32F4_RCC_SPI3 = STM32F4_RCC_INDEX(4, 15),
77 STM32F4_RCC_SPI2 = STM32F4_RCC_INDEX(4, 14),
78 STM32F4_RCC_WWDG = STM32F4_RCC_INDEX(4, 11),
79 STM32F4_RCC_TIM14 = STM32F4_RCC_INDEX(4, 8),
80 STM32F4_RCC_TIM13 = STM32F4_RCC_INDEX(4, 7),
81 STM32F4_RCC_TIM12 = STM32F4_RCC_INDEX(4, 6),
82 STM32F4_RCC_TIM7 = STM32F4_RCC_INDEX(4, 5),
83 STM32F4_RCC_TIM6 = STM32F4_RCC_INDEX(4, 4),
84 STM32F4_RCC_TIM5 = STM32F4_RCC_INDEX(4, 3),
85 STM32F4_RCC_TIM4 = STM32F4_RCC_INDEX(4, 2),
86 STM32F4_RCC_TIM3 = STM32F4_RCC_INDEX(4, 1),
87 STM32F4_RCC_TIM2 = STM32F4_RCC_INDEX(4, 0),
88
89 STM32F4_RCC_TIM11 = STM32F4_RCC_INDEX(5, 18),
90 STM32F4_RCC_TIM10 = STM32F4_RCC_INDEX(5, 17),
91 STM32F4_RCC_TIM9 = STM32F4_RCC_INDEX(5, 16),
92 STM32F4_RCC_SYSCFG = STM32F4_RCC_INDEX(5, 14),
93 STM32F4_RCC_SPI1 = STM32F4_RCC_INDEX(5, 12),
94 STM32F4_RCC_SDIO = STM32F4_RCC_INDEX(5, 11),
95 STM32F4_RCC_ADC3 = STM32F4_RCC_INDEX(5, 10),
96 STM32F4_RCC_ADC2 = STM32F4_RCC_INDEX(5, 9),
97 STM32F4_RCC_ADC1 = STM32F4_RCC_INDEX(5, 8),
98 STM32F4_RCC_USART6 = STM32F4_RCC_INDEX(5, 5),
99 STM32F4_RCC_USART1 = STM32F4_RCC_INDEX(5, 4),
100 STM32F4_RCC_TIM8 = STM32F4_RCC_INDEX(5, 1),
101 STM32F4_RCC_TIM1 = STM32F4_RCC_INDEX(5, 0),
102
105#endif /* STM32F4_FAMILY_F4XXXX */
106#ifdef STM32F4_FAMILY_F10XXX
107
113 STM32F4_RCC_DMA1 = STM32F4_RCC_INDEX(0, 0),
114 STM32F4_RCC_DMA2 = STM32F4_RCC_INDEX(0, 1),
115 STM32F4_RCC_SRAM = STM32F4_RCC_INDEX(0, 2),
116 STM32F4_RCC_FLITF = STM32F4_RCC_INDEX(0, 4),
117 STM32F4_RCC_CRCEN = STM32F4_RCC_INDEX(0, 6),
118 STM32F4_RCC_FSMC = STM32F4_RCC_INDEX(0, 8),
119 STM32F4_RCC_SDIO = STM32F4_RCC_INDEX(0, 10),
120 STM32F4_RCC_OTGFS = STM32F4_RCC_INDEX(0, 12),
121 STM32F4_RCC_ETHMAC = STM32F4_RCC_INDEX(0, 14),
122 STM32F4_RCC_ETHMACTX = STM32F4_RCC_INDEX(0, 15),
123 STM32F4_RCC_ETHMACRX = STM32F4_RCC_INDEX(0, 16),
124
125 STM32F4_RCC_AFIO = STM32F4_RCC_INDEX(1, 0),
126 STM32F4_RCC_GPIOA = STM32F4_RCC_INDEX(1, 2),
127 STM32F4_RCC_GPIOB = STM32F4_RCC_INDEX(1, 3),
128 STM32F4_RCC_GPIOC = STM32F4_RCC_INDEX(1, 4),
129 STM32F4_RCC_GPIOD = STM32F4_RCC_INDEX(1, 5),
130 STM32F4_RCC_GPIOE = STM32F4_RCC_INDEX(1, 6),
131 STM32F4_RCC_GPIOF = STM32F4_RCC_INDEX(1, 7),
132 STM32F4_RCC_GPIOG = STM32F4_RCC_INDEX(1, 8),
133 STM32F4_RCC_ADC1 = STM32F4_RCC_INDEX(1, 9),
134 STM32F4_RCC_ADC2 = STM32F4_RCC_INDEX(1, 10),
135 STM32F4_RCC_TIM1 = STM32F4_RCC_INDEX(1, 11),
136 STM32F4_RCC_SPI1 = STM32F4_RCC_INDEX(1, 12),
137 STM32F4_RCC_TIM8 = STM32F4_RCC_INDEX(1, 13),
138 STM32F4_RCC_USART1 = STM32F4_RCC_INDEX(1, 14),
139 STM32F4_RCC_ADC3 = STM32F4_RCC_INDEX(1, 15),
140 STM32F4_RCC_TIM9 = STM32F4_RCC_INDEX(1, 19),
141 STM32F4_RCC_TIM10 = STM32F4_RCC_INDEX(1, 20),
142 STM32F4_RCC_TIM11 = STM32F4_RCC_INDEX(1, 21),
143
144 STM32F4_RCC_TIM2 = STM32F4_RCC_INDEX(2, 0),
145 STM32F4_RCC_TIM3 = STM32F4_RCC_INDEX(2, 1),
146 STM32F4_RCC_TIM4 = STM32F4_RCC_INDEX(2, 2),
147 STM32F4_RCC_TIM5 = STM32F4_RCC_INDEX(2, 3),
148 STM32F4_RCC_TIM6 = STM32F4_RCC_INDEX(2, 4),
149 STM32F4_RCC_TIM7 = STM32F4_RCC_INDEX(2, 5),
150 STM32F4_RCC_TIM12 = STM32F4_RCC_INDEX(2, 6),
151 STM32F4_RCC_TIM13 = STM32F4_RCC_INDEX(2, 7),
152 STM32F4_RCC_TIM14 = STM32F4_RCC_INDEX(2, 8),
153 STM32F4_RCC_WWDG = STM32F4_RCC_INDEX(2, 11),
154 STM32F4_RCC_SPI2 = STM32F4_RCC_INDEX(2, 14),
155 STM32F4_RCC_SPI3 = STM32F4_RCC_INDEX(2, 15),
156 STM32F4_RCC_USART2 = STM32F4_RCC_INDEX(2, 17),
157 STM32F4_RCC_USART3 = STM32F4_RCC_INDEX(2, 18),
158 STM32F4_RCC_UART4 = STM32F4_RCC_INDEX(2, 19),
159 STM32F4_RCC_UART5 = STM32F4_RCC_INDEX(2, 20),
160 STM32F4_RCC_I2C1 = STM32F4_RCC_INDEX(2, 21),
161 STM32F4_RCC_I2C2 = STM32F4_RCC_INDEX(2, 22),
162 STM32F4_RCC_USB = STM32F4_RCC_INDEX(2, 23),
163 STM32F4_RCC_CAN1 = STM32F4_RCC_INDEX(2, 24),
164 STM32F4_RCC_CAN2 = STM32F4_RCC_INDEX(2, 25),
165 STM32F4_RCC_BKP = STM32F4_RCC_INDEX(2, 27),
166 STM32F4_RCC_PWR = STM32F4_RCC_INDEX(2, 28),
167 STM32F4_RCC_DAC = STM32F4_RCC_INDEX(2, 29),
168
171#endif /* STM32F4_FAMILY_F10XXX */
172} stm32f4_rcc_index;
173
174void stm32f4_rcc_reset(stm32f4_rcc_index index);
175
176void stm32f4_rcc_set_reset(stm32f4_rcc_index index, bool set);
177
178void stm32f4_rcc_set_clock(stm32f4_rcc_index index, bool set);
179
180#ifdef STM32F4_FAMILY_F4XXXX
181void stm32f4_rcc_set_low_power_clock(stm32f4_rcc_index index, bool set);
182#endif /* STM32F4_FAMILY_F4XXXX */
183
186#ifdef __cplusplus
187}
188#endif /* __cplusplus */
189
190#endif /* LIBBSP_ARM_STM32F4_RCC_H */