下载
中文
注册

dcmi_get_device_phyid_from_logicid接口原型

函数原型

int dcmi_get_device_phyid_from_logicid(unsigned int logicid, unsigned int *phyid)

功能说明

根据设备逻辑ID获取物理ID。

参数说明

参数名称

输入/输出

类型

描述

logicid

输入

unsigned int

NPU设备逻辑ID,当前实际支持的ID通过dcmi_get_device_logic_id接口获取。

phyid

输出

unsigned int

NPU设备物理ID。

返回值

类型

描述

int

处理结果:

  • 成功:返回0。
  • 失败:返回码请参见返回码

异常处理

无。

约束说明

表1 部署场景

Linux物理机

Linux物理机容器

root用户

运行用户组(非root用户)

root用户

Y

Y

Y

调用示例

…  
int ret;
int card_id = 0;
int chip_id = 0;
int logic_id = 0;
unsigned int phy_id = 0;
ret = dcmi_get_device_logic_id(&logic_id, card_id, chip_id);
if (ret != DCMI_OK) {
    printf("dcmi_get_device_logic_idfailed. err is %d\n", ret);
    return ret;
}
ret = dcmi_get_device_phyid_from_logicid((unsigned int)logic_id, &phy_id);
if (ret != DCMI_OK) {
    printf("dcmi_get_device_phyid_from_logicidfailed. err is %d\n", ret);
}
return ret; 
…