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->AHB2ENR |= RCC_AHB2ENR_GPIOAEN;
87 RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
97 GPIOA->PUPDR = 0x64000000UL;
98 GPIOA->OSPEEDR = 0xFC00000UL;
100 GPIOA->AFR[1] = 0xAA000;
101 GPIOA->MODER = 0xAAB3FFFFUL;
103 if (!(RCC->APB1ENR1 & RCC_APB1ENR1_PWREN)) {
104 RCC->APB1ENR1 |= RCC_APB1ENR1_PWREN;
105 PWR->CR2 |= PWR_CR2_USV;
106 RCC->APB1ENR1 &= ~RCC_APB1ENR1_PWREN;
108 PWR->CR2 |= PWR_CR2_USV;
110 #ifdef RCC_CRRCR_HSI48ON
112 RCC->CRRCR |= RCC_CRRCR_HSI48ON;
114 while(!(RCC->CRRCR & RCC_CRRCR_HSI48RDY));
116 RCC->CCIPR &= ~RCC_CCIPR_CLK48SEL;
119 #ifdef RCC_AHB2ENR_OTGFSEN
120 RCC->AHB2ENR |= RCC_AHB2ENR_OTGFSEN;
122 RCC->APB1ENR1 |= RCC_APB1ENR1_USBFSEN;
#define GPIOA
Definition MK60D10.h:6910
#define PWR_CR1_DBP
Definition stm32f745xx.h:9512