打開,關閉設備

首先添加引用:

using Jungo.wdapi_dotnet;
using Jungo.yourapp_lib;

獲取PCI設備列表:

private YourApp_DeviceList pciDevList;//Declare PCI Device List
pciDevList = YourApp_DeviceList.TheDeviceList();//New
UInt32 dwStatus = pciDevList.Init();//Initilize Devices
if (dwStatus != (UInt32)WD_ERROR_CODES.WD_STATUS_SUCCESS)
    return;
將列表添加到ComBox中:

foreach (YourApp_Device dev in pciDevList)
    comboBox1.Items.Add(dev.ToString(true));
comboBox1.SelectedIndex = 0;

獲取指定設備:

YourApp_Device device;
YourApp_Device dev = pciDevList.Get(comboBox1.SelectedIndex);


打開設備:

UInt32 dwStatus = device.Open();
if (dwStatus != (UInt32)WD_ERROR_CODES.WD_STATUS_SUCCESS)
{
    return false;
}

關閉設備:

bool bStatus = false;
if (device.Handle != IntPtr.Zero && !(bStatus = device.Close()))
{
    return false;
}
else
    device.Handle = IntPtr.Zero;
return bStatus;

獲取PCI BAR,並添加到ComBox中:
string[] sBars = device.AddrDescToString(false);
 for (int i = 0; i < sBars.Length; ++i)
 {
     cmboBar.Items.Add(sBars[i]);
 }
 cmboBar.SelectedIndex = 0;

發佈了58 篇原創文章 · 獲贊 6 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章