亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? d12testdlg.cpp

?? PDIUSBD12套件說明及源碼
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
/*
   //*************************************************************************
   //
   //                  P H I L I P S   P R O P R I E T A R Y
   //
   //           COPYRIGHT (c)   1998 BY PHILIPS SINGAPORE.
   //                     --  ALL RIGHTS RESERVED  --
   //
   // File Name:	D12TestDlg.CPP
   // Author:		Wenkai Du
   // Created:		14 Jan 98
   // Modified:
   // Revision:		1.4
   //
   //*************************************************************************
   //
   //*************************************************************************
   */

// D12TestDlg.cpp : implementation file
//
#include "stdafx.h"

#include <mmsystem.h>
#include "D12Test.h"
#include "D12TestDlg.h"
#include <devioctl.h>
#include "process.h"
#include "rwbulk.h"
#include "ioctl.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

UINT InterruptIn(void * pParam) {  
    char temp [80],cc[180], c;
	unsigned int i;
    BOOLEAN bResult = FALSE;
    ULONG nBytes = 0;
	struct CThreadParam * threadParam;
	HANDLE hFile, hDevice;
	CD12TestDlg* testDlg;
	IO_BLOCK ioBlock;
	IO_REQUEST ioRequest;

	threadParam=(struct CThreadParam *)pParam;
	threadParam->bInThread = TRUE;

	testDlg = threadParam->testDlg;

	threadParam->pcIoBuffer = (unsigned char *)malloc (threadParam->uiLength + 16); 
				
	do {
		do {
			Sleep(2000);
			
			hFile = open_file(threadParam->pipe_name);

			if(hFile != INVALID_HANDLE_VALUE) {

				hDevice = open_dev();

				ioBlock.uOffset = 0;
				ioBlock.uLength = 1;
				ioBlock.pbyData = (PUCHAR)&c;
				ioBlock.uIndex = GET_FIRMWARE_VERSION;

				bResult = DeviceIoControl(hDevice,
						IOCTL_READ_REGISTERS,
						(PVOID)&ioBlock,
						sizeof(IO_BLOCK),
						(PVOID)&c,
						1,
						&nBytes,
						NULL);

				if (bResult != TRUE) {
					CloseHandle(hFile);
					CloseHandle(hDevice);

					threadParam->bInThread = FALSE;
					wsprintf (cc, "This version of firmware does not support this test application.\r\nPlease upgrade the firmware of the evaluation board.");
					testDlg->MessageBox((LPCSTR)cc, "Incompatible Firmware", MB_ICONSTOP);
					testDlg->EndDialog(0);

					return 0;
				}
			}
		} while(hFile == INVALID_HANDLE_VALUE && threadParam->bInThread == TRUE);

		threadParam->ulData[0] |= D12_DRIVERLOAD;
		threadParam->ulData[1] = c;
		threadParam->bUpdate = TRUE;

		if (hFile != INVALID_HANDLE_VALUE) {

			while(threadParam->bInThread == TRUE){

				bResult = ReadFile(hFile,
							  threadParam->pcIoBuffer,
							  threadParam->uiLength,
							  &nBytes,
							  NULL);
				
				if (bResult == TRUE) {
					threadParam->ulData[0] |= D12_KEYSTATUS;
					threadParam->ulData[2] = *(threadParam->pcIoBuffer);
					threadParam->bUpdate = TRUE;
				} 
				else {
					DeviceIoControl(hFile,
						IOCTL_D12_RESET_PIPE,
						0,
						0,
						0,
						0,
						&nBytes,
						NULL);

					threadParam->ulData[0] |= D12_DRIVERUNLOAD;
					threadParam->bUpdate = TRUE;

					break;
				}/* else ioctl failed */
			};

			CloseHandle(hFile);
			CloseHandle(hDevice);

		}// if valid hDevice

	} while(threadParam->bInThread == TRUE);

	free(threadParam->pcIoBuffer);
	threadParam->pcIoBuffer = NULL;

	threadParam->bInThread = FALSE;

    return 0; 
} 

