diff --git a/fpga/lib/card.c b/fpga/lib/card.c index 87d327466..f7606d0a0 100644 --- a/fpga/lib/card.c +++ b/fpga/lib/card.c @@ -167,7 +167,7 @@ int fpga_card_start(struct fpga_card *c) struct pci_device *pdev; - assert(c->state == STATE_CHECKED); + assert(c->state == STATE_INITIALIZED); /* Search for FPGA card */ pdev = pci_lookup_device(c->pci, &c->filter); @@ -258,6 +258,8 @@ void fpga_card_dump(struct fpga_card *c) int fpga_card_check(struct fpga_card *c) { + assert(c->state == STATE_PARSED); + /* Check FPGA configuration */ c->reset = fpga_vlnv_lookup(&c->ips, &(struct fpga_vlnv) { "xilinx.com", "ip", "axi_gpio", NULL }); if (!c->reset) diff --git a/fpga/tests/main.c b/fpga/tests/main.c index 5c9a62d9e..41549943f 100644 --- a/fpga/tests/main.c +++ b/fpga/tests/main.c @@ -76,9 +76,15 @@ static void init() ret = fpga_card_init(card, &pci, &vc); cr_assert_eq(ret, 0, "FPGA card initialization failed"); + ret = fpga_card_start(card); + cr_assert_eq(ret, 0, "FPGA card cannot be started"); + ret = fpga_card_parse(card, json_card, FPGA_CARD); cr_assert_eq(ret, 0, "Failed to parse FPGA config"); + ret = fpga_card_check(card); + cr_assert_eq(ret, 0, "FPGA card check failed"); + json_decref(json); if (criterion_options.logging_threshold < CRITERION_IMPORTANT)