@@ -95,7 +95,7 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
9595 /* Enable USBFS Interrupt */
9696 HAL_NVIC_EnableIRQ (OTG_FS_IRQn );
9797 }
98-
98+ #if defined( USE_USB_HS )
9999 else if (hpcd -> Instance == USB_OTG_HS )
100100 {
101101#if defined(USE_USB_HS_IN_FS )
@@ -139,7 +139,7 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
139139 /* Enable USB HS Clocks */
140140 __USB_OTG_HS_CLK_ENABLE ();
141141
142- #elif defined( USE_USB_HS )
142+ #else // !USE_USB_HS_IN_FS
143143
144144 /* Configure USB HS GPIOs */
145145 __GPIOA_CLK_ENABLE ();
@@ -196,14 +196,15 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
196196 /* Enable USB HS Clocks */
197197 __USB_OTG_HS_CLK_ENABLE ();
198198 __USB_OTG_HS_ULPI_CLK_ENABLE ();
199- #endif
199+ #endif // !USE_USB_HS_IN_FS
200200
201201 /* Set USBHS Interrupt to the lowest priority */
202202 HAL_NVIC_SetPriority (OTG_HS_IRQn , IRQ_PRI_OTG_HS , IRQ_SUBPRI_OTG_HS );
203203
204204 /* Enable USBHS Interrupt */
205205 HAL_NVIC_EnableIRQ (OTG_HS_IRQn );
206206 }
207+ #endif // USE_USB_HS
207208}
208209/**
209210 * @brief DeInitializes the PCD MSP.
@@ -218,7 +219,7 @@ void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
218219 __USB_OTG_FS_CLK_DISABLE ();
219220 __SYSCFG_CLK_DISABLE ();
220221 }
221- #if defined(USE_USB_HS ) || defined( USE_USB_HS_IN_FS )
222+ #if defined(USE_USB_HS )
222223 else if (hpcd -> Instance == USB_OTG_HS )
223224 {
224225 /* Disable USB FS Clocks */
@@ -404,7 +405,8 @@ USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
404405 HAL_PCD_SetTxFiFo (& pcd_handle , 1 , 0x40 );
405406 HAL_PCD_SetTxFiFo (& pcd_handle , 2 , 0x20 );
406407 HAL_PCD_SetTxFiFo (& pcd_handle , 3 , 0x40 );
407- #elif defined(USE_USB_HS_IN_FS )
408+ #elif defined(USE_USB_HS )
409+ #if defined(USE_USB_HS_IN_FS )
408410 /*Set LL Driver parameters */
409411 pcd_handle .Instance = USB_OTG_HS ;
410412 pcd_handle .Init .dev_endpoints = 4 ;
@@ -431,7 +433,7 @@ USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
431433 HAL_PCD_SetTxFiFo (& pcd_handle , 1 , 0x40 );
432434 HAL_PCD_SetTxFiFo (& pcd_handle , 2 , 0x20 );
433435 HAL_PCD_SetTxFiFo (& pcd_handle , 3 , 0x40 );
434- #elif defined(USE_USB_HS )
436+ #else // ! defined(USE_USB_HS_IN_FS )
435437 /*Set LL Driver parameters */
436438 pcd_handle .Instance = USB_OTG_HS ;
437439 pcd_handle .Init .dev_endpoints = 6 ;
@@ -460,8 +462,8 @@ USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
460462 HAL_PCD_SetTxFiFo (& pcd_handle , 0 , 0x80 );
461463 HAL_PCD_SetTxFiFo (& pcd_handle , 1 , 0x174 );
462464
463-
464- #endif
465+ #endif // !USE_USB_HS_IN_FS
466+ #endif // USE_USB_HS
465467 return USBD_OK ;
466468}
467469
0 commit comments