打开,关闭设备

首先添加引用:

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;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值