UINT GenericOut(void * pParam) {  
    char temp [80],cc[80];
    BOOLEAN bResult = FALSE;
    ULONG nBytes = 0;
	struct CThreadParam * threadParam;
	HANDLE hFile;
	CD12TestDlg* testDlg;

	threadParam=(struct CThreadParam *)pParam;
	threadParam->bInThread = FALSE;
	testDlg = threadParam->testDlg;

	hFile = open_file(threadParam->pipe_name);
	if(hFile == INVALID_HANDLE_VALUE) {
		free(threadParam->pcIoBuffer);
		threadParam->pcIoBuffer = NULL;

		strcpy(temp, "Open driver failed! Can't write to ");
		strcat(temp, threadParam->pipe_name);
		strcat(temp, ".");
		testDlg->MessageBox((LPCSTR)temp, "Test Error");
		return 0;
	}

    if (hFile != INVALID_HANDLE_VALUE) {

		threadParam->bInThread = TRUE;
		
	        bResult = WriteFile(hFile,
	                      threadParam->pcIoBuffer,
                          threadParam->uiLength,
	                      &nBytes,
	                      NULL);
			
			if (bResult != TRUE) {
				DeviceIoControl(hFile,
					IOCTL_D12_RESET_PIPE,
					0,
					0,
					0,
					0,
					&nBytes,
					NULL);
				wsprintf (cc, "Writing ");
				strcat( cc, threadParam->pipe_name);
				strcat( cc, " failed! Aborted.");
				testDlg->MessageBox((LPCSTR)cc, "Test Error");
			}/* else ioctl failed */


    }// if valid hDevice

	//The thread terminated by itself, delete resources

	CloseHandle(hFile);

	free(threadParam->pcIoBuffer);
	threadParam->pcIoBuffer = NULL;

	threadParam->bInThread = FALSE;

    return 0; 
} 


UINT ReadPipe(void * pParam) {  
    char temp [80],cc[80];
	unsigned int i;
    BOOLEAN bResult = FALSE;
    ULONG nBytes = 0;
	struct CThreadParam * threadParam;
	CD12TestDlg* testDlg;
	HANDLE hFile, hDevice;
	DWORD time0, time1;
	IO_BLOCK ioBlock;
	IO_REQUEST ioRequest;

	threadParam=(struct CThreadParam *)pParam;
	threadParam->bInThread = FALSE;
	testDlg = threadParam->testDlg;
	threadParam->bUpdate = FALSE;

	hFile = open_file(threadParam->pipe_name);
	if(hFile == INVALID_HANDLE_VALUE) {
		strcpy(temp, "Open driver failed! Can't read from ");
		strcat(temp, threadParam->pipe_name);
		strcat(temp, ".");
		testDlg->MessageBox((LPCSTR)temp, "Test Error");
		return 0;
	}

	hDevice = open_dev();
	if(hDevice == INVALID_HANDLE_VALUE) {
		CloseHandle(hFile);
		strcpy(temp, "Open device handle failed! Can't read from ");
		strcat(temp, threadParam->pipe_name);
		strcat(temp, ".");
		testDlg->MessageBox((LPCSTR)temp, "Test Error");
		return 0;
	}

    threadParam->pcIoBuffer = (unsigned char *)malloc (threadParam->uiLength + 16); 
	threadParam->ulCount = 0;
	threadParam->total_time = 0;
	threadParam->cur_rate = 0;
	threadParam->max_rate = 0;

    if (hFile != INVALID_HANDLE_VALUE) {

		threadParam->bInThread = TRUE;
		testDlg->m_InStartBtn.EnableWindow(FALSE);
		testDlg->m_InStopBtn.EnableWindow(TRUE);
		
		do{

			ioRequest.uAddressL = 0;
			ioRequest.bAddressH = 0;
			ioRequest.uSize = threadParam->uiLength;
			ioRequest.bCommand = 0x81;	//start, read

			ioBlock.uOffset = 0;
			ioBlock.uLength = sizeof(IO_REQUEST);
			ioBlock.pbyData = (PUCHAR)&ioRequest;
			ioBlock.uIndex = SETUP_DMA_REQUEST;

			bResult = DeviceIoControl(hDevice,
					IOCTL_WRITE_REGISTERS,
					(PVOID)&ioBlock,
					sizeof(IO_BLOCK),
					NULL,
					0,
					&nBytes,
					NULL);

			if (bResult != TRUE) {
				threadParam->bInThread = FALSE;
				wsprintf (cc, "Requesting data transfer on ");
				strcat( cc, threadParam->pipe_name);
				strcat( cc, " failed! Aborted.");
				testDlg->MessageBox((LPCSTR)cc, "Test Error");
				break;
			}

			time0 = timeGetTime();
	        bResult = ReadFile(hFile,
	                      threadParam->pcIoBuffer,
                          threadParam->uiLength,
	                      &nBytes,
	                      NULL);
			time1 = timeGetTime();
			
			if (bResult != TRUE) {
				DeviceIoControl(hFile,
					IOCTL_D12_RESET_PIPE,
					0,
					0,
					0,
					0,
					&nBytes,
					NULL);
				threadParam->bInThread = FALSE;
				wsprintf (cc, "Reading ");
				strcat( cc, threadParam->pipe_name);
				strcat( cc, " failed! Aborted.");
				testDlg->MessageBox((LPCSTR)cc, "Test Error");
				break;
			} 
			else {
				threadParam->ulCount += nBytes;
				if(time1 != time0) {
					threadParam->cur_rate = (nBytes*1000)/(time1-time0-1);
					if(threadParam->cur_rate > threadParam->max_rate)
						threadParam->max_rate = threadParam->cur_rate;
					threadParam->total_time += (time1-time0-1);
					threadParam->bUpdate = TRUE;
				}
			}
		}while(threadParam->bInThread == TRUE);


    }// if valid hDevice

	//The thread terminated by itself, delete resources

	CloseHandle(hFile);
	CloseHandle(hDevice);

	free(threadParam->pcIoBuffer);
	threadParam->pcIoBuffer = NULL;

	testDlg->m_InStartBtn.EnableWindow(TRUE);
	testDlg->m_InStopBtn.EnableWindow(FALSE);

    return 0; 
} 

