Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha - 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 DEL 1ns 4cha - Software
Commits
a42d06be
Commit
a42d06be
authored
Mar 21, 2014
by
Tomasz Wlostowski
Committed by
Alessandro Rubini
Mar 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: less information in human-readable status, some fixes [WIP]
parent
303b79c6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
30 deletions
+92
-30
fmc-fdelay-pulse.c
tools/fmc-fdelay-pulse.c
+4
-4
fmc-fdelay-status.c
tools/fmc-fdelay-status.c
+5
-4
tools-common.h
tools/tools-common.h
+1
-1
tools-util.c
tools/tools-util.c
+82
-21
No files found.
tools/fmc-fdelay-pulse.c
View file @
a42d06be
...
...
@@ -146,7 +146,7 @@ void parse_default(struct fdelay_pulse *p)
memset
(
p
,
0
,
sizeof
(
*
p
));
memset
(
&
t_width
,
0
,
sizeof
(
&
t_width
));
p
->
mode
=
FD_OUT_MODE_PULSE
;
p
->
rep
=
-
1
;
/*
infinit
e */
p
->
rep
=
-
1
;
/*
1 puls
e */
/* Default settings are for 10Hz, 1us width */
p
->
loop
.
coarse
=
COARSE_PER_SEC
/
10
;
...
...
@@ -347,14 +347,14 @@ int main(int argc, char **argv)
p
.
end
=
ts_add
(
p
.
start
,
t_width
);
/* In delay mode, default is one pulse only; recover if wrong */
if
(
p
.
mode
==
FD_OUT_MODE_
PULSE
&&
p
.
rep
<=
0
)
if
(
p
.
mode
==
FD_OUT_MODE_
DELAY
&&
p
.
rep
<=
0
)
p
.
rep
=
1
;
/* Done. Report verbosely and activate the information we parsed */
channel
=
FDELAY_OUTPUT_USER_TO_HW
(
channel
);
if
(
verbose
)
{
tools_report_action
(
channel
,
&
p
,
TOOLS_UMODE_USER
);
tools_report_action
(
channel
,
&
p
,
TOOLS_UMODE_RAW
);
report_output_config
(
channel
,
&
p
,
TOOLS_UMODE_USER
);
//
tools_report_action(channel, &p, TOOLS_UMODE_RAW);
}
if
(
fdelay_config_pulse
(
b
,
channel
,
&
p
)
<
0
)
{
fprintf
(
stderr
,
"%s: fdelay_config_pulse(): %s
\n
"
,
...
...
tools/fmc-fdelay-status.c
View file @
a42d06be
...
...
@@ -12,7 +12,8 @@ void help(char *name)
{
fprintf
(
stderr
,
"fmc-fdelay-status: reports channel programming
\n
"
);
fprintf
(
stderr
,
"Use:
\"
%s [-i <index>] [-d <dev>]
\"\n
"
,
name
);
fprintf
(
stderr
,
"Use:
\"
%s [-i <index>] [-d <dev>] [-r]
\"\n
"
,
name
);
fprintf
(
stderr
,
"-r: display raw device configuration"
);
exit
(
1
);
}
...
...
@@ -68,10 +69,10 @@ int main(int argc, char **argv)
argv
[
0
],
ch
,
strerror
(
errno
));
}
/* pass hw number again, as the function is low-level */
tools_report_action
(
FDELAY_OUTPUT_USER_TO_HW
(
ch
),
report_output_config
(
FDELAY_OUTPUT_USER_TO_HW
(
ch
),
&
p
,
TOOLS_UMODE_USER
);
tools_report_action
(
FDELAY_OUTPUT_USER_TO_HW
(
ch
),
&
p
,
TOOLS_UMODE_RAW
);
//
tools_report_action(FDELAY_OUTPUT_USER_TO_HW(ch),
//
&p, TOOLS_UMODE_RAW);
}
fdelay_close
(
b
);
fdelay_exit
();
...
...
tools/tools-common.h
View file @
a42d06be
...
...
@@ -11,6 +11,6 @@ extern int tools_need_help(int argc, char **argv);
#define TOOLS_UMODE_FLOAT 2
extern
void
tools_report_time
(
char
*
name
,
struct
fdelay_time
*
t
,
int
umode
);
extern
void
tools_report_action
(
int
channel
,
struct
fdelay_pulse
*
p
,
int
umode
);
extern
void
report_output_config
(
int
channel
,
struct
fdelay_pulse
*
p
,
int
umode
);
extern
void
help
(
char
*
name
);
/* This is mandatory in all tools */
tools/tools-util.c
View file @
a42d06be
...
...
@@ -54,10 +54,10 @@ void tools_report_time(char *name, struct fdelay_time *t, int umode)
t
->
coarse
*
8000ULL
+
t
->
frac
*
8000ULL
/
4096ULL
;
printf
(
"
%s
"
,
name
);
printf
(
"
%s
"
,
name
);
switch
(
umode
)
{
case
TOOLS_UMODE_USER
:
printf
(
"
time
%10llu:%03llu,%03llu,%03llu,%03llu ps
\n
"
,
printf
(
"%10llu:%03llu,%03llu,%03llu,%03llu ps
\n
"
,
(
long
long
)(
t
->
utc
),
(
picoseconds
/
(
1000LL
*
1000
*
1000
)),
(
picoseconds
/
(
1000LL
*
1000
)
%
1000
),
...
...
@@ -65,34 +65,95 @@ void tools_report_time(char *name, struct fdelay_time *t, int umode)
(
picoseconds
%
1000LL
));
break
;
case
TOOLS_UMODE_FLOAT
:
printf
(
"
time
%10llu.%012llu
\n
"
,
(
long
long
)(
t
->
utc
),
printf
(
"
float
%10llu.%012llu
\n
"
,
(
long
long
)(
t
->
utc
),
picoseconds
);
break
;
case
TOOLS_UMODE_RAW
:
printf
(
"
raw utc %10lli, coarse %9li, frac %9li
\n
"
,
printf
(
"raw utc %10lli, coarse %9li, frac %9li
\n
"
,
(
long
long
)
t
->
utc
,
(
long
)
t
->
coarse
,
(
long
)
t
->
frac
);
break
;
}
}
void
tools_report_action
(
int
channel
,
struct
fdelay_pulse
*
p
,
int
umode
)
static
struct
fdelay_time
fd_ts_sub
(
struct
fdelay_time
a
,
struct
fdelay_time
b
)
{
char
*
mode
;
char
s
[
80
];
if
(
p
->
mode
==
FD_OUT_MODE_DISABLED
)
mode
=
"disable"
;
else
if
(
p
->
mode
==
FD_OUT_MODE_PULSE
)
mode
=
"pulse"
;
else
if
(
p
->
mode
==
FD_OUT_MODE_DELAY
)
mode
=
"delay"
;
else
if
(
p
->
mode
==
0x80
)
mode
=
"already-triggered"
;
else
{
sprintf
(
s
,
"%i (0x%04x)"
,
p
->
mode
,
p
->
mode
);
mode
=
s
;
struct
fdelay_time
rv
;
int
f
,
c
=
0
;
int64_t
u
=
0
;
f
=
a
.
frac
-
b
.
frac
;
if
(
f
<
0
)
{
f
+=
4096
;
c
--
;
}
c
+=
a
.
coarse
-
b
.
coarse
;
if
(
c
<
0
)
{
c
+=
125
*
1000
*
1000
;
u
--
;
}
printf
(
"Channel %i, mode %s, repeat %i %s
\n
"
,
FDELAY_OUTPUT_HW_TO_USER
(
channel
),
mode
,
p
->
rep
,
p
->
rep
==
-
1
?
"(infinite)"
:
""
);
tools_report_time
(
"start"
,
&
p
->
start
,
umode
);
tools_report_time
(
"end "
,
&
p
->
end
,
umode
);
tools_report_time
(
"loop "
,
&
p
->
loop
,
umode
);
u
+=
a
.
utc
-
b
.
utc
;
rv
.
utc
=
u
;
rv
.
coarse
=
c
;
rv
.
frac
=
f
;
return
rv
;
}
static
void
report_output_config_human
(
int
channel
,
struct
fdelay_pulse
*
p
)
{
struct
fdelay_time
width
;
printf
(
"Channel %i: "
,
FDELAY_OUTPUT_HW_TO_USER
(
channel
));
int
m
=
p
->
mode
&
0x7f
;
switch
(
m
)
{
case
FD_OUT_MODE_DISABLED
:
printf
(
"disabled
\n
"
);
return
;
case
FD_OUT_MODE_PULSE
:
printf
(
"pulse generator mode"
);
break
;
case
FD_OUT_MODE_DELAY
:
printf
(
"delay mode"
);
break
;
default:
printf
(
"unknown mode
\n
"
);
return
;
}
if
(
p
->
mode
&
0x80
)
printf
(
"(triggered) "
);
tools_report_time
(
m
==
FD_OUT_MODE_DELAY
?
"
\n
delay: "
:
"
\n
start at: "
,
&
p
->
start
,
TOOLS_UMODE_USER
);
width
=
fd_ts_sub
(
p
->
end
,
p
->
start
);
tools_report_time
(
" pulse width: "
,
&
width
,
TOOLS_UMODE_USER
);
if
(
p
->
rep
!=
1
)
{
printf
(
" repeat: "
);
if
(
p
->
rep
==
-
1
)
printf
(
"infinite
\n
"
);
else
printf
(
"%d times
\n
"
,
p
->
rep
);
tools_report_time
(
" period: "
,
&
p
->
loop
,
TOOLS_UMODE_USER
);
}
}
void
report_output_config
(
int
channel
,
struct
fdelay_pulse
*
p
,
int
umode
)
{
switch
(
umode
)
{
case
TOOLS_UMODE_USER
:
report_output_config_human
(
channel
,
p
);
default:
break
;
}
}
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