source: rtems/c/src/lib/libbsp/arm/stm32f4/include/stm32f4.h @ 7db6953

4.11
Last change on this file since 7db6953 was 7db6953, checked in by Tomasz Gregorek <tomasz.gregorek@…>, on Sep 21, 2014 at 6:07:41 PM

bsp/stm32f4XXXX: System clock configuration

Added simple math to caclulate register values for the PLL
and for the prescalers. It will try to keep 48MHz for the USB OTG FS.
Also it will set latency on the Flash memory for the high speeds.

Limitations:
It is assumed that 1MHz resolution is enough.
Best fits for the clocks are achieved with multiplies of 42MHz.
Even though APB1, APB2 and AHB are calculated user is still required
to provide correct values for the bsp configuration for the:
STM32F4_PCLK1
STM32F4_PCLK2
STM32F4_HCLK (= system clock)
as those are used for the peripheral clocking calculations.

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/**
2 * @file
3 * @ingroup stm32f4_reg
4 * @brief Register definitions.
5 */
6
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_STM32F4_H
22#define LIBBSP_ARM_STM32F4_STM32F4_H
23
24#include <bsp/utility.h>
25#include <bspopts.h>
26
27#define STM32F4_BASE 0x00
28
29#ifdef STM32F4_FAMILY_F4XXXX
30
31/**
32 * @defgroup stm32f4_reg Register Defintions
33 * @ingroup arm_stm32f4
34 * @brief Register Definitions
35 * @{
36 */
37
38/**
39 * @name STM32f4XXXX GPIO
40 * @{
41 */
42
43#include <bsp/stm32f4xxxx_gpio.h>
44#define STM32F4_GPIO(i) ((volatile stm32f4_gpio *) (STM32F4_BASE + 0x40020000) + (i))
45
46/** @} */
47
48/**
49 * @name STM32F4XXXX RCC
50 * @{
51 */
52
53#include <bsp/stm32f4xxxx_rcc.h>
54#define STM32F4_RCC ((volatile stm32f4_rcc *) (STM32F4_BASE + 0x40023800))
55
56/** @} */
57
58/**
59 * @name STM32F4XXXX FLASH
60 * @{
61 */
62
63#include <bsp/stm32f4xxxx_flash.h>
64#define STM32F4_FLASH ((volatile stm32f4_flash *) (STM32F4_BASE + 0x40023C00))
65
66/** @} */
67
68#include <bsp/stm32_i2c.h>
69
70/**
71 * @name STM32 I2C
72 * @{
73 */
74
75#define STM32F4_I2C3 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005C00))
76#define STM32F4_I2C2 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005800))
77#define STM32F4_I2C1 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005400))
78
79/** @} */
80
81/**
82 * @name STM32 USART
83 * @{
84 */
85
86#include <bsp/stm32_usart.h>
87#define STM32F4_USART_1 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40011000))
88#define STM32F4_USART_2 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40004400))
89#define STM32F4_USART_3 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40004800))
90#define STM32F4_USART_4 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40004c00))
91#define STM32F4_USART_5 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40005000))
92#define STM32F4_USART_6 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40011400))
93
94/** @} */
95
96#endif /* STM32F4_FAMILY_F4XXXX */
97
98#ifdef STM32F4_FAMILY_F10XXX
99
100/**
101 * @name STM32F10 EXTI
102 * @{
103 */
104
105#include <bsp/stm32f10xxx_exti.h>
106#define STM32F4_EXTI ((volatile stm32f4_exti *) (STM32F4_BASE + 0x40010400))
107
108/** @} */
109
110/**
111 * @name STM32F10XXX GPIO
112 * @{
113 */
114
115#include <bsp/stm32f10xxx_gpio.h>
116#define STM32F4_GPIO(i) ((volatile stm32f4_gpio *) (STM32F4_BASE + 0x40010800 + i * 0x400))
117#define STM32F4_AFIO ((volatile stm32f4_afio *) (STM32F4_BASE + 0x40010000))
118
119/** @} */
120
121/**
122 * @name STM32F10XXX RCC
123 * @{
124 */
125
126#include <bsp/stm32f10xxx_rcc.h>
127#define STM32F4_RCC ((volatile stm32f4_rcc *) (STM32F4_BASE + 0x40021000))
128
129/** @} */
130
131/**
132 * @name STM32 I2C
133 * @{
134 */
135
136#include <bsp/stm32_i2c.h>
137#define STM32F4_I2C2 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005800))
138#define STM32F4_I2C1 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005400))
139
140/** @} */
141
142/**
143 * @name STM32 USART
144 * @{
145 */
146
147#include <bsp/stm32_usart.h>
148#define STM32F4_USART_1 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40013800))
149#define STM32F4_USART_2 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40004400))
150#define STM32F4_USART_3 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40004800))
151#define STM32F4_USART_4 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40004c00))
152#define STM32F4_USART_5 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40005000))
153
154/** @} */
155
156/** @} */
157
158#endif /* STM32F4_FAMILY_F10XXX */
159
160#endif /* LIBBSP_ARM_STM32F4_STM32F4_H */
Note: See TracBrowser for help on using the repository browser.