阅读:4015回复:8
pci show
display 256 registers of pci device
input bus number,device number,function number see the following program develop environment visual c++ 6 |
|
|
沙发#
发布于:2002-03-21 18:32
Now I Open the source code
if you have anything,contact with me email fchwfchw@sina.com void CPCIDlg::OnButton1() { CListCtrl *pListCtrl=(CListCtrl *)GetDlgItem(IDC_LIST1); CString str; int temp; UpdateData(true);//get bus,dev,fun for(int i=0;i<16;i++) { for(int j=1;j<=16;j++) { temp=GetResult(m_bus,m_dev,m_fun,i*16+j-1); if(temp<16) str.Format(\"0%X\",temp); else str.Format(\"%X\",temp); pListCtrl->SetItemText(i,j,str); } } } int CPCIDlg::GetResult(int bus, int dev, int fun, int reg) { int i,j,temp; i=reg/4; j=reg-i*4; j=j*8; _asm{ pushad mov eax,80h sal eax,8 or eax,bus sal eax,5 or eax,dev sal eax,3 or eax,fun sal eax,6 or eax,i sal eax,2 mov dx,0cf8h out dx,eax mov dx,0cfch in eax,dx mov ecx,j and ecx,000000ffh sar eax,cl and eax,000000ffh mov temp,eax popad } return temp; } |
|
|
板凳#
发布于:2002-03-21 18:34
additional add the following code on function BOOL CPCIDlg::OnInitDialog()
CString str; CListCtrl *pListCtrl=(CListCtrl *)GetDlgItem(IDC_LIST1); pListCtrl->InsertColumn(0,\" \",LVCFMT_LEFT,30,0); for(int i=1;i<17;i++) { str.Format(\"%X\",i-1); pListCtrl->InsertColumn(i,str,LVCFMT_LEFT,30,i); pListCtrl->InsertItem(i-1,str); } |
|
|