テストに使ったプログラムの抜粋です
int __fastcall TForm2::FifoOpen() { FT_STATUS ftStatus; int serial_length; DWORD InTransferSize =65535; DWORD OutTransferSize =4096; char *serial; serial = "HDL00511A"; int ret; ret = -1; for(;;){ ftStatus = FT_OpenEx(serial, FT_OPEN_BY_SERIAL_NUMBER, &handle); if(ftStatus != FT_OK){ AddMemo("FT_OPEN_BY_SERIAL_NUMBER : NG"); break; }else{ AddMemo("FT_OPEN_BY_SERIAL_NUMBER : OK"); } ftStatus = FT_SetBitMode(handle, 0, 0x40); if(ftStatus != FT_OK){ AddMemo("FT_SetBitMode(Sync-FIFO Mode) : NG"); break; }else{ AddMemo("FT_SetBitMode(Sync-FIFO Mode) : OK"); } ftStatus = FT_SetLatencyTimer(handle, 2); if(ftStatus != FT_OK){ AddMemo("FT_SetLatencyTimer : NG"); break; }else{ AddMemo("FT_SetLatencyTimer : OK"); } ftStatus = FT_SetUSBParameters(handle, InTransferSize, OutTransferSize); if(ftStatus != FT_OK){ AddMemo("FT_SetUSBParameters : NG"); break; }else{ AddMemo("FT_SetUSBParameterse : OK"); } ftStatus = FT_SetFlowControl( handle, FT_FLOW_RTS_CTS, 0x10,0x13); if(ftStatus != FT_OK){ AddMemo("FT_SetFlowControl : NG"); break; }else{ AddMemo("FT_SetFlowControl : OK"); } // 正常リターン ret = 0; break; } if( ret == 0 ){ AddMemo("FIFO OPEN : OK"); }else{ AddMemo("FIFO OPEN : NG"); } return ret; } int __fastcall TForm2::Write_1000( char *p, int len, int kaisuu ) { FT_STATUS ftStatus; DWORD writtenBytes; int ret; ret = 0; for( int ii=0; ii < kaisuu; ii++ ){ ftStatus = FT_Write(handle, p, len, &writtenBytes); if(ftStatus != FT_OK){ ret = -1; break; } } return ret; } // 送信テスト int __fastcall TForm2::FifoExam_snd( void ) { String str; FT_STATUS ftStatus; DWORD writtenBytes; DWORD EventDWord; DWORD TxBytes; DWORD RxBytes; DWORD BytesReceived; char *RxData; char *TxData; String DiffTime; long fDiffTIme; long totalbyte; long nn; int kaisuu; int ret; AddMemo("送信テスト"); gExamBurden = Edit_ExamBurden->Text.ToInt(); TxData = new char[gExamBurden+1]; //*1 for(int i=0; i<gExamBurden; i++){ TxData[i] = '0' + i%(16*3-1); } TxData[gExamBurden] = '\0'; kaisuu = 10; ret = -1; for(;;){ QueryPerformanceCounter(&gStartTime); //開始時間 if( Write_1000(TxData, gExamBurden, kaisuu)!= FT_OK){ AddMemo("FT_Write ERROR"); break; } QueryPerformanceCounter(&gEndTime); //終了時間 fDiffTIme = ((gEndTime.QuadPart - gStartTime.QuadPart)*1000 / gCpuFreq.QuadPart); DiffTime.sprintf("%d [mSec]", (DWORD)fDiffTIme); AddMemo( DiffTime ) ; totalbyte = gExamBurden * kaisuu; nn = 1000*(totalbyte / (fDiffTIme+0.0000000001)); String tmp; tmp.sprintf( "%d bytes---%6.3f [MBytes/sec] " ,totalbyte, (float)nn/1000000.0 ); AddMemo( tmp ) ; ret = 0; // 正常終了 break; } AddMemo("................"); delete [] TxData; //*1 return ret; } // 受信テスト int __fastcall TForm2::FifoExam_rcv( void ) { String str; FT_STATUS ftStatus; DWORD writtenBytes; DWORD EventDWord; DWORD RxBytes; DWORD RxBytes1; DWORD TxBytes; DWORD BytesReceived; char *RxData; String DiffTime; long fDiffTIme; long nn; int ret; AddMemo("受信テスト"); RxBytes = 10000000; RxData = new char[RxBytes]; // *1 DWORD InTransferSize = 32768;//16384; ftStatus = FT_SetUSBParameters(handle, InTransferSize, 0); AddMemo("FT_SetUSBParameters(32768)"); FT_Purge(handle, FT_PURGE_RX); AddMemo("FT_Purge"); ret = -1; for(;;){ //Application->ProcessMessages(); ftStatus = FT_GetStatus(handle, &RxBytes1, &TxBytes, &EventDWord); if(ftStatus != FT_OK){ AddMemo("FT_GetStatus ERROR"); break; }else{ if (RxBytes1 == 0) { continue; } } QueryPerformanceCounter(&gStartTime); //開始時間 ftStatus = FT_Read(handle, RxData, RxBytes, &BytesReceived); if(ftStatus != FT_OK){ AddMemo("FT_Read ERROR"); break; } QueryPerformanceCounter(&gEndTime); //終了時間 fDiffTIme = ((gEndTime.QuadPart - gStartTime.QuadPart)*1000 / gCpuFreq.QuadPart); DiffTime.sprintf("%d [mSec]", (DWORD)fDiffTIme); AddMemo( DiffTime ) ; nn = 1000*(RxBytes / (fDiffTIme+0.0000000001)); String tmp; tmp.sprintf( "%d bytes---%6.3f [MBytes/sec] " ,RxBytes, (float)nn/1000000.0 ); AddMemo( tmp ) ; ret = 0; //正常終了 break; } delete []RxData; // *1 AddMemo("................"); return ret; }