EasyManua.ls Logo

Philips PDIUSBD12 - Host Side Programming Considerations

Philips PDIUSBD12
22 pages
Print Icon
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Interconnectivity Page 22 of 22
Firmware Programming Guide for PDIUSBD12
Philips Semiconductors - Asia Product Innovation Centre
Visit http://www.flexiusb.com
8.5 Host Side Programming Considerations
The USB device is not the only criteria, which decides the transfer rate. The performance of the host side
application plays a more important role in the overall system performance because the host always controls USB
transactions.
The DMA transfer is a sequential operation that involves both control endpoint and main endpoint. Cooperation
is important because the next step of the operation is determined by the result of the 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) operations on the 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);

Other manuals for Philips PDIUSBD12

Related product manuals