Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
31
Issues
31
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
Software for White Rabbit PTP Core
Commits
122caf5f
Commit
122caf5f
authored
Jan 25, 2021
by
Adam Wujek
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell: add cmd_leapsec
Signed-off-by:
Adam Wujek
<
adam.wujek@creotech.pl
>
parent
fa5f9f09
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
0 deletions
+74
-0
Kconfig
Kconfig
+8
-0
wrpc.tex
doc/wrpc.tex
+6
-0
cmd_leapsec.c
shell/cmd_leapsec.c
+50
-0
shell.c
shell/shell.c
+9
-0
shell.mk
shell/shell.mk
+1
-0
No files found.
Kconfig
View file @
122caf5f
...
...
@@ -372,6 +372,14 @@ config CMD_PPS
This enables pps command, which can be used to force PPS output
all the time for all clock classes.
config CMD_LEAPSEC
depends on WR_NODE
boolean "Include command to control leapsecond value"
default n
help
This enables leapsec command, which can be used to adjust leap seconds
value.
#
# This is a set of configuration options that should not be changed by
# normal users. If the "developer" menu is used, the binary is tainted.
...
...
doc/wrpc.tex
View file @
122caf5f
...
...
@@ -1801,6 +1801,12 @@ tools used to build and run it, you can write to our mailing list
\code
{
ip set <ip>
}
&
reports or sets the IPv4 address of the WRPC (only
available if
\texttt
{
CONFIG
\_
IP
}
is set at build time
\\
\code
{
leapsec
}
&
\\
\code
{
leapsec get
}
&
get number of leap seconds from PTP and from the system
\\
\code
{
leapsec set <num>
}
&
get number of leap seconds for PTP. This settings
make sense only for GM mode
\\
\code
{
ltest
}
&
\\
\code
{
ltest fake <nsecs>
}
&
fakes delay to trigger latency failures (for
testing).
\\
...
...
shell/cmd_leapsec.c
0 → 100644
View file @
122caf5f
/*
* This work is part of the White Rabbit project
*
* Copyright (C) 2021 CERN (www.cern.ch)
* Author: Adam Wujek
*
* Released according to the GNU GPL, version 2 or any later version.
*/
/* Command: leapsec
Arguments:
set SEC - sets leap seconds value
<none> - dumps leap seconds value
Description: set/read leap seconds value used by PTP */
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <wrc.h>
#include <wrpc.h>
#include "shell.h"
#include "util.h"
#include "wrc_ptp.h"
/* Setting leap second makes sense only for GM. For other modes leap seconds
* counter is received from a master (slave) or is hardcoded in PPSI (master).
* In master it is hardcoded to PP_DEFAULT_UTC_OFFSET, since master mode does
* not have timescale set. */
static
int
cmd_leapsec
(
const
char
*
args
[])
{
int
ptp_offset
,
system_offset
;
if
(
args
[
1
]
&&
!
strcasecmp
(
args
[
0
],
"set"
))
{
wrc_ptp_set_leapsec
(
atoi
(
args
[
1
]));
}
else
if
(
args
[
0
]
&&
strcasecmp
(
args
[
0
],
"get"
))
{
/* other param given, but not "get" */
return
-
EINVAL
;
}
wrc_ptp_get_leapsec
(
&
ptp_offset
,
&
system_offset
);
pp_printf
(
"leap seconds: ptp %d, system %d
\n
"
,
ptp_offset
,
system_offset
);
return
0
;
}
DEFINE_WRC_COMMAND
(
leapsec
)
=
{
.
name
=
"leapsec"
,
.
exec
=
cmd_leapsec
,
};
shell/shell.c
View file @
122caf5f
...
...
@@ -47,6 +47,13 @@
#define HAS_CMD_PPS 0
#endif
#ifdef CONFIG_CMD_LEAPSEC
#define HAS_CMD_LEAPSEC 1
#else
#define HAS_CMD_LEAPSEC 0
#endif
static
char
cmd_buf
[
SH_MAX_LINE_LEN
+
1
];
static
int
cmd_pos
=
0
,
cmd_len
=
0
;
static
int
state
=
SH_PROMPT
;
...
...
@@ -380,4 +387,6 @@ void shell_register_commands(void)
REGISTER_WRC_COMMAND
(
vlan
);
if
(
HAS_CMD_PPS
)
REGISTER_WRC_COMMAND
(
pps
);
if
(
HAS_CMD_LEAPSEC
)
REGISTER_WRC_COMMAND
(
leapsec
);
}
shell/shell.mk
View file @
122caf5f
...
...
@@ -26,5 +26,6 @@ obj-$(CONFIG_CMD_CONFIG) += shell/cmd_config.o
obj-$(CONFIG_CMD_SLEEP) += shell/cmd_sleep.o
obj-$(CONFIG_CMD_LL) += shell/cmd_ll.o
obj-$(CONFIG_CMD_PPS) += shell/cmd_pps.o
obj-$(CONFIG_CMD_LEAPSEC) += shell/cmd_leapsec.o
obj-$(CONFIG_FLASH_INIT) += shell/cmd_init.o
obj-$(CONFIG_VLAN) += shell/cmd_vlan.o
Adam Wujek
💬
@awujek
mentioned in issue
#7
·
Sep 30, 2021
mentioned in issue
#7
mentioned in issue #7
Toggle commit list
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