1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-30 08:32:52 +08:00

Check if FPGA needs reset in utilities

This commit is contained in:
Alex Forencich 2019-12-04 13:37:18 -08:00
parent ef365b9bab
commit 90e2f8f5d0

View File

@ -72,6 +72,13 @@ struct mqnic *mqnic_open(const char *dev_name)
goto fail_mmap_regs;
}
if (mqnic_reg_read32(dev->regs, MQNIC_REG_FW_ID) == 0xffffffff)
{
fprintf(stderr, "Error: device needs to be reset\n");
munmap((void *)dev->regs, dev->regs_size);
goto fail_mmap_regs;
}
dev->fw_id = mqnic_reg_read32(dev->regs, MQNIC_REG_FW_ID);
dev->fw_ver = mqnic_reg_read32(dev->regs, MQNIC_REG_FW_VER);
dev->board_id = mqnic_reg_read32(dev->regs, MQNIC_REG_BOARD_ID);