f7.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * stm32/f7.h
  3. *
  4. * Core and peripheral registers.
  5. *
  6. * Written & released by Keir Fraser <keir.xen@gmail.com>
  7. *
  8. * This is free and unencumbered software released into the public domain.
  9. * See the file COPYING for more details, or visit <http://unlicense.org>.
  10. */
  11. /* C pointer types */
  12. #define SYSCFG volatile struct syscfg * const
  13. /* C-accessible registers. */
  14. static STK stk = (struct stk *)STK_BASE;
  15. static SCB scb = (struct scb *)SCB_BASE;
  16. static NVIC nvic = (struct nvic *)NVIC_BASE;
  17. static DBG dbg = (struct dbg *)DBG_BASE;
  18. static FLASH flash = (struct flash *)FLASH_BASE;
  19. static PWR pwr = (struct pwr *)PWR_BASE;
  20. static RCC rcc = (struct rcc *)RCC_BASE;
  21. static IWDG iwdg = (struct iwdg *)IWDG_BASE;
  22. static GPIO gpioa = (struct gpio *)GPIOA_BASE;
  23. static GPIO gpiob = (struct gpio *)GPIOB_BASE;
  24. static GPIO gpioc = (struct gpio *)GPIOC_BASE;
  25. static GPIO gpiod = (struct gpio *)GPIOD_BASE;
  26. static GPIO gpioe = (struct gpio *)GPIOE_BASE;
  27. static GPIO gpiof = (struct gpio *)GPIOF_BASE;
  28. static GPIO gpiog = (struct gpio *)GPIOG_BASE;
  29. static GPIO gpioh = (struct gpio *)GPIOH_BASE;
  30. static GPIO gpioi = (struct gpio *)GPIOI_BASE;
  31. static SYSCFG syscfg = (struct syscfg *)SYSCFG_BASE;
  32. static EXTI exti = (struct exti *)EXTI_BASE;
  33. static DMA dma1 = (struct dma *)DMA1_BASE;
  34. static DMA dma2 = (struct dma *)DMA2_BASE;
  35. static TIM tim1 = (struct tim *)TIM1_BASE;
  36. static TIM tim2 = (struct tim *)TIM2_BASE;
  37. static TIM tim3 = (struct tim *)TIM3_BASE;
  38. static TIM tim4 = (struct tim *)TIM4_BASE;
  39. static TIM tim5 = (struct tim *)TIM5_BASE;
  40. static TIM tim6 = (struct tim *)TIM6_BASE;
  41. static TIM tim7 = (struct tim *)TIM7_BASE;
  42. static TIM tim8 = (struct tim *)TIM8_BASE;
  43. static TIM tim9 = (struct tim *)TIM9_BASE;
  44. static TIM tim10 = (struct tim *)TIM10_BASE;
  45. static TIM tim11 = (struct tim *)TIM11_BASE;
  46. static TIM tim12 = (struct tim *)TIM12_BASE;
  47. static TIM tim13 = (struct tim *)TIM13_BASE;
  48. static TIM tim14 = (struct tim *)TIM14_BASE;
  49. static SPI spi1 = (struct spi *)SPI1_BASE;
  50. static SPI spi2 = (struct spi *)SPI2_BASE;
  51. static SPI spi3 = (struct spi *)SPI3_BASE;
  52. static SPI spi4 = (struct spi *)SPI4_BASE;
  53. static SPI spi5 = (struct spi *)SPI5_BASE;
  54. static I2C i2c1 = (struct i2c *)I2C1_BASE;
  55. static I2C i2c2 = (struct i2c *)I2C2_BASE;
  56. static I2C i2c3 = (struct i2c *)I2C3_BASE;
  57. static USART usart1 = (struct usart *)USART1_BASE;
  58. static USART usart2 = (struct usart *)USART2_BASE;
  59. static USART usart3 = (struct usart *)USART3_BASE;
  60. static USART usart4 = (struct usart *)USART4_BASE;
  61. static USART usart5 = (struct usart *)USART5_BASE;
  62. static USART usart6 = (struct usart *)USART6_BASE;
  63. #define SYSCLK_MHZ 216
  64. #define AHB_MHZ (SYSCLK_MHZ / 1) /* 216MHz */
  65. #define APB1_MHZ (SYSCLK_MHZ / 4) /* 54MHz */
  66. #define APB2_MHZ (SYSCLK_MHZ / 2) /* 108MHz */
  67. #define FLASH_PAGE_SIZE 16384
  68. /* Delay after enabling peripheral clock, before accessing peripheral
  69. * (Ref STMicro RM0431, Section 5.2.12) */
  70. void peripheral_clock_delay(void);
  71. void gpio_set_af(GPIO gpio, unsigned int pin, unsigned int af);
  72. /*
  73. * Local variables:
  74. * mode: C
  75. * c-file-style: "Linux"
  76. * c-basic-offset: 4
  77. * tab-width: 4
  78. * indent-tabs-mode: nil
  79. * End:
  80. */