Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
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
White Rabbit Switch - Software
Commits
6c9c3cd6
Commit
6c9c3cd6
authored
Sep 17, 2018
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/tools: add read parameter to wrs_pps_control pps
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
aca42742
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
6 deletions
+27
-6
pps_gen.h
userspace/libwr/include/libwr/pps_gen.h
+6
-0
pps_gen.c
userspace/libwr/pps_gen.c
+9
-0
wrs_pps_control.c
userspace/tools/wrs_pps_control.c
+12
-6
No files found.
userspace/libwr/include/libwr/pps_gen.h
View file @
6c9c3cd6
...
...
@@ -9,6 +9,9 @@
#define PPSG_ADJUST_SEC 0x1
#define PPSG_ADJUST_NSEC 0x2
#define PPSG_PPS_OUT_ENABLE 0x1
#define PPSG_PPS_OUT_DISABLE 0x0
#define PPSG_PPS_IN_TERM_50OHM_ENABLE 0x1
#define PPSG_PPS_IN_TERM_50OHM_DISABLE 0x0
...
...
@@ -24,6 +27,9 @@ int shw_pps_gen_busy(void);
/* Enables/disables PPS Generator PPS output */
int
shw_pps_gen_enable_output
(
int
enable
);
/* Reads PPS Generator PPS output */
int
shw_pps_gen_enable_output_read
(
void
);
/* Reads the current time and stores at <seconds,nanoseconds>. */
void
shw_pps_gen_read_time
(
uint64_t
*
seconds
,
uint32_t
*
nanoseconds
);
...
...
userspace/libwr/pps_gen.c
View file @
6c9c3cd6
...
...
@@ -86,6 +86,15 @@ int shw_pps_gen_enable_output(int enable)
return
0
;
}
/* Enables/disables PPS output */
int
shw_pps_gen_enable_output_read
(
void
)
{
uint32_t
escr
=
ppsg_read
(
ESCR
);
return
escr
&
PPSG_ESCR_PPS_VALID
?
PPSG_PPS_OUT_ENABLE
:
PPSG_PPS_OUT_DISABLE
;
}
void
shw_pps_gen_read_time
(
uint64_t
*
seconds
,
uint32_t
*
nanoseconds
)
{
uint32_t
ns_cnt
;
...
...
userspace/tools/wrs_pps_control.c
View file @
6c9c3cd6
...
...
@@ -6,9 +6,6 @@
#include <libwr/switch_hw.h>
#include <libwr/pps_gen.h>
#define PPS_ON 1
#define PPS_OFF 0
void
help
(
char
*
prgname
)
{
fprintf
(
stderr
,
"%s: Use:
\"
%s [<options>] <cmd>
\n
"
,
...
...
@@ -18,7 +15,7 @@ void help(char *prgname)
" -h print help
\n
"
"
\n
"
" Commands are:
\n
"
" pps <on|off
>
- switch PPS output on/off.
\n
"
" pps <on|off
|read>
- switch PPS output on/off.
\n
"
" 50ohm-term-in <on|off|read> - on/off/read 50ohm termination for 1-PPS input
\n
"
);
exit
(
1
);
}
...
...
@@ -43,11 +40,20 @@ int main(int argc, char *argv[])
}
if
(
!
strcmp
(
argv
[
2
],
"on"
))
{
assert_init
(
shw_fpga_mmap_init
());
shw_pps_gen_enable_output
(
PPS
_ON
);
shw_pps_gen_enable_output
(
PPS
G_PPS_OUT_ENABLE
);
exit
(
0
);
}
else
if
(
!
strcmp
(
argv
[
2
],
"off"
))
{
assert_init
(
shw_fpga_mmap_init
());
shw_pps_gen_enable_output
(
PPS_OFF
);
shw_pps_gen_enable_output
(
PPSG_PPS_OUT_DISABLE
);
exit
(
0
);
}
else
if
(
!
strcmp
(
argv
[
2
],
"read"
))
{
assert_init
(
shw_fpga_mmap_init
());
if
(
shw_pps_gen_enable_output_read
()
==
PPSG_PPS_OUT_ENABLE
)
{
printf
(
"PPS output on
\n
;"
);
}
else
{
printf
(
"PPS output off
\n
;"
);
}
exit
(
0
);
}
else
{
printf
(
"Unknown parameter
\n
;"
);
...
...
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