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
9d860129
Commit
9d860129
authored
Jul 23, 2013
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/fdelay_board_time: added wr/local time setting option
parent
30458b54
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
3 deletions
+40
-3
fdelay-board-time.c
lib/fdelay-board-time.c
+40
-3
No files found.
lib/fdelay-board-time.c
View file @
9d860129
...
...
@@ -3,13 +3,14 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include "fdelay-lib.h"
int
main
(
int
argc
,
char
**
argv
)
{
struct
fdelay_board
*
b
;
int
i
,
get
=
0
,
host
=
0
;
int
i
,
get
=
0
,
host
=
0
,
wr_on
=
0
,
wr_off
=
0
;
struct
fdelay_time
t
;
int
dev
=
0
;
...
...
@@ -21,17 +22,21 @@ int main(int argc, char **argv)
}
if
(
argc
!=
2
)
{
fprintf
(
stderr
,
"%s: Use
\"
%s [-i <devindex>
\"
get
\"
|
\"
host
\"
|"
fprintf
(
stderr
,
"%s: Use
\"
%s [-i <devindex>
\"
get
\"
|
\"
host
\"
|
\"
local
\"
|
\"
wr
\"
|"
"<float-value>
\"\n
"
,
argv
[
0
],
argv
[
0
]);
exit
(
1
);
}
/* Crappy parser */
if
(
!
strcmp
(
argv
[
1
],
"get"
))
get
=
1
;
else
if
(
!
strcmp
(
argv
[
1
],
"host"
))
host
=
1
;
else
if
(
!
strcmp
(
argv
[
1
],
"wr"
))
wr_on
=
1
;
else
if
(
!
strcmp
(
argv
[
1
],
"local"
))
wr_off
=
1
;
else
{
double
nano
;
long
long
sec
;
...
...
@@ -93,6 +98,38 @@ int main(int argc, char **argv)
return
0
;
}
if
(
wr_on
)
{
printf
(
"Locking the card to WR: "
);
if
(
fdelay_wr_mode
(
b
,
1
)
<
0
)
{
fprintf
(
stderr
,
"%s: fdelay_wr_mode(): %s
\n
"
,
argv
[
0
],
strerror
(
errno
));
exit
(
1
);
}
while
(
fdelay_check_wr_mode
(
b
)
!=
0
)
{
printf
(
"."
);
sleep
(
1
);
}
printf
(
" locked!
\n
"
);
fdelay_close
(
b
);
fdelay_exit
();
return
0
;
}
if
(
wr_off
)
{
if
(
fdelay_wr_mode
(
b
,
0
)
<
0
)
{
fprintf
(
stderr
,
"%s: fdelay_wr_mode(): %s
\n
"
,
argv
[
0
],
strerror
(
errno
));
exit
(
1
);
}
fdelay_close
(
b
);
fdelay_exit
();
return
0
;
}
if
(
fdelay_set_time
(
b
,
&
t
)
<
0
)
{
fprintf
(
stderr
,
"%s: fdelay_set_host_time(): %s
\n
"
,
argv
[
0
],
strerror
(
errno
));
...
...
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