Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC TDC 1ns 5cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC TDC 1ns 5cha - Software
Commits
a5d97243
Commit
a5d97243
authored
Sep 07, 2012
by
Miguel Gómez Sexto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tdc: UTC time functions updated. Added test for them.
Signed-off-by:
Miguel Gómez
<
magomez@igalia.com
>
parent
07fe0a24
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
16 deletions
+36
-16
libtdc.c
lib/libtdc.c
+4
-3
test.c
lib/test.c
+32
-13
No files found.
lib/libtdc.c
View file @
a5d97243
...
...
@@ -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
)
...
...
lib/test.c
View file @
a5d97243
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment