STM/STM32_LIBRARIES/USB_Device/Core/Src/usbd_conf.c
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) {
#ifdef USB_USE_FS
	if (pdev->id == USB_ID_FS) {
		/* Set LL Driver parameters */
		hpcd_FS.Instance = USB_OTG_FS;
		hpcd_FS.Init.dev_endpoints = 4;
		hpcd_FS.Init.use_dedicated_ep1 = 0;
		hpcd_FS.Init.ep0_mps = 0x40;
		hpcd_FS.Init.dma_enable = 0;
		hpcd_FS.Init.low_power_enable = 0;
		hpcd_FS.Init.phy_itface = PCD_PHY_EMBEDDED;
		hpcd_FS.Init.Sof_enable = 0;
		hpcd_FS.Init.speed = PCD_SPEED_FULL;
		hpcd_FS.Init.vbus_sensing_enable = 0;
		hpcd_FS.Init.lpm_enable = 0;

		/* Link The driver to the stack */
		hpcd_FS.pData = pdev;
		pdev->pData = &hpcd_FS;

		/* Initialize LL Driver */
		HAL_PCD_Init(&hpcd_FS);

		HAL_PCDEx_SetRxFiFo(&hpcd_FS, 0x80);
		HAL_PCDEx_SetTxFiFo(&hpcd_FS, 0, 0x40);
		HAL_PCDEx_SetTxFiFo(&hpcd_FS, 1, 0x80);
	}
#endif

#ifdef USB_USE_HS
	if (pdev->id == USB_ID_HS) {
		/* Set LL Driver parameters */
		hpcd_HS.Instance = USB_OTG_HS;
		hpcd_HS.Init.dev_endpoints = 6;
		hpcd_HS.Init.use_dedicated_ep1 = 0;
		hpcd_HS.Init.ep0_mps = 0x40;
		hpcd_HS.Init.dma_enable = 0;
		hpcd_HS.Init.low_power_enable = 0;
		hpcd_HS.Init.lpm_enable = 0;
#ifdef USB_USE_ULPI_PHY
		hpcd_HS.Init.phy_itface = PCD_PHY_ULPI; 
		hpcd_HS.Init.speed = PCD_SPEED_HIGH;
#else
		hpcd_HS.Init.phy_itface = PCD_PHY_EMBEDDED; 
		hpcd_HS.Init.speed = PCD_SPEED_HIGH_IN_FULL;
#endif
		hpcd_HS.Init.Sof_enable = 0;
		hpcd_HS.Init.vbus_sensing_enable = 0;

		/* Link The driver to the stack */
		hpcd_HS.pData = pdev;
		pdev->pData = &hpcd_HS;

		/* Initialize LL Driver */
		HAL_PCD_Init(&hpcd_HS);

		HAL_PCDEx_SetRxFiFo(&hpcd_HS, 0x200);
		HAL_PCDEx_SetTxFiFo(&hpcd_HS, 0, 0x80);
		HAL_PCDEx_SetTxFiFo(&hpcd_HS, 1, 0x174);
	}
#endif
	
	/* Return OK */
	return USBD_OK;
}
/**
  * @brief  Initializes the Low Level portion of the Device driver.
  * @param  pdev: Device handle
  * @retval USBD Status
  */
