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