Commit a5d97243 authored by Miguel Gómez Sexto's avatar Miguel Gómez Sexto

tdc: UTC time functions updated. Added test for them.

Signed-off-by: Miguel Gómez Sexto's avatarMiguel Gómez <magomez@igalia.com>
parent 07fe0a24
......@@ -196,13 +196,14 @@ int tdc_stop_acquisition(struct tdc_board *b)
int tdc_set_host_utc_time(struct tdc_board *b)
{
return tdc_sysfs_set(b, "set_utc_time", 1);
/* -1 means that the driver will load the host time */
return tdc_sysfs_set(b, "set_utc_time", -1);
}
int tdc_set_utc_time(struct tdc_board *b, uint32_t utc)
{
/* FIXME: we need a new ZIO attribute to put the user UTC */
return 0;
/* a value different from -1 is an UTC */
return tdc_sysfs_set(b, "set_utc_time", utc);
}
int tdc_get_utc_time(struct tdc_board *b, uint32_t *utc)
......
......@@ -21,47 +21,66 @@ int main(int argc, char **argv)
exit(1);
}
if (i != 1) {
fprintf(stderr, "%s: found %i boards",
fprintf(stderr, "%s: found %i boards\n",
argv[0], i);
}
b = tdc_open(0, -1);
/* set/get UTC time */
set = 123;
if (tdc_set_utc_time(b, set))
printf("Error setting UTC time\n");
if (tdc_get_dac_word(b, &get))
printf("Error getting UtC time\n");
if (set != get)
printf("UTC time set and get don't match (this may not be an error)\n");
else
printf("UTC time functions OK\n");
/* set/get DAC word */
set = 123;
if (tdc_set_dac_word(b, set))
printf("Error setting DAC word");
printf("Error setting DAC word\n");
if (tdc_get_dac_word(b, &get))
printf("Error getting DAC word");
printf("Error getting DAC word\n");
if (set != get)
printf("DAC word set and get don't match");
printf("DAC word set and get don't match\n");
else
printf("DAC word functions OK\n");
/* set/get time threshold */
set = 123;
if (tdc_set_time_threshold(b, set))
printf("Error setting time thresh");
printf("Error setting time thresh\n");
if (tdc_get_time_threshold(b, &get))
printf("Error getting time thresh");
printf("Error getting time thresh\n");
if (set != get)
printf("Time thresh set and get don't match");
printf("Time thresh set and get don't match\n");
else
printf("Time threshold functions OK\n");
/* set/get timestamps threshold */
set = 123;
if (tdc_set_timestamp_threshold(b, set))
printf("Error setting timestamps thresh");
printf("Error setting timestamps thresh\n");
if (tdc_get_timestamp_threshold(b, &get))
printf("Error getting timestamps thresh");
printf("Error getting timestamps thresh\n");
if (set != get)
printf("Timestamps thresh set and get don't match");
printf("Timestamps thresh set and get don't match\n");
else
printf("Timestamps threshold functions OK\n");
/* set/get active channels */
set = 12;
if (tdc_set_active_channels(b, set))
printf("Error setting active channels");
printf("Error setting active channels\n");
if (tdc_get_active_channels(b, &get))
printf("Error getting active channels");
printf("Error getting active channels\n");
if (set != get)
printf("Active channels set and get don't match");
printf("Active channels set and get don't match\n");
else
printf("Channel activation functions OK\n");
tdc_close(b);
......
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