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
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
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
6004deb1
Commit
6004deb1
authored
Jan 25, 2021
by
Adam Wujek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell: add cmd_leapsec
Signed-off-by:
Adam Wujek
<
adam.wujek@creotech.pl
>
parent
11894f67
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
0 deletions
+64
-0
Kconfig
Kconfig
+8
-0
cmd_leapsec.c
shell/cmd_leapsec.c
+46
-0
shell.c
shell/shell.c
+9
-0
shell.mk
shell/shell.mk
+1
-0
No files found.
Kconfig
View file @
6004deb1
...
...
@@ -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.
...
...
shell/cmd_leapsec.c
0 → 100644
View file @
6004deb1
/*
* 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"
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 @
6004deb1
...
...
@@ -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 @
6004deb1
...
...
@@ -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
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