setup阶段成功,但在Data阶段操作失败,中断返回0x2E
unsigned char get_descr_ex() { unsigned char descr_len; unsigned char *p=data_buf; endp7_mode=0x80; toggle_send(); wr_usb_data(8,Request.Req_buf); issue_token(( 0 << 4 ) | DEF_USB_PID_SETUP);status=wait_interrupt(); if(status==USB_INT_SUCCESS)/* SETUP阶段操作成功 */ { endp6_mode=0xc0; toggle_recv(); } else return(status); //*******以上返回正确*****************
issue_token(( 0 << 4 ) | DEF_USB_PID_IN);status=wait_interrupt(); //*********这部返回错误,0x2E 设备返回STALL*********** //***********即status =0x2E*************************** //************************************************** if(status==USB_INT_SUCCESS)/* DATA阶段操作成功 */ { if(flag_config_2)descr_len=data_buf[2]-rd_usb_data(data_buf); else descr_len=data_buf[0]-rd_usb_data(data_buf); while(descr_len>0) { toggle_recv(); p+=0x08; issue_token(( 0 << 4 ) | DEF_USB_PID_IN);status=wait_interrupt(); if(status==USB_INT_SUCCESS) /* DATA阶段操作成功 */ descr_len-=rd_usb_data(p); else return(0); } } else return(3);
endp7_mode=0xc0; toggle_send(); wr_usb_data(0,Request.Req_buf); issue_token(( 0 << 4 ) | DEF_USB_PID_OUT);status=wait_interrupt(); if(status==USB_INT_SUCCESS)/* 状态阶段操作成功 */ return(1); else return(4); }