//然后转入下一个状态 -> HOST_CLASS_REQUEST
}
}
break;
case HOST_CLASS_REQUEST:
status = phost->class_cb->Requests(pdev, phost);
if(status == USBH_OK) //如果类请求事件完成
{
phost->gState = HOST_CLASS; //则进入下一状态 -> HOST_CLASS
}
else //否则
{
USBH_ErrorHandle(phost, status); //主机进行错误处理
}
break;
case HOST_CLASS: //主机类
status = phost->class_cb->Machine(pdev, phost);
USBH_ErrorHandle(phost, status);
break;
case HOST_CTRL_XFER:
USBH_HandleControl(pdev, phost);
break;
case HOST_SUSPENDED:
break;
case HOST_ERROR_STATE:
USBH_DeInit(pdev, phost); //重初始化
phost->usr_cb->DeInit(); //执行用户回调:重初始化
phost->class_cb->DeInit(pdev, &phost->device_prop);
break;
case HOST_DEV_DISCONNECTED :
phost->usr_cb->DeviceDisconnected(); //用户回调:在显示器上显示->设备未连接
USBH_DeInit(pdev, phost); //主机重新初始化,进入新的枚举过程
phost->usr_cb->DeInit(); //执行用户回调:重初始化
phost->class_cb->DeInit(pdev, &phost->device_prop);
USBH
_DeAllocate_AllChannel(pdev); //收回通道
phost->gState = HOST_IDLE; //主机回到初始状态 -> HOST_IDLE(空闲)
break;
default :
break;
}