update bsp/stm32/libraries/HAL_Drivers/drv_usbh.c.

修改了 hcd 初始化函数。删掉 RT_ASSERT 宏调用函数的操作方法。防止因禁用调试 RT_ASSERT 定义为空,导致 HAL_HCD_Init 不被编译的情况出现。
This commit is contained in:
THEWON 2021-06-16 16:37:53 +08:00 committed by Gitee
parent 45b540d334
commit c444c5d3d4
1 changed files with 7 additions and 1 deletions

View File

@ -197,6 +197,8 @@ static struct uhcd_ops _uhcd_ops =
static rt_err_t stm32_hcd_init(rt_device_t device) static rt_err_t stm32_hcd_init(rt_device_t device)
{ {
HAL_StatusTypeDef state;
HCD_HandleTypeDef *hhcd = (HCD_HandleTypeDef *)device->user_data; HCD_HandleTypeDef *hhcd = (HCD_HandleTypeDef *)device->user_data;
hhcd->Instance = USB_OTG_FS; hhcd->Instance = USB_OTG_FS;
hhcd->Init.Host_channels = 8; hhcd->Init.Host_channels = 8;
@ -204,7 +206,11 @@ static rt_err_t stm32_hcd_init(rt_device_t device)
hhcd->Init.dma_enable = DISABLE; hhcd->Init.dma_enable = DISABLE;
hhcd->Init.phy_itface = HCD_PHY_EMBEDDED; hhcd->Init.phy_itface = HCD_PHY_EMBEDDED;
hhcd->Init.Sof_enable = DISABLE; hhcd->Init.Sof_enable = DISABLE;
RT_ASSERT(HAL_HCD_Init(hhcd) == HAL_OK); state = HAL_HCD_Init(hhcd);
if (state != HAL_OK)
{
return -RT_ERROR;
}
HAL_HCD_Start(hhcd); HAL_HCD_Start(hhcd);
#ifdef USBH_USING_CONTROLLABLE_POWER #ifdef USBH_USING_CONTROLLABLE_POWER
rt_pin_mode(USBH_POWER_PIN, PIN_MODE_OUTPUT); rt_pin_mode(USBH_POWER_PIN, PIN_MODE_OUTPUT);