Commit a298a3e9 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

software/lib: cleaned up fdelay_test.c program

parent e1ed6c8d
...@@ -3,54 +3,26 @@ ...@@ -3,54 +3,26 @@
#include "fdelay_lib.h" #include "fdelay_lib.h"
#include "rr_io.h" #include "rr_io.h"
int spec_fdelay_init(int argc, char *argv[], fdelay_device_t *dev); extern int spec_fdelay_init(int argc, char *argv[], fdelay_device_t *dev);
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
fdelay_device_t dev; fdelay_device_t dev;
fdelay_time_t t_cur, t_start;
/* Initialize the fine delay generator */
if(spec_fdelay_init(argc, argv, &dev) < 0) if(spec_fdelay_init(argc, argv, &dev) < 0)
{ {
fdelay_show_test_results(); fdelay_show_test_results();
return -1; return -1;
} }
fdelay_configure_trigger(&dev, 1,1); /* Enable trigger input and 50 ohm termination */
fdelay_configure_trigger(&dev, 1,1);
fdelay_configure_output(&dev,1,1,500000, 100000, 100000, 0);
fdelay_configure_output(&dev,2,1,500000, 100000, 100000, 0);
fdelay_configure_output(&dev,3,1,500000, 100000, 100000, 0);
fdelay_configure_output(&dev,4,1,500000, 100000, 100000, 0);
fdelay_configure_readout(&dev, 1);
// fd_update_spll(&dev);
int64_t prev = 0, dp, pmin=10000000000LL,pmax=0;
#if 0 /* Enable all outputs and set them to 500 ns delay, 100 ns pulse width, single output pulse per trigger */
for(;;) fdelay_configure_output(&dev,1,1,500000, 100000, 100000, 1);
{ fdelay_configure_output(&dev,2,1,500000, 100000, 100000, 1);
fdelay_time_t ts; fdelay_configure_output(&dev,3,1,500000, 100000, 100000, 1);
if(fdelay_read(&dev, &ts, 1) == 1) fdelay_configure_output(&dev,4,1,500000, 100000, 100000, 1);
{
int64_t ts_p = fdelay_to_picos(ts), d;
d=ts_p - prev;
if(prev > 0)
{
if(d<pmin) pmin=d;
if(d>pmax) pmax=d;
fprintf(stderr,"Got it %lld:%d:%d delta %lld span %lld\n", ts.utc, ts.coarse, ts.frac, d, pmax-pmin);
}
prev = ts_p;
}
}
#endif
for(;;)
{
fdelay_update_calibration(&dev);
sleep(1);
}
} }
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