53#include "interrupts.h"
56#define NVIC_EnableIRQ(_x) interrupt_enable(_x + 16)
57#define NVIC_DisableIRQ(_x) interrupt_disable(_x + 16)
58#define power_set() ( USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_PWRDWN )
59#ifdef USB_OTG_GCCFG_VBUSASEN
60#define vbus_enable() ( USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_VBUSASEN )
62#define vbus_enable() ( USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_VBDEN )
65#define GPIOA_AFRH_PIN11_AF14 (0x0000E000)
66#define GPIOA_AFRH_PIN12_AF14 (0x000E0000)
89static inline void usb_hw_init(
void) {
92 RCC->AHBENR |= RCC_AHBENR_GPIOAEN;
98 GPIOA->OSPEEDR |= GPIO_OSPEEDER_OSPEEDR11_0;
99 GPIOA->OSPEEDR |= GPIO_OSPEEDER_OSPEEDR11_1;
100 GPIOA->OSPEEDR |= GPIO_OSPEEDER_OSPEEDR12_0;
101 GPIOA->OSPEEDR |= GPIO_OSPEEDER_OSPEEDR12_1;
103 GPIOA->AFR[1] |= GPIOA_AFRH_PIN11_AF14;
104 GPIOA->AFR[1] |= GPIOA_AFRH_PIN12_AF14;
107 if ( ( RCC->CFGR & RCC_CFGR_PLLMUL) == RCC_CFGR_PLLMUL12 )
108 RCC->CFGR |= RCC_CFGR_USBPRE_DIV1;
111 RCC->APB1ENR |= RCC_APB1ENR_USBEN;
113 RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
#define GPIOA
Definition MK60D10.h:6910
#define GPIO_MODER_MODER11_1
Definition stm32f207xx.h:8109
#define RCC_APB1ENR_PWREN
Definition stm32f107xc.h:1839
#define GPIO_MODER_MODER12_1
Definition stm32f207xx.h:8114