public unsafe bool PreReadAsysnchonous() { cBufs = new byte[CyConst.SINGLE_XFER_LEN + IsoPktBlockSize + ((InEndpoint.XferMode == XMODE.BUFFERED) ? BufSz : 0)]; xBufs = new byte[BufSz]; oLaps = new byte[20]; pktsInfo = new ISO_PKT_INFO[PPX]; fixed(byte *tL0 = oLaps, tc0 = cBufs, tb0 = xBufs) { OVERLAPPED *ovLapStatus = (OVERLAPPED *)tL0; ovLapStatus->hEvent = (IntPtr)PInvoke.CreateEvent(0, 0, 0, 0); // Pre-load the queue with a request int len = BufSz; if (InEndpoint.BeginDataXfer(ref cBufs, ref xBufs, ref len, ref oLaps) == false) { LogHelper.GetLogger <USB>().Debug("Begin data xfer failure"); } if (!InEndpoint.WaitForXfer(ovLapStatus->hEvent, 500)) { InEndpoint.Abort(); PInvoke.WaitForSingleObject(ovLapStatus->hEvent, 500); } } return(true); }
public void ReadAsysnchonous() { if (InEndpoint.Attributes == 1) { CyIsocEndPoint isoc = InEndpoint as CyIsocEndPoint; // FinishDataXfer if (isoc.FinishDataXfer(ref cBufs, ref xBufs, ref BufSz, ref oLaps, ref pktsInfo)) { LogHelper.GetLogger <USB>().Debug("isoc finish data xfer: "); } else { if (InEndpoint.FinishDataXfer(ref cBufs, ref xBufs, ref BufSz, ref oLaps)) { LogHelper.GetLogger <USB>().Debug("finish data xfer: "); } } } }