uint8_tIn0_Process(void)
{
uint32_t ControlState =pInformation->ControlState;
if ((ControlState == IN_DATA)|| (ControlState == LAST_IN_DATA)) //控制状态
{
DataStageIn();//第一次取设备描述符只取一次 当前的状态变为WAIT_STATUS_IN 表明设备等待状态过程主机输出0字节
ControlState= pInformation->ControlState;
}
else if (ControlState ==WAIT_STATUS_IN) //设置地址状态阶段进入这个程序
{
if((pInformation->USBbRequest == SET_ADDRESS)&&
(Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT)))
{
SetDeviceAddress(pInformation->USBwValue0); //设置使用新的地址
pUser_Standard_Requests->User_SetDeviceAddress();
}
(*pProperty->Process_Status_IN)();
ControlState=STALLED; //终止发送和接受
}
else
{
ControlState= STALLED;
}
pInformation->ControlState =ControlState;
return Post0_Process();
}
uint8_t Post0_Process(void)
{
#ifdef STM32F10X_CL
USB_OTG_EP *ep;
#endif
SetEPRxCount(ENDP0,Device_Property.MaxPacketSize); //设置端点0 要接受的字节数
if(pInformation->ControlState ==STALLED) //这种状态下只接受SETUP命令包
{
vSetEPRxStatus(EP_RX_STALL); //终止端点0接受
vSetEPTxStatus(EP_TX_STALL); //终止端点0发送
}
return(pInformation->ControlState ==PAUSE);
}
***************(6)*************
从新地址获取设备描述符
|