正在加载图片...
Interconnectivity Page 5 of 5 Application Notes: Using PDIUSBD12 in DMA Mode last operation. While multithreads can be used to access different pipes to increase system erformance, it makes programming much easier to process Setup DMA Request (IOCTL) and data transfer(Write File/ReadFile)operation on Main endpoints with a single thread IOCTL WRITE REGISTER and IOCtL READ REGiStER use structure Io block to exchange data with the device driver. Below structure definition is part of Microsoft Still Image USB Interface typedef struct Io BLOCK t unsigned uoffset unsigned length; IN OUT PUCHAR pby Data unsigned IO BLOCK, *PIO BLOCK IO_REQUEST structure is a proprietary definition that contains details of the Setup DMA typedef struct Io REqUEST I unsigned char aDdresse unsigned short unsigned char cOmmand: 1 IO REQUES See the sample code below: ioRequest. bAddressH =0 ioRequest. usize transfer size ioRequest. cOmmand = 0x80 //start, writ ioBlock. uoffset =0 ioBlock lEngth sizeof (IO RE i。Bl。ck Dat (PUCHAR)&ioRequest ioBlock. uIndex = 0x471 Result DeviceIocontrol(hDevice (PVOID)&ioBlock sizeof(IO BLOCK), lt testDig->MessageBox("Setup DMA request failed!","Test Error ")i bResult Writefile(hFile transfer size, Philips Semicond Visithttp://www.flexi usD. conInterconnectivity Page 5 of 5 Application Notes: Using PDIUSBD12 in DMA Mode ______________________________________________________________________________________________ Philips Semiconductors - Asia Product Innovation Centre Visit http://www.flexiusb.com last operation. While multithreads can be used to access different pipes to increase system performance, it makes programming much easier to process Setup DMA Request (IOCTL) and data transfer (WriteFile/ReadFile) operation on Main endpoints with a single thread. IOCTL_WRITE_REGISTER and IOCTL_READ_REGISTER use structure IO_BLOCK to exchange data with the device driver. Below structure definition is part of Microsoft Still Image USB Interface. typedef struct _IO_BLOCK { IN unsigned uOffset; IN unsigned uLength; IN OUT PUCHAR pbyData; IN unsigned uIndex; } IO_BLOCK, *PIO_BLOCK; IO_REQUEST structure is a proprietary definition that contains details of the Setup DMA Request. typedef struct _IO_REQUEST { unsigned short uAddressL; unsigned char bAddressH; unsigned short uSize; unsigned char bCommand; } IO_REQUEST, *PIO_REQUEST; See the sample code below: ioRequest.uAddressL = 0; ioRequest.bAddressH = 0; ioRequest.uSize = transfer_size; ioRequest.bCommand = 0x80; //start, write ioBlock.uOffset = 0; ioBlock.uLength = sizeof(IO_REQUEST); ioBlock.pbyData = (PUCHAR)&ioRequest; ioBlock.uIndex = 0x471; bResult = DeviceIoControl(hDevice, IOCTL_WRITE_REGISTERS, (PVOID)&ioBlock, sizeof(IO_BLOCK), NULL, 0, &nBytes, NULL); if (bResult != TRUE) { testDlg->MessageBox("Setup DMA request failed!", "Test Error"); return; } bResult = WriteFile(hFile, pcIoBuffer, transfer_size, &nBytes, NULL);
<<向上翻页
©2008-现在 cucdc.com 高等教育资讯网 版权所有