@brief  Initializes the Low Level portion of the Device driver.
@param  pdev: Device handle
@retval USBD Status
@brief Initializes the Low Level portion of the Device driver . @param pdev : Device handle @retval USBD Status
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) {
#ifdef USB_USE_FS
	if (pdev->id == USB_ID_FS) {
		hpcd_FS.Instance = USB_OTG_FS;
		hpcd_FS.Init.dev_endpoints = 4;
		hpcd_FS.Init.use_dedicated_ep1 = 0;
		hpcd_FS.Init.ep0_mps = 0x40;
		hpcd_FS.Init.dma_enable = 0;
		hpcd_FS.Init.low_power_enable = 0;
		hpcd_FS.Init.phy_itface = PCD_PHY_EMBEDDED;
		hpcd_FS.Init.Sof_enable = 0;
		hpcd_FS.Init.speed = PCD_SPEED_FULL;
		hpcd_FS.Init.vbus_sensing_enable = 0;
		hpcd_FS.Init.lpm_enable = 0;
		hpcd_FS.pData = pdev;
		pdev->pData = &hpcd_FS;
		HAL_PCD_Init(&hpcd_FS);
		HAL_PCDEx_SetRxFiFo(&hpcd_FS, 0x80);
		HAL_PCDEx_SetTxFiFo(&hpcd_FS, 0, 0x40);
		HAL_PCDEx_SetTxFiFo(&hpcd_FS, 1, 0x80);
	}
#endif
#ifdef USB_USE_HS
	if (pdev->id == USB_ID_HS) {
		hpcd_HS.Instance = USB_OTG_HS;
		hpcd_HS.Init.dev_endpoints = 6;
		hpcd_HS.Init.use_dedicated_ep1 = 0;
		hpcd_HS.Init.ep0_mps = 0x40;
		hpcd_HS.Init.dma_enable = 0;
		hpcd_HS.Init.low_power_enable = 0;
		hpcd_HS.Init.lpm_enable = 0;
#ifdef USB_USE_ULPI_PHY
		hpcd_HS.Init.phy_itface = PCD_PHY_ULPI; 
		hpcd_HS.Init.speed = PCD_SPEED_HIGH;
#else
		hpcd_HS.Init.phy_itface = PCD_PHY_EMBEDDED; 
		hpcd_HS.Init.speed = PCD_SPEED_HIGH_IN_FULL;
#endif
		hpcd_HS.Init.Sof_enable = 0;
		hpcd_HS.Init.vbus_sensing_enable = 0;
		hpcd_HS.pData = pdev;
		pdev->pData = &hpcd_HS;
		HAL_PCD_Init(&hpcd_HS);
		HAL_PCDEx_SetRxFiFo(&hpcd_HS, 0x200);
		HAL_PCDEx_SetTxFiFo(&hpcd_HS, 0, 0x80);
		HAL_PCDEx_SetTxFiFo(&hpcd_HS, 1, 0x174);
	}
#endif
	return USBD_OK;
}
USBD_StatusTypeDef USBD_LL_Init ( USBD_HandleTypeDef * pdev ) { #ifdef USB_USE_FS if ( pdev -> id == USB_ID_FS ) { hpcd_FS . Instance = USB_OTG_FS ; hpcd_FS . Init . dev_endpoints = 4 ; hpcd_FS . Init . use_dedicated_ep1 = 0 ; hpcd_FS . Init . ep0_mps = 0x40 ; hpcd_FS . Init . dma_enable = 0 ; hpcd_FS . Init . low_power_enable = 0 ; hpcd_FS . Init . phy_itface = PCD_PHY_EMBEDDED ; hpcd_FS . Init . Sof_enable = 0 ; hpcd_FS . Init . speed = PCD_SPEED_FULL ; hpcd_FS . Init . vbus_sensing_enable = 0 ; hpcd_FS . Init . lpm_enable = 0 ; hpcd_FS . pData = pdev ; pdev -> pData = & hpcd_FS ; HAL_PCD_Init ( & hpcd_FS ) ; HAL_PCDEx_SetRxFiFo ( & hpcd_FS , 0x80 ) ; HAL_PCDEx_SetTxFiFo ( & hpcd_FS , 0 , 0x40 ) ; HAL_PCDEx_SetTxFiFo ( & hpcd_FS , 1 , 0x80 ) ; } #endif #ifdef USB_USE_HS if ( pdev -> id == USB_ID_HS ) { hpcd_HS . Instance = USB_OTG_HS ; hpcd_HS . Init . dev_endpoints = 6 ; hpcd_HS . Init . use_dedicated_ep1 = 0 ; hpcd_HS . Init . ep0_mps = 0x40 ; hpcd_HS . Init . dma_enable = 0 ; hpcd_HS . Init . low_power_enable = 0 ; hpcd_HS . Init . lpm_enable = 0 ; #ifdef USB_USE_ULPI_PHY hpcd_HS . Init . phy_itface = PCD_PHY_ULPI ; hpcd_HS . Init . speed = PCD_SPEED_HIGH ; #else hpcd_HS . Init . phy_itface = PCD_PHY_EMBEDDED ; hpcd_HS . Init . speed = PCD_SPEED_HIGH_IN_FULL ; #endif hpcd_HS . Init . Sof_enable = 0 ; hpcd_HS . Init . vbus_sensing_enable = 0 ; hpcd_HS . pData = pdev ; pdev -> pData = & hpcd_HS ; HAL_PCD_Init ( & hpcd_HS ) ; HAL_PCDEx_SetRxFiFo ( & hpcd_HS , 0x200 ) ; HAL_PCDEx_SetTxFiFo ( & hpcd_HS , 0 , 0x80 ) ; HAL_PCDEx_SetTxFiFo ( & hpcd_HS , 1 , 0x174 ) ; } #endif return USBD_OK ; }
@brief  Initializes the Low Level portion of the Device driver.
@brief Initializes the Low Level portion of the Device driver .
/* Set LL Driver parameters */ /* Link The driver to the stack */ /* Initialize LL Driver */ /* Set LL Driver parameters */ /* Link The driver to the stack */ /* Initialize LL Driver */ /* Return OK */