UINT WritePipe(void * pParam) {  
    char temp [80],cc[80];
    BOOLEAN bResult = FALSE;
    ULONG nBytes = 0, ulCount = 0, index, cnt, seq;
	struct CThreadParam * threadParam;
	CD12TestDlg* testDlg;
	unsigned char rNum;
	HANDLE hFile, hDevice;
	DWORD time0, time1;
	IO_BLOCK ioBlock;
	IO_REQUEST ioRequest;


	threadParam=(struct CThreadParam *)pParam;
	threadParam->bInThread = FALSE;
	testDlg = threadParam->testDlg;
	threadParam->bUpdate = FALSE;

	hFile = open_file(threadParam->pipe_name);
	if(hFile == INVALID_HANDLE_VALUE) {
		strcpy(temp, "Open driver failed! Can't write to ");
		strcat(temp, threadParam->pipe_name);
		strcat(temp, ".");
		testDlg->MessageBox((LPCSTR)temp, "Test Error");
		return 0;
	}

	hDevice = open_dev();
	if(hDevice == INVALID_HANDLE_VALUE) {
		CloseHandle(hFile);
		strcpy(temp, "Open device handle failed! Can't write to ");
		strcat(temp, threadParam->pipe_name);
		strcat(temp, ".");
		testDlg->MessageBox((LPCSTR)temp, "Test Error");
		return 0;
	}

    threadParam->pcIoBuffer = (unsigned char *)malloc (threadParam->uiLength + 16); 
	threadParam->ulCount = 0;
	threadParam->total_time = 0;
	threadParam->cur_rate = 0;
	threadParam->max_rate = 0;

    if (hFile != INVALID_HANDLE_VALUE) {
		int buffLen;

		// this is the size of incrementing pattern
		buffLen = threadParam->uiLength - sizeof(ulCount);

		threadParam->bInThread = TRUE;
		testDlg->m_OutStartBtn.EnableWindow(FALSE);
		testDlg->m_OutStopBtn.EnableWindow(TRUE);

		if(threadParam->uiLength == 0) {
		}
		else {

			do {
			
				if(buffLen > 0)
				{
					rNum = 0;

					for(index = 0; index < threadParam->uiLength; index++)
						*(threadParam->pcIoBuffer+index) = rNum++;
					
					cnt = threadParam->uiLength/64;
					
					for(index = 0; index < cnt ; index ++) {
						seq = ulCount*cnt + index;
							// stick unsigned long count at the beginning of buffer
						memcpy(threadParam->pcIoBuffer + index*64, &seq, 
							min(sizeof(ulCount), threadParam->uiLength));
					}
				}

				ioRequest.uAddressL = 0;
				ioRequest.bAddressH = 0;
				ioRequest.uSize = threadParam->uiLength;
				ioRequest.bCommand = 0x80;	//start, write

				ioBlock.uOffset = 0;
				ioBlock.uLength = sizeof(IO_REQUEST);
				ioBlock.pbyData = (PUCHAR)&ioRequest;
				ioBlock.uIndex = SETUP_DMA_REQUEST;

				bResult = DeviceIoControl(hDevice,
						IOCTL_WRITE_REGISTERS,
						(PVOID)&ioBlock,
						sizeof(IO_BLOCK),
						NULL,
						0,
						&nBytes,
						NULL);

				if (bResult != TRUE) {
					threadParam->bInThread = FALSE;
					wsprintf (cc, "Requesting data transfer on ");
					strcat( cc, threadParam->pipe_name);
					strcat( cc, " failed! Aborted.");
					testDlg->MessageBox((LPCSTR)cc, "Test Error");
					break;
				}

				time0 = timeGetTime();
				bResult = WriteFile(hFile,
							  threadParam->pcIoBuffer,
							  threadParam->uiLength,
							  &nBytes,
							  NULL);

				time1 = timeGetTime();
				if (bResult != TRUE) {
					DeviceIoControl(hFile,
						IOCTL_D12_RESET_PIPE,
						0,
						0,
						0,
						0,
						&nBytes,
						NULL);
					threadParam->bInThread = FALSE;
					wsprintf (cc, "Writing ");
					strcat( cc, threadParam->pipe_name);
					strcat( cc, " failed! Aborted.");
					testDlg->MessageBox((LPCSTR)cc, "Test Error");
					break;
				}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
aaa国产一区| 日韩欧美你懂的| 久久综合丝袜日本网| 亚洲欧美日本在线| 国模冰冰炮一区二区| 在线观看成人免费视频| 久久精品一区蜜桃臀影院| 亚洲电影激情视频网站| 99这里只有精品| 久久精品这里都是精品| 理论电影国产精品| 欧美日本视频在线| 亚洲一区中文在线| www.亚洲人| 国产欧美日韩在线观看| 激情综合亚洲精品| 在线综合视频播放| 午夜精品久久久久久久| 在线免费亚洲电影| 一区二区三区欧美在线观看| 成人一二三区视频| 国产欧美久久久精品影院| 韩国女主播一区| 精品对白一区国产伦| 男人操女人的视频在线观看欧美| 欧美日韩的一区二区| 亚洲一区二区三区激情| 欧美亚洲综合色| 亚洲精品一二三区| 一本色道久久加勒比精品| 亚洲欧美一区二区三区国产精品| youjizz久久| 亚洲婷婷综合久久一本伊一区| 风间由美一区二区av101| 国产精品色在线观看| 成人禁用看黄a在线| 亚洲欧洲精品一区二区三区不卡| 99久久er热在这里只有精品15| 国产精品久久久久一区二区三区共 | 三级在线观看一区二区 | 99久久婷婷国产| 亚洲天堂精品在线观看| 欧美性xxxxx极品少妇| 亚洲一区二区三区中文字幕在线| 欧美中文字幕亚洲一区二区va在线 | 日韩午夜在线观看| 久久精品国产亚洲aⅴ| 久久伊人中文字幕| 成人精品国产免费网站| 亚洲国产一区二区视频| 日韩一卡二卡三卡四卡| 国产美女视频一区| 中文字幕欧美一区| 欧美日韩精品一二三区| 久久精品国产久精国产| 国产精品色噜噜| 欧美日韩综合色| 久久不见久久见中文字幕免费| 国产欧美一区视频| 欧洲日韩一区二区三区| 麻豆成人91精品二区三区| 国产亚洲成av人在线观看导航| 不卡一区二区在线| 日欧美一区二区| 欧美经典三级视频一区二区三区| 欧日韩精品视频| 加勒比av一区二区| 亚洲另类色综合网站| 日韩视频在线一区二区| www.视频一区| 麻豆成人91精品二区三区| 1024成人网| www久久精品| 欧美裸体一区二区三区| 风间由美中文字幕在线看视频国产欧美| 亚洲一区二区三区在线看| 五月综合激情日本mⅴ| 久久久久久久久岛国免费| 欧洲国产伦久久久久久久| 国产夫妻精品视频| 日韩精品三区四区| 亚洲激情网站免费观看| 久久久久国产免费免费| 欧美一区二区国产| 色噜噜狠狠成人网p站| 成人午夜av在线| 狠狠v欧美v日韩v亚洲ⅴ| 无码av免费一区二区三区试看| 国产精品美女一区二区三区| 欧美电影免费观看高清完整版在线观看 | 91精品国产一区二区三区香蕉| 伦理电影国产精品| 亚洲免费观看高清完整版在线观看| 日韩一区二区免费在线电影| 色婷婷综合久久久久中文 | 久久99精品久久久久久动态图| 亚洲精品成人天堂一二三| 欧美国产日韩精品免费观看| 欧美不卡视频一区| 欧美日韩成人综合天天影院| 一本到一区二区三区| 成人综合婷婷国产精品久久| 久久狠狠亚洲综合| 青娱乐精品在线视频| 亚洲香肠在线观看| 一区二区三区日本| 亚洲午夜精品在线| 一区二区三区电影在线播| 中文字幕一区二区不卡| 欧美一区二区精品在线| 色视频一区二区| 91农村精品一区二区在线| 高清日韩电视剧大全免费| 高潮精品一区videoshd| 国产aⅴ精品一区二区三区色成熟| 国产一区二区女| 国产91精品一区二区麻豆亚洲| 欧美综合亚洲图片综合区| 91亚洲精品一区二区乱码| 91在线码无精品| 色偷偷88欧美精品久久久| 色婷婷狠狠综合| 欧美在线短视频| 欧美一区二区黄| 久久久高清一区二区三区| 日本一区二区三区dvd视频在线| 国产精品视频观看| 亚洲午夜羞羞片| 免费观看一级特黄欧美大片| 久久99蜜桃精品| 懂色av一区二区三区免费看| 99在线精品观看| 欧美中文字幕一区二区三区 | 国产精品美女久久久久久久网站| 91麻豆精品国产91久久久久久| 欧美无砖专区一中文字| 欧美高清一级片在线| 日韩免费视频一区二区| 国产日产欧产精品推荐色| 亚洲柠檬福利资源导航| 91在线精品秘密一区二区| 日本久久精品电影| 日韩免费看的电影| 国产欧美一区二区三区网站| 樱桃视频在线观看一区| 蜜臀精品久久久久久蜜臀| 成人影视亚洲图片在线| 欧美日韩的一区二区| 欧美激情一区二区在线| 亚洲午夜激情av| 国产精品91一区二区| 欧美羞羞免费网站| 国产亚洲综合性久久久影院| 一区二区不卡在线视频 午夜欧美不卡在 | 欧美日韩一区三区四区| 精品日韩一区二区三区免费视频| 国产精品免费丝袜| 日本在线播放一区二区三区| 成人精品一区二区三区中文字幕| 8x福利精品第一导航| 国产精品女主播在线观看| 日本不卡1234视频| 欧美中文字幕一二三区视频| 国产亚洲成av人在线观看导航| 一区二区高清在线| fc2成人免费人成在线观看播放| 欧美一三区三区四区免费在线看| 国产精品福利一区二区三区| 国产自产v一区二区三区c| 欧美三级韩国三级日本三斤| 国产女主播视频一区二区| 日日夜夜一区二区| 色噜噜狠狠成人网p站| 久久亚洲精品国产精品紫薇| 亚洲成人黄色小说| 91天堂素人约啪| 久久精品一区二区三区不卡| 美国十次了思思久久精品导航| 在线区一区二视频| 中文字幕视频一区| 国产一区二区剧情av在线| 日韩一区二区中文字幕| 亚洲成人动漫在线免费观看| av电影天堂一区二区在线观看| 欧美一卡二卡在线| 亚洲国产精品自拍| 欧美网站大全在线观看| 亚洲男人天堂av网| 国产成人小视频| 精品国内二区三区| 久久av资源网| 日韩午夜三级在线| 看片的网站亚洲| 日韩女优av电影| 麻豆精品久久精品色综合| 欧美精品乱码久久久久久| 亚洲成av人**亚洲成av**| 欧美专区在线观看一区| 亚洲精品乱码久久久久久久久| 99久久婷婷国产综合精品电影|