f4_regs.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "../stm32/f1_regs.h"
  2. #define RCC_CFGR_PLLRANGE_GT72MHZ (1u<<31)
  3. #define RCC_CFGR_USBPSC_3 ((uint32_t)0x08400000)
  4. #define RCC_CFGR_HSE_PREDIV2 (1u<<17)
  5. #define RCC_CFGR_APB2PSC_2 (4u<<11)
  6. #define RCC_CFGR_APB1PSC_2 (4u<< 8)
  7. #define RCC_PLL (&rcc->cfgr2)
  8. #define RCC_PLL_PLLCFGEN (1u<<31)
  9. #define RCC_PLL_FREF_MASK (7u<<24)
  10. #define RCC_PLL_FREF_8M (2u<<24)
  11. #define RCC_APB2ENR_ACCEN (1u<<22)
  12. static volatile uint32_t * const RCC_MISC = (uint32_t *)(RCC_BASE + 0x30);
  13. #define RCC_MISC_HSI_NODIV (1u<<25)
  14. static volatile uint32_t * const RCC_MISC2 = (uint32_t *)(RCC_BASE + 0x54);
  15. #define RCC_MISC2_HSI_FOR_USB (1u<< 8)
  16. #define RCC_MISC2_AUTOSTEP_EN (3u<< 4)
  17. #define TIM_CR1_PMEN (1u<<10)
  18. /* HSI Auto Clock Calibration */
  19. struct acc {
  20. uint32_t sts; /* 00: Status */
  21. uint32_t ctrl1; /* 04: Control #1 */
  22. uint32_t ctrl2; /* 08: Control #2 */
  23. uint32_t c1; /* 0C: Compare value #1 */
  24. uint32_t c2; /* 10: Compare value #2 */
  25. uint32_t c3; /* 14: Compare value #3 */
  26. };
  27. #define ACC_CTRL1_ENTRIM (1u<<1)
  28. #define ACC_CTRL1_CALON (1u<<0)
  29. #define ACC_BASE 0x40015800