f1.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * stm32/f1.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. #define CORTEX_M3 1
  12. /* C pointer types */
  13. #define BKP volatile struct bkp * const
  14. #define AFIO volatile struct afio * const
  15. #define DMA_CHN volatile struct dma_chn * const
  16. /* C-accessible registers. */
  17. static STK stk = (struct stk *)STK_BASE;
  18. static SCB scb = (struct scb *)SCB_BASE;
  19. static NVIC nvic = (struct nvic *)NVIC_BASE;
  20. static DBG dbg = (struct dbg *)DBG_BASE;
  21. static FLASH flash = (struct flash *)FLASH_BASE;
  22. static PWR pwr = (struct pwr *)PWR_BASE;
  23. static BKP bkp = (struct bkp *)BKP_BASE;
  24. static RCC rcc = (struct rcc *)RCC_BASE;
  25. static IWDG iwdg = (struct iwdg *)IWDG_BASE;
  26. static GPIO gpioa = (struct gpio *)GPIOA_BASE;
  27. static GPIO gpiob = (struct gpio *)GPIOB_BASE;
  28. static GPIO gpioc = (struct gpio *)GPIOC_BASE;
  29. static GPIO gpiod = (struct gpio *)GPIOD_BASE;
  30. static GPIO gpioe = (struct gpio *)GPIOE_BASE;
  31. static GPIO gpiof = (struct gpio *)GPIOF_BASE;
  32. static GPIO gpiog = (struct gpio *)GPIOG_BASE;
  33. static AFIO afio = (struct afio *)AFIO_BASE;
  34. static EXTI exti = (struct exti *)EXTI_BASE;
  35. static DMA dma1 = (struct dma *)DMA1_BASE;
  36. static DMA dma2 = (struct dma *)DMA2_BASE;
  37. static TIM tim1 = (struct tim *)TIM1_BASE;
  38. static TIM tim2 = (struct tim *)TIM2_BASE;
  39. static TIM tim3 = (struct tim *)TIM3_BASE;
  40. static TIM tim4 = (struct tim *)TIM4_BASE;
  41. static TIM tim5 = (struct tim *)TIM5_BASE;
  42. static TIM tim6 = (struct tim *)TIM6_BASE;
  43. static TIM tim7 = (struct tim *)TIM7_BASE;
  44. static SPI spi1 = (struct spi *)SPI1_BASE;
  45. static SPI spi2 = (struct spi *)SPI2_BASE;
  46. static SPI spi3 = (struct spi *)SPI3_BASE;
  47. static I2C i2c1 = (struct i2c *)I2C1_BASE;
  48. static I2C i2c2 = (struct i2c *)I2C2_BASE;
  49. static USART usart1 = (struct usart *)USART1_BASE;
  50. static USART usart2 = (struct usart *)USART2_BASE;
  51. static USART usart3 = (struct usart *)USART3_BASE;
  52. static SER_ID ser_id = (uint32_t *)0x1ffff7e8;
  53. #define SYSCLK_MHZ 72
  54. #define AHB_MHZ 72
  55. #define APB1_MHZ 36
  56. #define APB2_MHZ 72
  57. #define FLASH_PAGE_SIZE 1024
  58. /* No delay required after enabling a peripheral clock, before accessing it. */
  59. #define peripheral_clock_delay() ((void)0)
  60. /* No secondary RAM region */
  61. #define section_ext_ram
  62. extern unsigned int sram_kb;
  63. enum {
  64. F1SM_basic = 0,
  65. F1SM_plus,
  66. F1SM_plus_unbuffered,
  67. };
  68. /*
  69. * Local variables:
  70. * mode: C
  71. * c-file-style: "Linux"
  72. * c-basic-offset: 4
  73. * tab-width: 4
  74. * indent-tabs-mode: nil
  75. * End:
  76. */