Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
PPSi
Commits
ceb37cbc
Commit
ceb37cbc
authored
Mar 13, 2024
by
Adam Wujek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEATURE:
#53
] allow overwrite of the used PTP version
Signed-off-by:
Adam Wujek
<
dev_public@wujek.eu
>
parent
3cf6cbbe
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
135 additions
and
6 deletions
+135
-6
wrc_ptp_ppsi.c
arch-wrpc/wrc_ptp_ppsi.c
+6
-0
wrs-startup.c
arch-wrs/wrs-startup.c
+43
-0
ppsi-manual.in
doc/ppsi-manual.in
+13
-0
wrh.h
include/hw-specific/wrh.h
+1
-1
conf.h
include/ppsi/conf.h
+11
-1
constants.h
include/ppsi/constants.h
+8
-1
pp-instance.h
include/ppsi/pp-instance.h
+2
-0
conf.c
lib/conf.c
+44
-1
state-initializing.c
proto-standard/state-initializing.c
+2
-2
dump_mem_ppsi_wrpc.c
tools/dump_mem_ppsi_wrpc.c
+3
-0
wrs_dump_shmem_ppsi.c
tools/wrs_dump_shmem_ppsi.c
+2
-0
No files found.
arch-wrpc/wrc_ptp_ppsi.c
View file @
ceb37cbc
...
...
@@ -132,6 +132,8 @@ int wrc_ptp_init(void)
/* copy default ppi config */
memcpy
(
&
ppi
->
cfg
,
&
__pp_default_instance_cfg
,
sizeof
(
__pp_default_instance_cfg
));
ppi
->
ext_hooks
=&
pp_hooks
;
/* default value */
ppi
->
cfg
.
versionNumber
=
PP_VERSION_PTP
;
ppi
->
cfg
.
minorVersionNumber
=
PP_MINOR_VERSION_PTP
;
#if CONFIG_HAS_EXT_L1SYNC
ppi
->
protocol_extension
=
PPSI_EXT_L1S
;
ppi
->
ext_hooks
=
&
l1e_ext_hooks
;
...
...
@@ -142,6 +144,8 @@ int wrc_ptp_init(void)
L1E_DSPOR_BS
(
ppi
)
->
rxCoherentIsRequired
=
TRUE
;
L1E_DSPOR_BS
(
ppi
)
->
txCoherentIsRequired
=
TRUE
;
L1E_DSPOR_BS
(
ppi
)
->
congruentIsRequired
=
TRUE
;
ppi
->
cfg
.
versionNumber
=
PP_VERSION_PTP_HA
;
ppi
->
cfg
.
minorVersionNumber
=
PP_MINOR_VERSION_PTP_HA
;
#endif
#if CONFIG_HAS_EXT_WR
ppi
->
protocol_extension
=
PPSI_EXT_WR
;
...
...
@@ -149,6 +153,8 @@ int wrc_ptp_init(void)
ppi
->
ext_data
=
&
wr_ext_data
;
ppi
->
portDS
->
ext_dsport
=
&
wr_dsport
;
ppi
->
cfg
.
versionNumber
=
PP_VERSION_PTP_WR
;
ppi
->
cfg
.
minorVersionNumber
=
PP_MINOR_VERSION_PTP_WR
;
#endif
/* egressLatency and ingressLatency are overwritten on ptp_start */
...
...
arch-wrs/wrs-startup.c
View file @
ceb37cbc
...
...
@@ -208,6 +208,47 @@ int set_extension_precheck(struct pp_instance *ppi, int extension)
return
-
2
;
}
static
void
set_ptpVersion
(
struct
pp_instance
*
ppi
)
{
if
(
ppi
->
cfg
.
versionNumber
)
{
pp_diag
(
ppi
,
config
,
3
,
"PTP version for port wri%d is already "
"set manually to %d.%d
\n
"
,
ppi
->
port_idx
,
ppi
->
cfg
.
versionNumber
,
ppi
->
cfg
.
minorVersionNumber
);
return
;
}
switch
(
ppi
->
protocol_extension
)
{
#if CONFIG_HAS_EXT_WR
case
PPSI_EXT_WR
:
ppi
->
portDS
->
versionNumber
=
PP_VERSION_PTP_WR
;
ppi
->
portDS
->
minorVersionNumber
=
PP_MINOR_VERSION_PTP_WR
;
break
;
#endif
#if CONFIG_HAS_EXT_L1SYNC
case
PPSI_EXT_L1S
:
ppi
->
portDS
->
versionNumber
=
PP_VERSION_PTP_HA
;
ppi
->
portDS
->
minorVersionNumber
=
PP_MINOR_VERSION_PTP_HA
;
break
;
#endif
case
PPSI_EXT_NONE
:
ppi
->
portDS
->
versionNumber
=
PP_VERSION_PTP
;
ppi
->
portDS
->
minorVersionNumber
=
PP_MINOR_VERSION_PTP
;
break
;
default:
break
;
}
pp_diag
(
ppi
,
config
,
3
,
"PTP version for port wri%d set to %d.%d
\n
"
,
ppi
->
port_idx
,
ppi
->
portDS
->
versionNumber
,
ppi
->
portDS
->
minorVersionNumber
);
return
;
}
static
int
set_extension
(
struct
pp_instance
*
ppi
,
int
extension
)
{
pp_diag
(
ppi
,
config
,
3
,
"%s: set extension: %s (%d)
\n
"
,
...
...
@@ -254,6 +295,8 @@ static int set_extension(struct pp_instance *ppi, int extension)
break
;
}
set_ptpVersion
(
ppi
);
return
0
;
}
...
...
doc/ppsi-manual.in
View file @
ceb37cbc
...
...
@@ -814,6 +814,19 @@ Some old keywords will be marked '@i{(deprecated)}', and will be removed in the
@item @t
{
udp
}
-- User Datagram Protocol
@end itemize
@item @b
{
ptpVersion
}
@i
{
[TextList]
}
Defines PTP version number to be used for in all messages on a port
(@i
{
versionNumber
}
and @i
{
minorVersionNumber
}
):
@itemize @bullet
@item @t
{
default
}
-- Use the PTP according to the selected @i
{
extension
}
.
If no extension or @i
{
L1Sync
}
is used, PTP version is
set to v2.1 (IEEE1588-2019). If @i
{
White Rabbit
}
extension is used then PTP version is set to
v2.0 (IEEE1588-2008).
@item @t
{
2.0
}
-- Force the use of PTP v2.0 (IEEE1588-2008)
@item @t
{
2.1
}
-- Force the use of v2.1 (IEEE1588-2019)
@end itemize
@item @b
{
scaledDelayCoefficient
}
@i
{
[Int64,Unit=RelativeDifference]]
}
Defines the relative delay coefficient (alpha parameter).
When the feature '@i
{
asymmetryCorrectionEnable
}
' is enabled, this value
...
...
include/hw-specific/wrh.h
View file @
ceb37cbc
...
...
@@ -10,7 +10,7 @@
#define __WRH_H__
/* Please increment WRS_PPSI_SHMEM_VERSION if you change any exported data structure */
#define WRS_PPSI_SHMEM_VERSION 3
6
#define WRS_PPSI_SHMEM_VERSION 3
7
/* Don't include the Following when this file is included in assembler. */
#ifndef __ASSEMBLY__
...
...
include/ppsi/conf.h
View file @
ceb37cbc
...
...
@@ -107,6 +107,11 @@ struct pp_argline {
OPTION(struct pp_instance,func,k,t,NULL,cfg,1) \
OPTION_CLOSE()
#define INST_OPTION_FCT_NAMES(func,k,t,a) \
OPTION_OPEN() \
OPTION(struct pp_instance,func,k,t,a,cfg,1) \
OPTION_CLOSE()
#define INST_OPTION_STR(k,field) \
INST_OPTION(f_string,k,ARG_STR,NULL,field)
...
...
@@ -149,7 +154,12 @@ struct pp_argline {
OPTION(struct pp_runtime_opts,func,k,t,a,field,0)\
OPTION_CLOSE()
#define RT_OPTION_FCT(func,k,t,a,field) \
#define RT_OPTION_FCT(func,k,t,field) \
OPTION_OPEN() \
OPTION(struct pp_runtime_opts,func,k,t,NULL,field,0) \
OPTION_CLOSE()
#define RT_OPTION_FCT_NAMES(func,k,t,a,field) \
OPTION_OPEN() \
OPTION(struct pp_runtime_opts,func,k,t,a,field,0) \
OPTION_CLOSE()
...
...
include/ppsi/constants.h
View file @
ceb37cbc
...
...
@@ -161,7 +161,14 @@
#define PP_ALTERNATE_MASTER_FLAG 1
#define PP_TWO_STEP_FLAG 2
#define PP_VERSION_PTP 2
#define PP_MINOR_VERSION_PTP 0
#define PP_MINOR_VERSION_PTP 1
#define PP_MINOR_VERSION_PTP_0 0
#define PP_MINOR_VERSION_PTP_1 1
#define PP_VERSION_PTP_WR PP_VERSION_PTP
#define PP_MINOR_VERSION_PTP_WR PP_MINOR_VERSION_PTP_0
#define PP_VERSION_PTP_HA PP_VERSION_PTP
#define PP_MINOR_VERSION_PTP_HA PP_MINOR_VERSION_PTP_1
#define PP_HEADER_LENGTH 34
#define PP_ANNOUNCE_LENGTH 64
...
...
include/ppsi/pp-instance.h
View file @
ceb37cbc
...
...
@@ -193,6 +193,8 @@ struct pp_instance_cfg {
Boolean
masterOnly
;
/* masterOnly */
Boolean
asymmetryCorrectionEnable
;
/* asymmetryCorrectionPortDS.enable */
Boolean
extAutonegEnable
;
/* extension autonegotiation (HA/WR) */
int
versionNumber
;
int
minorVersionNumber
;
};
/*
...
...
lib/conf.c
View file @
ceb37cbc
...
...
@@ -500,6 +500,41 @@ static int f_logMinPdelayReqInterval(struct pp_argline *l, int lineno,
return
0
;
}
static
int
f_ptpVersion
(
struct
pp_argline
*
l
,
int
lineno
,
struct
pp_globals
*
ppg
,
union
pp_cfg_arg
*
arg
)
{
struct
pp_instance
*
ppi
;
if
(
ppg
->
cfg
.
cur_ppi_n
<
0
)
{
pp_printf
(
"Warning: ptpVersion can only be defined for an "
"instance (line %d)
\n
"
,
lineno
);
return
-
1
;
}
ppi
=
CUR_PPI
(
ppg
);
switch
(
arg
->
i
)
{
case
PP_MINOR_VERSION_PTP_0
:
case
PP_MINOR_VERSION_PTP_1
:
ppi
->
cfg
.
versionNumber
=
2
;
/* same as PP_VERSION_PTP */
ppi
->
cfg
.
minorVersionNumber
=
arg
->
i
;
break
;
/* Use default PTP version (based on extension) */
case
-
1
:
ppi
->
cfg
.
versionNumber
=
0
;
ppi
->
cfg
.
minorVersionNumber
=
0
;
return
0
;
default:
ppi
->
cfg
.
versionNumber
=
0
;
ppi
->
cfg
.
minorVersionNumber
=
0
;
return
-
1
;
}
return
0
;
}
/* These are the tables for the parser */
static
struct
pp_argname
arg_proto
[]
=
{
{
"raw"
,
PPSI_PROTO_RAW
},
...
...
@@ -578,6 +613,13 @@ static struct pp_argname arg_bmca[] = {
{},
};
static
struct
pp_argname
arg_ptpVersion
[]
=
{
{
"default"
,
-
1
},
{
"2.0"
,
PP_MINOR_VERSION_PTP_0
},
{
"2.1"
,
PP_MINOR_VERSION_PTP_1
},
{},
};
static
struct
pp_argline
pp_global_arglines
[]
=
{
INST_OPTION_FCT
(
f_port
,
"link port"
,
ARG_STR
),
INST_OPTION_FCT
(
f_servo_pi
,
"servo-pi"
,
ARG_INT2
),
...
...
@@ -596,6 +638,7 @@ static struct pp_argline pp_global_arglines[] = {
PP_MIN_ANNOUNCE_RECEIPT_TIMEOUT
,
PP_MAX_ANNOUNCE_RECEIPT_TIMEOUT
),
INST_OPTION_FCT
(
f_logMinDelayReqInterval
,
"min-delay-req-interval logMinDelayReqInterval"
,
ARG_INT
),
INST_OPTION_FCT
(
f_logMinPdelayReqInterval
,
"min-pdelay-req-interval logMinPDelayReqInterval"
,
ARG_INT
),
INST_OPTION_FCT_NAMES
(
f_ptpVersion
,
"ptpVersion"
,
ARG_NAMES
,
arg_ptpVersion
),
#if CONFIG_HAS_EXT_L1SYNC
INST_OPTION_INT_RANGE
(
"l1sync-interval logL1SyncInterval"
,
ARG_INT
,
NULL
,
cfg
.
l1syncInterval
,
...
...
@@ -644,7 +687,7 @@ static struct pp_argline pp_global_arglines[] = {
RT_OPTION_INT_RANGE
(
"gmDelayToGenPpsSec"
,
ARG_INT
,
NULL
,
gmDelayToGenPpsSec
,
PP_MIN_GM_DELAY_TO_GEN_PPS_SEC
,
PP_MAX_GM_DELAY_TO_GEN_PPS_SEC
),
#if !CONFIG_HAS_CODEOPT_EPC_ENABLED && !CONFIG_HAS_CODEOPT_SO_ENABLED
RT_OPTION_FCT
(
f_bmca
,
"bmca"
,
ARG_NAMES
,
arg_bmca
,
bmca
),
RT_OPTION_FCT
_NAMES
(
f_bmca
,
"bmca"
,
ARG_NAMES
,
arg_bmca
,
bmca
),
RT_OPTION_BOOL
(
"slaveOnly"
,
slaveOnly
),
#else
#if CONFIG_HAS_CODEOPT_EPC_ENABLED
...
...
proto-standard/state-initializing.c
View file @
ceb37cbc
...
...
@@ -104,8 +104,8 @@ int pp_initializing(struct pp_instance *ppi, void *buf, int len)
&
DSDEF
(
ppi
)
->
clockIdentity
,
PP_CLOCK_IDENTITY_LENGTH
);
/* 1-based port number = index of this ppi in the global array */
port
->
portIdentity
.
portNumber
=
1
+
ppi
-
ppi
->
glbs
->
pp_instances
;
port
->
versionNumber
=
PP_VERSION_PTP
;
port
->
minorVersionNumber
=
PP_MINOR_VERSION_PTP
;
port
->
versionNumber
=
(
UInteger4
)
ppi
->
cfg
.
versionNumber
;
port
->
minorVersionNumber
=
(
UInteger4
)
ppi
->
cfg
.
minorVersionNumber
;
/* Init timers */
port
->
logAnnounceInterval
=
(
Integer8
)
ppi
->
cfg
.
announce_interval
;
...
...
tools/dump_mem_ppsi_wrpc.c
View file @
ceb37cbc
...
...
@@ -302,6 +302,9 @@ struct dump_info dump_ppsi_info[] = {
DUMP_FIELD_SIZE
(
char
,
cfg
.
iface_name
,
16
),
DUMP_FIELD
(
ppi_profile
,
cfg
.
profile
),
DUMP_FIELD
(
delay_mechanism
,
cfg
.
delayMechanism
),
DUMP_FIELD
(
UInteger4
,
cfg
.
versionNumber
),
DUMP_FIELD
(
UInteger4
,
cfg
.
minorVersionNumber
),
/* FIXME: other fields from cfg */
DUMP_FIELD
(
unsigned_long
,
ptp_tx_count
),
...
...
tools/wrs_dump_shmem_ppsi.c
View file @
ceb37cbc
...
...
@@ -341,6 +341,8 @@ struct dump_info ppi_info [] = {
DUMP_FIELD_SIZE
(
char
,
cfg
.
port_name
,
16
),
DUMP_FIELD_SIZE
(
char
,
cfg
.
iface_name
,
16
),
DUMP_FIELD
(
ppi_profile
,
cfg
.
profile
),
DUMP_FIELD
(
int
,
cfg
.
versionNumber
),
DUMP_FIELD
(
int
,
cfg
.
minorVersionNumber
),
DUMP_FIELD
(
int
,
cfg
.
announce_interval
),
DUMP_FIELD
(
int
,
cfg
.
announce_receipt_timeout
),
DUMP_FIELD
(
int
,
cfg
.
sync_interval
),
...
...
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