***************(5)**************
获取设备描述符以后,主机再一次的复位设备,设备又进入初始状态。开始枚举的第二步设置地址。
void NoData_Setup0(void)
{
RESULT Result = USB_UNSUPPORT;
uint32_t RequestNo =pInformation->USBbRequest;
uint32_t ControlState;
if(Type_Recipient == (STANDARD_REQUEST |DEVICE_RECIPIENT)) //设备请求
{
else if (RequestNo ==SET_ADDRESS) /设置地址
{
if ((pInformation->USBwValue0 > 127)|| (pInformation->USBwValue1 != 0)
|| (pInformation->USBwIndex != 0)
|| (pInformation->Current_Configuration != 0))
{
ControlState = STALLED;
goto exit_NoData_Setup0;
}
else
{
Result = USB_SUCCESS;
#ifdef STM32F10X_CL
SetDeviceAddress(pInformation->USBwValue0);
#endif
}
}
ControlState =WAIT_STATUS_IN;
USB_StatusIn();//准备好发送0字节的状态数据包SetEPTxCount(ENDP0, 0);
//vSetEPTxStatus(EP_TX_VALID);建立阶段后直接的进入状态阶段
exit_NoData_Setup0:
pInformation->ControlState =ControlState;
return;
} |