53#include "interrupts.h"
56#define NVIC_EnableIRQ(_x) interrupt_enable(_x + 16)
57#define NVIC_DisableIRQ(_x) interrupt_disable(_x + 16)
74extern volatile uint32_t SystemCoreClock;
83static inline void usb_hw_init(
void) {
85 RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
86 RCC->APB1ENR1 |= RCC_APB1ENR1_PWREN;
90 RCC->BDCR &= ~RCC_BDCR_LSEDRV_Msk;
92 RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN;
100 GPIOA->PUPDR = 0x64000000UL;
101 GPIOA->OSPEEDR = 0xFC00000UL;
103 GPIOA->AFR[1] = 0xAA000UL;
104 GPIOA->MODER = 0xAAB3FFFFUL;
106 if (!(RCC->APB1ENR1 & RCC_APB1ENR1_PWREN)) {
107 RCC->APB1ENR1 |= RCC_APB1ENR1_PWREN;
108 PWR->CR2 |= PWR_CR2_USV;
109 RCC->APB1ENR1 &= ~RCC_APB1ENR1_PWREN;
111 PWR->CR2 |= PWR_CR2_USV;
113 #ifdef RCC_CRRCR_HSI48ON
115 RCC->CRRCR |= RCC_CRRCR_HSI48ON;
117 while(!(RCC->CRRCR & RCC_CRRCR_HSI48RDY));
119 RCC->CCIPR &= ~RCC_CCIPR_CLK48SEL;
122 RCC->AHB2ENR |= RCC_AHB2ENR_OTGFSEN;
#define GPIOA
Definition MK60D10.h:6910
#define PWR_CR1_DBP
Definition stm32f745xx.h:9512