Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:05

0001 /**
0002  * @file
0003  * @ingroup stm32f4_reg
0004  * @brief Register definitions.
0005  */
0006 
0007 /*
0008  * Copyright (c) 2012 Sebastian Huber.  All rights reserved.
0009  *
0010  * The license and distribution terms for this file may be
0011  * found in the file LICENSE in this distribution or at
0012  * http://www.rtems.org/license/LICENSE.
0013  */
0014 
0015 #ifndef LIBBSP_ARM_STM32F4_STM32F4_H
0016 #define LIBBSP_ARM_STM32F4_STM32F4_H
0017 
0018 #include <bsp/utility.h>
0019 #include <bspopts.h>
0020 
0021 #define STM32F4_BASE 0x00
0022 
0023 #ifdef STM32F4_FAMILY_F4XXXX
0024 
0025 /**
0026  * @defgroup stm32f4_reg Register Defintions
0027  * @ingroup RTEMSBSPsARMSTM32F4
0028  * @brief Register Definitions
0029  * @{
0030  */
0031 
0032 #define STM32F4_APB1_BASE (STM32F4_BASE + 0x40000000)
0033 #define STM32F4_APB2_BASE (STM32F4_BASE + 0x40010000)
0034 #define STM32F4_AHB1_BASE (STM32F4_BASE + 0x40020000)
0035 #define STM32F4_AHB2_BASE (STM32F4_BASE + 0x50000000)
0036 
0037 /**
0038  * @name STM32f4XXXX GPIO
0039  * @{
0040  */
0041 
0042 #include <bsp/stm32f4xxxx_gpio.h>
0043 #define STM32F4_GPIO(i) ((volatile stm32f4_gpio *) (STM32F4_BASE + 0x40020000) + (i))
0044 
0045 /** @} */
0046 
0047 /**
0048  * @name STM32F4XXXX RCC
0049  * @{
0050  */
0051 
0052 #include <bsp/stm32f4xxxx_rcc.h>
0053 #define STM32F4_RCC ((volatile stm32f4_rcc *) (STM32F4_AHB1_BASE + 0x3800))
0054 
0055 /** @} */
0056 
0057 /**
0058  * @name STM32F4XXXX FLASH
0059  * @{
0060  */
0061 
0062 #include <bsp/stm32f4xxxx_flash.h>
0063 #define STM32F4_FLASH ((volatile stm32f4_flash *) (STM32F4_BASE + 0x40023C00))
0064 
0065 /** @} */
0066 
0067 #include <bsp/stm32_i2c.h>
0068 
0069 /**
0070  * @name STM32 I2C
0071  * @{
0072  */
0073 
0074 #define STM32F4_I2C3 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005C00))
0075 #define STM32F4_I2C2 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005800))
0076 #define STM32F4_I2C1 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005400))
0077 
0078 /** @} */
0079 
0080 /**
0081  * @name STM32 USART
0082  * @{
0083  */
0084 
0085 #include <bsp/stm32_usart.h>
0086 #define STM32F4_USART_1 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40011000))
0087 #define STM32F4_USART_2 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40004400))
0088 #define STM32F4_USART_3 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40004800))
0089 #define STM32F4_USART_4 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40004c00))
0090 #define STM32F4_USART_5 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40005000))
0091 #define STM32F4_USART_6 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40011400))
0092 
0093 /** @} */
0094 
0095 /**
0096  * @name STM32f4XXXX PWR
0097  * @{
0098  */
0099 
0100 #include <bsp/stm32f4xxxx_pwr.h>
0101 #define STM32F4_PWR ((volatile stm32f4_pwr *) (STM32F4_APB1_BASE + 0x7000))
0102 
0103 /** @} */
0104 
0105 /**
0106  * @name STM32f4XXXX EXTI
0107  * @{
0108  */
0109 
0110 #include <bsp/stm32f4xxxx_exti.h>
0111 #define STM32F4_EXTI ((volatile stm32f4_exti *) (STM32F4_APB2_BASE + 0x3c00))
0112 
0113 /** @} */
0114 
0115 /**
0116  * @name STM32f4XXXX SYSCFG
0117  * @{
0118  */
0119 
0120 #include <bsp/stm32f4xxxx_syscfg.h>
0121 #define STM32F4_SYSCFG ((volatile stm32f4_syscfg *) (STM32F4_APB2_BASE + 0x3800))
0122 
0123 /** @} */
0124 
0125 /**
0126  * @name STM32f4XXXX FLASH
0127  * @{
0128  */
0129 
0130 #include <bsp/stm32f4xxxx_flash.h>
0131 #define STM32F4_FLASH ((volatile stm32f4_flash *) (STM32F4_AHB1_BASE + 0x3c00))
0132 
0133 /** @} */
0134 
0135 /**
0136  * @name STM32f4XXXX TIM
0137  * @{
0138  */
0139 
0140 #include <bsp/stm32f4xxxx_tim.h>
0141 #define STM32F4_TIM1 ((volatile stm32f4_tim *) (STM32F4_APB2_BASE + 0x0000))
0142 #define STM32F4_TIM2 ((volatile stm32f4_tim *) (STM32F4_APB1_BASE + 0x0000))
0143 #define STM32F4_TIM3 ((volatile stm32f4_tim *) (STM32F4_APB1_BASE + 0x0400))
0144 #define STM32F4_TIM4 ((volatile stm32f4_tim *) (STM32F4_APB1_BASE + 0x0800))
0145 #define STM32F4_TIM5 ((volatile stm32f4_tim *) (STM32F4_APB1_BASE + 0x0c00))
0146 #define STM32F4_TIM6 ((volatile stm32f4_tim *) (STM32F4_APB1_BASE + 0x1000))
0147 #define STM32F4_TIM7 ((volatile stm32f4_tim *) (STM32F4_APB1_BASE + 0x1400))
0148 #define STM32F4_TIM8 ((volatile stm32f4_tim *) (STM32F4_APB2_BASE + 0x0400))
0149 #define STM32F4_TIM9 ((volatile stm32f4_tim *) (STM32F4_APB2_BASE + 0x4000))
0150 #define STM32F4_TIM10 ((volatile stm32f4_tim *) (STM32F4_APB2_BASE + 0x4400))
0151 #define STM32F4_TIM11 ((volatile stm32f4_tim *) (STM32F4_APB2_BASE + 0x4800))
0152 #define STM32F4_TIM12 ((volatile stm32f4_tim *) (STM32F4_APB1_BASE + 0x1800))
0153 #define STM32F4_TIM13 ((volatile stm32f4_tim *) (STM32F4_APB1_BASE + 0x1c00))
0154 #define STM32F4_TIM14 ((volatile stm32f4_tim *) (STM32F4_APB1_BASE + 0x2000))
0155 
0156 /** @} */
0157 
0158 /**
0159  * @name STM32f4XXXX ADC
0160  * @{
0161  */
0162 
0163 #include <bsp/stm32f4xxxx_adc.h>
0164 #define STM32F4_ADC1 ((volatile stm32f4_adc_chan *) (STM32F4_APB2_BASE + 0x2000))
0165 #define STM32F4_ADC2 ((volatile stm32f4_adc_chan *) (STM32F4_APB2_BASE + 0x2100))
0166 #define STM32F4_ADC3 ((volatile stm32f4_adc_chan *) (STM32F4_APB2_BASE + 0x2200))
0167 #define STM32F4_ADC_COMMON ((volatile stm32f4_adc_com *) (STM32F4_APB2_BASE + 0x2300))
0168 
0169 /** @} */
0170 
0171 /**
0172  * @name STM32f4XXXX OTGFS
0173  * @{
0174  */
0175 
0176 #include <bsp/stm32f4xxxx_otgfs.h>
0177 #define STM32F4_OTGFS_BASE (STM32F4_AHB2_BASE + 0x0000)
0178 #define STM32F4_OTGFS_CORE ((volatile stm32f4_otgfs *) (STM32F4_OTGFS_BASE + 0x000))
0179 #define STM32F4_OTGFS_DEV ((volatile stm32f4_otgfs_dregs *) (STM32F4_OTGFS_BASE + 0x800))
0180 #define STM32F4_OTGFS_INEP ((volatile stm32f4_otgfs_inepregs *) (STM32F4_OTGFS_BASE + 0x900))
0181 #define STM32F4_OTGFS_OUTEP ((volatile stm32f4_otgfs_outepregs *) (STM32F4_OTGFS_BASE + 0xb00))
0182 #define STM32F4_OTGFS_PWRCTL ((volatile stm32f4_otgfs_pwrctlregs *) (STM32F4_OTGFS_BASE + 0xe00))
0183 
0184 #define STM32F4_OTGFS_FIFO_BASE (STM32F4_OTGFS_BASE + USB_FIFO_BASE)
0185 
0186 /** @} */
0187 
0188 #endif /* STM32F4_FAMILY_F4XXXX */
0189 
0190 #ifdef STM32F4_FAMILY_F10XXX
0191 
0192 /**
0193  * @name STM32F10 EXTI
0194  * @{
0195  */
0196 
0197 #include <bsp/stm32f10xxx_exti.h>
0198 #define STM32F4_EXTI ((volatile stm32f4_exti *) (STM32F4_BASE + 0x40010400))
0199 
0200 /** @} */
0201 
0202 /**
0203  * @name STM32F10XXX GPIO
0204  * @{
0205  */
0206 
0207 #include <bsp/stm32f10xxx_gpio.h>
0208 #define STM32F4_GPIO(i) ((volatile stm32f4_gpio *) (STM32F4_BASE + 0x40010800 + i * 0x400))
0209 #define STM32F4_AFIO ((volatile stm32f4_afio *) (STM32F4_BASE + 0x40010000))
0210 
0211 /** @} */
0212 
0213 /**
0214  * @name STM32F10XXX RCC
0215  * @{
0216  */
0217 
0218 #include <bsp/stm32f10xxx_rcc.h>
0219 #define STM32F4_RCC ((volatile stm32f4_rcc *) (STM32F4_BASE + 0x40021000))
0220 
0221 /** @} */
0222 
0223 /**
0224  * @name STM32 I2C
0225  * @{
0226  */
0227 
0228 #include <bsp/stm32_i2c.h>
0229 #define STM32F4_I2C2 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005800))
0230 #define STM32F4_I2C1 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005400))
0231 
0232 /** @} */
0233 
0234 /**
0235  * @name STM32 USART
0236  * @{
0237  */
0238 
0239 #include <bsp/stm32_usart.h>
0240 #define STM32F4_USART_1 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40013800))
0241 #define STM32F4_USART_2 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40004400))
0242 #define STM32F4_USART_3 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40004800))
0243 #define STM32F4_USART_4 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40004c00))
0244 #define STM32F4_USART_5 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40005000))
0245 
0246 /** @} */
0247 
0248 /** @} */
0249 
0250 #endif /* STM32F4_FAMILY_F10XXX */
0251 
0252 #endif /* LIBBSP_ARM_STM32F4_STM32F4_H */