21.07.2015 Views

Programming Info D2XXPG31.pdf

Programming Info D2XXPG31.pdf

Programming Info D2XXPG31.pdf

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

FT-Win32 API Functions945.17 FT_W32_SetCommTimeoutsThis function sets the timeout parameters for I/O requests.BOOL FT_W32_SetCommTimeouts (FT_HANDLE ftHandle, LPFTTIMEOUTS lpftTimeouts)ParametersftHandlelpftTimeoutsHandle of the device.Pointer to an FTTIMEOUTS structure to store timeoutinformation.Return ValueIf the function is successful, the return value is nonzero.If the function is unsuccessful, the return value is zero.RemarksTimeouts are calculated using the information in the FTTIMEOUTS structure.For read requests, the number of bytes to be read is multiplied by the total timeout multiplier, andadded to the total timeout constant. So, if TS is an FTTIMEOUTS structure and the number ofbytes to read is dwToRead, the read timeout, rdTO, is calculated as follows.rdTO = (dwToRead * TS.ReadTotalTimeoutMultiplier) + TS.ReadTotalTimeoutConstantFor write requests, the number of bytes to be written is multiplied by the total timeout multiplier, andadded to the total timeout constant. So, if TS is an FTTIMEOUTS structure and the number ofbytes to write is dwToWrite, the write timeout, wrTO, is calculated as follows.wrTO = (dwToWrite * TS.WriteTotalTimeoutMultiplier) + TS.WriteTotalTimeoutConstantLinux does not support the W32 API.ExampleThis example shows how to setup a read timeout of 100 milliseconds and a write timeout of 200milliseconds.FT_HANDLE ftHandle; // setup by FT_W32_CreateFileFTTIMEOUTS ftTS;ftTS.ReadIntervalTimeout = 0;ftTS.ReadTotalTimeoutMultiplier = 0;ftTS.ReadTotalTimeoutConstant = 100;ftTS.WriteTotalTimeoutMultiplier = 0;ftTS.WriteTotalTimeoutConstant = 200;if (FT_W32_SetCommTimeouts(ftHandle,&ftTS)); // FT_W32_SetCommTimeouts OKelse; // FT_W32_SetCommTimeouts failed© Future Technology Devices International Ltd. 2005

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!