STM/STM32_LIBRARIES/USB_Host/Core/Src/usbh_conf.c
USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost) {
#ifdef USB_USE_FS
	if (phost->id == USB_ID_FS) {
		/* Set the LL Driver parameters */
		hhcd_FS.Instance = USB_OTG_FS;
		hhcd_FS.Init.Host_channels = 11; 
		hhcd_FS.Init.dma_enable = 0;
		hhcd_FS.Init.low_power_enable = 0;
		hhcd_FS.Init.phy_itface = HCD_PHY_EMBEDDED; 
		hhcd_FS.Init.Sof_enable = 0;
		hhcd_FS.Init.speed = HCD_SPEED_FULL;
		hhcd_FS.Init.vbus_sensing_enable = 0;
		hhcd_FS.Init.lpm_enable = 0;

		/* Link the driver to the stack */
		hhcd_FS.pData = phost;
		phost->pData = &hhcd_FS;

		/* Initialize the LL Driver */
		HAL_HCD_Init(&hhcd_FS);
	
		/* Set timer */
		USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd_FS));
	} 
#endif	
	
#ifdef USB_USE_HS
	if (phost->id == USB_ID_HS)	{
		/* Set the LL driver parameters */
		hhcd_HS.Instance = USB_OTG_HS;
		hhcd_HS.Init.Host_channels = 11; 
		hhcd_HS.Init.dma_enable = 1;
		hhcd_HS.Init.low_power_enable = 0;
#ifdef USB_USE_ULPI_PHY
		hhcd_HS.Init.phy_itface = HCD_PHY_ULPI;
#else
		hhcd_HS.Init.phy_itface = HCD_PHY_EMBEDDED;
#endif
		hhcd_HS.Init.Sof_enable = 0;
		hhcd_HS.Init.speed = HCD_SPEED_HIGH;
		hhcd_HS.Init.vbus_sensing_enable = 0;
		hhcd_HS.Init.use_external_vbus = 0;
		hhcd_HS.Init.lpm_enable = 0;

		/* Link the driver to the stack */
		hhcd_HS.pData = phost;
		phost->pData = &hhcd_HS;

		/* Initialize the LL driver */
		HAL_HCD_Init(&hhcd_HS);	
		
		/* Set timer */
		USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd_HS));
	}
#endif
	
	return USBH_OK;
}
/**
  * @brief  USBH_LL_Init 
  *         Initialize the Low Level portion of the Host driver.
  * @param  phost: Host handle
  * @retval USBH Status
  */
@brief  USBH_LL_Init
Initialize the Low Level portion of the Host driver.
@param  phost: Host handle
@retval USBH Status
@brief USBH_LL_Init Initialize the Low Level portion of the Host driver . @param phost : Host handle @retval USBH Status
USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost) {
#ifdef USB_USE_FS
	if (phost->id == USB_ID_FS) {
		hhcd_FS.Instance = USB_OTG_FS;
		hhcd_FS.Init.Host_channels = 11; 
		hhcd_FS.Init.dma_enable = 0;
		hhcd_FS.Init.low_power_enable = 0;
		hhcd_FS.Init.phy_itface = HCD_PHY_EMBEDDED; 
		hhcd_FS.Init.Sof_enable = 0;
		hhcd_FS.Init.speed = HCD_SPEED_FULL;
		hhcd_FS.Init.vbus_sensing_enable = 0;
		hhcd_FS.Init.lpm_enable = 0;
		hhcd_FS.pData = phost;
		phost->pData = &hhcd_FS;
		HAL_HCD_Init(&hhcd_FS);
		USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd_FS));
	} 
#endif	
#ifdef USB_USE_HS
	if (phost->id == USB_ID_HS)	{
		hhcd_HS.Instance = USB_OTG_HS;
		hhcd_HS.Init.Host_channels = 11; 
		hhcd_HS.Init.dma_enable = 1;
		hhcd_HS.Init.low_power_enable = 0;
#ifdef USB_USE_ULPI_PHY
		hhcd_HS.Init.phy_itface = HCD_PHY_ULPI;
#else
		hhcd_HS.Init.phy_itface = HCD_PHY_EMBEDDED;
#endif
		hhcd_HS.Init.Sof_enable = 0;
		hhcd_HS.Init.speed = HCD_SPEED_HIGH;
		hhcd_HS.Init.vbus_sensing_enable = 0;
		hhcd_HS.Init.use_external_vbus = 0;
		hhcd_HS.Init.lpm_enable = 0;
		hhcd_HS.pData = phost;
		phost->pData = &hhcd_HS;
		HAL_HCD_Init(&hhcd_HS);	
		USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd_HS));
	}
#endif
	return USBH_OK;
}
USBH_StatusTypeDef USBH_LL_Init ( USBH_HandleTypeDef * phost ) { #ifdef USB_USE_FS if ( phost -> id == USB_ID_FS ) { hhcd_FS . Instance = USB_OTG_FS ; hhcd_FS . Init . Host_channels = 11 ; hhcd_FS . Init . dma_enable = 0 ; hhcd_FS . Init . low_power_enable = 0 ; hhcd_FS . Init . phy_itface = HCD_PHY_EMBEDDED ; hhcd_FS . Init . Sof_enable = 0 ; hhcd_FS . Init . speed = HCD_SPEED_FULL ; hhcd_FS . Init . vbus_sensing_enable = 0 ; hhcd_FS . Init . lpm_enable = 0 ; hhcd_FS . pData = phost ; phost -> pData = & hhcd_FS ; HAL_HCD_Init ( & hhcd_FS ) ; USBH_LL_SetTimer ( phost , HAL_HCD_GetCurrentFrame ( & hhcd_FS ) ) ; } #endif #ifdef USB_USE_HS if ( phost -> id == USB_ID_HS ) { hhcd_HS . Instance = USB_OTG_HS ; hhcd_HS . Init . Host_channels = 11 ; hhcd_HS . Init . dma_enable = 1 ; hhcd_HS . Init . low_power_enable = 0 ; #ifdef USB_USE_ULPI_PHY hhcd_HS . Init . phy_itface = HCD_PHY_ULPI ; #else hhcd_HS . Init . phy_itface = HCD_PHY_EMBEDDED ; #endif hhcd_HS . Init . Sof_enable = 0 ; hhcd_HS . Init . speed = HCD_SPEED_HIGH ; hhcd_HS . Init . vbus_sensing_enable = 0 ; hhcd_HS . Init . use_external_vbus = 0 ; hhcd_HS . Init . lpm_enable = 0 ; hhcd_HS . pData = phost ; phost -> pData = & hhcd_HS ; HAL_HCD_Init ( & hhcd_HS ) ; USBH_LL_SetTimer ( phost , HAL_HCD_GetCurrentFrame ( & hhcd_HS ) ) ; } #endif return USBH_OK ; }
@brief  USBH_LL_Init
         Initialize the Low Level portion of the Host driver.
@brief USBH_LL_Init Initialize the Low Level portion of the Host driver .
/* Set the LL Driver parameters */ /* Link the driver to the stack */ /* Initialize the LL Driver */ /* Set timer */ /* Set the LL driver parameters */ /* Link the driver to the stack */ /* Initialize the LL driver */ /* Set timer */