阅读:1089回复:1
菜鸟的问题
请问各位大虾,USB采用控制传输时,如何添加读取数据的超时,
我的程序如下: NTSTATUS ntStatus, status = STATUS_SUCCESS; PDEVICE_EXTENSION pdx; PIRP irp; KEVENT event; IO_STATUS_BLOCK ioStatus; PIO_STACK_LOCATION nextStack; pdx = fdo->DeviceExtension; KeInitializeEvent(&event, NotificationEvent, FALSE); irp = IoBuildDeviceIoControlRequest( IOCTL_INTERNAL_USB_SUBMIT_URB, pdx->StackDeviceObject, NULL, 0, NULL, 0, TRUE, /* INTERNAL */ &event, &ioStatus); nextStack = IoGetNextIrpStackLocation(irp); ASSERT(nextStack != NULL); nextStack->Parameters.Others.Argument1 = Urb; ntStatus = IoCallDriver(pdx->StackDeviceObject, irp); if (ntStatus == STATUS_PENDING) { status = KeWaitForSingleObject( &event, Suspended, KernelMode, FALSE, NULL ); } else { ioStatus.Status = ntStatus; } ntStatus = ioStatus.Status; if (!(USBD_SUCCESS(Urb->UrbHeader.Status))) pdx->LastFailedUrbStatus = Urb->UrbHeader.Status; if (NT_SUCCESS(ntStatus)) { if (!(USBD_SUCCESS(Urb->UrbHeader.Status))) ntStatus = STATUS_UNSUCCESSFUL; } return ntStatus; 我曾经试图在WaitForSingleObject时,增加时间参数,但每次系统执行到这里都会崩溃,这是为什么?正确做法是怎样的? (硬件为CY7C63000A) |
|
沙发#
发布于:2002-05-27 09:52
不拿点分没人理你 :D
|
|
|