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 設(shè)備返回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)/* 狀態(tài)階段操作成功 */ return(1); else return(4); }