Commit 0f094448 authored by Federico Vaga's avatar Federico Vaga

ut: operational tests need White-Rabbit

In order for the test to work, both TDC and FD must share the same time.
It is possible to achive this with the local clock on both cards, but this
is not precise, I think that at best we can have a resolution of some
milliseconds.

I prefer to do a serious test.
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 00266d08
......@@ -46,6 +46,20 @@ static int fmctdc_execute_fmc_fdelay_pulse(unsigned int devid,
return system(cmd);
}
/**
* It sets the fine-delay to work with White-Rabbit
*/
static int fmcdc_execute_fmc_fdelay_wr(unsigned int devid)
{
char cmd[CMD_LEN];
snprintf(cmd, CMD_LEN,
"fmc-fdelay-board-time -d 0x%x wr > /dev/null",
devid);
return system(cmd);
}
/**
* Print help message
* @param[in] name program name
......@@ -273,6 +287,19 @@ static void fmctdc_op_test_setup(struct m_test *m_test)
err = fmctdc_flush(tdc, i);
m_assert_int_eq(0, err);
}
err = fmcdc_execute_fmc_fdelay_wr(fmcfd_dev_id);
m_assert_int_eq(0, err);
ret = fmctdc_wr_mode(tdc, 0);
m_assert_int_eq(0, ret);
/* wait maximum ~10seconds for white-rabbit to sync */
for (i = 0; err && i < 10; ++i) {
err = fmctdc_check_wr_mode(tdc);
sleep(1);
}
m_assert_int_eq(0, err);
}
static void fmctdc_op_test_tear_down(struct m_test *m_test)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment