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

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

?? test2040.cpp

?? pci2040VxD驅動非常詳細的源程序
?? CPP
字號:
/// MDAPP32.CPP - example app for use with MAPDEV example

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
#include <winioctl.h>
#include "test2040.h"
#include "pci.h"

#define   INTSET			0;
#define   INTCLEAR			0x04;
#define   INTMASK			0x08;
#define   INTUNMASK			0x0C;
#define   HPISTART          0x14;
#define   HPIDATAWIDTH      0x18;


HANDLE		hDevice;
void main(int ac, char* av[])
{
	DWORD Hpiaddress,Conaddress;       //the physical address
	BOOL  BoolMap0,BoolMap1[4];			 //to decide if lock the linear address
	int   Irq;			 //the virtual irq
	DWORD Ioport;        //the ioport address
	PVOID	inBuf[1];		 // buffer for struct pointer to VxD
	DWORD	cbBytesReturned; // count of bytes returned from VxD
	MAPDEVREQUEST req;		 // map device request structure
	DWORD Testid;			 //device id and vendor
	unsigned char  a[256];
	for(int k=0;k<256;k++)
		a[k]=11;

	DWORD CONFIGUEREG;
	DWORD Addhpic,Addhpia,Addhpidinc,Addhpid;
	WORD *Addhpic1,*Addhpia1,*Addhpidinc1,*Addhpid1;
	WORD Addhpic2,Addhpia2,Addhpidinc2,Addhpid2;
	WORD command;

/////////////////////////////get the device id and vendor
	for(int i=0x80000000;i<0x80ffff00+1;i=i+0x100)
	{
				_outpd(0x0cf8,i);
				Testid=_inpd(0x0cfc);
				if(Testid==0xac60104c)
				{	
					printf("The bus line ID and device ID is  %08lx\n", i);
					CONFIGUEREG=i;
///////////////////////////////command register
					_outpd(0x0cf8,CONFIGUEREG+0x04);
					command=_inpw(0x0cfc);
					printf("    Testcommmand is %04x",command); 
					command=command|0x0002;
					_outpd(0x0cf8,CONFIGUEREG+0x04); 
					_outpw(0x0cfc,command);
					_outpd(0x0cf8,CONFIGUEREG+0x04); 
					command=_inpw(0x0cfc);
					printf("     is %04x\n",command); 
					_outpd(0x0cf8,CONFIGUEREG);
					Testid=_inpd(0x0cfc);
					printf("Device ID and Vendor is %08lx\n",Testid); 
					break;
				}
	}


//////////////////////////////open   the    vxd
	hDevice = CreateFile("\\\\.\\pci2040.VXD", 0,0,0,
                        CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0);
	if (hDevice == INVALID_HANDLE_VALUE)
	{
        	fprintf(stderr, "Cannot open driver, error=%08lx\n",GetLastError());
			exit(1);
	}


//////////////////////////////////get the hpi csr irq 
		if (!DeviceIoControl(hDevice,GETIRQ,0,0,&Irq,0,0,0))
	{
	    	fprintf(stderr, "Failed to IRQ\n");
			exit(1);
	}
	printf("The IRQ is %08lx\n", Irq);


////////////////////////////////get the hpi csr memory base physical and linear address;
////1.get the physical address
	if ( ! DeviceIoControl(hDevice,GETMEMBASE0,0,0,&Hpiaddress,0,0,0)
	   )
	{
	    	fprintf(stderr, "Failed to getmembase0\n");
			exit(1);
	}
	printf("The HPI CSR Memory Base Phycical Address %08lx", Hpiaddress);
////2.map the address
	req.mdr_PhysicalAddress = (PVOID)Hpiaddress;
	req.mdr_SizeInBytes = 0x1000;
	inBuf[0] = &req;
	if ( ! DeviceIoControl(hDevice, MDR_SERVICE_MAP,
               inBuf, sizeof(PVOID), NULL, 0,
               &cbBytesReturned, NULL)
	   )
	    	fprintf(stderr, "Failed to map device\n");
	else
	{
		printf(" linear is %08lx\n", req.mdr_LinearAddress);
		BoolMap0=TRUE;
	}
///////////////////////////////////read the items of hpi reg
	DWORD *Dhpicsr;
	DWORD dhpi,dlasthpi;
	WORD  *Whpicsr,*Whpicsreset;
	WORD  whpi,wlasthpi;

	Whpicsr=(WORD*)((BYTE*)req.mdr_LinearAddress+0x18);////////0x18   data width
	whpi=*Whpicsr;  
  	printf("        datawidth    is %04x",whpi);
	*Whpicsr=whpi&0xfff0;
	whpi=*Whpicsr;
	printf("     is %04x\n",whpi);


	Whpicsr=(WORD*)((BYTE*)req.mdr_LinearAddress+0x16);////////0x16     implement reg 
	wlasthpi=*Whpicsr;
  	printf("        implement    is %04x",wlasthpi);
	*Whpicsr=wlasthpi|0x000f;
	whpi=*Whpicsr;
	printf("     is %04x\n",whpi);

///////////////////////////////////get the device id and vendor
	for(int i=0x80000000;i<0x80ffff00+1;i=i+0x100)
	{
				_outpd(0x0cf8,i);
				Testid=_inpd(0x0cfc);
				if(Testid==0xac60104c)
				{	
					printf("The bus line ID and device ID is  %08lx\n", i);
					CONFIGUEREG=i;
///////////////////////////////command register
					_outpd(0x0cf8,CONFIGUEREG+0x04);
					command=_inpw(0x0cfc);
					printf("        commmand     is %04lx",command); 
					command=command|0x0003;
					_outpd(0x0cf8,CONFIGUEREG+0x04); 
					_outpw(0x0cfc,command);
					_outpd(0x0cf8,CONFIGUEREG+0x04); 
					command=_inpw(0x0cfc);
					printf("     is %04lx\n",command); 
				//	_outpd(0x0cf8,CONFIGUEREG);
				//	Testid=_inpd(0x0cfc);
				//	printf("Device ID and Vendor is %08lx\n",Testid); 
					break;
				}
	}


	Whpicsreset=(WORD*)((BYTE*)req.mdr_LinearAddress+0x14);////////0x14    reset reg
	wlasthpi=*Whpicsreset;
  	printf("        reset        is %04x",wlasthpi);
	*Whpicsreset=wlasthpi&0xfff0;
	whpi=*Whpicsreset;
	printf("     is %04x\n",whpi);


	Whpicsr=(WORD*)((BYTE*)req.mdr_LinearAddress+0x10);////////0x10    error reg
	wlasthpi=*Whpicsr;
  	printf("        error        is %04x",wlasthpi);
	*Whpicsr=wlasthpi&0xfff0;
	whpi=*Whpicsr;
	printf("     is %04x\n",whpi);

	Dhpicsr=(DWORD*)((BYTE*)req.mdr_LinearAddress+0x4);////////0x04   clear interrupt
	dlasthpi=*Dhpicsr;								   ////////0x00   set interrupt
  	printf("        interrupt    is %08x\n",dlasthpi);

//	Dhpicsr=(DWORD*)((BYTE*)req.mdr_LinearAddress+0x08);////////0x0c   clear mask
//	dlasthpi=*Dhpicsr;								   ////////0x08   set mask
// 	printf("        mask        is %08x\n",dlasthpi);
//	*Dhpicsr=dlasthpi&0xfff0;
//	dhpi=*Dhpicsr;
//	printf("    is %08x\n",dhpi);





/////////////////////////////////////get the control space base physical and linear address;
////1.get the physical address
	if ( ! DeviceIoControl(hDevice,GETMEMBASE1,0,0,&Conaddress,0,0,0))
	{
	    	fprintf(stderr, "Failed to getmembase0\n");
			exit(1);
	}
	printf("The Control Space Base Phycical Address %08lx\n", Conaddress);

	Addhpic=Conaddress&0xffff8000;
	Addhpia=Addhpic|0x00001000;
	Addhpid=Addhpic|0x00001800;
	Addhpidinc=Addhpic|0x0000800;

/////map the addhpic address
	req.mdr_PhysicalAddress = (PVOID)Addhpic;
	req.mdr_SizeInBytes = 0x10000;
	inBuf[0] = &req;
	if ( ! DeviceIoControl(hDevice, MDR_SERVICE_MAP,
               inBuf, sizeof(PVOID), NULL, 0,
               &cbBytesReturned, NULL)
	   )
	    	fprintf(stderr, "Failed to map device\n");
	else
	{
		printf("	The addhpic  is %08lx",Addhpic);
		printf(" is %08lx\n",req.mdr_LinearAddress);
		BoolMap1[0]=TRUE;
	}
	Addhpic1=(WORD*)req.mdr_LinearAddress;
//	Addhpia1=Addhpic1+2048;
//	Addhpid1=Addhpia1+1024;
//	Addhpidinc1=Addhpic1+1024;
/////map the addhpia  address
	req.mdr_PhysicalAddress = (PVOID)Addhpia;
	req.mdr_SizeInBytes = 0x1000;
	inBuf[0] = &req;
	if ( ! DeviceIoControl(hDevice, MDR_SERVICE_MAP,
               inBuf, sizeof(PVOID), NULL, 0,
               &cbBytesReturned, NULL)
	   )
	    	fprintf(stderr, "Failed to map device\n");
	else
	{
		printf("  The addhpia    is %08lx",Addhpia);
		printf("  is %08lx\n",   req.mdr_LinearAddress);
		BoolMap1[1]=TRUE;
	}
	Addhpia1=(WORD*)req.mdr_LinearAddress;
//////map the addhpid address
	req.mdr_PhysicalAddress = (PVOID)Addhpid;
	req.mdr_SizeInBytes = 0x1000;
	inBuf[0] = &req;
	if ( ! DeviceIoControl(hDevice, MDR_SERVICE_MAP,
               inBuf, sizeof(PVOID), NULL, 0,
               &cbBytesReturned, NULL)
	   )
	    	fprintf(stderr, "Failed to map device\n");
	else
	{
		printf("  The addhpid    is %08lx",Addhpid);
		printf("  is %08lx\n",req.mdr_LinearAddress);
		BoolMap1[2]=TRUE;
	}
	Addhpid1=(WORD*)req.mdr_LinearAddress;
//////map the addhpidinc address
	req.mdr_PhysicalAddress = (PVOID)Addhpidinc;
	req.mdr_SizeInBytes = 0x1000;
	inBuf[0] = &req;
	if ( ! DeviceIoControl(hDevice, MDR_SERVICE_MAP,
               inBuf, sizeof(PVOID), NULL, 0,
               &cbBytesReturned, NULL)
	   )
	    	fprintf(stderr, "Failed to map device\n");
	else
	{
		printf("  The addhpidinc is %08lx",Addhpidinc);
		printf("  is %08lx\n",    req.mdr_LinearAddress);
		BoolMap1[3]=TRUE;
	}
	Addhpidinc1=(WORD*)req.mdr_LinearAddress;

///////test the dsp and pci2040
	*Addhpic1=0x1010;
	*Addhpia1=0x0000;
	*Addhpic1=0x0000;
	*Addhpia1=0x007f;
	
	*Addhpidinc1=0x0;
	*Addhpidinc1=0x1;
	*Addhpidinc1=0x2;
	*Addhpidinc1=0x3;
	*Addhpidinc1=0x4;
	*Addhpidinc1=0x5;
	*Addhpidinc1=0x6;
	*Addhpidinc1=0x7;


	*Addhpic1=0x1010;
	*Addhpia1=0x0000;
	*Addhpic1=0x0101;
	*Addhpia1=0x007f;
	Addhpid2=*Addhpidinc1;
	printf("\nAddhpid2 is %x\n", Addhpid2);
	for(int data=0;data<0x8;data++)
	{
		Addhpid2=*Addhpidinc1;
		printf("%04x ", Addhpid2);
	}



//////////////////////////test the communication between vxd and win32

	if ( ! DeviceIoControl(hDevice,TEST,a,0,0,0,0,NULL))
	{
	    	fprintf(stderr, "Failed to communication\n");
			exit(1);
	}
		fprintf(stderr,"\n");
		for( i=0;i<2;i++)
			{
				for(int j=0;j<16;j++)
				{
					printf("%3d ",a[i*16+j]);
				}
				fprintf(stderr,"\n");
			}

//////////////////////////test the communication between dsp and vxd
	if ( ! DeviceIoControl(hDevice,GETIOBASE,0,0,&Ioport,0,0,0)
	   )
	{
	    	fprintf(stderr, "Failed to get ioport base\n");
			exit(1);
	}
	printf("The Ioport base is  %08lx\n",Ioport);

////////////////////////to unlock all the locked linear address
////////unmap the hpi csr address
	if(BoolMap0==TRUE)
	{
		req.mdr_PhysicalAddress=(PVOID)Hpiaddress;
		req.mdr_SizeInBytes=0x1000;
		inBuf[0] = &req;
		DeviceIoControl(hDevice,MDR_SERVICE_UNMAP,
			inBuf,	sizeof(PVOID),NULL,0,
			&cbBytesReturned,NULL);
		BoolMap0=FALSE;
	}

///////unmap the control regist address
///////ummap hpic
	if(BoolMap1[0]==TRUE)
	{
		req.mdr_PhysicalAddress=(PVOID)Addhpic;
		req.mdr_SizeInBytes=0x1000;
		inBuf[0] = &req;
		DeviceIoControl(hDevice,MDR_SERVICE_UNMAP,
			inBuf,	sizeof(PVOID),NULL,0,
			&cbBytesReturned,NULL);
		BoolMap1[0]=FALSE;
	}
///////ummap hpia
	if(BoolMap1[1]==TRUE)
	{
		req.mdr_PhysicalAddress=(PVOID)Addhpia;
		req.mdr_SizeInBytes=0x1000;
		inBuf[0] = &req;
		DeviceIoControl(hDevice,MDR_SERVICE_UNMAP,
			inBuf,	sizeof(PVOID),NULL,0,
			&cbBytesReturned,NULL);
		BoolMap1[1]=FALSE;
	}
///////ummap hpid
	if(BoolMap1[2]==TRUE)
	{
		req.mdr_PhysicalAddress=(PVOID)Addhpid;
		req.mdr_SizeInBytes=0x1000;
		inBuf[0] = &req;
		DeviceIoControl(hDevice,MDR_SERVICE_UNMAP,
			inBuf,	sizeof(PVOID),NULL,0,
			&cbBytesReturned,NULL);
		BoolMap1[2]=FALSE;
	}
///////ummap hpidinc
	if(BoolMap1[3]==TRUE)
	{
		req.mdr_PhysicalAddress=(PVOID)Addhpidinc;
		req.mdr_SizeInBytes=0x1000;
		inBuf[0] = &req;
		DeviceIoControl(hDevice,MDR_SERVICE_UNMAP,
			inBuf,	sizeof(PVOID),NULL,0,
			&cbBytesReturned,NULL);
		BoolMap1[3]=FALSE;
	}

	wlasthpi=*Whpicsreset;
  	printf("reset  is %04x",wlasthpi);
	*Whpicsreset=wlasthpi|0x000f;
	whpi=*Whpicsreset;
	printf("     is %04x\n",whpi);

//////////////////////To terminate the thread
	CloseHandle(hDevice);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲电影在线播放| 欧美国产日本韩| 91黄色激情网站| 国产麻豆成人精品| 精东粉嫩av免费一区二区三区| 视频一区视频二区中文| 午夜欧美2019年伦理| 爽爽淫人综合网网站| 日韩黄色小视频| 九九九精品视频| 国产自产v一区二区三区c| 国产曰批免费观看久久久| 韩国欧美国产1区| 成人aa视频在线观看| 91亚洲精品久久久蜜桃| 欧美亚洲高清一区| 日韩亚洲欧美综合| 欧美极品少妇xxxxⅹ高跟鞋| 欧美激情一区二区在线| 亚洲精品国产a久久久久久| 亚洲高清视频中文字幕| 麻豆国产欧美日韩综合精品二区| 精品无码三级在线观看视频 | 一区二区三区不卡在线观看| 国产精品久久久久aaaa| 亚洲18色成人| 韩日精品视频一区| 99re在线视频这里只有精品| 欧美色中文字幕| 精品国一区二区三区| 国产精品久久久久影院| 亚洲成人黄色影院| 国产丶欧美丶日本不卡视频| 91麻豆精品一区二区三区| 欧美精品亚洲二区| 日本一区二区三区视频视频| 亚洲视频综合在线| 欧美a一区二区| 成人国产一区二区三区精品| 欧美人动与zoxxxx乱| 国产欧美日韩在线观看| 偷拍日韩校园综合在线| 成年人网站91| 欧美精品一区二区高清在线观看| 中日韩免费视频中文字幕| 亚洲超碰精品一区二区| av不卡免费在线观看| 欧美成人性战久久| 午夜伊人狠狠久久| 99re6这里只有精品视频在线观看| 51精品秘密在线观看| 综合av第一页| 成人综合在线网站| 日韩视频一区二区三区| 亚洲午夜激情av| 91在线精品一区二区| 久久亚洲欧美国产精品乐播 | 国产麻豆精品theporn| 欧美卡1卡2卡| 亚洲欧美日韩系列| 国产成人av网站| 国产三级久久久| 国产呦精品一区二区三区网站| 欧美色视频一区| 亚洲国产一区二区视频| 97久久超碰国产精品电影| 国产日韩av一区二区| 国产在线视频一区二区| 欧美成人vr18sexvr| 日产国产欧美视频一区精品| 欧美三级视频在线观看| 亚洲综合色丁香婷婷六月图片| 91在线视频免费91| 亚洲色图在线视频| 97久久超碰国产精品电影| 国产精品乱码妇女bbbb| 成人福利电影精品一区二区在线观看| 精品sm在线观看| 国产在线不卡视频| 国产视频一区二区在线| 国产激情视频一区二区在线观看 | 美女mm1313爽爽久久久蜜臀| 666欧美在线视频| 欧美aaa在线| 欧美sm美女调教| 国产伦理精品不卡| 中文字幕精品一区二区精品绿巨人 | 另类小说色综合网站| 91麻豆精品国产自产在线观看一区 | 欧美韩国日本综合| 成人免费视频网站在线观看| 国产精品久久99| 欧美综合亚洲图片综合区| 亚洲成人在线免费| 日韩欧美一区电影| 国产福利91精品一区二区三区| 国产色产综合色产在线视频| 不卡大黄网站免费看| 亚洲午夜精品在线| 精品国产乱码久久| 不卡一卡二卡三乱码免费网站| 夜夜亚洲天天久久| 日韩一区二区三区观看| 丁香亚洲综合激情啪啪综合| 亚洲狠狠丁香婷婷综合久久久| 91.麻豆视频| 丁香桃色午夜亚洲一区二区三区 | 欧美日韩一区二区三区在线 | 国产日韩亚洲欧美综合| 91国偷自产一区二区开放时间 | 亚洲激情图片一区| 日韩午夜小视频| 99国产麻豆精品| 捆绑变态av一区二区三区| 国产精品不卡视频| 日韩欧美视频一区| 97se亚洲国产综合自在线| 日韩高清一级片| 亚洲日本中文字幕区| 精品精品国产高清a毛片牛牛| 91一区二区三区在线播放| 韩国视频一区二区| 亚洲va欧美va人人爽| 国产精品国产三级国产普通话三级| 欧美日韩国产在线观看| 国产iv一区二区三区| 亚洲成人免费影院| 亚洲欧洲精品一区二区三区 | 色欧美乱欧美15图片| 国产毛片精品国产一区二区三区| 亚洲国产综合在线| 亚洲欧美激情一区二区| 久久久久久久久久看片| 日韩欧美国产一二三区| 欧美在线看片a免费观看| eeuss鲁片一区二区三区在线观看| 青青草视频一区| 午夜久久久久久久久| 亚洲免费观看高清| 1000部国产精品成人观看| 精品国产精品网麻豆系列| 91精品国产综合久久婷婷香蕉| 99v久久综合狠狠综合久久| 东方欧美亚洲色图在线| 国产毛片一区二区| 国产精品系列在线观看| 国内成人自拍视频| 美女性感视频久久| 免费在线视频一区| 秋霞午夜鲁丝一区二区老狼| 日韩av一级片| 日韩精品视频网| 九九视频精品免费| 久久成人免费网| 国精产品一区一区三区mba桃花| 欧美aaaaaa午夜精品| 老司机一区二区| 国产又粗又猛又爽又黄91精品| 久久99国产精品久久| 久久99精品国产麻豆婷婷| 国产中文字幕精品| 成人理论电影网| 91一区二区在线| 欧美日韩免费一区二区三区视频| 欧美亚男人的天堂| 欧美日韩免费视频| 91麻豆精品国产无毒不卡在线观看| 91麻豆精品国产91久久久资源速度 | 日日夜夜精品视频天天综合网| 天堂va蜜桃一区二区三区| 丝袜亚洲另类欧美| 国产精品一线二线三线精华| 国产成人精品三级麻豆| aaa欧美日韩| 欧美一区二区三区公司| 精品国产网站在线观看| 亚洲国产高清在线观看视频| 亚洲欧美一区二区三区久本道91 | 欧美国产精品专区| 亚洲男帅同性gay1069| 亚洲国产人成综合网站| 免费av网站大全久久| 成人性生交大片免费看中文| 色av成人天堂桃色av| 欧美一区二区大片| 亚洲国产精品国自产拍av| 亚洲va韩国va欧美va精品| 国产精品1024| 欧美日韩高清一区二区不卡| 精品88久久久久88久久久| 中文字幕永久在线不卡| 无码av中文一区二区三区桃花岛| 国产精品亚洲人在线观看| 色婷婷av一区二区三区软件| 欧美一区二区在线观看| 亚洲视频狠狠干| 激情六月婷婷久久| 欧美性猛交xxxx乱大交退制版| 欧美哺乳videos| 亚洲成a人v欧美综合天堂|