/ * @brief Configure USB. * @retval None ***********************************************************************************************************/
| 149 | * @retval None |
| 150 | ***********************************************************************************************************/ |
| 151 | void USB_Configuration(USBDCore_TypeDef *pCore) |
| 152 | { |
| 153 | |
| 154 | /* Enable peripheral clock */ |
| 155 | CKCU_PeripClockConfig_TypeDef CKCUClock = {{ 0 }}; |
| 156 | CKCUClock.Bit.USBD = 1; |
| 157 | CKCUClock.Bit.EXTI = 1; |
| 158 | CKCU_PeripClockConfig(CKCUClock, ENABLE); |
| 159 | |
| 160 | gUSBCore = pCore; |
| 161 | |
| 162 | #if (LIBCFG_CKCU_USB_PLL) |
| 163 | USBPLL_Configuration(); |
| 164 | #endif |
| 165 | |
| 166 | #if (LIBCFG_PWRCU_VREG) |
| 167 | USBVRG_Configuration(); /* Voltage of USB setting */ |
| 168 | #endif |
| 169 | |
| 170 | /* !!! NOTICE !!! |
| 171 | Must turn on if the USB clock source is from HSI (PLL clock Source) |
| 172 | */ |
| 173 | #if 0 |
| 174 | |
| 175 | /* Turn on HSI auto trim function */ |
| 176 | CKCU_HSIAutoTrimClkConfig(CKCU_ATC_USB); |
| 177 | CKCU_HSIAutoTrimCmd(ENABLE); |
| 178 | |
| 179 | #endif |
| 180 | |
| 181 | |
| 182 | /* USB Descriptor, Core, and Class initialization */ |
| 183 | gUSBCore->pDriver = (u32 *)&gUSBDriver; /* Initiate memory pointer of USB driver */ |
| 184 | gUSBCore->Power.CallBack_Suspend.func = Suspend; /* Install suspend call back function into USB core */ |
| 185 | |
| 186 | // USBDDesc_Init(&gUSBCore.Device.Desc); /* Initiate memory pointer of descriptor */ |
| 187 | // USBDClass_Init(&gUSBCore.Class); /* Initiate USB Class layer */ |
| 188 | USBDCore_Init(gUSBCore); /* Initiate USB Core layer */ |
| 189 | |
| 190 | NVIC_SetPriority(USB_IRQn,0); |
| 191 | NVIC_EnableIRQ(USB_IRQn); /* Enable USB device interrupt */ |
| 192 | |
| 193 | HT32F_DVB_USBConnect(); |
| 194 | |
| 195 | } |
| 196 | |
| 197 | |
| 198 |
no test coverage detected