Commit 70765afa authored by Adam Wujek's avatar Adam Wujek

Merge wr-switch-sw-v6.0.2 into master

Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parents dc14c5b5 43f319b5
mainmenu "PPSi configuration"
choice
prompt "Architecture to build for"
config ARCH_UNIX
bool "Unix (Linux and likely other systems)"
select HAS_VLAN
select HAS_MULTIPLE_VLAN
help
ARCH=unix supports standard Unix system calls, although
the code most likely includes some Linux dependencies.
Choose this architecture if you build for a Linux PC
or embedded system
config ARCH_BARE_I386
bool "Bare i386"
help
This architecture builds a Linux-i386 executable that
does not rely on the standard C library, but makes
system calls directly. This architecture is a test case
to ensure the code can run in freestanding environments
(microcontrollers or other contexts with no operating system)
config ARCH_BARE_X86_64
bool "Bare x86-64"
help
This architecture builds a Linux-x86-64 executable that
does not rely on the standard C library, but makes
system calls directly. This architecture is a test case
to ensure the code can run in freestanding environments
(microcontrollers or other contexts with no operating system)
config ARCH_WRPC
bool "White Rabbit PTP Core (WR Node)"
select HAS_VLAN
help
Build PPSi for use in the WRPC environment (SPEC card or similar
one). This is a freestanding build, without operating system.
The configuration selects the "White Rabbit" protocol extension.
config ARCH_WRS
bool "White Rabbit Switch"
select HAS_VLAN
select HAS_MULTIPLE_VLAN
help
Build PPSi for use in the WR switch. The computer is a standard
ARM-Linux host with hardware timestamping and internal PLLs
needed to achieve sub-ns synchronization.
The configuration selects the "White Rabbit" protocol extension.
config ARCH_SIMULATOR
bool "PPSi Simulator (hosted on Linux)"
help
Build a PPSi simulator. It's almost a unix full running slave,
with a simulated master stimulating it for test purposes. This
avoids to wait a long time to see how PPSi behaves.
This architecture uses standard Unix system calls, but the
code includes some Linux dependencies.
endchoice
config ARCH
string
default "unix" if ARCH_UNIX
default "bare-i386" if ARCH_BARE_I386
default "bare-x86-64" if ARCH_BARE_X86_64
default "wrpc" if ARCH_WRPC
default "wrs" if ARCH_WRS
default "sim" if ARCH_SIMULATOR
config CROSS_COMPILE
string "Cross compiler prefix"
default "/opt/gcc-lm32/bin/lm32-elf-" if ARCH_WRPC
default "/opt/arm-wrswitch/bin/arm-linux-" if ARCH_WRS
default ""
config ARCH_CFLAGS
string
default "-m32" if ARCH_BARE_I386
default "-m64" if ARCH_BARE_X86_64
default ""
config ARCH_LDFLAGS
string
default "-m elf_i386" if ARCH_BARE_I386
default "-m elf_x86_64" if ARCH_BARE_X86_64
default ""
config WRPCSW_ROOT
string "Source location of wrpc-sw"
depends on ARCH_WRPC
default "../wrpc-sw"
menu "Options"
menu "PTP Protocol Options"
choice
prompt "PTP Synchronization Mechanism"
config E2E
boolean "Delay-Request-Respond"
help
Delay-Request-Response uses 4 timestamps
for calculating the link delay and synchronizing.
config P2P
boolean "Peer Delay"
help
Peer Delay uses 4 timestamps for calculating
the link delay and another 2 for synchronizing.
endchoice
config E2E_ONLY
boolean "Avoid building P2P code"
depends on E2E
default y if E2E && (ARCH_BARE_I386 || ARCH_BARE_X86_64)
help
If you choose E2E above, P2P is built anyways,
and you can choose at runtime what to run.
This disables P2P code, for size reasons on wrpc-sw
config HAS_P2P
int
default 0 if E2E_ONLY
default 1
endmenu
menu "Enabled profiles"
config PROFILE_WR
bool "WhiteRabbit"
default y if ARCH_WRS
config PROFILE_HA
bool "HighAccuracy"
default y if ARCH_WRS || ARCH_WRPC
config PROFILE_CUSTOM
bool "Custom"
default y if ARCH_WRS
endmenu
config PROFILE_PTP
bool
default y
config HAS_EXT_WR
int
range 0 1
default 1 if PROFILE_WR
default 0
config HAS_EXT_L1SYNC
int
range 0 1
default 1 if PROFILE_HA
default 0
config HAS_EXT_NONE
int
range 0 1
default 1 if !(PROFILE_WR || PROFILE_HA || PROFILE_CUSTOM)
default 0
config HAS_PROFILE_PTP
int
range 0 1
default 1 if PROFILE_PTP
default 0
config HAS_PROFILE_HA
int
range 0 1
default 1 if PROFILE_HA
default 0
config HAS_PROFILE_WR
int
range 0 1
default 1 if PROFILE_WR
default 0
config HAS_PROFILE_CUSTOM
int
range 0 1
default 1 if PROFILE_CUSTOM
default 0
menu VLAN
# Vlan support: not all architectures have it, so this is set by them
config HAS_VLAN
bool
config HAS_MULTIPLE_VLAN
bool
config VLAN
bool "Enable VLAN support for raw Ethernet"
depends on HAS_VLAN || HAS_MULTIPLE_VLAN
default y
help
PPSI is able to directly emit and receive tagged frames,
with some architectures (if you see this option, it means
the architecture you selected has such support). A
designated master port can send announce on several VLANs,
but the other roles (designated slave or auto) can only bind
to a single VLAN. This choice is a tradeoff between code
complexity and flexibility.
Please note that you can always create several PTP ports that
act on different VLANs on the same physical port, and you can
also run VLAN support in your OS without special PPSI code.
Please see the PPSI documentation for details.
config MAX_VLANS_PER_PORT
int "Maximum number of VLANs per port"
depends on HAS_MULTIPLE_VLAN
default 32
help
This configuration option is mainly used to support
the special case of 1 VLAN per port, useful for
microcontroller-class architectures. Hosted builds
feature a bigger default, because they have no size constraints.
# I want a number, to be used without ifdef
config VLAN_ARRAY_SIZE
int
default 0 if !VLAN
default 1 if !HAS_MULTIPLE_VLAN
default MAX_VLANS_PER_PORT
endmenu
config ASSERT
bool "Build assertion checks in the code"
default n
help
Build assertions in the code, to catch unexpected situations.
When an assertion fails the code loops over repeating the
error message every second. OTOH, panic() is always built,
with no Kconfig -- and it does the same, unconditionally.
config NR_FOREIGN_RECORDS
int "Size of foreignMasterDS data set"
range 1 20
default 1 if ARCH_WRPC
default 5
help
Size of foreignMasterDS data set (Clause 9.3.2.4.5).
If the code is optimized with externalPortConfiguration.enable forced to true,
the NR_FOREIGN_RECORDS should be set to 1
config SINGLE_FMASTER
boolean
default y if NR_FOREIGN_RECORDS=1
default n
config NR_PORTS
int "Number of ports"
range 1 64
default 1 if ARCH_WRPC
default 18 if ARCH_WRS
default 64
help
number of physical ports
config NR_INSTANCES_PER_PORT
int "Max instances per port"
range 1 64
default 1 if ARCH_WRPC
default 2 if ARCH_WRS
default 1
help
Number of PPSi instances per physical port
menu "Code optimization"
config CODEOPT_ENABLED
boolean "Enable code optimization"
default y
help
Enable code optimization
config SINGLE_INSTANCE_PER_PORT
boolean
default y if NR_INSTANCES_PER_PORT=1
default n
config SINGLE_INSTANCE
boolean
default y if NR_INSTANCES_PER_PORT=1 && NR_PORTS=1
default n
config SINGLE_PORT
boolean
default y if NR_PORTS=1
default n
config CODEOPT_SINGLE_PORT
boolean "Single port"
depends on CODEOPT_ENABLED && SINGLE_PORT
default n
help
Code optimization when only one port is used (e.g:WRPC).
config CODEOPT_SINGLE_FMASTER
boolean "One foreign master"
depends on CODEOPT_ENABLED && SINGLE_FMASTER
default n
help
Only one foreign master per port instance.
config CODEOPT_SINGLE_INSTANCE_PER_PORT
boolean "One instance per port"
depends on CODEOPT_ENABLED && SINGLE_INSTANCE_PER_PORT
default n
help
Only one foreign master per port instance.
choice
prompt "Exclusive options"
config CODEOPT_EPC_SO_DISABLED
boolean "No optimization"
depends on CODEOPT_ENABLED
help
No optimization
config CODEOPT_EPC_ENABLED
boolean "Force externalPortConfiguration.enable to true"
depends on CODEOPT_ENABLED
help
externalPortConfiguration.enable is set to true and cannot be changed
config CODEOPT_SO_ENABLED
boolean "Force slaveOnly mode to true"
depends on CODEOPT_ENABLED && SINGLE_PORT
help
slaveOnly is set to true and cannot be changed.
It implies that the number of port instances must be set to 1.
endchoice
endmenu
endmenu
choice
prompt "Compilation optimization"
config OPTIMIZATION_SPEED
boolean "Execution time (-O2)"
help
GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff.
config OPTIMIZATION_SIZE_SPEED
boolean "Size and execution time (-Os)"
help
Optimize for size. Enables all -O2 optimizations except those that often increase code size.
config OPTIMIZATION_DEBUGGING
boolean "Debugging (-Og)"
help
Should be the optimization level of choice for the standard edit-compile-debug cycle
config OPTIMIZATION_NONE_DEBUGGING
boolean "Debugging without optimization(-ggdb)"
help
Compile without optimization and with debug informations
endchoice
config OPTIMIZATION
string
default "-Os" if OPTIMIZATION_SIZE_SPEED && ARCH_WRPC
default "-Os -ggdb" if OPTIMIZATION_SIZE_SPEED
default "-O2" if OPTIMIZATION_SPEED && ARCH_WRPC
default "-O2 -ggdb" if OPTIMIZATION_SPEED
default "-Og -ggdb" if OPTIMIZATION_DEBUGGING
default "-ggdb" if OPTIMIZATION_NONE_DEBUGGING
default ""
config FAULT_INJECTION_MECHANISM
bool "Add fault injection mechanism"
help
The implementation is architecture specific.
For wrpc it adds a "fault" shell command, with subcommands.
The same mechanisms are available in the wr switch, through
the configuration file.
config HAS_FAULT_INJECTION_MECHANISM
int
range 0 1
default 1 if FAULT_INJECTION_MECHANISM
default 0
# We want numbers (0/1) to avoid ifdef
config HAS_WRPC_FAULTS
int
range 0 1
default 1 if WRPC_FAULTS
default 0
config HAS_CODEOPT_SINGLE_FMASTER
int
range 0 1
default 1 if CODEOPT_SINGLE_FMASTER
default 0
config HAS_CODEOPT_SINGLE_PORT
int
range 0 1
default 1 if CODEOPT_SINGLE_PORT
default 0
config HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT
int
range 0 1
default 1 if CODEOPT_SINGLE_INSTANCE_PER_PORT
default 0
config HAS_CODEOPT_EPC_ENABLED
int
range 0 1
default 1 if CODEOPT_EPC_ENABLED
default 0
config HAS_CODEOPT_SO_ENABLED
int
range 0 1
default 1 if CODEOPT_SO_ENABLED
default 0
config HAS_EXT_WR
int
range 0 1
default 1 if EXT_WR
default 0
config HAS_EXT_L1SYNC
int
range 0 1
default 1 if EXT_L1SYNC
default 0
config ARCH_IS_WRS
int
range 0 1
default 1 if ARCH_WRS
default 0
config ARCH_IS_WRPC
int
range 0 1
default 1 if ARCH_WRPC
default 0
config HAS_ASSERT
int
range 0 1
default 1 if ASSERT
default 0
\ No newline at end of file
source Kconfig_ppsi
choice
prompt "Architecture to build for"
depends on !WRPC_PPSI
config ARCH_UNIX
bool "Unix (Linux and likely other systems)"
select ARCH_SUPPORT_VLAN
select ARCH_SUPPORT_MULTIPLE_VLAN
help
ARCH=unix supports standard Unix system calls, although
the code most likely includes some Linux dependencies.
Choose this architecture if you build for a Linux PC
or embedded system
config ARCH_BARE_I386
bool "Bare i386"
help
This architecture builds a Linux-i386 executable that
does not rely on the standard C library, but makes
system calls directly. This architecture is a test case
to ensure the code can run in freestanding environments
(microcontrollers or other contexts with no operating system)
config ARCH_BARE_X86_64
bool "Bare x86-64"
help
This architecture builds a Linux-x86-64 executable that
does not rely on the standard C library, but makes
system calls directly. This architecture is a test case
to ensure the code can run in freestanding environments
(microcontrollers or other contexts with no operating system)
config ARCH_WRPC
bool "White Rabbit PTP Core (WR Node)"
select ARCH_SUPPORT_VLAN
help
Build PPSi for use in the WRPC environment (SPEC card or similar
one). This is a freestanding build, without operating system.
The configuration selects the "White Rabbit" protocol extension.
config ARCH_WRS
bool "White Rabbit Switch"
select ARCH_SUPPORT_VLAN
select ARCH_SUPPORT_MULTIPLE_VLAN
help
Build PPSi for use in the WR switch. The computer is a standard
ARM-Linux host with hardware timestamping and internal PLLs
needed to achieve sub-ns synchronization.
The configuration selects the "White Rabbit" protocol extension.
config ARCH_SIMULATOR
bool "PPSi Simulator (hosted on Linux)"
help
Build a PPSi simulator. It's almost a unix full running slave,
with a simulated master stimulating it for test purposes. This
avoids to wait a long time to see how PPSi behaves.
This architecture uses standard Unix system calls, but the
code includes some Linux dependencies.
endchoice
config ARCH
string
default "unix" if ARCH_UNIX
default "bare-i386" if ARCH_BARE_I386
default "bare-x86-64" if ARCH_BARE_X86_64
default "wrpc" if ARCH_IS_WRPC=1
default "wrs" if ARCH_WRS
default "sim" if ARCH_SIMULATOR
config CROSS_COMPILE
string "Cross compiler prefix"
depends on !WRPC_PPSI
default "/opt/gcc-lm32/bin/lm32-elf-" if ARCH_IS_WRPC=1
default "/opt/arm-wrswitch/bin/arm-linux-" if ARCH_WRS
default ""
config ARCH_CFLAGS
string
default "-m32" if ARCH_BARE_I386
default "-m64" if ARCH_BARE_X86_64
default ""
config ARCH_LDFLAGS
string
default "-m elf_i386" if ARCH_BARE_I386
default "-m elf_x86_64" if ARCH_BARE_X86_64
default ""
menu "Options"
menu "PTP Protocol Options"
choice
prompt "PTP Synchronization Mechanism"
config E2E
boolean "Delay-Request-Respond"
help
Delay-Request-Response uses 4 timestamps
for calculating the link delay and synchronizing.
config P2P
boolean "Peer Delay"
help
Peer Delay uses 4 timestamps for calculating
the link delay and another 2 for synchronizing.
endchoice
config E2E_ONLY
boolean "Avoid building P2P code"
depends on E2E
default y if E2E && (ARCH_BARE_I386 || ARCH_BARE_X86_64 || ARCH_IS_WRPC=1)
help
If you choose E2E above, P2P is built anyways,
and you can choose at runtime what to run.
This disables P2P code, for size reasons on wrpc-sw
config HAS_P2P
int
default 0 if E2E_ONLY
default 1
config PTP_OVERWRITE_BASIC_ATTRIBUTES
boolean "Overwrite default PTP basic attributes (domain, priority)"
depends on WRPC_PPSI
default FALSE
help
This option allows to overwrite the default values like:
- priority1
- priority2
- domain number
On WRPC if a proper option is enabled, these parameters can be changed
in runtime (still require restart of PPSI).
if PTP_OVERWRITE_BASIC_ATTRIBUTES
config PTP_OPT_DOMAIN_NUMBER
int "domain-number"
default 0
range 0 255
help
A domain consists of one or more PTP devices communicating with each
other as defined by the PTP protocol. A domain defines the scope of
PTP message communication, state, operations, data sets, and
timescale. PTP devices may participate in multiple domains.
For more details please refer to the IEEE 1588-2019 standard.
config PTP_OPT_PRIORITY1
int "priority1"
default "128"
range 0 255
help
A user configurable designation that a clock belongs to an ordered
set of PTP devices from which a PTP Master is selected.
For more details please refer to the IEEE 1588-2019 standard
config PTP_OPT_PRIORITY2
int "priority2"
default "128"
range 0 255
help
A user configurable designation that provides finer grained ordering
among otherwise equivalent PTP devices.
For more details please refer to the IEEE 1588-2019 standard
endif
config PTP_OPT_OVERWRITE_ATTRIBUTES
boolean "Overwrite default PTP device attributes (class, accuracy, etc)"
default FALSE
help
This option allows to overwrite the default value depending
of the timing mode for the clock accuracy, the clock Allan variance.
On WRPC if a proper option is enabled, these parameters can be changed
in runtime (still require restart of PPSI).
if PTP_OPT_OVERWRITE_ATTRIBUTES
config PTP_OPT_CLOCK_ACCURACY
int "clock-accuracy"
default -1
range -1 255
help
An attribute defining the accuracy of the Local Clock (e.g. local
oscillator) of a Boundary Clock or Ordinary Clock.
Set to -1 to use the default value.
For more details please refer to the IEEE 1588-2019 standard.
config PTP_OPT_CLOCK_ALLAN_VARIANCE
int "clock-allan-variance/offsetScaledLogVariance"
default -1
range -1 65535
help
An attribute defining the stability of the Local Clock of a
Boundary Clock or Ordinary Clock.
Set to -1 to use the default value.
For more details please refer to the IEEE 1588-2019 standard.
config PTP_OPT_TIME_SOURCE
int "time-source"
default -1
range -1 255
help
This information-only attribute indicates the source of time used
by the grandmaster (or free-running master).
endif
config LEAP_SECONDS_VAL
int "Value of Leap Seconds"
depends on ARCH_IS_WRPC=1
default 37
help
Difference in seconds between TAI and UTC.
endmenu
menu "Enabled profiles"
config PROFILE_WR
bool "WhiteRabbit"
default y if ARCH_WRS || ARCH_IS_WRPC=1
config PROFILE_HA
bool "HighAccuracy"
default y if ARCH_WRS
config PROFILE_CUSTOM
bool "Custom"
default y if ARCH_WRS
endmenu
config PROFILE_PTP
bool
default y
config HAS_EXT_WR
int
range 0 1
default 1 if PROFILE_WR
default 0
config HAS_EXT_L1SYNC
int
range 0 1
default 1 if PROFILE_HA
default 0
config HAS_EXT_NONE
int
range 0 1
default 1 if !(PROFILE_WR || PROFILE_HA || PROFILE_CUSTOM)
default 0
config HAS_PROFILE_PTP
int
range 0 1
default 1 if PROFILE_PTP
default 0
config HAS_PROFILE_HA
int
range 0 1
default 1 if PROFILE_HA
default 0
config HAS_PROFILE_WR
int
range 0 1
default 1 if PROFILE_WR
default 0
config HAS_PROFILE_CUSTOM
int
range 0 1
default 1 if PROFILE_CUSTOM
default 0
#default to y if WRPC and VLAN support is enabled in WRPC's Kconfig
config PPSI_VLAN
bool
default y if WRPC_PPSI && VLAN
config ARCH_SUPPORT_MULTIPLE_VLAN
bool
# I want a number, to be used without ifdef
config VLAN_ARRAY_SIZE
int
default 0 if !PPSI_VLAN
default 1 if !ARCH_SUPPORT_MULTIPLE_VLAN
default MAX_VLANS_PER_PORT
# Vlan support: not all architectures have it, so this is set by them
config ARCH_SUPPORT_VLAN
bool
menu "VLAN"
depends on !WRPC_PPSI
config PPSI_VLAN
bool "Enable VLAN support for raw Ethernet"
depends on (ARCH_SUPPORT_VLAN || ARCH_SUPPORT_MULTIPLE_VLAN)
default y
help
PPSI is able to directly emit and receive tagged frames,
with some architectures (if you see this option, it means
the architecture you selected has such support). A
designated master port can send announce on several VLANs,
but the other roles (designated slave or auto) can only bind
to a single VLAN. This choice is a tradeoff between code
complexity and flexibility.
Please note that you can always create several PTP ports that
act on different VLANs on the same physical port, and you can
also run VLAN support in your OS without special PPSI code.
Please see the PPSI documentation for details.
config MAX_VLANS_PER_PORT
int "Maximum number of VLANs per port"
depends on ARCH_SUPPORT_MULTIPLE_VLAN
default 32
help
This configuration option is mainly used to support
the special case of 1 VLAN per port, useful for
microcontroller-class architectures. Hosted builds
feature a bigger default, because they have no size constraints.
endmenu
config PPSI_ASSERT
bool "Build assertion checks in the PPSI code"
default n
help
Build assertions in the PPSI code, to catch unexpected situations.
When an assertion fails the code loops over repeating the
error message every second. OTOH, panic() is always built,
with no Kconfig -- and it does the same, unconditionally.
config NR_FOREIGN_RECORDS
int "Size of foreignMasterDS data set"
range 1 20
default 1 if ARCH_IS_WRPC=1
default 5
help
Size of foreignMasterDS data set (Clause 9.3.2.4.5).
If the code is optimized with externalPortConfiguration.enable forced to true,
the NR_FOREIGN_RECORDS should be set to 1
config SINGLE_FMASTER
boolean
default y if NR_FOREIGN_RECORDS=1
default n
config NR_PORTS
int "Number of ports"
range 1 64
default 1 if ARCH_IS_WRPC=1
default 18 if ARCH_WRS
default 64
help
number of physical ports
config NR_INSTANCES_PER_PORT
int "Max instances per port"
range 1 64
default 1 if ARCH_IS_WRPC=1
default 2 if ARCH_WRS
default 1
help
Number of PPSi instances per physical port
menu "Code optimization"
config CODEOPT_ENABLED
boolean "Enable code optimization"
default y
help
Enable code optimization
config SINGLE_INSTANCE_PER_PORT
boolean
default y if NR_INSTANCES_PER_PORT=1
default n
config SINGLE_INSTANCE
boolean
default y if NR_INSTANCES_PER_PORT=1 && NR_PORTS=1
default n
config SINGLE_PORT
boolean
default y if NR_PORTS=1
default n
config CODEOPT_SINGLE_PORT
boolean "Single port"
depends on CODEOPT_ENABLED && SINGLE_PORT
default n
help
Code optimization when only one port is used (e.g:WRPC).
config CODEOPT_SINGLE_FMASTER
boolean "One foreign master"
depends on CODEOPT_ENABLED && SINGLE_FMASTER
default n
help
Only one foreign master per port instance.
config CODEOPT_SINGLE_INSTANCE_PER_PORT
boolean "One instance per port"
depends on CODEOPT_ENABLED && SINGLE_INSTANCE_PER_PORT
default n
help
Only one instance per port.
config CODEOPT_WRPC_SIZE
boolean "Size optimizations specific for WRPC"
depends on CODEOPT_ENABLED && ARCH_IS_WRPC=1
default y
help
Use optimizations specific to WRPC to reduce the footprint.
config CODEOPT_EXT_PORT_CONF_FORCE_DISABLED
boolean "Remove external port configuration"
depends on CODEOPT_ENABLED
default y if ARCH_IS_WRPC=1
default n
help
externalPortConfiguration set to false to reduce the footprint.
Saves ~1500B on WRPC
config CODEOPT_SO_FORCE_DISABLED
boolean "Force disabled slaveOnly"
depends on CODEOPT_ENABLED
default y if ARCH_IS_WRPC=1
default n
help
Force slaveOnly to false to reduce the footprint.
Saves ~650B.
config CODEOPT_MO_FORCE_DISABLED
boolean "Force disabled masterOnly"
depends on CODEOPT_ENABLED
default y if ARCH_IS_WRPC=1
default n
help
Force masterOnly to false to reduce the footprint.
Saves ~100B.
choice
prompt "Exclusive options"
config CODEOPT_EPC_SO_DISABLED
boolean "No optimization"
depends on CODEOPT_ENABLED
help
No optimization
config CODEOPT_EPC_ENABLED
boolean "Force externalPortConfiguration.enable to true"
depends on CODEOPT_ENABLED && !CODEOPT_EXT_PORT_CONF_FORCE_DISABLED
help
externalPortConfiguration.enable is set to true and cannot be changed
config CODEOPT_SO_ENABLED
boolean "Force slaveOnly mode to true"
depends on CODEOPT_ENABLED && SINGLE_PORT && !CODEOPT_SO_FORCE_DISABLED
help
slaveOnly is set to true and cannot be changed.
It implies that the number of port instances must be set to 1.
endchoice
endmenu
endmenu
choice
prompt "Compilation optimization"
depends on !WRPC_PPSI
config OPTIMIZATION_SPEED
boolean "Execution time (-O2)"
help
GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff.
config OPTIMIZATION_SIZE_SPEED
boolean "Size and execution time (-Os)"
help
Optimize for size. Enables all -O2 optimizations except those that often increase code size.
config OPTIMIZATION_DEBUGGING
boolean "Debugging (-Og)"
help
Should be the optimization level of choice for the standard edit-compile-debug cycle
config OPTIMIZATION_NONE_DEBUGGING
boolean "Debugging without optimization(-ggdb)"
help
Compile without optimization and with debug informations
endchoice
config OPTIMIZATION
string
default "-Os -ggdb" if OPTIMIZATION_SIZE_SPEED || ARCH_IS_WRPC=1
default "-O2 -ggdb" if OPTIMIZATION_SPEED
default "-Og -ggdb" if OPTIMIZATION_DEBUGGING
default "-ggdb" if OPTIMIZATION_NONE_DEBUGGING
default ""
config FAULT_INJECTION_MECHANISM
bool "Add fault injection mechanism"
help
The implementation is architecture specific.
For wrpc it adds a "fault" shell command, with subcommands.
The same mechanisms are available in the wr switch, through
the configuration file.
config NO_PTPDUMP
boolean "Disable dump of ptp payload"
depends on WRPC_PPSI
default n
help
Disable dump of ptp payload used by verbose command.
config HAS_FAULT_INJECTION_MECHANISM
int
range 0 1
default 1 if FAULT_INJECTION_MECHANISM
default 0
# We want numbers (0/1) to avoid ifdef
config HAS_WRPC_FAULTS
int
range 0 1
default 1 if WRPC_FAULTS
default 0
config HAS_CODEOPT_SINGLE_FMASTER
int
range 0 1
default 1 if CODEOPT_SINGLE_FMASTER
default 0
config HAS_CODEOPT_SINGLE_PORT
int
range 0 1
default 1 if CODEOPT_SINGLE_PORT
default 0
config HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT
int
range 0 1
default 1 if CODEOPT_SINGLE_INSTANCE_PER_PORT
default 0
config HAS_CODEOPT_CODEOPT_WRPC_SIZE
int
range 0 1
default 1 if CODEOPT_WRPC_SIZE
default 0
config HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED
int
range 0 1
default 1 if CODEOPT_EXT_PORT_CONF_FORCE_DISABLED
default 0
config HAS_CODEOPT_SO_FORCE_DISABLED
int
range 0 1
default 1 if CODEOPT_SO_FORCE_DISABLED
default 0
config HAS_CODEOPT_MO_FORCE_DISABLED
int
range 0 1
default 1 if CODEOPT_MO_FORCE_DISABLED
default 0
config HAS_CODEOPT_EPC_ENABLED
int
range 0 1
default 1 if CODEOPT_EPC_ENABLED
default 0
config HAS_CODEOPT_SO_ENABLED
int
range 0 1
default 1 if CODEOPT_SO_ENABLED
default 0
config HAS_EXT_WR
int
range 0 1
default 1 if EXT_WR
default 0
config HAS_EXT_L1SYNC
int
range 0 1
default 1 if EXT_L1SYNC
default 0
config ARCH_IS_WRS
int
range 0 1
default 1 if ARCH_WRS
default 0
config ARCH_IS_WRPC
int
range 0 1
default 1 if ARCH_WRPC || WRPC_PPSI
default 0
config HAS_PPSI_ASSERT
int
range 0 1
default 1 if PPSI_ASSERT
default 0
......@@ -3,14 +3,17 @@
#
# We are now Kconfig-based
-include $(CURDIR)/.config
WRPCSW_ROOT?=.
# Root of the main software, for now used only by WRPC. For other make it a
# current directory (".")
MAINSW_ROOT=$(WRPCSW_ROOT)
-include $(CURDIR)/$(MAINSW_ROOT)/.config
# We still accept command-line choices like we used to do.
# Also, we must remove the quotes from these Kconfig values
PROTO_EXTS ?= $(patsubst "%",%,$(CONFIG_EXTENSIONS))
ARCH ?= $(patsubst "%",%,$(CONFIG_ARCH))
CROSS_COMPILE ?= $(patsubst "%",%,$(CONFIG_CROSS_COMPILE))
WRPCSW_ROOT ?= $(patsubst "%",%,$(CONFIG_WRPCSW_ROOT))
# For "make config" to work, we need a valid ARCH
ifeq ($(ARCH),)
......@@ -53,6 +56,8 @@ export CFLAGS_OPTIMIZATION:= ${shell echo $(CONFIG_OPTIMIZATION)}
CFLAGS += $(CFLAGS_OPTIMIZATION)
CFLAGS += -I$(MAINSW_ROOT)
CFLAGS += -I$(MAINSW_ROOT)/include
CFLAGS += -Iinclude -fno-common
CFLAGS += -DPPSI_VERSION=\"$(VERSION)\"
......@@ -103,10 +108,14 @@ export CFLAGS
# libraries: see proto-standard/Makefile as an example.
$(TARGET).o: $(OBJ-y)
$(LD) --gc-sections --entry=main -Map $(TARGET).map1 -r -o $@ $(PPSI_O_LDFLAGS) \
$(LD) --gc-sections -Map $(TARGET).map1 -r -o $@ $(PPSI_O_LDFLAGS) \
--start-group $(OBJ-y) --end-group
$(OBJ-y): .config $(wildcard include/ppsi/*.h)
$(TARGET).a: $(OBJ-y)
$(AR) rc $@ $(OBJ-y)
$(OBJ-y): $(MAINSW_ROOT)/.config $(wildcard include/ppsi/*.h)
# Finally, "make clean" is expected to work
clean::
......@@ -118,8 +127,8 @@ distclean: clean
# Explicit rule for $(CURDIR)/.config
# needed since -include XXX triggers build for XXX
$(CURDIR)/.config:
@# Keep this dummy comment
$(CURDIR)/$(MAINSW_ROOT)/.config:
@#Keep this dummy comment
# following targets from Makefile.kconfig
silentoldconfig:
......@@ -136,4 +145,5 @@ defconfig:
@echo "Using unix_defconfig"
@$(MAKE) -f Makefile.kconfig unix_defconfig
.config: silentoldconfig
# "$(MAINSW_ROOT)/.config", when MAINSW_ROOT is "."
./.config .config: silentoldconfig
......@@ -68,7 +68,7 @@ int main(int argc, char **argv)
ppi = INST(ppg, i);
ppi->proto = PP_DEFAULT_PROTO;
ppi->role = PP_DEFAULT_ROLE;
ppi->delayMechanism = E2E;
ppi->delayMechanism = MECH_E2E;
}
/* Set offset here, so config parsing can override it */
......
CFLAGS += -ffreestanding -Os \
-ffunction-sections -fdata-sections \
-mmultiply-enabled -mbarrel-shift-enabled \
-Itools -Iproto-standard
CFLAGS-CPU-LM32 = -mmultiply-enabled -mbarrel-shift-enabled
CFLAGS-CPU-RISCV = -march=rv32im -mabi=ilp32
# use lm32 if not defined
CPU_ARCH ?= LM32
# Root of wrpc-sw project
WRPCSW_ROOT ?= $(CONFIG_WRPCSW_ROOT)
CFLAGS += -ffreestanding \
-ffunction-sections -fdata-sections \
-Itools -Iproto-standard \
$(CFLAGS-CPU-$(CPU_ARCH))
# WRPCSW_ROOT shall be defined in the env by WRPC's Makefile
CFLAGS += -I$(WRPCSW_ROOT)/include -I$(WRPCSW_ROOT)/include/std -I$(WRPCSW_ROOT)/softpll
PPSI_O_LDFLAGS = -u wrc_ptp_init
# TODOA: remove --no-gc-sections
PPSI_O_LDFLAGS = --no-gc-sections -u wrc_ptp_init
# Let's use the pp_printf we already have in wrpc-sw
CONFIG_NO_PRINTF = y
......@@ -26,7 +31,6 @@ OBJ-y += \
lib/drop.o \
lib/div64.o \
lib/time-arith.o \
lib/iicomm.o
OBJ-$(CONFIG_WRPC_FAULTS) += $A/faults.o
......
......@@ -20,9 +20,9 @@ static int cmd_fault(const char *args[])
if (args[0] && !strcmp(args[0], "drop")) {
if (args[1])
fromdec(args[1], &ppg->rxdrop);
ppg->rxdrop = atoi(args[1]);
if (args[2])
fromdec(args[2], &ppg->txdrop);
ppg->txdrop = atoi(args[2]);
ppsi_drop_init(ppg, timer_get_tics());
pp_printf("dropping %i/1000 rx, %i/1000 tx\n",
ppg->rxdrop, ppg->txdrop);
......@@ -30,7 +30,7 @@ static int cmd_fault(const char *args[])
}
if (args[0] && !strcmp(args[0], "delay")) {
if (args[1])
fromdec(args[1], &frame_rx_delay_us);
frame_rx_delay_us = atoi(args[1]);
pp_printf("delaying %i us on rx frame\n", frame_rx_delay_us);
return 0;
}
......
......@@ -13,24 +13,26 @@
#include <common-fun.h>
/* All of these live in wrpc-sw/include */
#include "minic.h"
#include "syscon.h"
#include "endpoint.h"
#include "dev/minic.h"
#include "dev/syscon.h"
#include "dev/endpoint.h"
#include "dev/pps_gen.h"
#include "dev/console.h"
#include "dev/rxts_calibrator.h"
#include "softpll_ng.h"
#include "pps_gen.h"
#include "uart.h"
#include "rxts_calibrator.h"
extern int32_t cal_phase_transition;
/* TODO: get rid of ptp_mode, use WRPC_ARCH_G(ppg)->timingModeCfg instead */
int ptp_mode = WRC_MODE_UNKNOWN;
static int ptp_enabled = 0;
struct wrh_operations wrh_oper = {
.locking_enable = wrpc_spll_locking_enable,
.locking_enable = wrpc_spll_locking_enable, // entering slave
.locking_poll = wrpc_spll_locking_poll,
.locking_disable = wrpc_spll_locking_disable,
.locking_reset = wrpc_spll_locking_reset,
.locking_reset = wrpc_spll_locking_reset, // entering master, when leaving slave
.enable_ptracker = wrpc_spll_enable_ptracker,
.adjust_in_progress = wrpc_adjust_in_progress,
......@@ -38,24 +40,22 @@ struct wrh_operations wrh_oper = {
.adjust_phase = wrpc_adjust_phase,
.read_calib_data = wrpc_read_calibration_data,
.calib_disable = wrpc_calibrating_disable,
.calib_enable = wrpc_calibrating_enable,
.calib_poll = wrpc_calibrating_poll,
.calib_pattern_enable = wrpc_calibration_pattern_enable,
.calib_pattern_disable = wrpc_calibration_pattern_disable,
.enable_timing_output = wrpc_enable_timing_output,
/* not used */
.set_timing_mode = NULL,
.get_timing_mode = NULL,
.get_timing_mode_state = NULL,
};
/*ppi fields*/
static defaultDS_t defaultDS;
static currentDS_t currentDS;
static [parentDS_t parentDS;
static parentDS_t parentDS;
static timePropertiesDS_t timePropertiesDS;
static struct pp_servo servo;
#if CONFIG_EXT_WR == 1
#if CONFIG_HAS_EXT_WR == 1
/* WR extension declaration */
#include "../proto-ext-whiterabbit/wr-api.h"
#include "../proto-ext-whiterabbit/wr-constants.h"
......@@ -70,7 +70,8 @@ static portDS_t portDS ;
static int delay_ms = PP_DEFAULT_NEXT_DELAY_MS;
static int start_tics = 0;
static struct pp_globals ppg_static; /* forward declaration */
struct pp_globals ppg_static; /* forward declaration */
struct pp_globals *ppg = &ppg_static;
static unsigned char __tx_buffer[PP_MAX_FRAME_LENGTH];
static unsigned char __rx_buffer[PP_MAX_FRAME_LENGTH];
......@@ -82,138 +83,137 @@ struct pp_instance ppi_static = {
.t_ops = &wrpc_time_ops,
.vlans_array_len = CONFIG_VLAN_ARRAY_SIZE,
.proto = PP_DEFAULT_PROTO,
.delayMechanism = E2E, /* until changed by cfg */
.iface_name = "wr1",
.port_name = "wr1",
.__tx_buffer = __tx_buffer,
.__rx_buffer = __rx_buffer,
.delayMechanism = MECH_E2E, /* until changed by cfg */
.iface_name = "wr0",
.port_name = "wr0",
.__tx_buffer = __tx_buffer,
.__rx_buffer = __rx_buffer,
.servo = &servo,
.ptp_support = TRUE,
.asymmetryCorrectionPortDS.enable = 1,
};
struct wrpc_arch_data_t wrpc_arch_data = {
.timingMode = WRH_TM_DISABLED,
.wrpcModeCfg = WRC_MODE_UNKNOWN
};
/* We now have a structure with all globals, and multiple ppi inside */
static struct pp_globals ppg_static = {
struct pp_globals ppg_static = {
.pp_instances = &ppi_static,
.servo = &servo,
.defaultDS = &defaultDS,
.currentDS = &currentDS,
.parentDS = &parentDS,
.timePropertiesDS = &timePropertiesDS,
.max_links = PP_MAX_LINKS,
.nlinks = 1,
/* rt_opts set by pp_init_globals */
.arch_data = &wrpc_arch_data,
};
extern struct pp_ext_hooks pp_hooks;
int wrc_ptp_is_abscal(void);
int wrc_ptp_init()
int wrc_ptp_init(void)
{
struct pp_instance *ppi = &ppi_static;
sdb_find_devices();
uart_init_hw();
pp_printf("PPSi for WRPC. Commit %s, built on " __DATE__ "\n",
PPSI_VERSION);
/* copy default ppi config */
memcpy(&ppi->cfg, &__pp_default_instance_cfg, sizeof(__pp_default_instance_cfg));
ppi->ext_hooks =&pp_hooks; /* default value */
if ( CONFIG_EXT_WR == 1 ) {
if ( CONFIG_HAS_EXT_WR == 1 ) {
ppi->protocol_extension = PPSI_EXT_WR;
ppi->ext_hooks = &wr_ext_hooks;
ppi->ext_data = &wr_ext_data;
wr_ext_data->servo_state.servo_head.extension=PPSI_EXT_WR;
portDS.ext_dsport = &wr_dsport;
ppi->portDS->ext_dsport = &wr_dsport;
}
/* egressLatency and ingressLatency are overwritten on ptp_start */
ppi->timestampCorrectionPortDS.messageTimestampPointLatency=0;
pp_init_globals(&ppg_static, &__pp_default_rt_opts);
return 0;
}
#define LOCK_TIMEOUT_FM (4 * TICS_PER_SECOND)
#define LOCK_TIMEOUT_GM (60 * TICS_PER_SECOND)
int wrc_ptp_set_mode(int mode)
{
uint32_t start_tics, lock_timeout = 0;
struct pp_instance *ppi = &ppi_static;
struct pp_globals *ppg = ppi->glbs;
// struct pp_globals *ppg = ppi->glbs;
struct wr_dsport *wrp = WR_DSPOR(ppi);
typeof(ppg->rt_opts->clock_quality.clockClass) *class_ptr;
typeof(ppg->rt_opts->clock_quality.clockAccuracy) *accuracy_ptr;
typeof(ppg->rt_opts->clock_quality_clockClass) *class_ptr;
int error = 0;
/*
* We need to change the class in the default options.
* Unfortunately, ppg->rt_opts may be yet unassigned when this runs
*/
class_ptr = &__pp_default_rt_opts.clock_quality.clockClass;
accuracy_ptr = &__pp_default_rt_opts.clock_quality.clockAccuracy;
class_ptr = &ppg->rt_opts->clock_quality_clockClass;
ptp_mode = 0;
wrc_ptp_stop();
/* clear rt_opts so bmc_set_default_device_attributes can later set it
* according to a set clock class */
ppg->rt_opts->clock_quality_clockAccuracy = CONFIG_PTP_OPT_CLOCK_ACCURACY;
ppg->rt_opts->clock_quality_offsetScaledLogVariance = CONFIG_PTP_OPT_CLOCK_ALLAN_VARIANCE;
ppg->rt_opts->timeSource = CONFIG_PTP_OPT_TIME_SOURCE;
ppg->rt_opts->ptpTimeScale = -1;
ppg->rt_opts->frequencyTraceable = -1;
ppg->rt_opts->timeTraceable = -1;
switch (mode) {
case WRC_MODE_GM:
case WRC_MODE_ABSCAL: /* absolute calibration, gm-lookalike */
wrp->wrConfig = WR_M_ONLY;
ppi->role = PPSI_ROLE_MASTER;
/* Can become slave if clock class is degradated due to PLL
* unlocked and the peer on the other side has better clock class */
wrp->wrConfig = WR_M_AND_S;
WRPC_ARCH_G(ppg)->timingMode = WRH_TM_GRAND_MASTER;
*class_ptr = PP_PTP_CLASS_GM_LOCKED;
*accuracy_ptr = PP_PTP_ACCURACY_GM_LOCKED;
spll_init(SPLL_MODE_GRAND_MASTER, 0, 1);
shw_pps_gen_unmask_output(1);
lock_timeout = LOCK_TIMEOUT_GM;
DSDEF(ppi)->clockQuality.clockClass = PP_PTP_CLASS_GM_LOCKED;
DSDEF(ppi)->clockQuality.clockAccuracy = PP_PTP_ACCURACY_GM_LOCKED;
bmc_m1(ppi);
spll_init(SPLL_MODE_GRAND_MASTER, 0, SPLL_FLAG_ALIGN_PPS);
error = wrpc_spll_check_lock_with_timeout(LOCK_TIMEOUT_GM);
/* generate PPS no matter if PLL locked */
wrpc_enable_timing_output(ppg, 1);
break;
case WRC_MODE_MASTER:
wrp->wrConfig = WR_M_ONLY;
ppi->role = PPSI_ROLE_MASTER;
*class_ptr = PP_PTP_CLASS_GM_UNLOCKED;
*accuracy_ptr = PP_PTP_ACCURACY_GM_UNLOCKED;
spll_init(SPLL_MODE_FREE_RUNNING_MASTER, 0, 1);
shw_pps_gen_unmask_output(1);
lock_timeout = LOCK_TIMEOUT_FM;
DSDEF(ppi)->clockQuality.clockClass = PP_PTP_CLASS_GM_UNLOCKED;
DSDEF(ppi)->clockQuality.clockAccuracy = PP_PTP_ACCURACY_GM_UNLOCKED;
bmc_m1(ppi);
wrp->wrConfig = WR_M_AND_S;
WRPC_ARCH_G(ppg)->timingMode = WRH_TM_FREE_MASTER;
spll_init(SPLL_MODE_FREE_RUNNING_MASTER, 0, SPLL_FLAG_ALIGN_PPS);
wrpc_enable_timing_output(ppg, 1);
*class_ptr = PP_FRUNNING_CLOCK_CLASS;
error = wrpc_spll_check_lock_with_timeout(LOCK_TIMEOUT_FM);
break;
case WRC_MODE_SLAVE:
wrp->wrConfig = WR_S_ONLY;
ppi->role = PPSI_ROLE_SLAVE;
/* when enter to slave state it will set spll to slave */
WRPC_ARCH_G(ppg)->timingMode = WRH_TM_BOUNDARY_CLOCK;
*class_ptr = PP_CLASS_SLAVE_ONLY;
*accuracy_ptr = PP_ACCURACY_DEFAULT;
spll_init(SPLL_MODE_SLAVE, 0, 1);
shw_pps_gen_unmask_output(0);
DSDEF(ppi)->clockQuality.clockClass = PP_CLASS_SLAVE_ONLY;
DSDEF(ppi)->clockQuality.clockAccuracy = PP_ACCURACY_DEFAULT;
break;
}
start_tics = timer_get_tics();
pp_printf("Locking PLL");
wrp->ops->enable_timing_output(ppi, 0); /* later, wr_init chooses */
while (!spll_check_lock(0) && lock_timeout) {
spll_update();
timer_delay(TICS_PER_SECOND);
if (timer_get_tics() - start_tics > lock_timeout) {
pp_printf("\nLock timeout.");
error = -ETIMEDOUT;
break;
}
pp_printf(".");
}
pp_printf("\n");
/* Update the default attributes depending on the clock class in
* the configuration structure */
bmc_set_default_device_attributes(ppg);
/* Update defaultDS & timePropertiesDS with configured setting
* (clockClass,...) */
bmc_apply_configured_device_attributes(ppg);
ptp_mode = mode;
/* If we can't lock to the atomic/gps, we say it in the class */
if (error && mode == WRC_MODE_GM) {
*class_ptr = PP_PTP_CLASS_GM_UNLOCKED;
*accuracy_ptr = PP_PTP_ACCURACY_GM_UNLOCKED;
}
/* Keep a copy of mode for dump */
WRPC_ARCH_G(ppg)->wrpcModeCfg = mode;
ptp_mode = mode;
return error;
}
int wrc_ptp_get_mode()
int wrc_ptp_get_mode(void)
{
return ptp_mode;
}
......@@ -227,8 +227,8 @@ int wrc_ptp_sync_mech(int e2e_p2p_qry)
return ppi->delayMechanism;
switch(e2e_p2p_qry) {
case E2E:
case P2P:
case MECH_E2E:
case MECH_P2P:
running = wrc_ptp_run(-1);
wrc_ptp_run(0);
ppi->delayMechanism = e2e_p2p_qry;
......@@ -239,12 +239,38 @@ int wrc_ptp_sync_mech(int e2e_p2p_qry)
}
}
int wrc_ptp_start()
int wrc_ptp_start(void)
{
struct pp_instance *ppi = &ppi_static;
TimeInterval scaledBitSlide = 0;
RelativeDifference scaledDelayCoefficient = 0;
TimeInterval scaledSfpDeltaTx = 0;
TimeInterval scaledSfpDeltaRx = 0;
/* sfp match was done before so read calibration data */
wrpc_read_calibration_data(ppi, NULL,
&scaledBitSlide,
&scaledDelayCoefficient,
&scaledSfpDeltaTx,
&scaledSfpDeltaRx);
ppi->timestampCorrectionPortDS.semistaticLatency = scaledBitSlide;
if (scaledDelayCoefficient>=PP_MIN_DELAY_COEFFICIENT_AS_RELDIFF
&& scaledDelayCoefficient<=PP_MAX_DELAY_COEFFICIENT_AS_RELDIFF ) {
/* Scaled delay coefficient is valid then delta tx and rx also */
if ( ppi->asymmetryCorrectionPortDS.enable ) {
ppi->asymmetryCorrectionPortDS.scaledDelayCoefficient = ppi->cfg.scaledDelayCoefficient = scaledDelayCoefficient;
/* taken from: enable_asymmetryCorrection(ppi,TRUE); */
ppi->portDS->delayAsymCoeff=pp_servo_calculateDelayAsymCoefficient(ppi->asymmetryCorrectionPortDS.scaledDelayCoefficient);
ppi->asymmetryCorrectionPortDS.constantAsymmetry = picos_to_interval(ppi->cfg.constantAsymmetry_ps); /* needed? */
pp_printf("PTP start\n");
pp_init_globals(&ppg_static, &__pp_default_rt_opts);
}
ppi->timestampCorrectionPortDS.egressLatency =
picos_to_interval(ppi->cfg.egressLatency_ps) + scaledSfpDeltaTx;
ppi->timestampCorrectionPortDS.ingressLatency =
picos_to_interval(ppi->cfg.ingressLatency_ps) + scaledSfpDeltaRx;
}
/* Call the state machine. Being it in "Initializing" state, make
* ppsi initialize what is necessary */
......@@ -259,29 +285,56 @@ int wrc_ptp_start()
return 0;
}
int wrc_ptp_stop()
int wrc_ptp_stop(void)
{
struct pp_instance *ppi = &ppi_static;
struct wr_dsport *wrp = WR_DSPOR(ppi);
pp_printf("PTP stop\n");
wrp->ops->enable_timing_output(ppi, 0);
/* Moving fiber: forget about this parent (FIXME: shouldn't be here) */
wrp->parentWrConfig = wrp->parentWrModeOn = 0;
memset(ppi->frgn_master, 0, sizeof(ppi->frgn_master));
ppi->frgn_rec_num = 0; /* no known master */
ppi->frgn_rec_best = -1;
/* just tell that the link is down now */
ppi->link_up = FALSE;
ptp_enabled = 0;
ppi->next_state = PPS_DISABLED;
pp_leave_current_state(ppi);
wr_servo_reset(ppi);
ppi->n_ops->exit(ppi);
pp_sprintf(ppi->servo->servo_state_name, "LINK_DOWN");
if( ppi->ext_hooks->servo_reset) {
(*ppi->ext_hooks->servo_reset)(ppi);
}
/* FIXME: this should be done in a different place and in a nicer way.
This dirty hack was introduce to force re-doing of WR Link Setup
when a link goes down and then up. */
if (ppi->ext_data)
WRH_SRV(ppi)->doRestart = TRUE;
pp_close_globals(&ppg_static);
return 0;
}
int wrc_ptp_link_down(void)
{
/* special case, keep PPS on for GM and Master */
if (ptp_mode == WRC_MODE_MASTER || ptp_mode == WRC_MODE_GM) {
wrpc_enable_timing_output(ppg, 1);
/* if spll not in SPLL_MODE_FREE_RUNNING_MASTER/GM,
Can happen if fiber is unplugged between locking spll in slave mode
and entering PP_SLAVE state */
if (WRPC_ARCH_G(ppg)->timingMode == WRH_TM_BOUNDARY_CLOCK) {
WRPC_ARCH_G(ppg)->timingMode = WRH_TM_FREE_MASTER;
spll_init(SPLL_MODE_FREE_RUNNING_MASTER, 0, SPLL_FLAG_ALIGN_PPS);
}
}
return 0;
}
int wrc_ptp_run(int start_stop_query)
{
switch(start_stop_query) {
......@@ -295,7 +348,7 @@ int wrc_ptp_run(int start_stop_query)
}
/* this returns whether or not the function did any work */
int wrc_ptp_update()
int wrc_ptp_update(void)
{
int i;
struct pp_instance *ppi = &ppi_static;
......@@ -318,3 +371,122 @@ int wrc_ptp_update()
delay_ms = pp_state_machine(ppi, ppi->rx_ptp, i);
return 1;
}
/* this returns whether or not the function did any work */
int wrc_ptp_bmc_update(void)
{
static int start_tics_bmc;
if (!ptp_enabled) {
/* ptp disabled */
return 0;
}
/* BMCA must run at least once per announce interval 9.2.6.8 */
if (timer_get_tics() - start_tics_bmc < TMO_DEFAULT_BMCA_MS) {
/* not yet */
return 0;
}
start_tics_bmc = timer_get_tics();
bmc_calculate_ebest(ppg);
return 1;
}
int wrc_pps_force(wrpc_pps_force_t action)
{
if (action == pps_force_check) {
/* wrpc_pps_force_t is mapped to values forcePpsGen */
return GOPTS(ppg)->forcePpsGen;
}
GOPTS(ppg)->forcePpsGen = action & 1; /* 0 or 1 */
/* Disable pps generation if needed; according to forcePpsGen */
wrpc_enable_timing_output(ppg, 2);
return action & 1;
}
int wrc_ptp_is_abscal(void)
{
return ptp_mode == WRC_MODE_ABSCAL;
}
/* lm32'S compiler does not remove strings used in the function if
* the function is optimized out. So if the option is not used don't include
* the nbot optimized out strings in functions wrpc_ptp_set*. Ugly but can be
* repoved when LM32's support is dropped. */
#if defined CONFIG_CMD_PTP_ADV && defined CONFIG_ARCH_LM32
static int assign_ptp_param(char *name, int *param, int value, int min, int max)
{
int running;
if (value == -1) {
pp_printf("%s = %d\n", name, *param);
return 0;
}
if (value < min || value > max) {
/* value out of range */
return -EINVAL;
}
running = wrc_ptp_run(-1);
wrc_ptp_run(0);
*param = value;
/* copy updated parameters from rt_opts */
bmc_apply_configured_device_attributes(ppg);
wrc_ptp_run(running);
return 0;
}
int wrc_ptp_set_prio1(int prio1)
{
return assign_ptp_param("prio1", &__pp_default_rt_opts.priority1,
prio1, PP_MIN_PRIORITY1, PP_MAX_PRIORITY1);
}
int wrc_ptp_set_prio2(int prio2)
{
return assign_ptp_param("prio2", &__pp_default_rt_opts.priority2,
prio2, PP_MIN_PRIORITY2, PP_MAX_PRIORITY2);
}
int wrc_ptp_set_domain_number(int domain)
{
return assign_ptp_param("domain", &__pp_default_rt_opts.domainNumber,
domain, PP_MIN_DOMAIN_NUMBER,
PP_MAX_DOMAIN_NUMBER);
}
int wrc_ptp_set_clock_class(int clock_class)
{
return assign_ptp_param("clock class",
&__pp_default_rt_opts.clock_quality_clockClass,
clock_class, PP_MIN_CLOCK_CLASS,
PP_MAX_CLOCK_CLASS);
}
int wrc_ptp_set_clock_accuracy(int clock_accuracy)
{
return assign_ptp_param("clock accuracy",
&__pp_default_rt_opts.clock_quality_clockAccuracy,
clock_accuracy, PP_MIN_CLOCK_ACCURACY,
PP_MAX_CLOCK_ACCURACY);
}
int wrc_ptp_set_clock_allan_variance(int clock_allan_variance)
{
return assign_ptp_param("clock allan variance",
&__pp_default_rt_opts.clock_quality_offsetScaledLogVariance,
clock_allan_variance, PP_MIN_CLOCK_VARIANCE,
PP_MAX_CLOCK_VARIANCE);
}
int wrc_ptp_set_time_source(int time_source)
{
return assign_ptp_param("time source",
&__pp_default_rt_opts.timeSource,
time_source, PP_MIN_TIME_SOURCE,
PP_MAX_TIME_SOURCE);
}
#endif
/*
* Copyright (C) 2012 CERN (www.cern.ch)
* Author: Aurelio Colosimo
* Copyright (C) 2012-2020 CERN (www.cern.ch)
* Author: Aurelio Colosimo, Adam Wujek
*
* Released to the public domain
*/
#include <endpoint.h>
#include <dev/endpoint.h>
#include <ppsi/ppsi.h>
#include <softpll_ng.h>
#include <hal_exports.h>
#include "wrpc.h"
#include "../proto-ext-whiterabbit/wr-constants.h"
extern int32_t sfp_alpha;
int wrpc_read_calibration_data(struct pp_instance *ppi,
uint32_t *deltaTx, uint32_t *deltaRx, int32_t *fix_alpha,
int32_t *clock_period)
#include "board.h"
int wrpc_read_calibration_data(
struct pp_instance *ppi,
int32_t *clock_period,
TimeInterval *scaledBitSlide,
RelativeDifference *scaledDelayCoefficient,
TimeInterval *scaledSfpDeltaTx,
TimeInterval *scaledSfpDeltaRx)
{
struct hal_port_state state;
struct wrc_port_state state;
wrpc_get_port_state(&state, ppi->iface_name);
if (wrpc_get_port_state(&state, ppi->iface_name))
return WRH_HW_CALIB_NOT_FOUND;
/* check if the data is available */
if (fix_alpha)
/* take local alpha instead of HAL */
*fix_alpha = sfp_alpha;
if (scaledDelayCoefficient)
*scaledDelayCoefficient = (RelativeDifference) state.calib.alpha;
if (scaledBitSlide)
*scaledBitSlide = picos_to_interval((int64_t)state.calib.bitslide_ps);
if (clock_period)
*clock_period = state.clock_period;
/* check if tx is calibrated,
* if so read data */
if (state.calib.tx_calibrated) {
if (deltaTx)
*deltaTx = state.calib.delta_tx_phy
+ state.calib.sfp.delta_tx_ps
+ state.calib.delta_tx_board;
} else
return WR_HW_CALIB_NOT_FOUND;
if (scaledSfpDeltaTx) {
*scaledSfpDeltaTx = picos_to_interval(state.calib.delta_tx_ps);
}
/* check if rx is calibrated,
* if so read data */
if (state.calib.rx_calibrated) {
if (deltaRx)
*deltaRx = state.calib.delta_rx_phy
+ state.calib.sfp.delta_rx_ps
+ state.calib.delta_rx_board;
} else
return WR_HW_CALIB_NOT_FOUND;
return WR_HW_CALIB_OK;
}
/* Begin of exported functions */
int wrpc_calibrating_disable(struct pp_instance *ppi, int txrx)
{
return WR_HW_CALIB_OK;
}
int wrpc_calibrating_enable(struct pp_instance *ppi, int txrx)
{
return WR_HW_CALIB_OK;
}
int wrpc_calibrating_poll(struct pp_instance *ppi, int txrx, uint32_t *delta)
{
uint32_t delta_rx = 0, delta_tx = 0;
if (scaledSfpDeltaRx) {
*scaledSfpDeltaRx = picos_to_interval(state.calib.delta_rx_ps);
}
/* FIXME: why delta was 64bit whereas ep_get_deltas accepts 32bit? */
wrpc_read_calibration_data(ppi, &delta_tx, &delta_rx, NULL, NULL);
if (txrx == WRH_HW_CALIB_TX)
*delta = delta_tx;
else
*delta = delta_rx;
return WR_HW_CALIB_READY;
}
int wrpc_calibration_pattern_enable(struct pp_instance *ppi,
unsigned int calibrationPeriod,
unsigned int calibrationPattern,
unsigned int calibrationPatternLen)
{
ep_cal_pattern_enable();
return WR_HW_CALIB_OK;
}
int wrpc_calibration_pattern_disable(struct pp_instance *ppi)
{
ep_cal_pattern_disable();
return WR_HW_CALIB_OK;
return WRH_HW_CALIB_OK;
}
......@@ -6,9 +6,9 @@
*/
#include <ppsi/ppsi.h>
#include "wrpc.h"
#include "uart.h" /* wrpc-sw */
#include "dev/console.h" /* wrpc-sw */
void pp_puts(const char *s)
{
uart_write_string(s);
puts(s);
}
......@@ -6,11 +6,12 @@
*/
#include <stdint.h>
#include <errno.h>
#include <ppsi/ppsi.h>
#include <pps_gen.h>
#include <dev/pps_gen.h>
#include <softpll_ng.h>
#include "../proto-ext-whiterabbit/wr-constants.h"
#include <rxts_calibrator.h>
#include <dev/rxts_calibrator.h>
#include "../include/hw-specific/wrh.h"
#include "wrpc.h"
......@@ -19,22 +20,24 @@ extern uint32_t cal_phase_transition;
int wrpc_spll_locking_enable(struct pp_instance *ppi)
{
spll_init(SPLL_MODE_SLAVE, 0, 1);
if (wrc_ptp_get_mode() == WRC_MODE_GM) {
/* If in grand master don't change pll mode */
return WRH_SPLL_OK;
}
spll_init(SPLL_MODE_SLAVE, 0, SPLL_FLAG_ALIGN_PPS);
WRPC_ARCH_I(ppi)->timingMode = WRH_TM_BOUNDARY_CLOCK;
spll_enable_ptracker(0, 1);
rxts_calibration_start();
return WRH_SPLL_OK;
}
int wrpc_spll_locking_poll(struct pp_instance *ppi, int grandmaster)
int wrpc_spll_locking_poll(struct pp_instance *ppi)
{
int locked;
static int t24p_calibrated = 0;
locked = spll_check_lock(0); /* both slave and gm mode */
if (grandmaster)
return locked ? WRH_SPLL_READY : WRH_SPLL_ERROR;
/* Else, slave: ensure calibration is done */
if(!locked) {
t24p_calibrated = 0;
......@@ -42,16 +45,43 @@ int wrpc_spll_locking_poll(struct pp_instance *ppi, int grandmaster)
else if(locked && !t24p_calibrated) {
/*run t24p calibration if needed*/
if (calib_t24p(WRC_MODE_SLAVE, &cal_phase_transition) < 0)
return WRH_SPLL_CALIB_NOT_READY;
return WRH_SPLL_UNLOCKED;
t24p_calibrated = 1;
}
return locked ? WRH_SPLL_READY : WRH_SPLL_ERROR;
return locked ? WRH_SPLL_LOCKED : WRH_SPLL_ERROR;
}
int wrpc_spll_check_lock_with_timeout(int lock_timeout)
{
uint32_t start_tics;
start_tics = timer_get_tics();
pp_printf("Locking PLL");
while (!spll_check_lock(0) && lock_timeout) {
spll_update();
timer_delay(TICS_PER_SECOND);
if (timer_get_tics() - start_tics > lock_timeout) {
pp_printf("\nLock timeout.");
return -ETIMEDOUT;
}
pp_printf(".");
}
pp_printf("\n");
return 0;
}
int wrpc_spll_locking_reset(struct pp_instance *ppi)
{
//TODO?
/* if configured as master, but due to BMCA changed into BC */
if (wrc_ptp_get_mode() == WRC_MODE_MASTER && WRPC_ARCH_I(ppi)->timingMode == WRH_TM_BOUNDARY_CLOCK) {
spll_init(SPLL_MODE_FREE_RUNNING_MASTER, 0, SPLL_FLAG_ALIGN_PPS);
WRPC_ARCH_I(ppi)->timingMode = WRH_TM_FREE_MASTER;
/* wait for spll to lock */
wrpc_spll_check_lock_with_timeout(LOCK_TIMEOUT_FM);
}
return WRH_SPLL_OK;
}
......@@ -68,13 +98,14 @@ int wrpc_spll_enable_ptracker(struct pp_instance *ppi)
return WRH_SPLL_OK;
}
int wrpc_enable_timing_output(struct pp_instance *ppi, int enable)
int wrpc_enable_timing_output(struct pp_globals *ppg, int enable)
{
if (enable == WR_DSPOR(ppi)->ppsOutputOn)
return WR_SPLL_OK;
WR_DSPOR(ppi)->ppsOutputOn = enable;
static int pps_enable;
shw_pps_gen_enable_output(enable);
if (enable != 2) {
pps_enable = enable;
}
shw_pps_gen_enable_output(pps_enable | GOPTS(ppg)->forcePpsGen);
return WRH_SPLL_OK;
}
......@@ -98,3 +129,13 @@ int wrpc_adjust_phase(int32_t phase_ps)
return WRH_SPLL_OK;
}
int wrpc_get_GM_lock_state(struct pp_globals *ppg, pp_timing_mode_state_t *state)
{
if (spll_check_lock(0))
*state = PP_TIMING_MODE_STATE_LOCKED;
else
*state = PP_TIMING_MODE_STATE_UNLOCKED;
/* Holdover not implemented (PP_TIMING_MODE_STATE_HOLDOVER) */
return 0;
}
......@@ -10,9 +10,11 @@
#define __WRPC_H
#include <ppsi/ppsi.h>
#include <hw/memlayout.h>
#include <libwr/hal_shmem.h>
#define LOCK_TIMEOUT_FM (4 * TICS_PER_SECOND)
#define LOCK_TIMEOUT_GM (60 * TICS_PER_SECOND)
/* This part is exactly wrpc-sw::wrc_ptp.h */
#define WRC_MODE_UNKNOWN 0
#define WRC_MODE_GM 1
......@@ -24,6 +26,13 @@ extern int ptp_mode;
int wrc_ptp_init(void);
int wrc_ptp_set_mode(int mode);
int wrc_ptp_get_mode(void);
int wrc_ptp_set_prio1(int prio1);
int wrc_ptp_set_prio2(int prio2);
int wrc_ptp_set_domain_number(int domain);
int wrc_ptp_set_clock_class(int clock_class);
int wrc_ptp_set_clock_accuracy(int clock_accuracy);
int wrc_ptp_set_clock_allan_variance(int clock_allan_variance);
int wrc_ptp_set_time_source(int time_source);
int wrc_ptp_sync_mech(int e2e_p2p_qry);
int wrc_ptp_start(void);
int wrc_ptp_stop(void);
......@@ -42,29 +51,70 @@ struct wrpc_ethhdr {
uint16_t h_proto;
} __attribute__((packed));
typedef struct wrpc_arch_data_t {
wrh_timing_mode_t timingMode; /* Timing mode: Grand master, Free running,...*/
/* Keep a copy of configured mode for dump */
int wrpcModeCfg; /* Mode: Grand master, master, slave, abscal */
} wrpc_arch_data_t;
/* values mapped to pp_globals->pp_runtime_opts->forcePpsGen */
typedef enum {
pps_force_off,
pps_force_on,
pps_force_check
} wrpc_pps_force_t;
extern struct pp_globals *ppg;
/* wrpc-spll.c (some should move to time-wrpc/) */
int wrpc_spll_locking_enable(struct pp_instance *ppi);
int wrpc_spll_locking_poll(struct pp_instance *ppi, int grandmaster);
int wrpc_spll_locking_poll(struct pp_instance *ppi);
int wrpc_spll_locking_disable(struct pp_instance *ppi);
int wrpc_spll_locking_reset(struct pp_instance *ppi);
int wrpc_spll_enable_ptracker(struct pp_instance *ppi);
int wrpc_adjust_in_progress(void);
int wrpc_adjust_counters(int64_t adjust_sec, int32_t adjust_nsec);
int wrpc_adjust_phase(int32_t phase_ps);
int wrpc_enable_timing_output(struct pp_instance *ppi, int *ppsOutputOn, int enable);
int wrpc_enable_timing_output(struct pp_globals *ppg, int enable);
int wrpc_spll_check_lock_with_timeout(int lock_timeout);
int wrc_ptp_bmc_update(void);
int wrc_ptp_link_down(void);
int wrc_pps_force(wrpc_pps_force_t action);
int wrpc_get_GM_lock_state(struct pp_globals *ppg, pp_timing_mode_state_t *state);
/* wrpc-calibration.c */
int wrpc_read_calibration_data(struct pp_instance *ppi,
uint32_t *deltaTx, uint32_t *deltaRx,
int32_t *fix_alpha, int32_t *clock_period);
int wrpc_calibrating_disable(struct pp_instance *ppi, int txrx);
int wrpc_calibrating_enable(struct pp_instance *ppi, int txrx);
int wrpc_calibrating_poll(struct pp_instance *ppi, int txrx, uint32_t *delta);
int wrpc_calibration_pattern_enable(struct pp_instance *ppi,
unsigned int calibrationPeriod,
unsigned int calibrationPattern,
unsigned int calibrationPatternLen);
int wrpc_calibration_pattern_disable(struct pp_instance *ppi);
int wrpc_get_port_state(struct hal_port_state *port, const char *port_name);
int wrpc_read_calibration_data(
struct pp_instance *ppi,
int32_t *clock_period,
TimeInterval *scaledBitSlide,
RelativeDifference *scaledDelayCoefficient,
TimeInterval *scaledSfpDeltaTx,
TimeInterval *scaledSfpDeltaRx);
int wrpc_get_port_state(struct wrc_port_state *port, const char *port_name);
static inline wrpc_arch_data_t *WRPC_ARCH_I(struct pp_instance *ppi)
{
return (wrpc_arch_data_t *) GLBS(ppi)->arch_data;
}
static inline wrpc_arch_data_t *WRPC_ARCH_G(struct pp_globals *ppg)
{
return (wrpc_arch_data_t *) ppg->arch_data;
}
static inline void wrc_ptp_get_leapsec(int *ptp, int *system)
{
int tmp;
*ptp = ppg->timePropertiesDS->currentUtcOffset;
TOPS(INST(ppg, 0))->get_utc_offset(NULL, system, &tmp, &tmp);
return;
}
static inline void wrc_ptp_set_leapsec(int leapsec)
{
TOPS(INST(ppg, 0))->set_utc_offset(NULL, leapsec, 0, 0);
}
#endif /* __WRPC_H */
......@@ -5,6 +5,10 @@ A := arch-$(ARCH)
SIZE = $(CROSS_COMPILE)size
CFLAGS += -Itools
# needed for --gc-sections option of ld
PPSI_O_LDFLAGS = --entry=main
# Prevent a warning for a missing prototype in pp_printf, bug since ever
ARCH_PP_PRINTF_CFLAGS += -include ../$A/include/strnlen.h
......
......@@ -144,10 +144,10 @@ static unsigned int run_all_state_machines(struct pp_globals *ppg)
ppi->iface_name, ppi->link_up ? "up":"down");
if (ppi->link_up) {
TimeInterval scaledBitSlide;
RelativeDifference scaledDelayCoefficient;
TimeInterval scaledSfpDeltaTx;
TimeInterval scaledSfpDeltaRx;
TimeInterval scaledBitSlide = 0;
RelativeDifference scaledDelayCoefficient = 0;
TimeInterval scaledSfpDeltaTx = 0;
TimeInterval scaledSfpDeltaRx = 0;
ppi->state = PPS_INITIALIZING;
if ( wrs_read_calibration_data(ppi,NULL,
......@@ -155,20 +155,19 @@ static unsigned int run_all_state_machines(struct pp_globals *ppg)
&scaledDelayCoefficient,
&scaledSfpDeltaTx,
&scaledSfpDeltaRx)!= WRH_HW_CALIB_OK ) {
pp_diag(ppi, fsm, 1, "Cannot read bit_slide value values\n");
scaledBitSlide=0;
pp_diag(ppi, fsm, 1, "Cannot get calibration values (bitslide, alpha, TX/Rx delays\n");
}
ppi->timestampCorrectionPortDS.semistaticLatency= scaledBitSlide;
if (scaledDelayCoefficient>=PP_MIN_DELAY_COEFFICIENT_AS_RELDIFF &&
scaledDelayCoefficient<=PP_MAX_DELAY_COEFFICIENT_AS_RELDIFF ) {
/* Scaled delay coefficient is valid then delta tx and rx also */
if ( ppi->asymmetryCorrectionPortDS.enable ) {
ppi->cfg.scaledDelayCoefficient=scaledDelayCoefficient;
enable_asymmetryCorrection(ppi,TRUE);
}
ppi->timestampCorrectionPortDS.egressLatency=picos_to_interval(ppi->cfg.egressLatency_ps)+scaledSfpDeltaTx;
ppi->timestampCorrectionPortDS.ingressLatency=picos_to_interval(ppi->cfg.ingressLatency_ps)+scaledSfpDeltaRx;
}
if (scaledDelayCoefficient>=PP_MIN_DELAY_COEFFICIENT_AS_RELDIFF
&& scaledDelayCoefficient<=PP_MAX_DELAY_COEFFICIENT_AS_RELDIFF ) {
/* Scaled delay coefficient is valid then delta tx and rx also */
if ( ppi->asymmetryCorrectionPortDS.enable ) {
ppi->cfg.scaledDelayCoefficient=scaledDelayCoefficient;
enable_asymmetryCorrection(ppi,TRUE);
}
ppi->timestampCorrectionPortDS.egressLatency=picos_to_interval(ppi->cfg.egressLatency_ps)+scaledSfpDeltaTx;
ppi->timestampCorrectionPortDS.ingressLatency=picos_to_interval(ppi->cfg.ingressLatency_ps)+scaledSfpDeltaRx;
}
}
else {
ppi->next_state = PPS_DISABLED;
......
......@@ -133,3 +133,27 @@ void *create_map(unsigned long address, unsigned long size)
return NULL;
return mapaddr + fragment;
}
char *format_hex(char *s, const unsigned char *mac, int cnt)
{
int i;
*s = '\0';
for (i = 0; i < cnt; i++) {
pp_sprintf(s, "%s%02x:", s, mac[i]);
}
/* remove last colon */
s[cnt * 3 - 1] = '\0'; /* cnt * strlen("FF:") - 1 */
return s;
}
char *format_hex8(char *s, const unsigned char *mac)
{
return format_hex(s, mac, 8);
}
char *format_mac(char *s, const unsigned char *mac)
{
format_hex(s, mac, 6);
return s;
}
......@@ -159,6 +159,9 @@ int main(int argc, char **argv)
}
}
/* it will be opened later for write */
wrs_shm_put(ppsi_head);
/* try connecting to HAL multiple times in case it's still not ready */
hal_retries = WRSW_HAL_RETRIES;
while (hal_retries) { /* may be never, if built without WR extension */
......
#
# PPSI config
#
CONFIG_ARCH="wrpc"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
#
# Options
#
#
# PTP Protocol Options
#
# CONFIG_E2E is not set
CONFIG_P2P=y
CONFIG_HAS_P2P=1
CONFIG_PTP_OVERWRITE_BASIC_ATTRIBUTES=y
CONFIG_PTP_OPT_DOMAIN_NUMBER=1
CONFIG_PTP_OPT_PRIORITY1=129
CONFIG_PTP_OPT_PRIORITY2=129
CONFIG_PTP_OPT_OVERWRITE_ATTRIBUTES=y
CONFIG_PTP_OPT_CLOCK_ACCURACY=248
CONFIG_PTP_OPT_CLOCK_ALLAN_VARIANCE=123
CONFIG_PTP_OPT_TIME_SOURCE=161
CONFIG_LEAP_SECONDS_VAL=37
#
# Enabled profiles
#
CONFIG_PROFILE_WR=y
# CONFIG_PROFILE_HA is not set
# CONFIG_PROFILE_CUSTOM is not set
CONFIG_PROFILE_PTP=y
CONFIG_HAS_EXT_WR=1
CONFIG_HAS_EXT_L1SYNC=0
CONFIG_HAS_EXT_NONE=0
CONFIG_HAS_PROFILE_PTP=1
CONFIG_HAS_PROFILE_HA=0
CONFIG_HAS_PROFILE_WR=1
CONFIG_HAS_PROFILE_CUSTOM=0
CONFIG_PPSI_VLAN=y
CONFIG_VLAN_ARRAY_SIZE=1
CONFIG_PPSI_ASSERT=y
CONFIG_NR_FOREIGN_RECORDS=1
CONFIG_SINGLE_FMASTER=y
CONFIG_NR_PORTS=1
CONFIG_NR_INSTANCES_PER_PORT=1
#
# Code optimization
#
CONFIG_CODEOPT_ENABLED=y
CONFIG_SINGLE_INSTANCE_PER_PORT=y
CONFIG_SINGLE_INSTANCE=y
CONFIG_SINGLE_PORT=y
# CONFIG_CODEOPT_SINGLE_PORT is not set
# CONFIG_CODEOPT_SINGLE_FMASTER is not set
# CONFIG_CODEOPT_SINGLE_INSTANCE_PER_PORT is not set
CONFIG_CODEOPT_WRPC_SIZE=y
CONFIG_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=y
CONFIG_CODEOPT_SO_FORCE_DISABLED=y
CONFIG_CODEOPT_MO_FORCE_DISABLED=y
CONFIG_CODEOPT_EPC_SO_DISABLED=y
CONFIG_OPTIMIZATION="-Os -ggdb"
# CONFIG_FAULT_INJECTION_MECHANISM is not set
CONFIG_NO_PTPDUMP=y
CONFIG_HAS_FAULT_INJECTION_MECHANISM=0
CONFIG_HAS_WRPC_FAULTS=0
CONFIG_HAS_CODEOPT_SINGLE_FMASTER=0
CONFIG_HAS_CODEOPT_SINGLE_PORT=0
CONFIG_HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT=0
CONFIG_HAS_CODEOPT_CODEOPT_WRPC_SIZE=1
CONFIG_HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=0
CONFIG_ARCH_IS_WRPC=1
CONFIG_HAS_PPSI_ASSERT=1
#
# PPSI config
#
CONFIG_ARCH="wrpc"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
#
# Options
#
#
# PTP Protocol Options
#
CONFIG_E2E=y
# CONFIG_P2P is not set
CONFIG_E2E_ONLY=y
CONFIG_HAS_P2P=0
CONFIG_LEAP_SECONDS_VAL=37
#
# Enabled profiles
#
CONFIG_PROFILE_WR=y
# CONFIG_PROFILE_HA is not set
# CONFIG_PROFILE_CUSTOM is not set
CONFIG_PROFILE_PTP=y
CONFIG_HAS_EXT_WR=1
CONFIG_HAS_EXT_L1SYNC=0
CONFIG_HAS_EXT_NONE=0
CONFIG_HAS_PROFILE_PTP=1
CONFIG_HAS_PROFILE_HA=0
CONFIG_HAS_PROFILE_WR=1
CONFIG_HAS_PROFILE_CUSTOM=0
CONFIG_VLAN_ARRAY_SIZE=0
# CONFIG_PPSI_ASSERT is not set
CONFIG_NR_FOREIGN_RECORDS=1
CONFIG_SINGLE_FMASTER=y
CONFIG_NR_PORTS=1
CONFIG_NR_INSTANCES_PER_PORT=1
#
# Code optimization
#
CONFIG_CODEOPT_ENABLED=y
CONFIG_SINGLE_INSTANCE_PER_PORT=y
CONFIG_SINGLE_INSTANCE=y
CONFIG_SINGLE_PORT=y
# CONFIG_CODEOPT_SINGLE_PORT is not set
# CONFIG_CODEOPT_SINGLE_FMASTER is not set
# CONFIG_CODEOPT_SINGLE_INSTANCE_PER_PORT is not set
CONFIG_CODEOPT_WRPC_SIZE=y
CONFIG_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=y
CONFIG_CODEOPT_SO_FORCE_DISABLED=y
CONFIG_CODEOPT_MO_FORCE_DISABLED=y
CONFIG_CODEOPT_EPC_SO_DISABLED=y
CONFIG_OPTIMIZATION="-Os -ggdb"
# CONFIG_FAULT_INJECTION_MECHANISM is not set
CONFIG_HAS_FAULT_INJECTION_MECHANISM=0
CONFIG_HAS_WRPC_FAULTS=0
CONFIG_HAS_CODEOPT_SINGLE_FMASTER=0
CONFIG_HAS_CODEOPT_SINGLE_PORT=0
CONFIG_HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT=0
CONFIG_HAS_CODEOPT_CODEOPT_WRPC_SIZE=1
CONFIG_HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=0
CONFIG_ARCH_IS_WRPC=1
CONFIG_HAS_PPSI_ASSERT=0
#
# PPSI config
#
CONFIG_ARCH="wrpc"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
#
# Options
#
#
# PTP Protocol Options
#
# CONFIG_E2E is not set
CONFIG_P2P=y
CONFIG_HAS_P2P=1
CONFIG_LEAP_SECONDS_VAL=37
#
# Enabled profiles
#
CONFIG_PROFILE_WR=y
# CONFIG_PROFILE_HA is not set
# CONFIG_PROFILE_CUSTOM is not set
CONFIG_PROFILE_PTP=y
CONFIG_HAS_EXT_WR=1
CONFIG_HAS_EXT_L1SYNC=0
CONFIG_HAS_EXT_NONE=0
CONFIG_HAS_PROFILE_PTP=1
CONFIG_HAS_PROFILE_HA=0
CONFIG_HAS_PROFILE_WR=1
CONFIG_HAS_PROFILE_CUSTOM=0
CONFIG_VLAN_ARRAY_SIZE=0
# CONFIG_PPSI_ASSERT is not set
CONFIG_NR_FOREIGN_RECORDS=1
CONFIG_SINGLE_FMASTER=y
CONFIG_NR_PORTS=1
CONFIG_NR_INSTANCES_PER_PORT=1
#
# Code optimization
#
CONFIG_CODEOPT_ENABLED=y
CONFIG_SINGLE_INSTANCE_PER_PORT=y
CONFIG_SINGLE_INSTANCE=y
CONFIG_SINGLE_PORT=y
# CONFIG_CODEOPT_SINGLE_PORT is not set
# CONFIG_CODEOPT_SINGLE_FMASTER is not set
# CONFIG_CODEOPT_SINGLE_INSTANCE_PER_PORT is not set
CONFIG_CODEOPT_WRPC_SIZE=y
CONFIG_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=y
CONFIG_CODEOPT_SO_FORCE_DISABLED=y
CONFIG_CODEOPT_MO_FORCE_DISABLED=y
CONFIG_CODEOPT_EPC_SO_DISABLED=y
CONFIG_OPTIMIZATION="-Os -ggdb"
# CONFIG_FAULT_INJECTION_MECHANISM is not set
CONFIG_HAS_FAULT_INJECTION_MECHANISM=0
CONFIG_HAS_WRPC_FAULTS=0
CONFIG_HAS_CODEOPT_SINGLE_FMASTER=0
CONFIG_HAS_CODEOPT_SINGLE_PORT=0
CONFIG_HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT=0
CONFIG_HAS_CODEOPT_CODEOPT_WRPC_SIZE=1
CONFIG_HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=0
CONFIG_ARCH_IS_WRPC=1
CONFIG_HAS_PPSI_ASSERT=0
#
# Automatically generated file; DO NOT EDIT.
# WR PTP Core software configuration
#
#
# PPSI config
#
CONFIG_ARCH="wrpc"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
#
# Options
#
#
# PTP Protocol Options
#
CONFIG_E2E=y
# CONFIG_P2P is not set
CONFIG_E2E_ONLY=y
CONFIG_HAS_P2P=0
CONFIG_LEAP_SECONDS_VAL=37
#
# Enabled profiles
#
CONFIG_PROFILE_WR=y
# CONFIG_PROFILE_HA is not set
# CONFIG_PROFILE_CUSTOM is not set
CONFIG_PROFILE_PTP=y
CONFIG_HAS_EXT_WR=1
CONFIG_HAS_EXT_L1SYNC=0
CONFIG_HAS_EXT_NONE=0
CONFIG_HAS_PROFILE_PTP=1
CONFIG_HAS_PROFILE_HA=0
CONFIG_HAS_PROFILE_WR=1
CONFIG_HAS_PROFILE_CUSTOM=0
CONFIG_PPSI_VLAN=y
CONFIG_VLAN_ARRAY_SIZE=1
# CONFIG_PPSI_ASSERT is not set
CONFIG_NR_FOREIGN_RECORDS=1
CONFIG_SINGLE_FMASTER=y
CONFIG_NR_PORTS=1
CONFIG_NR_INSTANCES_PER_PORT=1
#
# Code optimization
#
CONFIG_CODEOPT_ENABLED=y
CONFIG_SINGLE_INSTANCE_PER_PORT=y
CONFIG_SINGLE_INSTANCE=y
CONFIG_SINGLE_PORT=y
# CONFIG_CODEOPT_SINGLE_PORT is not set
# CONFIG_CODEOPT_SINGLE_FMASTER is not set
# CONFIG_CODEOPT_SINGLE_INSTANCE_PER_PORT is not set
CONFIG_CODEOPT_WRPC_SIZE=y
CONFIG_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=y
CONFIG_CODEOPT_SO_FORCE_DISABLED=y
CONFIG_CODEOPT_MO_FORCE_DISABLED=y
CONFIG_CODEOPT_EPC_SO_DISABLED=y
CONFIG_OPTIMIZATION="-Os -ggdb"
# CONFIG_FAULT_INJECTION_MECHANISM is not set
CONFIG_HAS_FAULT_INJECTION_MECHANISM=0
CONFIG_HAS_WRPC_FAULTS=0
CONFIG_HAS_CODEOPT_SINGLE_FMASTER=0
CONFIG_HAS_CODEOPT_SINGLE_PORT=0
CONFIG_HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT=0
CONFIG_HAS_CODEOPT_CODEOPT_WRPC_SIZE=1
CONFIG_HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=0
CONFIG_ARCH_IS_WRPC=1
CONFIG_HAS_PPSI_ASSERT=0
#
# PPSI config
#
CONFIG_ARCH="wrpc"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
#
# Options
#
#
# PTP Protocol Options
#
# CONFIG_E2E is not set
CONFIG_P2P=y
CONFIG_HAS_P2P=1
CONFIG_LEAP_SECONDS_VAL=37
#
# Enabled profiles
#
CONFIG_PROFILE_WR=y
# CONFIG_PROFILE_HA is not set
# CONFIG_PROFILE_CUSTOM is not set
CONFIG_PROFILE_PTP=y
CONFIG_HAS_EXT_WR=1
CONFIG_HAS_EXT_L1SYNC=0
CONFIG_HAS_EXT_NONE=0
CONFIG_HAS_PROFILE_PTP=1
CONFIG_HAS_PROFILE_HA=0
CONFIG_HAS_PROFILE_WR=1
CONFIG_HAS_PROFILE_CUSTOM=0
CONFIG_PPSI_VLAN=y
CONFIG_VLAN_ARRAY_SIZE=1
# CONFIG_PPSI_ASSERT is not set
CONFIG_NR_FOREIGN_RECORDS=1
CONFIG_SINGLE_FMASTER=y
CONFIG_NR_PORTS=1
CONFIG_NR_INSTANCES_PER_PORT=1
#
# Code optimization
#
CONFIG_CODEOPT_ENABLED=y
CONFIG_SINGLE_INSTANCE_PER_PORT=y
CONFIG_SINGLE_INSTANCE=y
CONFIG_SINGLE_PORT=y
# CONFIG_CODEOPT_SINGLE_PORT is not set
# CONFIG_CODEOPT_SINGLE_FMASTER is not set
# CONFIG_CODEOPT_SINGLE_INSTANCE_PER_PORT is not set
CONFIG_CODEOPT_WRPC_SIZE=y
CONFIG_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=y
CONFIG_CODEOPT_SO_FORCE_DISABLED=y
CONFIG_CODEOPT_MO_FORCE_DISABLED=y
CONFIG_CODEOPT_EPC_SO_DISABLED=y
CONFIG_OPTIMIZATION="-Os -ggdb"
# CONFIG_FAULT_INJECTION_MECHANISM is not set
CONFIG_HAS_FAULT_INJECTION_MECHANISM=0
CONFIG_HAS_WRPC_FAULTS=0
CONFIG_HAS_CODEOPT_SINGLE_FMASTER=0
CONFIG_HAS_CODEOPT_SINGLE_PORT=0
CONFIG_HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT=0
CONFIG_HAS_CODEOPT_CODEOPT_WRPC_SIZE=1
CONFIG_HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=0
CONFIG_ARCH_IS_WRPC=1
CONFIG_HAS_PPSI_ASSERT=0
#
# PPSI config
#
CONFIG_ARCH="wrpc"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
#
# Options
#
#
# PTP Protocol Options
#
CONFIG_E2E=y
# CONFIG_P2P is not set
CONFIG_E2E_ONLY=y
CONFIG_HAS_P2P=0
CONFIG_LEAP_SECONDS_VAL=37
#
# Enabled profiles
#
CONFIG_PROFILE_WR=y
# CONFIG_PROFILE_HA is not set
# CONFIG_PROFILE_CUSTOM is not set
CONFIG_PROFILE_PTP=y
CONFIG_HAS_EXT_WR=1
CONFIG_HAS_EXT_L1SYNC=0
CONFIG_HAS_EXT_NONE=0
CONFIG_HAS_PROFILE_PTP=1
CONFIG_HAS_PROFILE_HA=0
CONFIG_HAS_PROFILE_WR=1
CONFIG_HAS_PROFILE_CUSTOM=0
CONFIG_PPSI_VLAN=y
CONFIG_VLAN_ARRAY_SIZE=1
# CONFIG_PPSI_ASSERT is not set
CONFIG_NR_FOREIGN_RECORDS=1
CONFIG_SINGLE_FMASTER=y
CONFIG_NR_PORTS=1
CONFIG_NR_INSTANCES_PER_PORT=1
#
# Code optimization
#
CONFIG_CODEOPT_ENABLED=y
CONFIG_SINGLE_INSTANCE_PER_PORT=y
CONFIG_SINGLE_INSTANCE=y
CONFIG_SINGLE_PORT=y
# CONFIG_CODEOPT_SINGLE_PORT is not set
# CONFIG_CODEOPT_SINGLE_FMASTER is not set
# CONFIG_CODEOPT_SINGLE_INSTANCE_PER_PORT is not set
CONFIG_CODEOPT_WRPC_SIZE=y
CONFIG_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=y
CONFIG_CODEOPT_SO_FORCE_DISABLED=y
CONFIG_CODEOPT_MO_FORCE_DISABLED=y
CONFIG_CODEOPT_EPC_SO_DISABLED=y
CONFIG_OPTIMIZATION="-Os -ggdb"
# CONFIG_FAULT_INJECTION_MECHANISM is not set
CONFIG_HAS_FAULT_INJECTION_MECHANISM=0
CONFIG_HAS_WRPC_FAULTS=0
CONFIG_HAS_CODEOPT_SINGLE_FMASTER=0
CONFIG_HAS_CODEOPT_SINGLE_PORT=0
CONFIG_HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT=0
CONFIG_HAS_CODEOPT_CODEOPT_WRPC_SIZE=1
CONFIG_HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=0
CONFIG_ARCH_IS_WRPC=1
CONFIG_HAS_PPSI_ASSERT=0
#
# PPSI config
#
CONFIG_ARCH="wrpc"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
#
# Options
#
#
# PTP Protocol Options
#
CONFIG_E2E=y
# CONFIG_P2P is not set
CONFIG_E2E_ONLY=y
CONFIG_HAS_P2P=0
CONFIG_LEAP_SECONDS_VAL=37
#
# Enabled profiles
#
CONFIG_PROFILE_WR=y
# CONFIG_PROFILE_HA is not set
# CONFIG_PROFILE_CUSTOM is not set
CONFIG_PROFILE_PTP=y
CONFIG_HAS_EXT_WR=1
CONFIG_HAS_EXT_L1SYNC=0
CONFIG_HAS_EXT_NONE=0
CONFIG_HAS_PROFILE_PTP=1
CONFIG_HAS_PROFILE_HA=0
CONFIG_HAS_PROFILE_WR=1
CONFIG_HAS_PROFILE_CUSTOM=0
CONFIG_VLAN_ARRAY_SIZE=0
# CONFIG_PPSI_ASSERT is not set
CONFIG_NR_FOREIGN_RECORDS=1
CONFIG_SINGLE_FMASTER=y
CONFIG_NR_PORTS=1
CONFIG_NR_INSTANCES_PER_PORT=1
#
# Code optimization
#
CONFIG_CODEOPT_ENABLED=y
CONFIG_SINGLE_INSTANCE_PER_PORT=y
CONFIG_SINGLE_INSTANCE=y
CONFIG_SINGLE_PORT=y
# CONFIG_CODEOPT_SINGLE_PORT is not set
# CONFIG_CODEOPT_SINGLE_FMASTER is not set
# CONFIG_CODEOPT_SINGLE_INSTANCE_PER_PORT is not set
CONFIG_CODEOPT_WRPC_SIZE=y
CONFIG_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=y
CONFIG_CODEOPT_SO_FORCE_DISABLED=y
CONFIG_CODEOPT_MO_FORCE_DISABLED=y
CONFIG_CODEOPT_EPC_SO_DISABLED=y
CONFIG_OPTIMIZATION="-Os -ggdb"
# CONFIG_FAULT_INJECTION_MECHANISM is not set
CONFIG_HAS_FAULT_INJECTION_MECHANISM=0
CONFIG_HAS_WRPC_FAULTS=0
CONFIG_HAS_CODEOPT_SINGLE_FMASTER=0
CONFIG_HAS_CODEOPT_SINGLE_PORT=0
CONFIG_HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT=0
CONFIG_HAS_CODEOPT_CODEOPT_WRPC_SIZE=1
CONFIG_HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=0
CONFIG_ARCH_IS_WRPC=1
CONFIG_HAS_PPSI_ASSERT=0
#
# PPSI config
#
CONFIG_ARCH="wrpc"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
#
# Options
#
#
# PTP Protocol Options
#
CONFIG_E2E=y
# CONFIG_P2P is not set
CONFIG_E2E_ONLY=y
CONFIG_HAS_P2P=0
CONFIG_LEAP_SECONDS_VAL=37
#
# Enabled profiles
#
CONFIG_PROFILE_WR=y
# CONFIG_PROFILE_HA is not set
# CONFIG_PROFILE_CUSTOM is not set
CONFIG_PROFILE_PTP=y
CONFIG_HAS_EXT_WR=1
CONFIG_HAS_EXT_L1SYNC=0
CONFIG_HAS_EXT_NONE=0
CONFIG_HAS_PROFILE_PTP=1
CONFIG_HAS_PROFILE_HA=0
CONFIG_HAS_PROFILE_WR=1
CONFIG_HAS_PROFILE_CUSTOM=0
CONFIG_VLAN_ARRAY_SIZE=0
# CONFIG_PPSI_ASSERT is not set
CONFIG_NR_FOREIGN_RECORDS=1
CONFIG_SINGLE_FMASTER=y
CONFIG_NR_PORTS=1
CONFIG_NR_INSTANCES_PER_PORT=1
#
# Code optimization
#
CONFIG_CODEOPT_ENABLED=y
CONFIG_SINGLE_INSTANCE_PER_PORT=y
CONFIG_SINGLE_INSTANCE=y
CONFIG_SINGLE_PORT=y
# CONFIG_CODEOPT_SINGLE_PORT is not set
# CONFIG_CODEOPT_SINGLE_FMASTER is not set
# CONFIG_CODEOPT_SINGLE_INSTANCE_PER_PORT is not set
CONFIG_CODEOPT_WRPC_SIZE=y
CONFIG_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=y
CONFIG_CODEOPT_SO_FORCE_DISABLED=y
CONFIG_CODEOPT_MO_FORCE_DISABLED=y
CONFIG_CODEOPT_EPC_SO_DISABLED=y
CONFIG_OPTIMIZATION="-Os -ggdb"
# CONFIG_FAULT_INJECTION_MECHANISM is not set
CONFIG_HAS_FAULT_INJECTION_MECHANISM=0
CONFIG_HAS_WRPC_FAULTS=0
CONFIG_HAS_CODEOPT_SINGLE_FMASTER=0
CONFIG_HAS_CODEOPT_SINGLE_PORT=0
CONFIG_HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT=0
CONFIG_HAS_CODEOPT_CODEOPT_WRPC_SIZE=1
CONFIG_HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=0
CONFIG_ARCH_IS_WRPC=1
CONFIG_HAS_PPSI_ASSERT=0
#
# PPSI config
#
CONFIG_ARCH="wrpc"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
#
# Options
#
#
# PTP Protocol Options
#
CONFIG_E2E=y
# CONFIG_P2P is not set
CONFIG_E2E_ONLY=y
CONFIG_HAS_P2P=0
CONFIG_LEAP_SECONDS_VAL=37
#
# Enabled profiles
#
CONFIG_PROFILE_WR=y
# CONFIG_PROFILE_HA is not set
# CONFIG_PROFILE_CUSTOM is not set
CONFIG_PROFILE_PTP=y
CONFIG_HAS_EXT_WR=1
CONFIG_HAS_EXT_L1SYNC=0
CONFIG_HAS_EXT_NONE=0
CONFIG_HAS_PROFILE_PTP=1
CONFIG_HAS_PROFILE_HA=0
CONFIG_HAS_PROFILE_WR=1
CONFIG_HAS_PROFILE_CUSTOM=0
CONFIG_VLAN_ARRAY_SIZE=0
# CONFIG_PPSI_ASSERT is not set
CONFIG_NR_FOREIGN_RECORDS=1
CONFIG_SINGLE_FMASTER=y
CONFIG_NR_PORTS=1
CONFIG_NR_INSTANCES_PER_PORT=1
#
# Code optimization
#
CONFIG_CODEOPT_ENABLED=y
CONFIG_SINGLE_INSTANCE_PER_PORT=y
CONFIG_SINGLE_INSTANCE=y
CONFIG_SINGLE_PORT=y
# CONFIG_CODEOPT_SINGLE_PORT is not set
# CONFIG_CODEOPT_SINGLE_FMASTER is not set
# CONFIG_CODEOPT_SINGLE_INSTANCE_PER_PORT is not set
CONFIG_CODEOPT_WRPC_SIZE=y
CONFIG_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=y
CONFIG_CODEOPT_SO_FORCE_DISABLED=y
CONFIG_CODEOPT_MO_FORCE_DISABLED=y
CONFIG_CODEOPT_EPC_SO_DISABLED=y
CONFIG_OPTIMIZATION="-Os -ggdb"
# CONFIG_FAULT_INJECTION_MECHANISM is not set
CONFIG_HAS_FAULT_INJECTION_MECHANISM=0
CONFIG_HAS_WRPC_FAULTS=0
CONFIG_HAS_CODEOPT_SINGLE_FMASTER=0
CONFIG_HAS_CODEOPT_SINGLE_PORT=0
CONFIG_HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT=0
CONFIG_HAS_CODEOPT_CODEOPT_WRPC_SIZE=1
CONFIG_HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=0
CONFIG_ARCH_IS_WRPC=1
CONFIG_HAS_PPSI_ASSERT=0
#
# PPSI config
#
CONFIG_ARCH="wrpc"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
#
# Options
#
#
# PTP Protocol Options
#
CONFIG_E2E=y
# CONFIG_P2P is not set
CONFIG_E2E_ONLY=y
CONFIG_HAS_P2P=0
CONFIG_LEAP_SECONDS_VAL=37
#
# Enabled profiles
#
CONFIG_PROFILE_WR=y
# CONFIG_PROFILE_HA is not set
# CONFIG_PROFILE_CUSTOM is not set
CONFIG_PROFILE_PTP=y
CONFIG_HAS_EXT_WR=1
CONFIG_HAS_EXT_L1SYNC=0
CONFIG_HAS_EXT_NONE=0
CONFIG_HAS_PROFILE_PTP=1
CONFIG_HAS_PROFILE_HA=0
CONFIG_HAS_PROFILE_WR=1
CONFIG_HAS_PROFILE_CUSTOM=0
CONFIG_VLAN_ARRAY_SIZE=0
# CONFIG_PPSI_ASSERT is not set
CONFIG_NR_FOREIGN_RECORDS=1
CONFIG_SINGLE_FMASTER=y
CONFIG_NR_PORTS=1
CONFIG_NR_INSTANCES_PER_PORT=1
#
# Code optimization
#
CONFIG_CODEOPT_ENABLED=y
CONFIG_SINGLE_INSTANCE_PER_PORT=y
CONFIG_SINGLE_INSTANCE=y
CONFIG_SINGLE_PORT=y
# CONFIG_CODEOPT_SINGLE_PORT is not set
# CONFIG_CODEOPT_SINGLE_FMASTER is not set
# CONFIG_CODEOPT_SINGLE_INSTANCE_PER_PORT is not set
CONFIG_CODEOPT_WRPC_SIZE=y
CONFIG_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=y
CONFIG_CODEOPT_SO_FORCE_DISABLED=y
CONFIG_CODEOPT_MO_FORCE_DISABLED=y
CONFIG_CODEOPT_EPC_SO_DISABLED=y
CONFIG_OPTIMIZATION="-Os -ggdb"
# CONFIG_FAULT_INJECTION_MECHANISM is not set
CONFIG_HAS_FAULT_INJECTION_MECHANISM=0
CONFIG_HAS_WRPC_FAULTS=0
CONFIG_HAS_CODEOPT_SINGLE_FMASTER=0
CONFIG_HAS_CODEOPT_SINGLE_PORT=0
CONFIG_HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT=0
CONFIG_HAS_CODEOPT_CODEOPT_WRPC_SIZE=1
CONFIG_HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=0
CONFIG_ARCH_IS_WRPC=1
CONFIG_HAS_PPSI_ASSERT=0
#
# PPSI config
#
CONFIG_ARCH="wrpc"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
#
# Options
#
#
# PTP Protocol Options
#
CONFIG_E2E=y
# CONFIG_P2P is not set
CONFIG_E2E_ONLY=y
CONFIG_HAS_P2P=0
CONFIG_LEAP_SECONDS_VAL=37
#
# Enabled profiles
#
CONFIG_PROFILE_WR=y
# CONFIG_PROFILE_HA is not set
# CONFIG_PROFILE_CUSTOM is not set
CONFIG_PROFILE_PTP=y
CONFIG_HAS_EXT_WR=1
CONFIG_HAS_EXT_L1SYNC=0
CONFIG_HAS_EXT_NONE=0
CONFIG_HAS_PROFILE_PTP=1
CONFIG_HAS_PROFILE_HA=0
CONFIG_HAS_PROFILE_WR=1
CONFIG_HAS_PROFILE_CUSTOM=0
CONFIG_VLAN_ARRAY_SIZE=0
# CONFIG_PPSI_ASSERT is not set
CONFIG_NR_FOREIGN_RECORDS=1
CONFIG_SINGLE_FMASTER=y
CONFIG_NR_PORTS=1
CONFIG_NR_INSTANCES_PER_PORT=1
#
# Code optimization
#
CONFIG_CODEOPT_ENABLED=y
CONFIG_SINGLE_INSTANCE_PER_PORT=y
CONFIG_SINGLE_INSTANCE=y
CONFIG_SINGLE_PORT=y
# CONFIG_CODEOPT_SINGLE_PORT is not set
# CONFIG_CODEOPT_SINGLE_FMASTER is not set
# CONFIG_CODEOPT_SINGLE_INSTANCE_PER_PORT is not set
CONFIG_CODEOPT_WRPC_SIZE=y
CONFIG_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=y
CONFIG_CODEOPT_SO_FORCE_DISABLED=y
CONFIG_CODEOPT_MO_FORCE_DISABLED=y
CONFIG_CODEOPT_EPC_SO_DISABLED=y
CONFIG_OPTIMIZATION="-Os -ggdb"
# CONFIG_FAULT_INJECTION_MECHANISM is not set
CONFIG_HAS_FAULT_INJECTION_MECHANISM=0
CONFIG_HAS_WRPC_FAULTS=0
CONFIG_HAS_CODEOPT_SINGLE_FMASTER=0
CONFIG_HAS_CODEOPT_SINGLE_PORT=0
CONFIG_HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT=0
CONFIG_HAS_CODEOPT_CODEOPT_WRPC_SIZE=1
CONFIG_HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=0
CONFIG_ARCH_IS_WRPC=1
CONFIG_HAS_PPSI_ASSERT=0
......@@ -19,9 +19,9 @@ CONFIG_EXTENSION=""
CONFIG_CROSS_COMPILE=""
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
CONFIG_HAS_VLAN=y
CONFIG_HAS_MULTIPLE_VLAN=y
CONFIG_VLAN=y
CONFIG_SUPPORT_VLAN=y
CONFIG_SUPORRT_MULTIPLE_VLAN=y
CONFIG_PPSI_VLAN=y
CONFIG_MAX_VLANS_PER_PORT=32
CONFIG_VLAN_ARRAY_SIZE=32
CONFIG_DISABLE_OPTIMIZATION=y
......
......@@ -19,8 +19,8 @@ CONFIG_EXTENSION=""
CONFIG_CROSS_COMPILE=""
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
CONFIG_HAS_VLAN=y
CONFIG_HAS_MULTIPLE_VLAN=y
CONFIG_VLAN=y
CONFIG_SUPPORT_VLAN=y
CONFIG_SUPPORT_MULTIPLE_VLAN=y
CONFIG_PPSI_VLAN=y
CONFIG_MAX_VLANS_PER_PORT=32
CONFIG_VLAN_ARRAY_SIZE=32
#
# PTP Protocol Options
#
CONFIG_E2E=y
# CONFIG_P2P is not set
CONFIG_E2E_ONLY=y
CONFIG_HAS_P2P=0
CONFIG_LEAP_SECONDS_VAL=37
#
# Enabled profiles
#
CONFIG_PROFILE_WR=y
# CONFIG_PROFILE_HA is not set
# CONFIG_PROFILE_CUSTOM is not set
CONFIG_PROFILE_PTP=y
CONFIG_HAS_EXT_WR=1
CONFIG_HAS_EXT_L1SYNC=0
CONFIG_HAS_EXT_NONE=0
CONFIG_HAS_PROFILE_PTP=1
CONFIG_HAS_PROFILE_HA=0
CONFIG_HAS_PROFILE_WR=1
CONFIG_HAS_PROFILE_CUSTOM=0
CONFIG_PPSI_VLAN=y
CONFIG_VLAN_ARRAY_SIZE=1
# CONFIG_PPSI_ASSERT is not set
CONFIG_NR_FOREIGN_RECORDS=1
CONFIG_SINGLE_FMASTER=y
CONFIG_NR_PORTS=1
CONFIG_NR_INSTANCES_PER_PORT=1
#
# Code optimization
#
CONFIG_CODEOPT_ENABLED=y
CONFIG_SINGLE_INSTANCE_PER_PORT=y
CONFIG_SINGLE_INSTANCE=y
CONFIG_SINGLE_PORT=y
# CONFIG_CODEOPT_SINGLE_PORT is not set
# CONFIG_CODEOPT_SINGLE_FMASTER is not set
# CONFIG_CODEOPT_SINGLE_INSTANCE_PER_PORT is not set
CONFIG_CODEOPT_WRPC_SIZE=y
CONFIG_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=y
CONFIG_CODEOPT_SO_FORCE_DISABLED=y
CONFIG_CODEOPT_MO_FORCE_DISABLED=y
CONFIG_CODEOPT_EPC_SO_DISABLED=y
CONFIG_OPTIMIZATION="-Os -ggdb"
# CONFIG_FAULT_INJECTION_MECHANISM is not set
CONFIG_HAS_FAULT_INJECTION_MECHANISM=0
CONFIG_HAS_WRPC_FAULTS=0
CONFIG_HAS_CODEOPT_SINGLE_FMASTER=0
CONFIG_HAS_CODEOPT_SINGLE_PORT=0
CONFIG_HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT=0
CONFIG_HAS_CODEOPT_CODEOPT_WRPC_SIZE=1
CONFIG_HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=0
CONFIG_ARCH_IS_WRPC=1
CONFIG_HAS_PPSI_ASSERT=0
......@@ -9,6 +9,14 @@ CONFIG_ARCH_WRPC=y
# CONFIG_ARCH_WRS is not set
# CONFIG_ARCH_SIMULATOR is not set
CONFIG_ARCH="wrpc"
CONFIG_CROSS_COMPILE="/opt/gcc-lm32/bin/lm32-elf-"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
CONFIG_WRPCSW_ROOT="../wrpc-sw"
#
# Options
#
#
# PTP Protocol Options
......@@ -17,15 +25,62 @@ CONFIG_E2E=y
# CONFIG_P2P is not set
CONFIG_E2E_ONLY=y
CONFIG_HAS_P2P=0
CONFIG_EXT_WR=y
# CONFIG_EXT_NONE is not set
CONFIG_EXTENSION="whiterabbit"
CONFIG_CROSS_COMPILE="/opt/gcc-lm32/bin/lm32-elf-"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
CONFIG_WRPCSW_ROOT="../wrpc-sw"
CONFIG_LEAP_SECONDS_VAL=37
#
# Enabled profiles
#
CONFIG_PROFILE_WR=y
# CONFIG_PROFILE_HA is not set
# CONFIG_PROFILE_CUSTOM is not set
CONFIG_PROFILE_PTP=y
CONFIG_HAS_EXT_WR=1
CONFIG_HAS_EXT_L1SYNC=0
CONFIG_HAS_EXT_NONE=0
CONFIG_HAS_PROFILE_PTP=1
CONFIG_HAS_PROFILE_HA=0
CONFIG_HAS_PROFILE_WR=1
CONFIG_HAS_PROFILE_CUSTOM=0
#
# VLAN
#
CONFIG_HAS_VLAN=y
CONFIG_VLAN=y
CONFIG_VLAN_ARRAY_SIZE=1
# CONFIG_DISABLE_OPTIMIZATION is not set
CONFIG_OPTIMIZATION=2
# CONFIG_PPSI_ASSERT is not set
CONFIG_NR_FOREIGN_RECORDS=1
CONFIG_SINGLE_FMASTER=y
CONFIG_NR_PORTS=1
CONFIG_NR_INSTANCES_PER_PORT=1
#
# Code optimization
#
CONFIG_CODEOPT_ENABLED=y
CONFIG_SINGLE_INSTANCE_PER_PORT=y
CONFIG_SINGLE_INSTANCE=y
CONFIG_SINGLE_PORT=y
# CONFIG_CODEOPT_SINGLE_PORT is not set
# CONFIG_CODEOPT_SINGLE_FMASTER is not set
# CONFIG_CODEOPT_SINGLE_INSTANCE_PER_PORT is not set
CONFIG_CODEOPT_WRPC_SIZE=y
CONFIG_CODEOPT_EPC_SO_DISABLED=y
# CONFIG_CODEOPT_EPC_ENABLED is not set
# CONFIG_CODEOPT_SO_ENABLED is not set
# CONFIG_OPTIMIZATION_SPEED is not set
CONFIG_OPTIMIZATION_SIZE_SPEED=y
# CONFIG_OPTIMIZATION_DEBUGGING is not set
# CONFIG_OPTIMIZATION_NONE_DEBUGGING is not set
CONFIG_OPTIMIZATION="-Os -ggdb"
# CONFIG_FAULT_INJECTION_MECHANISM is not set
CONFIG_HAS_FAULT_INJECTION_MECHANISM=0
CONFIG_HAS_WRPC_FAULTS=0
CONFIG_HAS_CODEOPT_SINGLE_FMASTER=0
CONFIG_HAS_CODEOPT_SINGLE_PORT=0
CONFIG_HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT=0
CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=0
CONFIG_ARCH_IS_WRPC=1
CONFIG_HAS_PPSI_ASSERT=0
#
# PPSI config
#
CONFIG_ARCH="wrpc"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
#
# Options
#
#
# PTP Protocol Options
#
CONFIG_E2E=y
# CONFIG_P2P is not set
CONFIG_E2E_ONLY=y
CONFIG_HAS_P2P=0
CONFIG_LEAP_SECONDS_VAL=37
#
# Enabled profiles
#
CONFIG_PROFILE_WR=y
# CONFIG_PROFILE_HA is not set
# CONFIG_PROFILE_CUSTOM is not set
CONFIG_PROFILE_PTP=y
CONFIG_HAS_EXT_WR=1
CONFIG_HAS_EXT_L1SYNC=0
CONFIG_HAS_EXT_NONE=0
CONFIG_HAS_PROFILE_PTP=1
CONFIG_HAS_PROFILE_HA=0
CONFIG_HAS_PROFILE_WR=1
CONFIG_HAS_PROFILE_CUSTOM=0
CONFIG_VLAN_ARRAY_SIZE=0
# CONFIG_PPSI_ASSERT is not set
CONFIG_NR_FOREIGN_RECORDS=1
CONFIG_SINGLE_FMASTER=y
CONFIG_NR_PORTS=1
CONFIG_NR_INSTANCES_PER_PORT=1
#
# Code optimization
#
CONFIG_CODEOPT_ENABLED=y
CONFIG_SINGLE_INSTANCE_PER_PORT=y
CONFIG_SINGLE_INSTANCE=y
CONFIG_SINGLE_PORT=y
# CONFIG_CODEOPT_SINGLE_PORT is not set
# CONFIG_CODEOPT_SINGLE_FMASTER is not set
# CONFIG_CODEOPT_SINGLE_INSTANCE_PER_PORT is not set
CONFIG_CODEOPT_WRPC_SIZE=y
CONFIG_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=y
CONFIG_CODEOPT_SO_FORCE_DISABLED=y
CONFIG_CODEOPT_MO_FORCE_DISABLED=y
CONFIG_CODEOPT_EPC_SO_DISABLED=y
CONFIG_OPTIMIZATION="-Os -ggdb"
# CONFIG_FAULT_INJECTION_MECHANISM is not set
CONFIG_HAS_FAULT_INJECTION_MECHANISM=0
CONFIG_HAS_WRPC_FAULTS=0
CONFIG_HAS_CODEOPT_SINGLE_FMASTER=0
CONFIG_HAS_CODEOPT_SINGLE_PORT=0
CONFIG_HAS_CODEOPT_SINGLE_INSTANCE_PER_PORT=0
CONFIG_HAS_CODEOPT_CODEOPT_WRPC_SIZE=1
CONFIG_HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED=1
CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=0
CONFIG_ARCH_IS_WRPC=1
CONFIG_HAS_PPSI_ASSERT=0
......@@ -43,12 +43,12 @@ CONFIG_HAS_PROFILE_CUSTOM=0
#
# VLAN
#
CONFIG_HAS_VLAN=y
CONFIG_HAS_MULTIPLE_VLAN=y
CONFIG_VLAN=y
CONFIG_SUPPORT_VLAN=y
CONFIG_SUPPORT_MULTIPLE_VLAN=y
CONFIG_PPSI_VLAN=y
CONFIG_MAX_VLANS_PER_PORT=32
CONFIG_VLAN_ARRAY_SIZE=32
# CONFIG_ASSERT is not set
# CONFIG_PPSI_ASSERT is not set
CONFIG_NR_FOREIGN_RECORDS=5
# CONFIG_SINGLE_FMASTER is not set
CONFIG_NR_PORTS=18
......@@ -79,4 +79,4 @@ CONFIG_HAS_CODEOPT_EPC_ENABLED=0
CONFIG_HAS_CODEOPT_SO_ENABLED=0
CONFIG_ARCH_IS_WRS=1
CONFIG_ARCH_IS_WRPC=0
CONFIG_HAS_ASSERT=0
CONFIG_HAS_PPSI_ASSERT=0
......@@ -58,7 +58,7 @@
@top Introduction
PPSi (@sc{ptp} Ported to Silicon) is an application which, in
its basic operation, implements @sc{ieee} 1588-2020 specification in a way
its basic operation, implements @sc{ieee} 1588-2019 specification in a way
that is portable to several architectures, including OS-less ones.
This manual is mainly aimed at developers: people who are working with
......@@ -79,7 +79,7 @@ thousands of I/O devices distributed in a network several kilometers
wide; its software protocol is an extension of @sc{ptp}. A WR network is
made up of two devices: the @i{WR Switch} and the @i{WR Node}. White
Rabbit is developed at ohwr.org:
@url{http://www.ohwr.org/project/white-rabbit}.
@url{https://www.ohwr.org/project/white-rabbit}.
The WR switch is an 18-ports Gigabit Ethernet switch that runs
@sc{wr-ptp} as a Linux process, synchronizing each Ethernet link as
......@@ -104,8 +104,8 @@ We thank Danilo Sabato for fixing the @i{bare} architectures
The home page of the PPSi project and the source repository are:
@indentedblock
@itemize @bullet
@item @url{http://www.ohwr.org/project/ppsi}
@item ssh://git@@ohwr.org:7999/project/ppsi.git;
@item @url{https://www.ohwr.org/project/ppsi}
@item ssh://git@@ohwr.org:7999/project/ppsi.git
@end itemize
@end indentedblock
......@@ -376,7 +376,7 @@ As of 2013-05 the project suffers from these known bugs:
@itemize
@item All frames must be sent according to a pseudo-random distribution;
this is mostly in place but mut be audited project-wide.
this is mostly in place but must be audited project-wide.
@item We removed @i{peer-delay} support. We plan to add it back, and
actually move White Rabbit to use @i{peer-delay} @sc{ptp} instead of
@i{end-to-end} @sc{ptp}.
......@@ -445,7 +445,7 @@ following 'port-specific' keywords will be associated to this port until
a new keyword 'port' or 'link' appears.
@anchor{arg-types}
An option is a key/value(s) pair separated by at least a space character '@t{key value(s)}'. The '@t{value{s}}' entry
An option is a key/value(s) pair separated by at least a space character '@t{key value(s)}'. The '@t{value(s)}' entry
depends on the option type. Few types are supported by PPSi:
......@@ -508,25 +508,25 @@ Some old keywords will be marked '@i{(deprecated)}', and will be removed in the
other as defined by the PTP protocol. A domain defines the scope of
PTP message communication, state, operations, data sets, and
timescale. PTP devices may participate in multiple domains.
For more details please refer to the IEEE 1588-2020 standard.
For more details please refer to the IEEE 1588-2019 standard.
@item @b{priority1} @i{[Int32]}
A user configurable designation that a clock belongs to an ordered
set of PTP devices from which a PTP Master is selected.
For more details please refer to the IEEE 1588-2020 standard.
For more details please refer to the IEEE 1588-2019 standard.
@item @b{priority2} @i{[Int32]}
A user configurable designation that provides finer grained ordering
among otherwise equivalent PTP devices.
For more details please refer to the IEEE 1588-2020 standard.
For more details please refer to the IEEE 1588-2019 standard.
@item @b{forcePpsGen} @i{[Boolean]}
Configuration of the PPS output. By default, the PPS is generated
only when the clock class is set to 6(Grand master) or to 193(Free Running master.
When this option is set, the PPS is always generated.
Configuration of the PPS output. By default, the PPS is generated all the time
only when the clock class is set to 6 (Grand master) or to 193 (Free Running master).
When this option is set, the PPS is generated all the time for all clock class.
@item @b{ptpFallbackPpsGen} @i{[Boolean]}
if activated, enables the PPS generation if a slave instance
if activated, enables the PPS generation if a slave instance
programmed to use an extension protocol (WR, L1Sync, ...) is falling back
to PTP communication only.
......@@ -548,14 +548,14 @@ Some old keywords will be marked '@i{(deprecated)}', and will be removed in the
This option is used to force the state of all port instances. The BMCA is then disabled
in PPSi.
When enabled, the port-specific option @t{desiredState} must be defined for each port instance
For more details please refer to the IEEE 1588-2020 (clause 17.6.2)
For more details please refer to the IEEE 1588-2019 (clause 17.6.2)
@item @b{slaveOnly} @i{[Boolean]}
A @t{slaveOnly} Ordinary Clock utilizes the slaveOnly state machine
which does not enable transition to MASTER state.
This option must not be used when @i{externalPortConfigurationEnabled} is
enabled.
For more details please refer to the IEEE 1588-2020 (clause 9.2.2.1)
For more details please refer to the IEEE 1588-2019 (clause 9.2.2.1)
@end table
......@@ -595,7 +595,7 @@ Some old keywords will be marked '@i{(deprecated)}', and will be removed in the
@item @b{masterOnly} @i{[Boolean]}
If enabled , activates the optional '@i{masterOnly}' feature
(refer to the IEEE 1588-2020 - clause 9.2.2.2).
(refer to the IEEE 1588-2019 - clause 9.2.2.2).
This option cannot be used if the global option '@i{externalPortConfiguration}' is
enabled.
If this option is not set, then the standard BMCA algorithm will be used.
......@@ -819,7 +819,7 @@ code, in the following way.
@itemize @bullet
@item Each architecture states, in @t{Kconfig}, whether it supports
vlans (@t{HAS_VLAN}) and multiple vlans (@t{HAS_MULTIPLE_VLAN}).
vlans (@t{SUPPORT_VLAN}) and multiple vlans (@t{SUPPORT_MULTIPLE_VLAN}).
@item The configuration parser (@t{lib/conf.c}) accepts a @t{vlan}
keyword, specifying one or more vlans. If several, they are
......
......@@ -9,13 +9,14 @@
#ifndef __WRH_H__
#define __WRH_H__
/* Please increment WRS_PPSI_SHMEM_VERSION if you change any exported data structure */
#define WRS_PPSI_SHMEM_VERSION 35
/* Don't include the Following when this file is included in assembler. */
#ifndef __ASSEMBLY__
#include <stdint.h>
#include <hal_exports.h>
#include <ppsi/lib.h>
/* Please increment WRS_PPSI_SHMEM_VERSION if you change any exported data structure */
#define WRS_PPSI_SHMEM_VERSION 33
/* White Rabbit softpll status values */
#define WRH_SPLL_ERROR -1
#define WRH_SPLL_OK 0
......@@ -146,11 +147,12 @@ static inline wrh_servo_t *WRH_SRV(struct pp_instance *ppi)
extern void wrh_servo_enable_tracking(int enable);
extern int wrh_servo_init(struct pp_instance *ppi);
extern void wrh_servo_reset(struct pp_instance *ppi);
extern void wrh_servo_enable_tracking(int enable);
extern int wrh_servo_got_sync(struct pp_instance *ppi);
extern int wrh_servo_got_resp(struct pp_instance *ppi);
extern int wrh_servo_got_presp(struct pp_instance *ppi);
extern int wrh_update_correction_values(struct pp_instance *ppi);
#endif /* __ASSEMBLY__ */
#endif /* __WRH_H__ */
......@@ -12,11 +12,11 @@ extern void panic(const char *fmt, ...)
__attribute__((format(printf,1,2)));
#define assert(cond, fmt, ...) \
if (CONFIG_HAS_ASSERT && !(cond)) \
if (CONFIG_HAS_PPSI_ASSERT && !(cond)) \
__assert(__func__, __LINE__, 1 /* forever */, fmt, ## __VA_ARGS__)
#define assert_warn(cond, fmt, ...) \
if (CONFIG_HAS_ASSERT && !(cond)) \
if (CONFIG_HAS_PPSI_ASSERT && !(cond)) \
__assert(__func__, __LINE__, 0 /* once */, fmt, ## __VA_ARGS__)
......
......@@ -9,6 +9,19 @@
#ifndef __PPSI_CONSTANTS_H__
#define __PPSI_CONSTANTS_H__
#ifndef CONFIG_PTP_OVERWRITE_BASIC_ATTRIBUTES
#define CONFIG_PTP_OPT_DOMAIN_NUMBER 0
#define CONFIG_PTP_OPT_PRIORITY1 128
#define CONFIG_PTP_OPT_PRIORITY2 128
#endif
#ifndef CONFIG_PTP_OPT_OVERWRITE_ATTRIBUTES
/* not defined */
#define CONFIG_PTP_OPT_CLOCK_ACCURACY -1
#define CONFIG_PTP_OPT_CLOCK_ALLAN_VARIANCE -1
#define CONFIG_PTP_OPT_TIME_SOURCE -1
#endif
/* general purpose constants */
#define PP_NSEC_PER_SEC (1000*1000*1000)
#define PP_PSEC_PER_SEC ((int64_t)1000*(int64_t)PP_NSEC_PER_SEC)
......@@ -26,7 +39,7 @@
#define PP_MIN_DOMAIN_NUMBER 0
#define PP_MAX_DOMAIN_NUMBER 127
#define PP_DEFAULT_DOMAIN_NUMBER 0
#define PP_DEFAULT_DOMAIN_NUMBER CONFIG_PTP_OPT_DOMAIN_NUMBER
#define PP_DEFAULT_ANNOUNCE_INTERVAL 1 /* 0 in 802.1AS */
#define PP_MIN_ANNOUNCE_INTERVAL 0
......@@ -56,11 +69,11 @@
#define PP_DEFAULT_UTC_OFFSET 37
#define PP_MIN_PRIORITY1 0
#define PP_MAX_PRIORITY1 255
#define PP_DEFAULT_PRIORITY1 128
#define PP_DEFAULT_PRIORITY1 CONFIG_PTP_OPT_PRIORITY1
#define PP_MIN_PRIORITY2 0
#define PP_MAX_PRIORITY2 255
#define PP_DEFAULT_PRIORITY2 128
#define PP_DEFAULT_PRIORITY2 CONFIG_PTP_OPT_PRIORITY2
#define PP_DEFAULT_EXT_PORT_CONFIG_ENABLE 0
......@@ -126,7 +139,7 @@
/* Free running master */
#define PP_FRUNNING_CLOCK_CLASS PP_ARB_CLASS_GM_UNLOCKED_B
#define PP_FRUNNING_CLOCK_VARIANCE PP_ARB_VARIANCE_GM_UNLOCKED
#define PP_FRUNNING_CLOCK_ACCURACY PP_ARB_ACCURACY_GM_UNLOCKED
#define PP_FRUNNING_CLOCK_ACCURACY PP_ARB_ACCURACY_GM_UNLOCKED_B
#define PP_NR_FOREIGN_RECORDS CONFIG_NR_FOREIGN_RECORDS /* Clause 9.3.2.4.5 */
#define PP_FOREIGN_MASTER_TIME_WINDOW 4
......@@ -170,9 +183,6 @@
#define PP_MCAST_MACADDRESS "\x01\x1B\x19\x00\x00\x00"
#define PP_PDELAY_MACADDRESS "\x01\x80\xC2\x00\x00\x0E"
#define PP_E2E_MECH 0
#define PP_P2P_MECH 1
#include <arch/constants.h> /* architectures may override the defaults */
#endif /* __PPSI_CONSTANTS_H__ */
......@@ -72,7 +72,7 @@ typedef struct Timestamp { /* page 13 (33) -- no typedef expected */
UInteger32 nanosecondsField;
} Timestamp;
/** ******************* IEEE1588-2018 **************************************/
/** ******************* IEEE1588-2019 **************************************/
#define REL_DIFF_FRACBITS 62
#define REL_DIFF_FRACBITS_AS_FLOAT 62.0
#define REL_DIFF_TWO_POW_FRACBITS ((double)4.611686018427388E18) /* double value returned by pow(2.0,62.0) */
......@@ -86,7 +86,7 @@ typedef struct Timestamp { /* page 13 (33) -- no typedef expected */
/*draft P1588_v_29: page 17*/
/* The scaledRelativeDifference member is the relative difference expressed
* as a dimensionless fraction and multiplied by 2+^62, with any remaining
* as a dimensionless fraction and multiplied by 2^+62, with any remaining
* fractional part truncated. */
typedef Integer64 RelativeDifference;
......@@ -229,7 +229,7 @@ typedef struct { /* page 65 */
UInteger8 priority2;
UInteger8 domainNumber;
Boolean slaveOnly;
/** Optional (IEEE1588-2018) */
/** Optional (IEEE1588-2019) */
Timestamp currentTime; /*draft P1588_v_29: page 85*/
Boolean instanceEnable; /*draft P1588_v_29: page 86*/
Boolean externalPortConfigurationEnabled; /*draft P1588_v_29: page 86*/
......@@ -280,7 +280,7 @@ typedef struct { /* page 72 */
UInteger4 versionNumber;
void *ext_dsport;
/** (IEEE1588-2018) */
/** (IEEE1588-2019) */
Integer8 logMinPdelayReqInterval; /*draft P1588_v_29: page 124 */
UInteger4 minorVersionNumber; /*draft P1588_v_29: page 124 */
TimeInterval delayAsymmetry; /*draft P1588_v_29: page 124 */
......@@ -305,7 +305,7 @@ typedef struct { /* page 70 */
Enumeration8 timeSource;
} timePropertiesDS_t;
/** ******************* IEEE1588-2018 **************************************
/** ******************* IEEE1588-2019 **************************************
* Adding new optional data sets (DS) defined in clause, only these relevant
* for HA
*/
......@@ -424,11 +424,12 @@ enum ENTimeSource {
/* Enumeration Delay mechanism (table 21, page 126) */
enum ENDelayMechanism {
E2E = 1,
P2P = 2,
COMMON_P2P = 3,
SPECIAL = 4,
NO_MECHANISM = 0xFE
MECH_E2E = 1,
MECH_P2P = 2,
MECH_MAX_SUPPORTED = 2,
MECH_COMMON_P2P = 3,
MECH_SPECIAL = 4,
MECH_NO_MECHANISM = 0xFE
};
/* clockAccuracy enumeration (table 5) */
......
......@@ -15,4 +15,7 @@ extern int atoi(const char *s);
extern uint32_t __div64_32(uint64_t *n, uint32_t base);
extern char *format_hex8(char *s, const unsigned char *mac);
extern char *format_mac(char *s, const unsigned char *mac);
#endif /* __PPSI_LIB_H__ */
......@@ -20,7 +20,7 @@ struct pp_runtime_opts {
int clock_quality_clockAccuracy; // ClockQuality.clockAccuracy
int clock_quality_offsetScaledLogVariance; // ClockQuality.offsetScaledLogVariance
int timeSource; // timePropertiesDS_t.timeSource
Boolean ptpTimeScale; // timePropertiesDS_t.timeSource
Boolean ptpTimeScale; // timePropertiesDS_t.timeScale
Boolean frequencyTraceable; // timePropertiesDS_t.frequencyTraceable
Boolean timeTraceable; // timePropertiesDS_t.timeTraceable
Integer32 ttl;
......@@ -95,6 +95,7 @@ struct pp_frgn_master {
unsigned long lastAnnounceMsgMs; // Last time in ms when the announce message was received
/* used by extension */
UInteger16 ext_specific[4]; /* Extension specific. Must be UInteger16 to align it in the structure*/
unsigned char peer_mac[6];
};
/*
......@@ -243,7 +244,7 @@ struct pp_instance {
/* The net_path used to be allocated separately, but there's no need */
struct pp_channel ch[__NR_PP_NP]; /* general and event ch */
Integer32 mcast_addr[2]; /* only ipv4/udp */
Integer32 mcast_addr[MECH_MAX_SUPPORTED + 1]; /* only ipv4/udp */
int tx_offset, rx_offset; /* ptp payload vs send/recv */
unsigned char peer[6]; /* Our peer's MAC address from last received msg*/
unsigned char activePeer[6]; /* Our peer's MAC address we talk with */
......
......@@ -59,7 +59,7 @@ struct pp_msgtype_info {
pp_std_messages msg_type;
uint16_t msglen;
unsigned char chtype;
unsigned char is_pdelay;
unsigned char delay_mechanism;
unsigned char controlField; /* Table 23 */
unsigned char logMessageInterval; /* Table 24, see defines */
......@@ -170,21 +170,32 @@ static inline struct pp_servo *SRV(struct pp_instance *ppi)
}
static inline int is_externalPortConfigurationEnabled (defaultDS_t *def) {
return CONFIG_HAS_CODEOPT_EPC_ENABLED || def->externalPortConfigurationEnabled;
return CONFIG_HAS_CODEOPT_EXT_PORT_CONF_FORCE_DISABLED == 0
&& (CONFIG_HAS_CODEOPT_EPC_ENABLED
|| def->externalPortConfigurationEnabled);
}
static inline int is_delayMechanismP2P(struct pp_instance *ppi) {
return CONFIG_HAS_P2P && ppi->delayMechanism == P2P;
return CONFIG_HAS_P2P && ppi->delayMechanism == MECH_P2P;
}
static inline int is_delayMechanismE2E(struct pp_instance *ppi) {
return CONFIG_HAS_P2P==0 || ppi->delayMechanism == E2E;
return CONFIG_HAS_P2P==0 || ppi->delayMechanism == MECH_E2E;
}
static inline int is_slaveOnly(defaultDS_t *def) {
return CONFIG_HAS_CODEOPT_EPC_ENABLED==0 && def->slaveOnly;
return CONFIG_HAS_CODEOPT_SO_FORCE_DISABLED == 0 && CONFIG_HAS_CODEOPT_EPC_ENABLED==0 && def->slaveOnly;
}
static inline int is_masterOnly(portDS_t *portDS) {
#if CONFIG_HAS_CODEOPT_MO_FORCE_DISABLED
return 0;
#else
return portDS->masterOnly;
#endif
}
static inline int get_numberPorts(defaultDS_t *def) {
return CONFIG_HAS_CODEOPT_SINGLE_PORT ? 1 : def->numberPorts;
}
......@@ -407,7 +418,7 @@ extern int64_t interval_to_picos(TimeInterval interval);
extern int is_timestamps_incorrect(struct pp_instance *ppsi, int *err_count, int ts_mask);
extern char *time_to_string(struct pp_time *t);
extern char *interval_to_string(TimeInterval time);
extern char *relative_interval_to_string(TimeInterval time);
extern char *relative_interval_to_string(RelativeDifference time);
/*
* The state machine itself is an array of these structures.
......
......@@ -43,7 +43,7 @@ static struct pp_instance ppi_static = {
.port_name = "eth0",
.vlans_array_len = CONFIG_VLAN_ARRAY_SIZE,
.proto = PP_DEFAULT_PROTO,
.delayMechanism = CONFIG_HAS_P2P ? P2P : E2E,
.delayMechanism = CONFIG_HAS_P2P ? MECH_P2P : MECH_E2E,
.__tx_buffer = __tx_buffer,
.__rx_buffer = __rx_buffer,
};
......
......@@ -310,9 +310,9 @@ static struct pp_argname arg_profile[] = {
{},
};
static struct pp_argname arg_delayMechanism[] = {
{"request-response delay e2e", E2E},
{"request-response delay e2e", MECH_E2E},
#if CONFIG_HAS_P2P
{"peer-delay pdelay p2p", P2P},
{"peer-delay pdelay p2p", MECH_P2P},
#endif
{},
};
......
......@@ -115,8 +115,8 @@ int64_t pp_time_to_picos(struct pp_time *t)
void fixedDelta_to_pp_time(struct FixedDelta fd, struct pp_time *t) {
/* FixedDelta is expressed in ps*2^16 */
uint64_t *v=(uint64_t*)&fd;
t->scaled_nsecs=*v/1000L; /* We can do it because scaled_nsecs is also multiply by 2^16 */
uint64_t v = ((uint64_t)fd.scaledPicoseconds.msb)<<32 | (uint64_t)fd.scaledPicoseconds.lsb;
t->scaled_nsecs=v/1000L; /* We can do it because scaled_nsecs is also multiply by 2^16 */
t->secs=0;
normalize_pp_time(t);
}
......@@ -124,16 +124,17 @@ void fixedDelta_to_pp_time(struct FixedDelta fd, struct pp_time *t) {
void picos_to_pp_time(int64_t picos, struct pp_time *ts)
{
uint64_t sec, nsec;
uint64_t picos_u;
int sign = (picos < 0 ? -1 : 1);
picos *= sign;
sec=picos/PP_PSEC_PER_SEC;
picos-=sec*PP_PSEC_PER_SEC;
nsec = picos/1000;
picos%=1000;
picos_u = picos * sign;
sec = picos_u / PP_PSEC_PER_SEC;
picos_u -= sec * PP_PSEC_PER_SEC;
nsec = picos_u / 1000;
picos_u %= 1000;
ts->scaled_nsecs = nsec << TIME_FRACBITS;
ts->scaled_nsecs += ((picos << TIME_FRACBITS)+TIME_ROUNDING_VALUE) / 1000;
ts->scaled_nsecs += ((picos_u << TIME_FRACBITS) + TIME_ROUNDING_VALUE)/ 1000;
ts->scaled_nsecs *= sign;
ts->secs = sec * sign;
}
......@@ -143,9 +144,9 @@ void picos_to_pp_time(int64_t picos, struct pp_time *ts)
void pp_time_hardwarize(struct pp_time *time, int clock_period_ps,
int32_t *ticks, int32_t *picos)
{
int64_t ps, adj_ps;
uint64_t ps, adj_ps;
int32_t sign=(time->scaled_nsecs<0) ? -1 : 1;
int64_t scaled_nsecs=time->scaled_nsecs*sign;
uint64_t scaled_nsecs = time->scaled_nsecs * sign;
if ( clock_period_ps <= 0 ) {
pp_error("%s : Invalid clock period %d\n",__func__, clock_period_ps);
......@@ -178,11 +179,12 @@ TimeInterval picos_to_interval(int64_t picos)
} else {
int64_t scaled_ns;
uint64_t picos_u;
int sign = (picos < 0 ? -1 : 1);
picos *= sign;
scaled_ns=(picos/1000) << TIME_INTERVAL_FRACBITS; /* Calculate nanos */
scaled_ns+=((picos%1000) << TIME_INTERVAL_FRACBITS)/1000; /* Add picos */
picos_u = picos * sign;
scaled_ns = (picos_u / 1000) << TIME_INTERVAL_FRACBITS; /* Calculate nanos */
scaled_ns += ((picos_u % 1000) << TIME_INTERVAL_FRACBITS) / 1000; /* Add picos */
return scaled_ns*sign;
}
......@@ -271,35 +273,43 @@ char *time_to_string(struct pp_time *t)
/* Convert TimeInterval to string */
char *interval_to_string(TimeInterval time)
{
int64_t sign,nanos,picos;
int64_t nanos;
uint32_t picos;
char sign = ' ';
if ( time<0 && time !=INT64_MIN) {
sign=-1;
sign='-';
time=-time;
} else {
sign=1;
}
nanos = time >> TIME_INTERVAL_FRACBITS;
picos = (((time & TIME_INTERVAL_FRACMASK) * 1000) + TIME_INTERVAL_ROUNDING_VALUE ) >> TIME_INTERVAL_FRACBITS;
sprintf(time_as_string,"%" PRId64 ".%03" PRId64, sign*nanos,picos);
pp_sprintf(time_as_string,"%c%" PRId64 ".%03d", sign, nanos, picos);
return time_as_string;
}
/* Convert RelativeInterval to string */
char *relative_interval_to_string(TimeInterval time) {
int32_t nsecs=time >> REL_DIFF_FRACBITS;
uint64_t sub_yocto=0;
int64_t fraction;
uint64_t bitWeight=500000000000000000;
char *relative_interval_to_string(RelativeDifference time)
{
char sign;
int32_t nsecs;
uint64_t sub_yocto = 0;
int64_t fraction;
uint64_t bitWeight = 500000000000000000;
uint64_t mask;
if (time < 0) {
time =- time;
sign = '-';
} else {
sign = '+';
}
fraction=time & REL_DIFF_FRACMASK;
for (mask=(uint64_t) 1<< (REL_DIFF_FRACBITS-1);mask!=0; mask>>=1 ) {
if ( mask & fraction )
sub_yocto+=bitWeight;
bitWeight/=2;
nsecs = time >> REL_DIFF_FRACBITS;
fraction=time & REL_DIFF_FRACMASK;
for (mask = (uint64_t) 1 << (REL_DIFF_FRACBITS - 1); mask != 0; mask >>= 1) {
if (mask & fraction)
sub_yocto += bitWeight;
bitWeight /= 2;
}
sprintf(time_as_string,"%"PRId32".%018"PRIu64, nsecs, sub_yocto);
pp_sprintf(time_as_string,"%c%"PRId32".%018Ld", sign, nsecs, sub_yocto);
return time_as_string;
}
......@@ -2,43 +2,43 @@
/*
* PP_NP_GEN/EVT is the event or general message. It selects the socket etc
* PP_P2P_MECH is used to select a destination address for pdelay frames.
* P2P is used to select a destination address for pdelay frames.
* the numeric 0..5 is the "controlField" (magic ptpV1 numbers in byte 32).
* PP_LOG is the kind of logInterval to put in byte 33.
*/
struct pp_msgtype_info pp_msgtype_info[] = {
[PPM_SYNC_FMT] = {
PPM_SYNC, PP_SYNC_LENGTH,
PP_NP_EVT, PP_E2E_MECH, 0, PP_LOG_SYNC },
PP_NP_EVT, MECH_E2E, 0, PP_LOG_SYNC },
[PPM_DELAY_REQ_FMT] = {
PPM_DELAY_REQ, PP_DELAY_REQ_LENGTH,
PP_NP_EVT, PP_E2E_MECH, 1, 0x7f },
PP_NP_EVT, MECH_E2E, 1, 0x7f },
[PPM_PDELAY_REQ_FMT] = {
PPM_PDELAY_REQ,PP_PDELAY_REQ_LENGTH,
PP_NP_EVT, PP_P2P_MECH, 5, 0x7f },
PP_NP_EVT, MECH_P2P, 5, 0x7f },
[PPM_PDELAY_RESP_FMT] = {
PPM_PDELAY_RESP, PP_PDELAY_RESP_LENGTH,
PP_NP_EVT, PP_P2P_MECH, 5, 0x7f },
PP_NP_EVT, MECH_P2P, 5, 0x7f },
[PPM_FOLLOW_UP_FMT] = {
PPM_FOLLOW_UP, PP_FOLLOW_UP_LENGTH,
PP_NP_GEN, PP_E2E_MECH, 2, PP_LOG_SYNC },
PP_NP_GEN, MECH_E2E, 2, PP_LOG_SYNC },
[PPM_DELAY_RESP_FMT] = {
PPM_DELAY_RESP, PP_DELAY_RESP_LENGTH,
PP_NP_GEN, PP_E2E_MECH, 3, PP_LOG_REQUEST },
PP_NP_GEN, MECH_E2E, 3, PP_LOG_REQUEST },
[PPM_PDELAY_R_FUP_FMT] = {
PPM_PDELAY_R_FUP, PP_PDELAY_RESP_FOLLOW_UP_LENGTH,
PP_NP_GEN, PP_P2P_MECH, 5, 0x7f },
PP_NP_GEN, MECH_P2P, 5, 0x7f },
[PPM_ANNOUNCE_FMT] = {
PPM_ANNOUNCE, PP_ANNOUNCE_LENGTH,
PP_NP_GEN, PP_E2E_MECH, 5, PP_LOG_ANNOUNCE},
PP_NP_GEN, MECH_E2E, 5, PP_LOG_ANNOUNCE},
[PPM_SIGNALING_FMT] = {
PPM_SIGNALING, -1,
PP_NP_GEN, PP_E2E_MECH, 5, 0x7f},
PP_NP_GEN, MECH_E2E, 5, 0x7f},
[PPM_SIGNALING_NO_FWD_FMT] = {
PPM_SIGNALING, -1,
PP_NP_GEN, PP_P2P_MECH, 5, 0x7f},
PP_NP_GEN, MECH_P2P, 5, 0x7f},
/* We don't use management, or not in the table-driven code */
[PPM_MANAGEMENT_FMT] = { PPM_MANAGEMENT, -1, PP_NP_GEN, PP_E2E_MECH, 4, 0x7f},
[PPM_MANAGEMENT_FMT] = { PPM_MANAGEMENT, -1, PP_NP_GEN, MECH_E2E, 4, 0x7f},
};
char *pp_msgtype_name[] = {
......
......@@ -365,7 +365,7 @@ static int __wrh_servo_update(struct pp_instance *ppi)
}
gs->servo_locked=gs->state==WRH_TRACK_PHASE;
gs->servo_locked = (gs->state==WRH_TRACK_PHASE);
/* Increase number of servo updates with state different than
* WRH_TRACK_PHASE. (Used by SNMP) */
......
......@@ -79,7 +79,7 @@ typedef struct { /*draft P1588_v_29: page 100 and 333-335 */
Boolean peerIsTxCoherent;
Boolean peerIsRxCoherent;
Boolean peerIsCongruent;
/* None compliant members with IEEE1558-2018 */
/* None compliant members with IEEE1558-2019 */
Enumeration8 next_state;
} L1SyncBasicPortDS_t;
......
......@@ -57,7 +57,7 @@ static int wr_open(struct pp_instance *ppi, struct pp_runtime_opts *rt_opts)
){
WR_DSPOR(ppi)->wrConfig = WR_S_ONLY;
} else {
WR_DSPOR(ppi)->wrConfig = ( ppi->portDS->masterOnly ||
WR_DSPOR(ppi)->wrConfig = (is_masterOnly(ppi->portDS) ||
( is_externalPortConfigurationEnabled(DSDEF(ppi)) &&
ppi->externalPortConfigurationPortDS.desiredState==PPS_MASTER)) ?
WR_M_ONLY :
......@@ -333,6 +333,23 @@ static int wr_extension_state_changed( struct pp_instance * ppi) {
return 0;
}
static int wr_new_slave (struct pp_instance *ppi, void *buf, int len) {
if ( ppi->extState==PP_EXSTATE_ACTIVE ) {
struct wr_dsport *wrp = WR_DSPOR(ppi);
wr_servo_init(ppi);
/* To avoid comparison of sequenceId with parentAnnSequenceId
* and portIndentity with parentAnnPortIdentity set
* doRestart as TRUE*/
if (ppi->ext_data)
WRH_SRV(ppi)->doRestart = TRUE;
}
return 0;
}
struct pp_ext_hooks wr_ext_hooks = {
.init = wr_init,
.open = wr_open,
......@@ -342,6 +359,7 @@ struct pp_ext_hooks wr_ext_hooks = {
.handle_followup = wr_handle_followup,
.ready_for_slave = wr_ready_for_slave,
.run_ext_state_machine = wr_run_state_machine,
.new_slave = wr_new_slave,
#if CONFIG_HAS_P2P
.handle_presp = wr_handle_presp,
#endif
......
......@@ -27,7 +27,6 @@ static int next_pps_ms(struct pp_instance *ppi, struct pp_time *t)
int wr_abscal(struct pp_instance *ppi, void *buf, int plen, int new_state)
{
struct pp_time t;
struct wr_dsport *wrp = WR_DSPOR(ppi);
int len, i;
if (new_state) {
......@@ -40,7 +39,7 @@ int wr_abscal(struct pp_instance *ppi, void *buf, int plen, int new_state)
if (pp_timeout(ppi, wrTmoIdx)) {
uint64_t secs = t.secs;
TOPS()->enable_timing_output(GLBS(ppi), 1);
TOPS(ppi)->enable_timing_output(GLBS(ppi), 1);
/* Wait for the second to tick */
while( TOPS(ppi)->get(ppi, &t), t.secs == secs)
......@@ -49,7 +48,7 @@ int wr_abscal(struct pp_instance *ppi, void *buf, int plen, int new_state)
/* Send sync, no f-up -- actually we could send any frame */
TOPS(ppi)->get(ppi, &t);
len = msg_pack_sync(ppi, &t);
__send_and_log(ppi, len, PP_NP_EVT);
__send_and_log(ppi, len, PP_NP_EVT, PPM_SYNC_FMT);
/* And again next second */
pp_timeout_set(ppi, wrTmoIdx, next_pps_ms(ppi, &t) - 10);
......
......@@ -40,8 +40,7 @@ int wr_calibrated(struct pp_instance *ppi, void *buf, int len, int new_state)
(wrp->wrMode == WR_SLAVE)) {
wrp->next_state = WRS_WR_LINK_ON;
} else {
pp_diag(ppi, ext, 1, "WR: Invalid msgId(x%04x) received. CALIBRATE/WR_MODE_ON was expected\n",wrMsgId);
wr_handshake_fail(ppi);
pp_diag(ppi, ext, 1, "WR: Invalid msgId(x%04x) received. %s was expected\n", wrMsgId, "CALIBRATE/WR_MODE_ON");
}
return 0;
......@@ -52,7 +51,7 @@ int wr_calibrated(struct pp_instance *ppi, void *buf, int len, int new_state)
int rms=pp_next_delay_1(ppi, wrTmoIdx);
if ( rms<=(wrp->wrStateRetry*WR_TMO_MS)) {
if ( !rms ) {
pp_diag(ppi, time, 1, "timeout expired: "WR_TMO_NAME"\n");
pp_diag(ppi, time, 1, "timeout expired: %s\n", WR_TMO_NAME);
wr_handshake_fail(ppi);
return 0; /* non-wr already */
}
......
......@@ -19,24 +19,29 @@ int wr_calibration(struct pp_instance *ppi, void *buf, int len, int new_state)
{
struct wr_dsport *wrp = WR_DSPOR(ppi);
wr_servo_ext_t *se =WRE_SRV(ppi);
UInteger64 *delta;
FixedDelta *delta;
TimeInterval ti;
/* Calculate deltaTx and update servo*/
delta=(UInteger64 *)&wrp->deltaTx;
*delta= (UInteger64)(ppi->timestampCorrectionPortDS.egressLatency*1000);
pp_diag(ppi, ext, 1, "deltaTx: msb=0x%x lsb=0x%x\n",
delta = &wrp->deltaTx;
ti = ppi->timestampCorrectionPortDS.egressLatency*1000;
delta->scaledPicoseconds.msb = ti >> 32;
delta->scaledPicoseconds.lsb = ti & 0xFFFFFFFF;
pp_diag(ppi, ext, 1, "%s: msb=0x%x lsb=0x%x\n", "deltaTx",
wrp->deltaTx.scaledPicoseconds.msb,
wrp->deltaTx.scaledPicoseconds.lsb);
fixedDelta_to_pp_time(*(struct FixedDelta *)delta,&se->delta_txs);/* Update servo specific data */
fixedDelta_to_pp_time(*delta, &se->delta_txs);/* Update servo specific data */
/* Calculate deltaRx and update servo*/
delta=(UInteger64 *)&wrp->deltaRx;
*delta=(UInteger64)((ppi->timestampCorrectionPortDS.ingressLatency +
delta = &wrp->deltaRx;
ti= ((ppi->timestampCorrectionPortDS.ingressLatency +
ppi->timestampCorrectionPortDS.semistaticLatency) * 1000);
pp_diag(ppi, ext, 1, "deltaRx: msb=0x%x lsb=0x%x\n",
delta->scaledPicoseconds.msb = ti >> 32;
delta->scaledPicoseconds.lsb = ti & 0xFFFFFFFF;
pp_diag(ppi, ext, 1, "%s: msb=0x%x lsb=0x%x\n", "deltaRx",
wrp->deltaRx.scaledPicoseconds.msb,
wrp->deltaRx.scaledPicoseconds.lsb);
fixedDelta_to_pp_time(*(struct FixedDelta *)delta, &se->delta_rxs);/* Update servo specific data */
fixedDelta_to_pp_time(*delta, &se->delta_rxs);/* Update servo specific data */
/* Go to the next state */
wrp->next_state = WRS_CALIBRATED;
......
......@@ -27,14 +27,14 @@ int wr_link_on(struct pp_instance *ppi, void *buf, int len, int new_state)
wrp->next_state=WRS_IDLE;
#ifdef CONFIG_ABSCAL
#include "wrc_ptp.h"
/*
* absolute calibration only exists in arch-wrpc, so far, but
* we can't include wrpc headers, not available in wrs builds
*/
extern int ptp_mode;
extern int ep_get_bitslide(void);
if (ptp_mode == 4 /* WRC_MODE_ABSCAL */) {
if (wrc_ptp_is_abscal() /* WRC_MODE_ABSCAL */) {
wrp->next_state = WRS_ABSCAL;
/* print header for the serial port stream of stamps */
pp_printf("### t4.phase is already corrected for bitslide\n");
......
......@@ -34,8 +34,7 @@ int wr_locked(struct pp_instance *ppi, void *buf, int len, int new_state)
if ( wrMsgId == CALIBRATE ) {
wrp->next_state= WRS_RESP_CALIB_REQ;
} else {
pp_diag(ppi, ext, 1, "WR: Invalid msgId(x%04x) received. CALIBRATE was expected\n",wrMsgId);
wr_handshake_fail(ppi);
pp_diag(ppi, ext, 1, "WR: Invalid msgId(x%04x) received. %s was expected\n",wrMsgId, "CALIBRATE");
}
return 0;
}
......@@ -45,7 +44,7 @@ int wr_locked(struct pp_instance *ppi, void *buf, int len, int new_state)
int rms=pp_next_delay_1(ppi, wrTmoIdx);
if ( rms<=(wrp->wrStateRetry*WR_TMO_MS)) {
if ( !rms ) {
pp_diag(ppi, time, 1, "timeout expired: "WR_TMO_NAME"\n");
pp_diag(ppi, time, 1, "timeout expired: %s\n", WR_TMO_NAME);
wr_handshake_fail(ppi);
return 0; /* non-wr already */
}
......
......@@ -34,8 +34,7 @@ int wr_m_lock(struct pp_instance *ppi, void *buf, int len, int new_state)
if (wrMsgId == LOCKED) {
wrp->next_state = WRS_CALIBRATION;
} else {
pp_diag(ppi, ext, 1, "WR: Invalid msgId(x%04x) received. LOCKED was expected\n",wrMsgId);
wr_handshake_fail(ppi);
pp_diag(ppi, ext, 1, "WR: Invalid msgId(x%04x) received. %s was expected\n",wrMsgId, "LOCKED");
}
return 0;
}
......@@ -45,7 +44,7 @@ int wr_m_lock(struct pp_instance *ppi, void *buf, int len, int new_state)
int rms=pp_next_delay_1(ppi, wrTmoIdx);
if ( rms<=(wrp->wrStateRetry*WR_TMO_MS)) {
if ( !rms ) {
pp_diag(ppi, time, 1, "timeout expired: "WR_TMO_NAME"\n");
pp_diag(ppi, time, 1, "timeout expired: %s\n", WR_TMO_NAME);
wr_handshake_fail(ppi);
return 0; /* non-wr already */
}
......
......@@ -36,8 +36,7 @@ int wr_present(struct pp_instance *ppi, void *buf, int len, int new_state)
if ( wrMsgId == LOCK ) {
wrp->next_state = WRS_S_LOCK;
} else {
pp_diag(ppi, ext, 1, "WR: Invalid msgId(x%04x) received. LOCK was expected\n",wrMsgId);
wr_handshake_fail(ppi);
pp_diag(ppi, ext, 1, "WR: Invalid msgId(x%04x) received. %s was expected\n",wrMsgId, "LOCK");
}
return 0;
}
......@@ -47,7 +46,7 @@ int wr_present(struct pp_instance *ppi, void *buf, int len, int new_state)
int rms=pp_next_delay_1(ppi, wrTmoIdx);
if (rms<=(wrp->wrStateRetry*WR_TMO_MS)) {
if (!rms) {
pp_diag(ppi, time, 1, "timeout expired: "WR_TMO_NAME"\n");
pp_diag(ppi, time, 1, "timeout expired: %s\n", WR_TMO_NAME);
wr_handshake_fail(ppi);
return 0; /* non-wr already */
}
......
......@@ -18,41 +18,39 @@ int wr_resp_calib_req(struct pp_instance *ppi, void *buf, int len, int new_state
if (new_state) {
wrp->wrStateRetry = WR_STATE_RETRY;
pp_timeout_set_rename(ppi, wrTmoIdx,WR_TMO_MS*(WR_STATE_RETRY+1),WR_TMO_NAME);
} else {
if (ppi->received_ptp_header.messageType == PPM_SIGNALING) {
Enumeration16 wrMsgId;
MsgSignaling wrsig_msg;
if ( msg_unpack_wrsig(ppi, buf, &wrsig_msg, &wrMsgId) ) {
if ( wrMsgId == CALIBRATED) {
/* Update servo */
wr_servo_ext_t *se =WRE_SRV(ppi);
fixedDelta_to_pp_time(wrp->otherNodeDeltaTx,&se->delta_txm);
fixedDelta_to_pp_time(wrp->otherNodeDeltaRx,&se->delta_rxm);
wrp->next_state = (wrp->wrMode == WR_MASTER) ?
WRS_WR_LINK_ON :
WRS_CALIBRATION;
} else {
pp_diag(ppi, ext, 1, "WR: Invalid msgId(x%04x) received. CALIBRATED was expected\n",wrMsgId);
wr_handshake_fail(ppi);
}
return 0;
}
/* Check whether a message is received, otherwise it may downgrade a link to ptp for wrs v5.0.x */
if (ppi->received_ptp_header.messageType == PPM_SIGNALING) {
Enumeration16 wrMsgId;
MsgSignaling wrsig_msg;
if ( msg_unpack_wrsig(ppi, buf, &wrsig_msg, &wrMsgId) ) {
if ( wrMsgId == CALIBRATED) {
/* Update servo */
wr_servo_ext_t *se =WRE_SRV(ppi);
fixedDelta_to_pp_time(wrp->otherNodeDeltaTx,&se->delta_txm);
fixedDelta_to_pp_time(wrp->otherNodeDeltaRx,&se->delta_rxm);
wrp->next_state = (wrp->wrMode == WR_MASTER) ?
WRS_WR_LINK_ON :
WRS_CALIBRATION;
} else {
pp_diag(ppi, ext, 1, "WR: Invalid msgId(x%04x) received. %s was expected\n",wrMsgId, "CALIBRATED");
}
return 0;
}
}
{ /* Check remaining time */
int rms=pp_next_delay_1(ppi, wrTmoIdx);
if ( rms<=(wrp->wrStateRetry*WR_TMO_MS)) {
if ( !rms ) {
pp_diag(ppi, time, 1, "timeout expired: "WR_TMO_NAME"\n");
wr_handshake_fail(ppi);
return 0; /* non-wr already */
}
wr_handshake_retry(ppi);
{ /* Check remaining time */
int rms=pp_next_delay_1(ppi, wrTmoIdx);
if ( rms<=(wrp->wrStateRetry*WR_TMO_MS)) {
if ( !rms ) {
pp_diag(ppi, time, 1, "timeout expired: %s\n", WR_TMO_NAME);
wr_handshake_fail(ppi);
return 0; /* non-wr already */
}
wr_handshake_retry(ppi);
}
}
......
......@@ -33,7 +33,7 @@ int wr_s_lock(struct pp_instance *ppi, void *buf, int len, int new_state)
if ( rms<=(wrp->wrStateRetry*WR_TMO_MS)) {
WRH_OPER()->locking_disable(ppi);
if ( rms==0 ) {
pp_diag(ppi, time, 1, "timeout expired: "WR_TMO_NAME"\n");
pp_diag(ppi, time, 1, "timeout expired: %s\n", WR_TMO_NAME);
wr_handshake_fail(ppi);
return 0; /* non-wr already */
}
......@@ -47,5 +47,5 @@ int wr_s_lock(struct pp_instance *ppi, void *buf, int len, int new_state)
WRH_OPER()->locking_enable(ppi);
}
return 100 ;/* 100ms : We check every 100ms if the PLL is locked */
return 0; /* 0ms : If needed we yeld in locking_poll during waiting for the PLL to lock */
}
......@@ -115,7 +115,6 @@ void wr_reset_process(struct pp_instance *ppi, wr_role_t role);
/* wr_servo interface */
int wr_servo_init(struct pp_instance *ppi);
void wr_servo_enable_tracking(int enable);
typedef struct wr_servo_ext {
struct pp_time delta_txm;
......
......@@ -208,26 +208,30 @@ int msg_unpack_wrsig(struct pp_instance *ppi, void *buf,
tlv_versionNumber = 0xFF & ntohs(*(UInteger16 *)(buf + 52));
if (tlv_type != TLV_TYPE_ORG_EXTENSION) {
pp_diag(ppi, frames, 1, "handle Signaling msg, failed, This is not "
"organization extension TLV = 0x%x\n", tlv_type);
/* "handle Signaling msg, failed, not organization extension TLV = 0x%x\n" */
pp_diag(ppi, frames, 1, "%sorganization extension TLV = 0x%x\n",
"handle Signaling msg, failed, not ", tlv_type);
return 0;
}
if (tlv_organizationID != WR_TLV_ORGANIZATION_ID) {
pp_diag(ppi, frames, 1, "handle Signaling msg, failed, not CERN's "
"OUI = 0x%x\n", tlv_organizationID);
/* "handle Signaling msg, failed, not CERN's OUI = 0x%x\n" */
pp_diag(ppi, frames, 1, "%sCERN's OUI = 0x%x\n",
"handle Signaling msg, failed, not ", tlv_organizationID);
return 0;
}
if (tlv_magicNumber != WR_TLV_MAGIC_NUMBER) {
pp_diag(ppi, frames, 1, "handle Signaling msg, failed, "
"not White Rabbit magic number = 0x%x\n", tlv_magicNumber);
/* "handle Signaling msg, failed, not White Rabbit magic number = 0x%x\n" */
pp_diag(ppi, frames, 1, "%sWhite Rabbit magic number = 0x%x\n",
"handle Signaling msg, failed, not ", tlv_magicNumber);
return 0;
}
if (tlv_versionNumber != WR_TLV_WR_VERSION_NUMBER ) {
pp_diag(ppi, frames, 1, "handle Signaling msg, failed, not supported "
"version number = 0x%x\n", tlv_versionNumber);
/* "handle Signaling msg, failed, not supported version number = 0x%x\n" */
pp_diag(ppi, frames, 1, "%ssupported version number = 0x%x\n",
"handle Signaling msg, failed, not ", tlv_versionNumber);
return 0;
}
......
......@@ -3,14 +3,6 @@
#include <libwr/shmem.h>
#include "../proto-standard/common-fun.h"
/* Enable tracking by default. Disabling the tracking is used for demos. */
static int wr_tracking_enabled = 1;
void wr_servo_enable_tracking(int enable)
{
wr_tracking_enabled = enable;
}
static inline void _calculate_raw_delayMM(struct pp_instance *ppi,
struct pp_time *ta,struct pp_time *tb,
struct pp_time *tc,struct pp_time *td ) {
......
......@@ -27,7 +27,7 @@ static wr_state_machine_t wr_state_actions[] ={
.action=wr_present,
},
[WRS_M_LOCK]{
.name="wr_m_lock",
.name="wr-m-lock",
.action=wr_m_lock,
},
[WRS_S_LOCK]{
......
......@@ -16,11 +16,6 @@
#define FFB_TTRA 0x10
#define FFB_FTRA 0x20
/* String to save space in diag messages */
#define fmt_clock_identity_id_A_B "%sId A: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x.%04x,\n" \
"%sId B: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x.%04x\n"
#define fmt_clock_identity_id "%s: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x.%04x\n"
/* ppi->port_idx port is becoming Master. Table 13 (9.3.5) of the spec. */
void bmc_m1(struct pp_instance *ppi)
{
......@@ -156,8 +151,9 @@ void bmc_s1(struct pp_instance *ppi,
if (prop->ptpTimescale) {
ret = TOPS(ppi)->get_utc_time(ppi, &hours, &minutes, &seconds);
if (ret) {
/* "Could not get UTC time from system, taking received flags\n"; */
pp_diag(ppi, bmc, 1,
"Could not get UTC time from system, taking received flags\n");
"Could not get UTC %s from system, taking received flags\n", "time");
prop->leap59 = ((frgn_master->flagField[1] & FFB_LI59) != 0);
prop->leap61 = ((frgn_master->flagField[1] & FFB_LI61) != 0);
prop->currentUtcOffset = frgn_master->currentUtcOffset;
......@@ -183,8 +179,9 @@ void bmc_s1(struct pp_instance *ppi,
} else {
ret = TOPS(ppi)->get_utc_offset(ppi, &offset, &leap59, &leap61);
if (ret) {
/* "Could not get UTC flags from system, taking received flags\n" */
pp_diag(ppi, bmc, 1,
"Could not get UTC flags from system, taking received flags\n");
"Could not get UTC %s from system, taking received flags\n", "flags");
prop->leap59 = ((frgn_master->flagField[1] & FFB_LI59) != 0);
prop->leap61 = ((frgn_master->flagField[1] & FFB_LI61) != 0);
prop->currentUtcOffset = frgn_master->currentUtcOffset;
......@@ -375,21 +372,21 @@ static int are_qualified(struct pp_instance *ppi,
/* if B is not qualified 9.3.2.5 c) & 9.3.2.3 a) & b)*/
if ( a_is_qualified && !b_is_qualified ) {
pp_diag(ppi, bmc, 2, "Dataset B not qualified\n");
pp_diag(ppi, bmc, 2, "Dataset %s not qualified\n", "B");
*ret=-1;
return 0;
}
/* if A is not qualified 9.3.2.5 c) & 9.3.2.3 a) & b) */
if (b_is_qualified && !a_is_qualified) {
pp_diag(ppi, bmc, 2, "Dataset A not qualified\n");
pp_diag(ppi, bmc, 2, "Dataset %s not qualified\n", "A");
*ret= 1;
return 0;
}
/* if both are not qualified 9.3.2.5 c) & 9.3.2.3 a) & b) */
if ( !a_is_qualified && !b_is_qualified ) {
pp_diag(ppi, bmc, 2, "Dataset A & B not qualified\n");
pp_diag(ppi, bmc, 2, "Dataset %s not qualified\n", "A & B");
*ret= 0;
return 0;
}
......@@ -405,6 +402,7 @@ static int bmc_gm_cmp(struct pp_instance *ppi,
int ret;
struct ClockQuality *qa = &a->grandmasterClockQuality;
struct ClockQuality *qb = &b->grandmasterClockQuality;
char clkid_str[26];
/* bmc_gm_cmp is called several times, so report only at level 2 */
pp_diag(ppi, bmc, 2, "%s\n", __func__);
......@@ -414,47 +412,52 @@ static int bmc_gm_cmp(struct pp_instance *ppi,
}
if (a->grandmasterPriority1 != b->grandmasterPriority1) {
pp_diag(ppi, bmc, 3, "Priority1 A: %i, Priority1 B: %i\n",
a->grandmasterPriority1, b->grandmasterPriority1);
/* "Priority1 A: %i, Priority1 B: %i\n", */
pp_diag(ppi, bmc, 3, "%s A: %i, %s B: %i\n",
"Priority1", a->grandmasterPriority1,
"Priority1", b->grandmasterPriority1);
return a->grandmasterPriority1 - b->grandmasterPriority1;
}
if (qa->clockClass != qb->clockClass) {
pp_diag(ppi, bmc, 3, "ClockClass A: %i, ClockClass B: %i\n",
qa->clockClass, qb->clockClass);
/* "ClockClass A: %i, ClockClass B: %i\n", */
pp_diag(ppi, bmc, 3, "%s A: %i, %s B: %i\n",
"ClockClass", qa->clockClass,
"ClockClass", qb->clockClass);
return qa->clockClass - qb->clockClass;
}
if (qa->clockAccuracy != qb->clockAccuracy) {
pp_diag(ppi, bmc, 3, "ClockAccuracy A: %i, ClockAccuracy B: %i\n",
qa->clockAccuracy, qb->clockAccuracy);
/* "ClockAccuracy A: %i, ClockAccuracy B: %i\n", */
pp_diag(ppi, bmc, 3, "%s A: %i, %s B: %i\n",
"ClockAccuracy", qa->clockAccuracy,
"ClockAccuracy", qb->clockAccuracy);
return qa->clockAccuracy - qb->clockAccuracy;
}
if (qa->offsetScaledLogVariance != qb->offsetScaledLogVariance) {
pp_diag(ppi, bmc, 3, "Variance A: %i, Variance B: %i\n",
qa->offsetScaledLogVariance, qb->offsetScaledLogVariance);
/* "Variance A: %i, Variance B: %i\n", */
pp_diag(ppi, bmc, 3, "%s A: %i, %s B: %i\n",
"Variance", qa->offsetScaledLogVariance,
"Variance", qb->offsetScaledLogVariance);
return qa->offsetScaledLogVariance
- qb->offsetScaledLogVariance;
}
if (a->grandmasterPriority2 != b->grandmasterPriority2) {
pp_diag(ppi, bmc, 3, "Priority2 A: %i, Priority2 B: %i\n",
a->grandmasterPriority2, b->grandmasterPriority2);
/* "Priority2 A: %i, Priority2 B: %i\n", */
pp_diag(ppi, bmc, 3, "%s A: %i, %s B: %i\n",
"Priority2", a->grandmasterPriority2,
"Priority2", b->grandmasterPriority2);
return a->grandmasterPriority2 - b->grandmasterPriority2;
}
pp_diag(ppi, bmc, 3, "GmId A: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
a->grandmasterIdentity.id[0], a->grandmasterIdentity.id[1],
a->grandmasterIdentity.id[2], a->grandmasterIdentity.id[3],
a->grandmasterIdentity.id[4], a->grandmasterIdentity.id[5],
a->grandmasterIdentity.id[6], a->grandmasterIdentity.id[7]);
pp_diag(ppi, bmc, 3, "GmId B: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
b->grandmasterIdentity.id[0], b->grandmasterIdentity.id[1],
b->grandmasterIdentity.id[2], b->grandmasterIdentity.id[3],
b->grandmasterIdentity.id[4], b->grandmasterIdentity.id[5],
b->grandmasterIdentity.id[6], b->grandmasterIdentity.id[7]);
pp_diag(ppi, bmc, 3, "GmId A: %s\n",
format_hex8(clkid_str, a->grandmasterIdentity.id));
pp_diag(ppi, bmc, 3, "GmId B: %s\n",
format_hex8(clkid_str, b->grandmasterIdentity.id));
return bmc_idcmp(&a->grandmasterIdentity, &b->grandmasterIdentity);
}
......@@ -469,6 +472,8 @@ static int bmc_topology_cmp(struct pp_instance *ppi,
struct PortIdentity *pidrxa = &a->receivePortIdentity;
struct PortIdentity *pidrxb = &b->receivePortIdentity;
int diff;
char clkida_str[26];
char clkidb_str[26];
/* bmc_topology_cmp is called several times, so report only at level 2
*/
......@@ -509,37 +514,25 @@ static int bmc_topology_cmp(struct pp_instance *ppi,
/* stepsRemoved is equal, compare identities */
diff = bmc_pidcmp(pidtxa, pidtxb);
if (diff) {
pp_diag(ppi, bmc, 3, fmt_clock_identity_id_A_B,
pp_diag(ppi, bmc, 3, "%sId A: %s.%04x,\n%sId B: %s.%04x\n",
"Tx",
pidtxa->clockIdentity.id[0], pidtxa->clockIdentity.id[1],
pidtxa->clockIdentity.id[2], pidtxa->clockIdentity.id[3],
pidtxa->clockIdentity.id[4], pidtxa->clockIdentity.id[5],
pidtxa->clockIdentity.id[6], pidtxa->clockIdentity.id[7],
format_hex8(clkida_str, pidtxa->clockIdentity.id),
pidtxa->portNumber,
"Tx",
pidtxb->clockIdentity.id[0], pidtxb->clockIdentity.id[1],
pidtxb->clockIdentity.id[2], pidtxb->clockIdentity.id[3],
pidtxb->clockIdentity.id[4], pidtxb->clockIdentity.id[5],
pidtxb->clockIdentity.id[6], pidtxb->clockIdentity.id[7],
format_hex8(clkidb_str, pidtxb->clockIdentity.id),
pidtxb->portNumber);
return diff;
}
/* sourcePortIdentity is equal, compare receive port identites, which
* is the last decision maker, which has to be different */
pp_diag(ppi, bmc, 3, fmt_clock_identity_id_A_B,
pp_diag(ppi, bmc, 3, "%sId A: %s.%04x,\n%sId B: %s.%04x\n",
"Rx",
pidrxa->clockIdentity.id[0], pidrxa->clockIdentity.id[1],
pidrxa->clockIdentity.id[2], pidrxa->clockIdentity.id[3],
pidrxa->clockIdentity.id[4], pidrxa->clockIdentity.id[5],
pidrxa->clockIdentity.id[6], pidrxa->clockIdentity.id[7],
pidrxa->portNumber,
format_hex8(clkida_str, pidtxa->clockIdentity.id),
pidtxa->portNumber,
"Rx",
pidrxb->clockIdentity.id[0], pidrxb->clockIdentity.id[1],
pidrxb->clockIdentity.id[2], pidrxb->clockIdentity.id[3],
pidrxb->clockIdentity.id[4], pidrxb->clockIdentity.id[5],
pidrxb->clockIdentity.id[6], pidrxb->clockIdentity.id[7],
pidrxb->portNumber);
format_hex8(clkidb_str, pidtxb->clockIdentity.id),
pidtxb->portNumber);
return bmc_pidcmp(pidrxa, pidrxb);
}
......@@ -553,19 +546,14 @@ static int bmc_dataset_cmp(struct pp_instance *ppi,
struct pp_frgn_master *a,
struct pp_frgn_master *b)
{
char clkid_str[26];
/* dataset_cmp is called several times, so report only at level 2 */
pp_diag(ppi, bmc, 2, "%s\n", __func__);
pp_diag(ppi, bmc, 3, "portId A: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
a->sourcePortIdentity.clockIdentity.id[0], a->sourcePortIdentity.clockIdentity.id[1],
a->sourcePortIdentity.clockIdentity.id[2], a->sourcePortIdentity.clockIdentity.id[3],
a->sourcePortIdentity.clockIdentity.id[4], a->sourcePortIdentity.clockIdentity.id[5],
a->sourcePortIdentity.clockIdentity.id[6], a->sourcePortIdentity.clockIdentity.id[7]);
pp_diag(ppi, bmc, 3, "portId B: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
b->sourcePortIdentity.clockIdentity.id[0], b->sourcePortIdentity.clockIdentity.id[1],
b->sourcePortIdentity.clockIdentity.id[2], b->sourcePortIdentity.clockIdentity.id[3],
b->sourcePortIdentity.clockIdentity.id[4], b->sourcePortIdentity.clockIdentity.id[5],
b->sourcePortIdentity.clockIdentity.id[6], b->sourcePortIdentity.clockIdentity.id[7]);
pp_diag(ppi, bmc, 3, "portId A: %s\n",
format_hex8(clkid_str, a->sourcePortIdentity.clockIdentity.id));
pp_diag(ppi, bmc, 3, "portId B: %s\n",
format_hex8(clkid_str, b->sourcePortIdentity.clockIdentity.id));
if (!bmc_idcmp(&a->grandmasterIdentity, &b->grandmasterIdentity)) {
/* Check topology */
......@@ -622,7 +610,7 @@ static int bmc_state_decision(struct pp_instance *ppi)
bmc_setup_local_frgn_master(ppi, &d0);
if ( ppi->portDS->masterOnly ) {
if (is_masterOnly(ppi->portDS)) {
/* if there is a better master show these values */
if (ppg->ebest_idx >= 0) {
/* don't update parent dataset */
......@@ -862,6 +850,7 @@ void bmc_store_frgn_master(struct pp_instance *ppi,
frgn_master->qualified=
frgn_master->lastAnnounceMsgMs=0;
memcpy(frgn_master->ext_specific,ann.ext_specific,sizeof(frgn_master->ext_specific));
memcpy(frgn_master->peer_mac, ppi->peer, sizeof(ppi->peer));
}
......@@ -870,6 +859,7 @@ struct pp_frgn_master * bmc_add_frgn_master(struct pp_instance *ppi, struct pp_
int sel;
MsgHeader *hdr = &ppi->received_ptp_header;
struct PortIdentity *pid = &hdr->sourcePortIdentity;
char clkid_str[26];
pp_diag(ppi, bmc, 2, "%s\n", __func__);
......@@ -877,12 +867,9 @@ struct pp_frgn_master * bmc_add_frgn_master(struct pp_instance *ppi, struct pp_
assert(ppi->state != PPS_FAULTY, "Should not be called when state is FAULTY\n");
assert(ppi->state != PPS_INITIALIZING, "Should not be called when state is INITIALIZING\n");
pp_diag(ppi, bmc, 3, fmt_clock_identity_id,
pp_diag(ppi, bmc, 3, "%s: %s.%04x\n",
"Foreign Master Port Id",
pid->clockIdentity.id[0], pid->clockIdentity.id[1],
pid->clockIdentity.id[2], pid->clockIdentity.id[3],
pid->clockIdentity.id[4], pid->clockIdentity.id[5],
pid->clockIdentity.id[6], pid->clockIdentity.id[7],
format_hex8(clkid_str, pid->clockIdentity.id),
pid->portNumber);
if (is_externalPortConfigurationEnabled(DSDEF(ppi)) ) {
......@@ -895,7 +882,7 @@ struct pp_frgn_master * bmc_add_frgn_master(struct pp_instance *ppi, struct pp_
*/
if (!bmc_idcmp(&pid->clockIdentity, &DSDEF(ppi)->clockIdentity) &&
pid->portNumber==ppi->port_idx) {
pp_diag(ppi, bmc, 2, "Announce frame from same port\n");
pp_diag(ppi, bmc, 2, "Announce frame from %s\n", "same port");
return NULL;
}
sel = 0;
......@@ -919,19 +906,19 @@ struct pp_frgn_master * bmc_add_frgn_master(struct pp_instance *ppi, struct pp_
&DSDEF(ppi)->clockIdentity)) {
cmpres = bmc_pidcmp(pid, &DSPOR(ppi)->portIdentity);
pp_diag(ppi, bmc, 2, "Announce frame from this clock\n");
pp_diag(ppi, bmc, 2, "Announce frame from %s\n", "this clock");
if (cmpres < 0) {
pp_diag(ppi, bmc, 2, "Announce frame from a better port on this clock\n");
pp_diag(ppi, bmc, 2, "Announce frame from %s\n", "a better port on this clock");
bmc_p1(ppi);
ppi->next_state = PPS_PASSIVE;
/* as long as we receive that reset the announce timeout */
pp_timeout_reset(ppi, PP_TO_ANN_RECEIPT);
} else if (cmpres > 0) {
pp_diag(ppi, bmc, 2, "Announce frame from a worse port on this clock\n");
pp_diag(ppi, bmc, 2, "Announce frame from %s\n", "a worse port on this clock");
return NULL;
} else {
pp_diag(ppi, bmc, 2, "Announce frame from this port\n");
pp_diag(ppi, bmc, 2, "Announce frame from %s\n", "this port");
return NULL;
}
}
......@@ -939,7 +926,7 @@ struct pp_frgn_master * bmc_add_frgn_master(struct pp_instance *ppi, struct pp_
/* Check if announce from a port from this clock 9.3.2.5 a) */
if (!bmc_idcmp(&pid->clockIdentity,
&DSDEF(ppi)->clockIdentity)) {
pp_diag(ppi, bmc, 2, "Announce frame from this clock\n");
pp_diag(ppi, bmc, 2, "Announce frame from %s\n", "this clock");
return NULL;
}
}
......@@ -947,7 +934,7 @@ struct pp_frgn_master * bmc_add_frgn_master(struct pp_instance *ppi, struct pp_
/* Check if announce has steps removed larger than 255 9.3.2.5 d) */
if (frgn_master->stepsRemoved >= 255) {
pp_diag(ppi, bmc, 2, "Announce frame steps removed"
"larger or equal 255: %i\n",
" larger or equal 255: %i\n",
frgn_master->stepsRemoved);
return NULL;
}
......@@ -1083,7 +1070,7 @@ static void bmc_remove_foreign_master(struct pp_instance *ppi, int frg_master_id
void bmc_flush_erbest(struct pp_instance *ppi)
{
if ( ppi->frgn_rec_best!=-1 && ppi->frgn_rec_best<ppi->frgn_rec_num ) {
pp_diag(ppi, bmc, 1, "Aged out ErBest foreign master %i/%i\n",
pp_diag(ppi, bmc, 1, "Aged out %sforeign master %i/%i\n", "ErBest ",
ppi->frgn_rec_best, ppi->frgn_rec_num);
bmc_remove_foreign_master(ppi,ppi->frgn_rec_best);
}
......@@ -1104,7 +1091,7 @@ static void bmc_age_frgn_master(struct pp_instance *ppi)
if ( !is_ebest(GLBS(ppi),frgn_master) ) {
if (time_after(now, frgn_master->lastAnnounceMsgMs + ppi->frgn_master_time_window_ms)) {
// Remove age out
pp_diag(ppi, bmc, 1, "Aged out foreign master %i/%i\n",
pp_diag(ppi, bmc, 1, "Aged out %sforeign master %i/%i\n", "",
i, ppi->frgn_rec_num);
bmc_remove_foreign_master(ppi,i);
continue;
......@@ -1132,6 +1119,7 @@ static int bmc_check_frgn_master(struct pp_instance *ppi)
{
int i;
struct PortIdentity *pid;
char clkid_str[26];
if (ppi->frgn_rec_num > 0) {
for (i =0; i < ppi->frgn_rec_num; i++) {
......@@ -1142,12 +1130,9 @@ static int bmc_check_frgn_master(struct pp_instance *ppi)
if(0 > bmc_pidcmp(&ppi->frgn_master[i].sourcePortIdentity,
&DSPOR(ppi)->portIdentity)) {
pid = &ppi->frgn_master[i].sourcePortIdentity;
pp_diag(ppi, bmc, 3, fmt_clock_identity_id,
pp_diag(ppi, bmc, 3, "%s: %s.%04x\n",
"Better Master on same Clock Port Id",
pid->clockIdentity.id[0], pid->clockIdentity.id[1],
pid->clockIdentity.id[2], pid->clockIdentity.id[3],
pid->clockIdentity.id[4], pid->clockIdentity.id[5],
pid->clockIdentity.id[6], pid->clockIdentity.id[7],
format_hex8(clkid_str, pid->clockIdentity.id),
pid->portNumber);
return 1;
}
......@@ -1191,6 +1176,7 @@ static void bmc_update_erbest_inst(struct pp_instance *ppi) {
struct pp_frgn_master *frgn_master;
PortIdentity *frgn_master_pid;
int j, best;
char clkid_str[26];
/* if link is down clear foreign master table */
if ((!ppi->link_up) && (ppi->frgn_rec_num > 0))
......@@ -1219,12 +1205,9 @@ static void bmc_update_erbest_inst(struct pp_instance *ppi) {
ppi->frgn_rec_num);
frgn_master_pid = &frgn_master[best].sourcePortIdentity;
pp_diag(ppi, bmc, 3, fmt_clock_identity_id,
pp_diag(ppi, bmc, 3, "%s: %s.%04x\n",
"SourcePortId",
frgn_master_pid->clockIdentity.id[0], frgn_master_pid->clockIdentity.id[1],
frgn_master_pid->clockIdentity.id[2], frgn_master_pid->clockIdentity.id[3],
frgn_master_pid->clockIdentity.id[4], frgn_master_pid->clockIdentity.id[5],
frgn_master_pid->clockIdentity.id[6], frgn_master_pid->clockIdentity.id[7],
format_hex8(clkid_str, frgn_master_pid->clockIdentity.id),
frgn_master_pid->portNumber);
} else
best=-1;
......@@ -1240,6 +1223,11 @@ static void bmc_update_erbest_inst(struct pp_instance *ppi) {
ppi->frgn_rec_best = -1;
}
/* Store MAC of a peer */
if (ppi->frgn_rec_best >= 0)
memcpy(&ppi->activePeer,
&ppi->frgn_master[ppi->frgn_rec_best].peer_mac,
sizeof(ppi->activePeer));
}
/* Find Erbest, 9.3.2.2 */
......@@ -1256,6 +1244,7 @@ static void bmc_update_ebest(struct pp_globals *ppg)
int i, best=-1;
struct pp_instance *ppi_best;
PortIdentity *frgn_master_pid;
char clkid_str[26];
/* bmc_update_ebest is called several times, so report only at
* level 2 */
......@@ -1287,12 +1276,9 @@ static void bmc_update_ebest(struct pp_globals *ppg)
pp_diag(ppi_best, bmc, 1, "Best foreign master is at port "
"%i\n", (best+1));
frgn_master_pid = &ppi_best->frgn_master[ppi_best->frgn_rec_best].sourcePortIdentity;
pp_diag(ppi_best, bmc, 3, fmt_clock_identity_id,
pp_diag(ppi_best, bmc, 3, "%s: %s.%04x\n",
"SourcePortId",
frgn_master_pid->clockIdentity.id[0], frgn_master_pid->clockIdentity.id[1],
frgn_master_pid->clockIdentity.id[2], frgn_master_pid->clockIdentity.id[3],
frgn_master_pid->clockIdentity.id[4], frgn_master_pid->clockIdentity.id[5],
frgn_master_pid->clockIdentity.id[6], frgn_master_pid->clockIdentity.id[7],
format_hex8(clkid_str, frgn_master_pid->clockIdentity.id),
frgn_master_pid->portNumber);
}
if (ppg->ebest_idx != best) {
......
......@@ -60,6 +60,7 @@ clockDegradation_t clockDegradation[]= {
.msg="unlocked",
},
},
#ifndef CONFIG_CODEOPT_WRPC_SIZE
// PP_ARB_CLASS_GM_LOCKED
{
.clockClass=PP_ARB_CLASS_GM_LOCKED,
......@@ -122,6 +123,7 @@ clockDegradation_t clockDegradation[]= {
.msg="unlocked",
}
},
#endif
// PP_ARB_CLASS_GM_UNLOCKED_B
{
.clockClass=PP_ARB_CLASS_GM_UNLOCKED_B,
......@@ -190,6 +192,7 @@ defaultDeviceAttributes_t defaultDeviceAttributes[] = {
.frequencyTraceable=TRUE,
.timeTraceable=TRUE,
},
#ifndef CONFIG_CODEOPT_WRPC_SIZE
{ .clockClass = PP_PTP_CLASS_GM_UNLOCKED_A,
.clock_quality_clockAccuracy = PP_PTP_ACCURACY_GM_UNLOCKED_A,
.clock_quality_offsetScaledLogVariance = PP_PTP_VARIANCE_GM_UNLOCKED_A,
......@@ -198,6 +201,7 @@ defaultDeviceAttributes_t defaultDeviceAttributes[] = {
.frequencyTraceable=FALSE,
.timeTraceable=FALSE,
},
#endif
{ .clockClass = PP_PTP_CLASS_GM_UNLOCKED_B,
.clock_quality_clockAccuracy = PP_PTP_ACCURACY_GM_UNLOCKED_B,
.clock_quality_offsetScaledLogVariance = PP_PTP_VARIANCE_GM_UNLOCKED_B,
......@@ -206,6 +210,7 @@ defaultDeviceAttributes_t defaultDeviceAttributes[] = {
.frequencyTraceable=FALSE,
.timeTraceable=FALSE,
},
#ifndef CONFIG_CODEOPT_WRPC_SIZE
{ .clockClass = PP_ARB_CLASS_GM_LOCKED,
.clock_quality_clockAccuracy = PP_ARB_ACCURACY_GM_LOCKED,
.clock_quality_offsetScaledLogVariance = PP_ARB_VARIANCE_GM_LOCKED,
......@@ -230,6 +235,7 @@ defaultDeviceAttributes_t defaultDeviceAttributes[] = {
.frequencyTraceable=FALSE,
.timeTraceable=FALSE,
},
#endif
{ .clockClass = PP_ARB_CLASS_GM_UNLOCKED_B,
.clock_quality_clockAccuracy = PP_ARB_ACCURACY_GM_UNLOCKED_B,
.clock_quality_offsetScaledLogVariance = PP_ARB_VARIANCE_GM_UNLOCKED_B,
......@@ -317,8 +323,8 @@ void bmc_update_clock_quality(struct pp_globals *ppg)
"Timing mode changed : %s, "
"clock class: %d"
", clock accuracy: %d"
", clock variance: x%04x"
", timeSource: x%02x"
", clock variance: 0x%04x"
", timeSource: 0x%02x"
", ptpTimeScale: %d"
", frequencyTraceable: %d"
", timeTraceable: %d"
......@@ -342,6 +348,8 @@ void bmc_set_default_device_attributes (struct pp_globals *ppg) {
while ( pDef->clockClass!=clockClass && pDef->clockClass!=-1)
pDef++;
/* if (pDef->clockClass == -1)
pp_printf("%s clockClass %d not found\n", __func__, pDef->clockClass);*/
if ( rt_opts->clock_quality_clockAccuracy==-1 )
rt_opts->clock_quality_clockAccuracy=(unsigned)pDef->clock_quality_clockAccuracy;
if ( rt_opts->clock_quality_offsetScaledLogVariance==-1 )
......@@ -373,5 +381,9 @@ void bmc_apply_configured_device_attributes(struct pp_globals *ppg) {
tpDS->frequencyTraceable=rt_opts->frequencyTraceable;
tpDS->timeTraceable=rt_opts->timeTraceable;
defDS->priority1 = rt_opts->priority1;
defDS->priority2 = rt_opts->priority2;
defDS->domainNumber = rt_opts->domainNumber;
}
......@@ -43,7 +43,7 @@ int st_com_peer_handle_pres(struct pp_instance *ppi, void *buf,
int e = 0;
/* if not in P2P mode, just return */
if (ppi->delayMechanism != P2P)
if (ppi->delayMechanism != MECH_P2P)
return 0;
msg_unpack_pdelay_resp(buf, &resp);
......@@ -120,7 +120,7 @@ int st_com_peer_handle_pres_followup(struct pp_instance *ppi,
int e = 0;
/* if not in P2P mode, just return */
if (ppi->delayMechanism != P2P)
if (ppi->delayMechanism != MECH_P2P)
return 0;
msg_unpack_pdelay_resp_follow_up(buf, &respFllw);
......@@ -166,7 +166,7 @@ int st_com_peer_handle_preq(struct pp_instance *ppi, void *buf,
int e = 0;
/* if not in P2P mode, just return */
if (ppi->delayMechanism != P2P)
if (ppi->delayMechanism != MECH_P2P)
return 0;
if (is_ext_hook_available(ppi,handle_preq))
......@@ -185,7 +185,7 @@ int st_com_peer_handle_preq(struct pp_instance *ppi, void *buf,
*/
void update_meanDelay(struct pp_instance *ppi, TimeInterval meanDelay) {
/* clause 11.4.2.d.f : the <meanLinkDelay> shall be stored ... for the P2P port in the PTP SLAVE state in currentDS.meanDelay.*/
if ( ppi->delayMechanism==P2P ) {
if (ppi->delayMechanism == MECH_P2P) {
DSPOR(ppi)->meanLinkDelay=meanDelay;
if ( ppi->state != PPS_SLAVE )
return;
......
......@@ -96,8 +96,9 @@ int pp_lib_may_issue_announce(struct pp_instance *ppi)
if (prop->ptpTimescale) {
ret = TOPS(ppi)->get_utc_time(ppi, &hours, &minutes, &seconds);
if (ret) {
/* "Could not get UTC time from system, taking received flags\n" */
pp_diag(ppi, frames, 1,
"Could not get UTC time from system, taking received flags\n");
"Could not get UTC %s from system, taking received flags\n", "time");
} else {
/* for 2 announce intervals after midnight, get the offset from the system */
if ((hours == 00) && (minutes == 00) &&
......
......@@ -7,15 +7,13 @@
#ifndef __MSG_H
#define __MSG_H
#define htonll(x) ((*(char *)&endianess == 1) ? \
htobe64(x) /* Little endian */ \
: \
(x)) /* Big endian */
#define ntohll(x) ((*(char *)&endianess == 1) ? \
be64toh(x) /* Little endian */ \
: \
(x)) /* Big endian */
#if __BYTE_ORDER == __BIG_ENDIAN
# define htonll(x) (x)
# define ntohll(x) (x)
#else
# define htonll(x) htobe64(x)
# define ntohll(x) be64toh(x)
#endif
extern const int endianess; /* use to check endianess */
......
......@@ -13,9 +13,9 @@
*/
struct pp_runtime_opts __pp_default_rt_opts = {
.clock_quality_clockClass = PP_CLASS_DEFAULT,
.clock_quality_clockAccuracy = -1, // Not defined
.clock_quality_offsetScaledLogVariance = -1, // Not defined
.timeSource = -1, // Not defined
.clock_quality_clockAccuracy = CONFIG_PTP_OPT_CLOCK_ACCURACY, // Not defined
.clock_quality_offsetScaledLogVariance = CONFIG_PTP_OPT_CLOCK_ALLAN_VARIANCE, // Not defined
.timeSource = CONFIG_PTP_OPT_TIME_SOURCE, // Not defined
.ptpTimeScale=-1, // Not defined
.frequencyTraceable=-1, // Not defined
.timeTraceable=-1, // Not defined
......@@ -40,7 +40,7 @@ struct pp_runtime_opts __pp_default_rt_opts = {
/* These parameters can be then overwritten with the config file ppsi.conf */
struct pp_instance_cfg __pp_default_instance_cfg = {
.profile=PPSI_PROFILE_PTP,
.delayMechanism=E2E,
.delayMechanism = MECH_E2E,
.announce_interval=PP_DEFAULT_ANNOUNCE_INTERVAL,
.announce_receipt_timeout=PP_DEFAULT_ANNOUNCE_RECEIPT_TIMEOUT,
.sync_interval=PP_DEFAULT_SYNC_INTERVAL,
......@@ -103,7 +103,7 @@ int pp_init_globals(struct pp_globals *ppg, struct pp_runtime_opts *pp_rt_opts)
def->externalPortConfigurationEnabled=pp_rt_opts->externalPortConfigurationEnabled;
def->slaveOnly=rt_opts->slaveOnly;
if ( is_externalPortConfigurationEnabled(def) ) {
if ( def->slaveOnly ) {
if (is_slaveOnly(def)) {
pp_printf("ppsi: Incompatible configuration: SlaveOnly and externalPortConfigurationEnabled\n");
def->slaveOnly=FALSE;
}
......@@ -139,10 +139,6 @@ int pp_init_globals(struct pp_globals *ppg, struct pp_runtime_opts *pp_rt_opts)
}
def->priority1 = rt_opts->priority1;
def->priority2 = rt_opts->priority2;
def->domainNumber = rt_opts->domainNumber;
for (i = 0; i < get_numberPorts(def); i++) {
struct pp_instance *ppi = INST(ppg, i);
......@@ -162,7 +158,7 @@ int pp_init_globals(struct pp_globals *ppg, struct pp_runtime_opts *pp_rt_opts)
Enumeration8 desiradedState=ppi->cfg.desiredState;
/* Clause 17.6.5.3 : - Clause 9.2.2 shall not be in effect */
if ( ppi->portDS->masterOnly ) {
if (is_masterOnly(ppi->portDS)) {
/* priority given to externalPortConfigurationEnabled */
ppi->portDS->masterOnly=FALSE;
pp_printf("ppsi: Wrong configuration: externalPortConfigurationEnabled=materOnly=TRUE. materOnly set to FALSE\n");
......
......@@ -288,8 +288,8 @@ int pp_servo_calculate_delays(struct pp_instance *ppi) {
if (__PP_DIAG_ALLOW(ppi, pp_dt_servo, 2)) {
pp_diag(ppi, servo, 2,"delayMM : %s s\n", time_to_string(&servo->delayMM));
pp_diag(ppi, servo, 2,"delayMS : %s s\n", time_to_string(&servo->delayMS));
pp_diag(ppi, servo, 2,"delayAsym : %s ns\n", relative_interval_to_string(ppi->portDS->delayAsymCoeff));
pp_diag(ppi, servo, 2,"delayAsymCoeff : %s ns\n", interval_to_string(ppi->portDS->delayAsymmetry));
pp_diag(ppi, servo, 2,"delayAsym : %s ns\n", interval_to_string(ppi->portDS->delayAsymmetry));
pp_diag(ppi, servo, 2,"delayAsymCoeff : %s ns\n", relative_interval_to_string(ppi->portDS->delayAsymCoeff));
pp_diag(ppi, servo, 2,"meanDelay : %s s\n", time_to_string(&servo->meanDelay));
pp_diag(ppi, servo, 2,"offsetFromMaster: %s s\n", time_to_string(&servo->offsetFromMaster));
}
......
......@@ -37,7 +37,7 @@ static int listening_handle_announce(struct pp_instance *ppi, void *buf, int len
* Announce messages received on a masterOnly PTP Port shall not be considered
* in the operation of the best master clock algorithm or in the update of data sets.
*/
if ( ! DSPOR(ppi)->masterOnly) {
if (!is_masterOnly(DSPOR(ppi))) {
struct pp_frgn_master frgn_master;
bmc_store_frgn_master(ppi, &frgn_master, buf, len);
......
......@@ -40,7 +40,7 @@ static int master_handle_announce(struct pp_instance *ppi, void *buf, int len)
* Announce messages received on a masterOnly PTP Port shall not be considered
* in the operation of the best master clock algorithm or in the update of data sets.
*/
if ( ! DSPOR(ppi)->masterOnly) {
if (!is_masterOnly(DSPOR(ppi))) {
struct pp_frgn_master frgn_master;
bmc_store_frgn_master(ppi, &frgn_master, buf, len);
......@@ -52,7 +52,7 @@ static int master_handle_announce(struct pp_instance *ppi, void *buf, int len)
static int master_handle_delay_request(struct pp_instance *ppi,
void *buf, int len)
{
/* if not in E2E mode, just return */
/* if not in MECH_E2E mode, just return */
if ( is_delayMechanismE2E(ppi) ) {
if (ppi->state == PPS_MASTER) { /* not pre-master */
if ( !msg_issue_delay_resp(ppi, &ppi->last_rcv_time) ) {
......
......@@ -39,7 +39,7 @@ static int passive_handle_announce(struct pp_instance *ppi, void *buf, int len)
* Announce messages received on a masterOnly PTP Port shall not be considered
* in the operation of the best master clock algorithm or in the update of data sets.
*/
if ( ! DSPOR(ppi)->masterOnly) {
if (!is_masterOnly(DSPOR(ppi))) {
struct pp_frgn_master frgn_master;
bmc_store_frgn_master(ppi, &frgn_master, buf, len);
......
......@@ -215,7 +215,7 @@ static int slave_handle_announce(struct pp_instance *ppi, void *buf, int len)
* Announce messages received on a masterOnly PTP Port shall not be considered
* in the operation of the best master clock algorithm or in the update of data sets.
*/
if ( ! DSPOR(ppi)->masterOnly) {
if (!is_masterOnly(DSPOR(ppi))) {
bmc_add_frgn_master(ppi, &frgn_master);
}
......@@ -260,6 +260,7 @@ int pp_slave(struct pp_instance *ppi, void *buf, int len)
/* Check if the foreign master has changed */
if ( DSPAR(ppi)->newGrandmaster ) {
char gm_str[26];
// New grandmaster detected
DSPAR(ppi)->newGrandmaster=FALSE; // Clear it
......@@ -268,8 +269,7 @@ int pp_slave(struct pp_instance *ppi, void *buf, int len)
ppi->next_state = PPS_UNCALIBRATED;
Octet *id=DSPAR(ppi)->parentPortIdentity.clockIdentity.id;
pp_info("New grandmaster detected: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
id[0],id[1],id[2],id[3],id[4],id[5],id[6],id[7]);
pp_info("New grandmaster detected: %s\n", format_hex8(gm_str, id));
}
}
......
......@@ -29,16 +29,16 @@ static int bare_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg
struct pp_msgtype_info *mf = pp_msgtype_info + msg_fmt;
struct bare_ethhdr *hdr = pkt;
struct pp_time *t = &ppi->last_snt_time;
static const uint8_t macaddr[2][ETH_ALEN] = {
[PP_E2E_MECH] = PP_MCAST_MACADDRESS,
[PP_P2P_MECH] = PP_PDELAY_MACADDRESS,
static const uint8_t macaddr[MECH_MAX_SUPPORTED + 1][ETH_ALEN] = {
[MECH_E2E] = PP_MCAST_MACADDRESS,
[MECH_P2P] = PP_PDELAY_MACADDRESS,
};
int is_pdelay = mf->is_pdelay;
int delay_mechanism = mf->delay_mechanism;
int ret;
hdr->h_proto = htons(ETH_P_1588);
memcpy(hdr->h_dest, macaddr[is_pdelay], ETH_ALEN);
memcpy(hdr->h_dest, macaddr[delay_mechanism], ETH_ALEN);
/* raw socket implementation always uses gen socket */
memcpy(hdr->h_source, ppi->ch[PP_NP_GEN].addr, 6);
......
......@@ -185,14 +185,14 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg
struct pp_vlanhdr *vhdr = pkt;
struct pp_channel *ch = ppi->ch + chtype;
struct pp_time *t = &ppi->last_snt_time;
int is_pdelay = mf->is_pdelay;
int delay_mechanism = mf->delay_mechanism;
static const uint16_t udpport[] = {
[PP_NP_GEN] = PP_GEN_PORT,
[PP_NP_EVT] = PP_EVT_PORT,
};
static const uint8_t macaddr[2][ETH_ALEN] = {
[PP_E2E_MECH] = PP_MCAST_MACADDRESS,
[PP_P2P_MECH] = PP_PDELAY_MACADDRESS,
static const uint8_t macaddr[MECH_MAX_SUPPORTED + 1][ETH_ALEN] = {
[MECH_E2E] = PP_MCAST_MACADDRESS,
[MECH_P2P] = PP_PDELAY_MACADDRESS,
};
int ret;
......@@ -209,7 +209,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg
ch = ppi->ch + PP_NP_GEN;
hdr->h_proto = htons(ETH_P_1588);
memcpy(hdr->h_dest, macaddr[is_pdelay], ETH_ALEN);
memcpy(hdr->h_dest, macaddr[delay_mechanism], ETH_ALEN);
memcpy(hdr->h_source, ch->addr, ETH_ALEN);
TOPS(ppi)->get(ppi, t);
......@@ -234,7 +234,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg
vhdr->h_tci = htons(ppi->peer_vid); /* prio is 0 */
vhdr->h_tpid = htons(0x8100);
memcpy(hdr->h_dest, macaddr[is_pdelay], ETH_ALEN);
memcpy(hdr->h_dest, macaddr[delay_mechanism], ETH_ALEN);
memcpy(vhdr->h_source, ch->addr, ETH_ALEN);
TOPS(ppi)->get(ppi, t);
......@@ -254,7 +254,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg
case PPSI_PROTO_UDP:
addr.sin_family = AF_INET;
addr.sin_port = htons(udpport[chtype]);
addr.sin_addr.s_addr = ppi->mcast_addr[is_pdelay];
addr.sin_addr.s_addr = ppi->mcast_addr[delay_mechanism];
TOPS(ppi)->get(ppi, t);
......@@ -422,7 +422,7 @@ static int unix_open_ch_udp(struct pp_instance *ppi, char *ifname, int chtype)
context = addr_str; errno = EINVAL;
if (!inet_aton(addr_str, &net_addr))
goto err_out;
ppi->mcast_addr[PP_E2E_MECH] = net_addr.s_addr;
ppi->mcast_addr[MECH_E2E] = net_addr.s_addr;
/* multicast sends only on specified interface */
imr.imr_multiaddr.s_addr = net_addr.s_addr;
......@@ -446,7 +446,7 @@ static int unix_open_ch_udp(struct pp_instance *ppi, char *ifname, int chtype)
errno = EINVAL;
if (!inet_aton(addr_str, &net_addr))
goto err_out;
ppi->mcast_addr[PP_P2P_MECH] = net_addr.s_addr;
ppi->mcast_addr[MECH_P2P] = net_addr.s_addr;
imr.imr_multiaddr.s_addr = net_addr.s_addr;
/* join multicast group (for receiving) on specified interface */
......@@ -564,17 +564,17 @@ static int unix_net_exit(struct pp_instance *ppi)
/* Close General Multicast */
imr.imr_interface.s_addr = htonl(INADDR_ANY);
imr.imr_multiaddr.s_addr = ppi->mcast_addr[0];
imr.imr_multiaddr.s_addr = ppi->mcast_addr[MECH_E2E];
setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP,
&imr, sizeof(struct ip_mreq));
imr.imr_multiaddr.s_addr = ppi->mcast_addr[1];
imr.imr_multiaddr.s_addr = ppi->mcast_addr[MECH_P2P];
setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP,
&imr, sizeof(struct ip_mreq));
close(fd);
ppi->ch[i].fd = -1;
}
ppi->mcast_addr[0] = ppi->mcast_addr[1] = 0;
ppi->mcast_addr[MECH_E2E] = ppi->mcast_addr[MECH_P2P] = 0;
return 0;
default:
......@@ -601,10 +601,6 @@ static int unix_net_check_packet(struct pp_globals *ppg, int delay_ms)
arch_data->tv.tv_usec = (delay_ms % 1000) * 1000;
}
/* Detect general timeout with no needs for select stuff */
if ((arch_data->tv.tv_sec == 0) && (arch_data->tv.tv_usec == 0))
return 0;
FD_ZERO(&set);
for (j = 0; j < ppg->nlinks; j++) {
......
......@@ -8,9 +8,10 @@
#include "ptpdump.h"
#include "../arch-wrpc/wrpc.h"
#include <syscon.h> /* wrpc-sw */
#include <endpoint.h> /* wrpc-sw */
#include <dev/syscon.h> /* wrpc-sw */
#include <dev/endpoint.h> /* wrpc-sw */
#include <ptpd_netif.h> /* wrpc-sw */
#include "board.h"
#ifdef CONFIG_ABSCAL
#define HAS_ABSCAL 1
......@@ -77,7 +78,9 @@ static int wrpc_net_recv(struct pp_instance *ppi, void *pkt, int len,
&& (!HAS_ABSCAL || ptp_mode != WRC_MODE_ABSCAL))
mark_incorrect(t);
}
/* copy MAC and vlan of a peer to ppi */
memcpy(ppi->peer, &addr.mac, ETH_ALEN);
ppi->peer_vid = addr.vlan;
/* wrpc-sw may pass this in USER_CFLAGS, to remove footprint */
#ifndef CONFIG_NO_PTPDUMP
/* The header is separate, so dump payload only */
......@@ -90,7 +93,7 @@ static int wrpc_net_recv(struct pp_instance *ppi, void *pkt, int len,
/* WR counts bitslide later, in fixed-delta, so subtract it */
t4 = *t;
bitslide = ep_get_bitslide();
bitslide = ep_get_bitslide(&wrc_endpoint_dev);
t_bts.secs = 0;
t_bts.scaled_nsecs = (bitslide << 16) / 1000;
pp_time_sub(&t4, &t_bts);
......@@ -121,10 +124,10 @@ static int wrpc_net_send(struct pp_instance *ppi, void *pkt, int len, enum pp_ms
struct wr_timestamp wr_ts;
struct wr_sockaddr addr;
struct pp_time *t = &ppi->last_snt_time;
int is_pdelay = mf->is_pdelay;
static const uint8_t macaddr[2][ETH_ALEN] = {
[PP_E2E_MECH] = PP_MCAST_MACADDRESS,
[PP_P2P_MECH] = PP_PDELAY_MACADDRESS,
int delay_mechanism = mf->delay_mechanism;
static const uint8_t macaddr[MECH_MAX_SUPPORTED + 1][ETH_ALEN] = {
[MECH_E2E] = PP_MCAST_MACADDRESS,
[MECH_P2P] = PP_PDELAY_MACADDRESS,
};
/*
......@@ -138,7 +141,7 @@ static int wrpc_net_send(struct pp_instance *ppi, void *pkt, int len, enum pp_ms
sock = ppi->ch[PP_NP_EVT].custom;
addr.ethertype = htons(ETH_P_1588);
memcpy(&addr.mac, macaddr[is_pdelay], sizeof(mac_addr_t));
memcpy(&addr.mac, macaddr[delay_mechanism], sizeof(mac_addr_t));
if (CONFIG_HAS_WRPC_FAULTS && drop) {
addr.ethertype = 1;
addr.mac[0] = 0x22; /* pfilter uses mac; drop for nodes too */
......
......@@ -6,8 +6,11 @@
* Released according to the GNU LGPL, version 2.1 or any later version.
*/
#include <ppsi/ppsi.h>
#include "pps_gen.h" /* in wrpc-sw */
#include "syscon.h" /* in wrpc-sw */
#include "dev/pps_gen.h" /* in wrpc-sw */
#include "dev/syscon.h" /* in wrpc-sw */
#include "../arch-wrpc/wrpc.h"
static int utcOffset = CONFIG_LEAP_SECONDS_VAL;
static int wrpc_time_get_utc_time(struct pp_instance *ppi, int *hours, int *minutes, int *seconds)
{
......@@ -20,29 +23,15 @@ static int wrpc_time_get_utc_time(struct pp_instance *ppi, int *hours, int *minu
static int wrpc_time_get_utc_offset(struct pp_instance *ppi, int *offset, int *leap59, int *leap61)
{
/* no UTC offset */
*leap59 = 0;
*leap61 = 0;
*offset = 0;
return -1;
*offset = utcOffset;
return 0;
}
static int wrpc_time_set_utc_offset(struct pp_instance *ppi, int offset, int leap59, int leap61)
{
/* no UTC offset */
return -1;
}
static int wrpc_time_get_servo_state(struct pp_instance *ppi, int *state)
{
struct wr_dsport *wrp = WR_DSPOR(ppi);
int locked;
locked = wrp->ops->locking_poll(ppi, 1);
if (locked == WR_SPLL_READY)
*state = PP_SERVO_LOCKED;
else
*state = PP_SERVO_UNLOCKED;
utcOffset = offset;
return 0;
}
......@@ -105,11 +94,12 @@ struct pp_time_operations wrpc_time_ops = {
.get_utc_time = wrpc_time_get_utc_time,
.get_utc_offset = wrpc_time_get_utc_offset,
.set_utc_offset = wrpc_time_set_utc_offset,
.get_servo_state = wrpc_time_get_servo_state,
.get = wrpc_time_get,
.set = wrpc_time_set,
.adjust = wrpc_time_adjust,
.adjust_offset = wrpc_time_adjust_offset,
.adjust_freq = NULL,
.calc_timeout = wrpc_calc_timeout,
.get_GM_lock_state = wrpc_get_GM_lock_state,
.enable_timing_output = wrpc_enable_timing_output,
};
......@@ -492,14 +492,14 @@ static int wrs_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg_
struct pp_vlanhdr *vhdr = pkt;
struct pp_channel *ch = ppi->ch + chtype;
struct pp_time *t = &ppi->last_snt_time;
int is_pdelay = mf->is_pdelay;
int delay_mechanism = mf->delay_mechanism;
static uint16_t udpport[] = {
[PP_NP_GEN] = PP_GEN_PORT,
[PP_NP_EVT] = PP_EVT_PORT,
};
static const uint8_t macaddr[2][ETH_ALEN] = {
[PP_E2E_MECH] = PP_MCAST_MACADDRESS,
[PP_P2P_MECH] = PP_PDELAY_MACADDRESS,
static const uint8_t macaddr[MECH_MAX_SUPPORTED + 1][ETH_ALEN] = {
[MECH_E2E] = PP_MCAST_MACADDRESS,
[MECH_P2P] = PP_PDELAY_MACADDRESS,
};
struct wrs_socket *s;
int ret, fd, drop;
......@@ -524,7 +524,7 @@ static int wrs_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg_
if (drop)
hdr->h_proto++;
memcpy(hdr->h_dest, macaddr[is_pdelay], ETH_ALEN);
memcpy(hdr->h_dest, macaddr[delay_mechanism], ETH_ALEN);
memcpy(hdr->h_source, ch->addr, ETH_ALEN);
if (t)
......@@ -555,7 +555,7 @@ static int wrs_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg_
if (drop)
hdr->h_proto++;
memcpy(hdr->h_dest, macaddr[is_pdelay], ETH_ALEN);
memcpy(hdr->h_dest, macaddr[delay_mechanism], ETH_ALEN);
memcpy(vhdr->h_source, ch->addr, ETH_ALEN);
if (t)
......@@ -583,7 +583,7 @@ static int wrs_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg_
fd = ppi->ch[chtype].fd;
addr.sin_family = AF_INET;
addr.sin_port = htons(udpport[chtype]);
addr.sin_addr.s_addr = ppi->mcast_addr[is_pdelay];
addr.sin_addr.s_addr = ppi->mcast_addr[delay_mechanism];
if (drop)
addr.sin_port = 3200;
ret = sendto(fd, pkt, len, 0, (struct sockaddr *)&addr,
......
......@@ -308,6 +308,9 @@ int wrs_locking_poll(struct pp_instance *ppi)
char *pp_diag_msg;
char text[128];
/* Wait 10ms between checks when polling */
usleep(10 * 1000);
ret = minipc_call(hal_ch, DEFAULT_TO, &__rpcdef_lock_cmd,
&rval, ppi->iface_name, HEXP_LOCK_CMD_CHECK, 0);
if ( ret<0 ) {
......
......@@ -6,9 +6,10 @@
*/
#include <stdio.h>
#include <string.h>
#include "ptpdump.h"
#include <ppsi/ieee1588_types.h> /* from ../include */
#include "decent_types.h"
#include "ptpdump.h"
#include <ppsi/lib.h>
#define WR_MODE_ON_MASK 0x8
#define CALIBRATED_MASK 0x4
......@@ -65,6 +66,8 @@ static int dump_eth(char *prefix, struct ethhdr *eth)
unsigned char *s = eth->h_source;
int proto = ntohs(eth->h_proto);
int ret;
char mac_s[20];
char mac_d[20];
/* Between eth header and payload may be a VLAN tag;
* NOTE: We cannot distinguish between both cases looking at
......@@ -77,10 +80,9 @@ static int dump_eth(char *prefix, struct ethhdr *eth)
} else
ret = sizeof(struct ethhdr);
printf("%sETH: %04x (%02x:%02x:%02x:%02x:%02x:%02x -> "
"%02x:%02x:%02x:%02x:%02x:%02x)\n", prefix, proto,
s[0], s[1], s[2], s[3], s[4], s[5],
d[0], d[1], d[2], d[3], d[4], d[5]);
printf("%sETH: %04x (%s -> %s)\n", prefix, proto,
format_mac(mac_s, s),
format_mac(mac_d, d));
return ret;
}
......@@ -413,6 +415,7 @@ static void dump_payload(char *prefix, void *pl, int len)
break;
case PPM_SIGNALING :
donelen += l1sync_dump_tlv(prefix, pl + donelen, n);
donelen += wr_dump_tlv(prefix, pl + donelen, n);
break;
default :
goto out;
......
/*
* This header defines structures for dumping other structures from
* binary files. Every arch has a different endianness and alignment/size,
* so we can't just use the structures from the host compiler. It used to
* work for lm32/i386, but it fails with x86-64, so let's change attitude.
*/
#include <stdint.h>
/*
* To ease copying from header files, allow int, char and other known types.
* Please add more type as more structures are included here
*/
enum dump_type_ppsi {
dump_type_UInteger64 = 100,
dump_type_Integer64,
dump_type_UInteger32,
dump_type_Integer32,
dump_type_UInteger16,
dump_type_Integer16,
dump_type_UInteger8,
dump_type_Integer8,
dump_type_Enumeration8,
dump_type_UInteger4,
dump_type_Boolean,
dump_type_ClockIdentity,
dump_type_PortIdentity,
dump_type_ClockQuality,
dump_type_TimeInterval,
dump_type_RelativeDifference,
dump_type_FixedDelta,
dump_type_Timestamp,
dump_type_scaledPicoseconds,
/* and this is ours */
dump_type_yes_no_Boolean,
dump_type_pp_time,
dump_type_delay_mechanism,
dump_type_protocol_extension,
dump_type_wrpc_mode_cfg,
dump_type_timing_mode,
dump_type_ppi_state,
dump_type_ppi_state_Enumeration8,
dump_type_wr_config,
dump_type_wr_config_Enumeration8,
dump_type_wr_role,
dump_type_wr_role_Enumeration8,
dump_type_pp_pdstate,
dump_type_exstate,
dump_type_pp_servo_flag,
dump_type_pp_servo_state,
dump_type_wr_state,
dump_type_ppi_profile,
dump_type_ppi_proto,
dump_type_ppi_flag,
};
typedef Boolean yes_no_Boolean;
typedef int delay_mechanism;
typedef int protocol_extension;
typedef wrh_timing_mode_t timing_mode;
typedef int wrpc_mode_cfg;
typedef int ppi_state;
typedef Enumeration8 ppi_state_Enumeration8;
typedef int wr_config;
typedef Enumeration8 wr_config_Enumeration8;
typedef int wr_role;
typedef Enumeration8 wr_role_Enumeration8;
typedef pp_pdstate_t pp_pdstate;
typedef pp_exstate_t exstate;
typedef unsigned long pp_servo_flag;
typedef int pp_servo_state;
typedef wr_state_t wr_state;
typedef int ppi_profile;
typedef int ppi_proto;
typedef unsigned char ppi_flag;
typedef FixedDelta scaledPicoseconds;
......@@ -222,3 +222,27 @@ int main(int argc, char **argv)
return 0;
}
char *format_hex(char *s, const unsigned char *mac, int cnt)
{
int i;
*s = '\0';
for (i = 0; i < cnt; i++) {
sprintf(s, "%s%02x:", s, mac[i]);
}
/* remove last colon */
s[cnt * 3 - 1] = '\0'; /* cnt * strlen("FF:") - 1 */
return s;
}
char *format_hex8(char *s, const unsigned char *mac)
{
return format_hex(s, mac, 8);
}
char *format_mac(char *s, const unsigned char *mac)
{
format_hex(s, mac, 6);
return s;
}
#include <sys/types.h>
#include <ppsi/ppsi.h>
#include <stdio.h>
#include <wrpc.h>
#include <time_lib.h>
#include "dump-info.h"
#include "dump-info_ppsi.h"
struct dump_info dump_ppsi_info[] = {
/* map for fields of ppsi structures */
#undef DUMP_STRUCT
#define DUMP_STRUCT struct pp_globals
DUMP_HEADER("pp_globals"),
DUMP_FIELD(pointer, pp_instances),
DUMP_FIELD(pointer, rt_opts),
DUMP_FIELD(pointer, defaultDS),
DUMP_FIELD(pointer, currentDS),
DUMP_FIELD(pointer, parentDS),
DUMP_FIELD(pointer, timePropertiesDS),
DUMP_FIELD(int, ebest_idx),
DUMP_FIELD(int, ebest_updated),
DUMP_FIELD(int, nlinks),
DUMP_FIELD(int, max_links),
/* substructure pp_globals_cfg */
DUMP_FIELD(int, cfg.cfg_items),
DUMP_FIELD(int, cfg.cur_ppi_n),
DUMP_FIELD(int, rxdrop),
DUMP_FIELD(int, txdrop),
DUMP_FIELD(pointer, arch_data),
DUMP_FIELD(pointer, global_ext_data),
#undef DUMP_STRUCT
#define DUMP_STRUCT struct pp_runtime_opts /* Horrible typedef */
DUMP_HEADER("pp_runtime_opts"),
DUMP_FIELD(uint32_t, updated_fields_mask),
DUMP_FIELD(int, clock_quality_clockClass), // ClockQuality.clockClass
DUMP_FIELD(int, clock_quality_clockAccuracy), // ClockQuality.clockAccuracy
DUMP_FIELD(int, clock_quality_offsetScaledLogVariance), // ClockQuality.offsetScaledLogVariance
DUMP_FIELD(int, timeSource), // timePropertiesDS_t.timeSource
DUMP_FIELD(yes_no_Boolean, ptpTimeScale), // timePropertiesDS_t.timeScale
DUMP_FIELD(yes_no_Boolean, frequencyTraceable), // timePropertiesDS_t.frequencyTraceable
DUMP_FIELD(yes_no_Boolean, timeTraceable), // timePropertiesDS_t.timeTraceable
DUMP_FIELD(Integer32, ttl),
DUMP_FIELD(int, flags), /* see below */
DUMP_FIELD(Integer16, ap),
DUMP_FIELD(Integer16, ai),
DUMP_FIELD(Integer16, s),
DUMP_FIELD(int, priority1),
DUMP_FIELD(int, priority2),
DUMP_FIELD(int, domainNumber),
DUMP_FIELD(int, ptpPpsThresholdMs),
DUMP_FIELD(int, gmDelayToGenPpsSec),
DUMP_FIELD(yes_no_Boolean, externalPortConfigurationEnabled),
DUMP_FIELD(yes_no_Boolean, slaveOnly),
DUMP_FIELD(yes_no_Boolean, forcePpsGen),
DUMP_FIELD(yes_no_Boolean, ptpFallbackPpsGen),
DUMP_FIELD(pointer, arch_opts),
#undef DUMP_STRUCT
#define DUMP_STRUCT defaultDS_t /* Horrible typedef */
DUMP_HEADER("defaultDS_t"),
DUMP_FIELD(Boolean, twoStepFlag),
DUMP_FIELD(ClockIdentity, clockIdentity),
DUMP_FIELD(UInteger16, numberPorts),
DUMP_FIELD(ClockQuality, clockQuality),
DUMP_FIELD(UInteger8, priority1),
DUMP_FIELD(UInteger8, priority2),
DUMP_FIELD(UInteger8, domainNumber),
DUMP_FIELD(yes_no_Boolean, slaveOnly),
/** Optional (IEEE1588-2019) */
// FIXME: DUMP_FIELD(Timestamp, currentTime),
DUMP_FIELD(yes_no_Boolean, instanceEnable),
DUMP_FIELD(yes_no_Boolean, externalPortConfigurationEnabled),
DUMP_FIELD(Enumeration8, maxStepsRemoved),
DUMP_FIELD(Enumeration8, SdoId),
DUMP_FIELD(Enumeration8, instanceType),
#undef DUMP_STRUCT
#define DUMP_STRUCT currentDS_t /* Horrible typedef */
DUMP_HEADER("currentDS_t"),
DUMP_FIELD(UInteger16, stepsRemoved),
DUMP_FIELD(TimeInterval, offsetFromMaster),
DUMP_FIELD(TimeInterval, meanDelay), /* oneWayDelay */
DUMP_FIELD(UInteger16, primarySlavePortNumber),
#undef DUMP_STRUCT
#define DUMP_STRUCT parentDS_t /* Horrible typedef */
DUMP_HEADER("parentDS_t"),
DUMP_FIELD(PortIdentity, parentPortIdentity),
DUMP_FIELD(UInteger16, observedParentOffsetScaledLogVariance),
DUMP_FIELD(Integer32, observedParentClockPhaseChangeRate),
DUMP_FIELD(ClockIdentity, grandmasterIdentity),
DUMP_FIELD(ClockQuality, grandmasterClockQuality),
DUMP_FIELD(UInteger8, grandmasterPriority1),
DUMP_FIELD(UInteger8, grandmasterPriority2),
DUMP_FIELD(yes_no_Boolean, newGrandmaster),
#undef DUMP_STRUCT
#define DUMP_STRUCT timePropertiesDS_t /* Horrible typedef */
DUMP_HEADER("timePropertiesDS_t"),
DUMP_FIELD(Integer16, currentUtcOffset),
DUMP_FIELD(yes_no_Boolean, currentUtcOffsetValid),
DUMP_FIELD(yes_no_Boolean, leap59),
DUMP_FIELD(yes_no_Boolean, leap61),
DUMP_FIELD(yes_no_Boolean, timeTraceable),
DUMP_FIELD(yes_no_Boolean, frequencyTraceable),
DUMP_FIELD(yes_no_Boolean, ptpTimescale),
DUMP_FIELD(Enumeration8, timeSource),
#undef DUMP_STRUCT
#define DUMP_STRUCT struct pp_servo
DUMP_HEADER("pp_servo"),
DUMP_FIELD(long_long, obs_drift),
DUMP_FIELD(Integer64, mpd_fltr.m),
DUMP_FIELD(Integer64, mpd_fltr.y),
DUMP_FIELD(Integer64, mpd_fltr.s_exp),
/* Data shared with extension servo */
DUMP_FIELD(pp_time, delayMM), /* Shared with extension servo */
DUMP_FIELD(pp_time, delayMS), /* Shared with extension servo */
DUMP_FIELD(pp_time, meanDelay), /* Shared with extension servo */
DUMP_FIELD(pp_time, offsetFromMaster), /* Shared with extension servo */
DUMP_FIELD(pp_servo_flag, flags),
DUMP_FIELD(int, reset_address),
/* Data used only by extensions */
DUMP_FIELD(pp_servo_state, state),
DUMP_FIELD_SIZE(char, servo_state_name, 32),
/* Data shared with extension servo */
DUMP_FIELD(UInteger32, update_count),
DUMP_FIELD(pp_time, update_time),
DUMP_FIELD(pp_time, t1),
DUMP_FIELD(pp_time, t2),
DUMP_FIELD(pp_time, t3),
DUMP_FIELD(pp_time, t4),
DUMP_FIELD(pp_time, t5),
DUMP_FIELD(pp_time, t6),
DUMP_FIELD(yes_no, servo_locked),
DUMP_FIELD(yes_no, got_sync),
#if CONFIG_HAS_EXT_L1SYNC || CONFIG_HAS_EXT_WR
#undef DUMP_STRUCT
#define DUMP_STRUCT wrh_servo_t
DUMP_HEADER("wrh_servo_t"),
DUMP_FIELD(Integer32, clock_period_ps),
DUMP_FIELD(Integer64, delayMM_ps),
DUMP_FIELD(Integer32, cur_setpoint_ps),
DUMP_FIELD(Integer64, delayMS_ps),
DUMP_FIELD(int, tracking_enabled),
DUMP_FIELD(Integer64, skew_ps),
DUMP_FIELD(Integer64, offsetMS_ps),
DUMP_FIELD(UInteger32, n_err_state),
DUMP_FIELD(UInteger32, n_err_offset),
DUMP_FIELD(UInteger32, n_err_delta_rtt),
DUMP_FIELD(Integer64, prev_delayMS_ps),
DUMP_FIELD(int, missed_iters),
#endif
#if CONFIG_HAS_EXT_WR == 1
#undef DUMP_STRUCT
#define DUMP_STRUCT wr_servo_ext_t
DUMP_HEADER("wr_servo_ext_t"),
DUMP_FIELD(pp_time, delta_txm),
DUMP_FIELD(pp_time, delta_rxm),
DUMP_FIELD(pp_time, delta_txs),
DUMP_FIELD(pp_time, delta_rxs),
DUMP_FIELD(pp_time, rawT1),
DUMP_FIELD(pp_time, rawT2),
DUMP_FIELD(pp_time, rawT3),
DUMP_FIELD(pp_time, rawT4),
DUMP_FIELD(pp_time, rawT5),
DUMP_FIELD(pp_time, rawT6),
DUMP_FIELD(pp_time, rawDelayMM),
#endif
#undef DUMP_STRUCT
#define DUMP_STRUCT portDS_t
DUMP_HEADER("portDS_t"),
DUMP_FIELD(PortIdentity, portIdentity),
DUMP_FIELD(Integer8, logMinDelayReqInterval),
DUMP_FIELD(Integer8, logAnnounceInterval),
DUMP_FIELD(UInteger8, announceReceiptTimeout),
DUMP_FIELD(Integer8, logSyncInterval),
DUMP_FIELD(pointer, ext_dsport),
DUMP_FIELD(Integer8, logMinPdelayReqInterval),
DUMP_FIELD(TimeInterval, meanLinkDelay),
DUMP_FIELD(UInteger4, versionNumber),
DUMP_FIELD(UInteger4, minorVersionNumber),
DUMP_FIELD(TimeInterval, delayAsymmetry),
DUMP_FIELD(RelativeDifference, delayAsymCoeff),
DUMP_FIELD(yes_no_Boolean, portEnable),
DUMP_FIELD(yes_no_Boolean, masterOnly),
#undef DUMP_STRUCT
#define DUMP_STRUCT struct pp_instance
DUMP_HEADER("pp_instance"),
DUMP_FIELD(ppi_state, state),
DUMP_FIELD(ppi_state, next_state),
DUMP_FIELD(int, next_delay),
DUMP_FIELD(yes_no, is_new_state),
DUMP_FIELD(pointer, current_state_item),
DUMP_FIELD(pointer, arch_data),
DUMP_FIELD(pointer, ext_data),
DUMP_FIELD(protocol_extension, protocol_extension),
DUMP_FIELD(pointer, ext_hooks),
DUMP_FIELD(unsigned_long, d_flags),
DUMP_FIELD(ppi_flag, flags),
DUMP_FIELD(ppi_proto, proto),
DUMP_FIELD(delay_mechanism, delayMechanism),
DUMP_FIELD(pointer, glbs),
DUMP_FIELD(pointer, n_ops),
DUMP_FIELD(pointer, t_ops),
DUMP_FIELD(pointer, __tx_buffer),
DUMP_FIELD(pointer, __rx_buffer),
DUMP_FIELD(pointer, tx_frame),
DUMP_FIELD(pointer, rx_frame),
DUMP_FIELD(pointer, tx_ptp),
DUMP_FIELD(pointer, rx_ptp),
/* This is a sub-structure */
DUMP_FIELD(int, ch[0].fd),
DUMP_FIELD(pointer, ch[0].custom),
DUMP_FIELD(pointer, ch[0].arch_data),
DUMP_FIELD_SIZE(bina, ch[0].addr, 6),
DUMP_FIELD(yes_no, ch[0].pkt_present),
DUMP_FIELD(int, ch[1].fd),
DUMP_FIELD(pointer, ch[1].custom),
DUMP_FIELD(pointer, ch[1].arch_data),
DUMP_FIELD_SIZE(bina, ch[1].addr, 6),
DUMP_FIELD(yes_no, ch[1].pkt_present),
DUMP_FIELD(ip_address, mcast_addr[0]),
DUMP_FIELD(ip_address, mcast_addr[1]),
DUMP_FIELD(int, tx_offset),
DUMP_FIELD(int, rx_offset),
DUMP_FIELD_SIZE(bina, peer, 6),
DUMP_FIELD_SIZE(bina, activePeer, 6),
DUMP_FIELD(uint16_t, peer_vid),
DUMP_FIELD(pp_time, t1),
DUMP_FIELD(pp_time, t2),
DUMP_FIELD(pp_time, t3),
DUMP_FIELD(pp_time, t4),
DUMP_FIELD(pp_time, t5),
DUMP_FIELD(pp_time, t6),
DUMP_FIELD(Integer32, t4_cf),
DUMP_FIELD(Integer32, t6_cf),
DUMP_FIELD(UInteger64, syncCF),
DUMP_FIELD(pp_time, last_rcv_time),
DUMP_FIELD(pp_time, last_snt_time),
DUMP_FIELD(UInteger16, frgn_rec_num),
DUMP_FIELD(Integer16, frgn_rec_best),
DUMP_FIELD(UInteger32, frgn_master_time_window_ms),
DUMP_FIELD(dummy /*struct pp_frgn_master */, frgn_master), /* use dummy type just to save the offset */
DUMP_FIELD(pointer, portDS),
DUMP_FIELD(pointer, servo),
/* dump of substructure asymmetryCorrectionPortDS_t; draft P1588_v_29: page 99*/
DUMP_FIELD(TimeInterval, asymmetryCorrectionPortDS.constantAsymmetry),
DUMP_FIELD(RelativeDifference, asymmetryCorrectionPortDS.scaledDelayCoefficient),
DUMP_FIELD(yes_no_Boolean, asymmetryCorrectionPortDS.enable),
/* dump of substructure timestampCorrectionPortDS_t; draft P1588_v_29: page 99 */
DUMP_FIELD(TimeInterval, timestampCorrectionPortDS.egressLatency),
DUMP_FIELD(TimeInterval, timestampCorrectionPortDS.ingressLatency),
DUMP_FIELD(TimeInterval, timestampCorrectionPortDS.messageTimestampPointLatency),
DUMP_FIELD(TimeInterval, timestampCorrectionPortDS.semistaticLatency),
/* dump of substructure externalPortConfigurationPortDS_t; draft P1588: Clause 17.6.3*/
DUMP_FIELD(ppi_state_Enumeration8, externalPortConfigurationPortDS.desiredState),
// timeOutInstCnt_t tmo_cfg[PP_TO_COUNT];
DUMP_FIELD(UInteger16, recv_sync_sequence_id),
//DUMP_FIELD(UInteger16 sent_seq[__PP_NR_MESSAGES_TYPES]),
DUMP_FIELD_SIZE(bina, received_ptp_header, sizeof(MsgHeader)),
DUMP_FIELD(yes_no_Boolean, link_up),
DUMP_FIELD_SIZE(char, iface_name, 16), /* for direct actions on hardware */
DUMP_FIELD_SIZE(char, port_name, 16), /* for diagnostics, mainly */
DUMP_FIELD(int, port_idx),
DUMP_FIELD(int, vlans_array_len),
/* FIXME: array */
// int vlans[CONFIG_VLAN_ARRAY_SIZE];
DUMP_FIELD(int, nvlans),
/* sub structure */
DUMP_FIELD_SIZE(char, cfg.port_name, 16),
DUMP_FIELD_SIZE(char, cfg.iface_name, 16),
DUMP_FIELD(ppi_profile, cfg.profile),
DUMP_FIELD(delay_mechanism, cfg.delayMechanism),
/* FIXME: other fields from cfg */
DUMP_FIELD(unsigned_long, ptp_tx_count),
DUMP_FIELD(unsigned_long, ptp_rx_count),
DUMP_FIELD(yes_no_Boolean, received_dresp), /* Count the number of delay response messages received for a given delay request */
DUMP_FIELD(yes_no_Boolean, received_dresp_fup), /* Count the number of delay response follow up messages received for a given delay request */
DUMP_FIELD(yes_no_Boolean, ptp_support), /* True if allow pure PTP support */
DUMP_FIELD(yes_no_Boolean, bmca_execute), /* True: Ask fsm to run bmca state decision */
DUMP_FIELD(pp_pdstate, pdstate), /* Protocol detection state */
DUMP_FIELD(exstate, extState), /* Extension state */
#undef DUMP_STRUCT
#define DUMP_STRUCT struct pp_frgn_master
DUMP_HEADER_SIZE("pp_frgn_master", sizeof(struct pp_frgn_master)),
DUMP_FIELD(PortIdentity, sourcePortIdentity),
DUMP_FIELD(PortIdentity, receivePortIdentity),
DUMP_FIELD(ClockQuality, grandmasterClockQuality),
DUMP_FIELD(ClockIdentity, grandmasterIdentity),
DUMP_FIELD(UInteger8, grandmasterPriority1),
DUMP_FIELD(UInteger8, grandmasterPriority2),
DUMP_FIELD_SIZE(UInteger8, flagField,2),
DUMP_FIELD(Enumeration8, timeSource),
DUMP_FIELD(UInteger16, sequenceId),
DUMP_FIELD(UInteger16, stepsRemoved),
DUMP_FIELD(Integer16, currentUtcOffset),
DUMP_FIELD(yes_no_Boolean, qualified),
DUMP_FIELD(unsigned_long, lastAnnounceMsgMs),
DUMP_FIELD_SIZE(bina, peer_mac, 6),
#if CONFIG_HAS_EXT_WR == 1
#undef DUMP_STRUCT
#define DUMP_STRUCT struct wr_dsport
DUMP_HEADER("wr_dsport"),
DUMP_FIELD(wr_state, state),
DUMP_FIELD(wr_state, next_state),
DUMP_FIELD(yes_no_Boolean, wrModeOn),
DUMP_FIELD(yes_no_Boolean, parentWrModeOn),
DUMP_FIELD(FixedDelta, deltaTx),
DUMP_FIELD(FixedDelta, deltaRx),
DUMP_FIELD(UInteger16, otherNodeCalSendPattern),
DUMP_FIELD(UInteger8, otherNodeCalRetry),
DUMP_FIELD(UInteger32, otherNodeCalPeriod),
DUMP_FIELD(FixedDelta, otherNodeDeltaTx),
DUMP_FIELD(FixedDelta, otherNodeDeltaRx),
DUMP_FIELD(wr_config_Enumeration8, wrConfig),
DUMP_FIELD(wr_config_Enumeration8, parentWrConfig),
DUMP_FIELD(wr_role_Enumeration8, wrMode),
/* DUMP_FIELD(Enumeration8, wrPortState), not used*/
#endif
#if CONFIG_ARCH_IS_WRPC
#undef DUMP_STRUCT
#define DUMP_STRUCT struct wrpc_arch_data_t
DUMP_HEADER("wrpc_arch_data_t"),
DUMP_FIELD(timing_mode, timingMode),
DUMP_FIELD(wrpc_mode_cfg, wrpcModeCfg),
#endif
#undef DUMP_STRUCT
#define DUMP_STRUCT struct wr_data
DUMP_HEADER("wr_data"),
/* These are structs not pointers, but we need to know the offset in wr_data structure */
DUMP_FIELD(pointer,servo),
DUMP_FIELD(pointer,servo_ext),
DUMP_HEADER("end"),
};
void dump_mem_ppsi_wrpc(void *mapaddr, unsigned long ppg_off)
{
unsigned long ppi_off, servo_off, ds_off, arch_data_offset, tmp_off;
char *prefix;
prefix = "ppsi.globalDS";
if (!ppg_off) {
printf("%s not found\n", prefix);
/* global structure not found, can't do more, return */
return;
}
/* print ppg first */
printf("%s at 0x%lx\n", prefix, ppg_off);
dump_many_fields(mapaddr + ppg_off, "pp_globals", prefix);
arch_data_offset = wrpc_get_pointer(mapaddr + ppg_off,
"pp_globals", "arch_data");
if (arch_data_offset) {
prefix = "ppsi.arch_data";
printf("%s at 0x%lx\n", prefix, arch_data_offset);
dump_many_fields(mapaddr + arch_data_offset, "wrpc_arch_data_t",
prefix);
}
ds_off = ppg_off;
/* dump global data sets */
tmp_off = wrpc_get_pointer(mapaddr + ds_off, "pp_globals", "rt_opts");
if (tmp_off) {
prefix = "ppsi.rt_opts";
printf("%s at 0x%lx\n", prefix, tmp_off);
dump_many_fields(mapaddr + tmp_off, "pp_runtime_opts", prefix);
}
tmp_off = wrpc_get_pointer(mapaddr + ds_off, "pp_globals", "defaultDS");
if (tmp_off) {
prefix = "ppsi.defaultDS";
printf("%s at 0x%lx\n", prefix, tmp_off);
dump_many_fields(mapaddr + tmp_off, "defaultDS_t", prefix);
}
tmp_off = wrpc_get_pointer(mapaddr + ds_off, "pp_globals", "currentDS");
if (tmp_off) {
prefix = "ppsi.currentDS";
printf("%s at 0x%lx\n", prefix, tmp_off);
dump_many_fields(mapaddr + tmp_off, "currentDS_t", prefix);
}
tmp_off = wrpc_get_pointer(mapaddr + ds_off, "pp_globals", "parentDS");
if (tmp_off) {
prefix = "ppsi.parentDS";
printf("%s at 0x%lx\n", prefix, tmp_off);
dump_many_fields(mapaddr + tmp_off, "parentDS_t", prefix);
}
tmp_off = wrpc_get_pointer(mapaddr + ds_off, "pp_globals",
"timePropertiesDS");
if (tmp_off) {
prefix = "ppsi.timePropertiesDS";
printf("%s at 0x%lx\n", prefix, tmp_off);
dump_many_fields(mapaddr + tmp_off, "timePropertiesDS_t",
prefix);
}
/* dump instance's data sets */
ppi_off = wrpc_get_pointer(mapaddr + ppg_off, "pp_globals",
"pp_instances");
if (ppi_off) {
int protocol_extension;
unsigned long portds_off;
unsigned long frgn_m_off;
unsigned long frgn_master_struct_size;
int frgn_rec_num;
int frgn_m_i;
char buff[50];
prefix = "ppsi.inst.0";
printf("%s at 0x%lx\n", prefix, ppi_off);
dump_many_fields(mapaddr + ppi_off, "pp_instance", prefix);
/* FIXME: support multiple servo */
servo_off = wrpc_get_pointer(mapaddr + ppi_off,
"pp_instance", "servo");
if (servo_off) {
prefix = "ppsi.inst.0.servo";
printf("%s at 0x%lx\n", prefix, servo_off);
dump_many_fields(mapaddr + servo_off, "pp_servo",
prefix);
}
/* dump foreign masters */
frgn_rec_num = wrpc_get_16(mapaddr + ppi_off + wrpc_get_offset("pp_instance", "frgn_rec_num"));
frgn_m_off = ppi_off + wrpc_get_offset("pp_instance", "frgn_master");
prefix = "ppsi.inst.0.frgn_master";
printf("%s at 0x%lx\n", prefix, frgn_m_off);
frgn_master_struct_size = wrpc_get_struct_size("pp_frgn_master");
for (frgn_m_i = 0; frgn_m_i < frgn_rec_num && frgn_m_i < PP_NR_FOREIGN_RECORDS; frgn_m_i++) {
snprintf(buff , sizeof(buff), "ppsi.inst.0.frgn_master.%i", frgn_m_i);
dump_many_fields(mapaddr + frgn_m_off + frgn_m_i * frgn_master_struct_size,
"pp_frgn_master", buff);
}
protocol_extension = wrpc_get_i32(mapaddr + ppi_off + wrpc_get_offset("pp_instance", "protocol_extension"));
#if CONFIG_HAS_EXT_WR == 1
if ( protocol_extension == PPSI_EXT_WR) {
unsigned long ext_data_off;
unsigned long ext_data_servo_off;
unsigned long ext_data_servo_ext_off;
ext_data_off = wrpc_get_pointer(mapaddr + ppi_off,
"pp_instance", "ext_data");
ext_data_servo_off = wrpc_get_offset("wr_data", "servo"); /* should be 0, but check it anyway */
ext_data_servo_ext_off = wrpc_get_offset("wr_data", "servo_ext");
printf("ppsi.inst.0.ext_date at 0x%lx\n", ext_data_off);
prefix = "ppsi.inst.0.servo.wr";
printf("%s at 0x%lx\n", prefix, ext_data_off + ext_data_servo_off);
dump_many_fields(mapaddr + ext_data_off + ext_data_servo_off, "wrh_servo_t", prefix);
prefix = "ppsi.inst.0.servo_ext.wr";
printf("%s at 0x%lx\n", prefix, ext_data_off + ext_data_servo_ext_off);
dump_many_fields(mapaddr + ext_data_off + ext_data_servo_ext_off, "wr_servo_ext_t", prefix);
}
#endif
/* FIXME: support multiple servo */
portds_off = wrpc_get_pointer(mapaddr + ppi_off, "pp_instance",
"portDS");
if (portds_off) {
prefix = "ppsi.inst.0.portDS";
printf("%s at 0x%lx\n", prefix, portds_off);
dump_many_fields(mapaddr + portds_off, "portDS_t",
prefix);
}
#if CONFIG_HAS_EXT_WR == 1
if ( protocol_extension == PPSI_EXT_WR) {
unsigned long ext_dsport_off;
ext_dsport_off = wrpc_get_pointer(mapaddr + portds_off,
"portDS_t", "ext_dsport");
if (ext_dsport_off) {
prefix = "ppsi.inst.0.wrportDS";
printf("%s at 0x%lx\n", prefix, ext_dsport_off);
dump_many_fields(mapaddr + ext_dsport_off,
"wr_dsport", prefix);
}
}
#endif
}
}
int dump_one_field_type_ppsi_wrpc(int type, int size, void *p)
{
int i;
switch(type) {
case dump_type_yes_no_Boolean:
case dump_type_ppi_state:
case dump_type_ppi_state_Enumeration8:
case dump_type_wr_config:
case dump_type_wr_config_Enumeration8:
case dump_type_wr_role:
case dump_type_wr_role_Enumeration8:
case dump_type_pp_pdstate:
case dump_type_exstate:
case dump_type_pp_servo_flag:
case dump_type_pp_servo_state:
case dump_type_wr_state:
case dump_type_ppi_profile:
case dump_type_ppi_proto:
case dump_type_ppi_flag:
if (size == 1)
i = *(uint8_t *)p;
else if (size == 2)
i = wrpc_get_16(p);
else
i = wrpc_get_l32(p);
break;
default:
i = 0;
}
return i;
}
/* create fancy macro to shorten the switch statements, assign val as a string to p */
#define ENUM_TO_P_IN_CASE(val, p) \
case val: \
p = #val;\
break;
void dump_one_field_ppsi_wrpc(int type, int size, void *p, int i)
{
struct pp_time *t = p;
struct PortIdentity *pi = p;
struct ClockQuality *cq = p;
TimeInterval *ti=p;
RelativeDifference *rd=p;
char buf[128];
char *char_p;
/* check the size of Boolean, which is declared as Enum */
if (type == dump_type_Boolean) {
switch(size) {
case 1:
type = dump_type_UInteger8;
break;
case 2:
type = dump_type_UInteger16;
break;
case 4:
default:
type = dump_type_UInteger32;
break;
}
}
switch(type) {
case dump_type_UInteger64:
printf("%lld\n", wrpc_get_64(p));
break;
case dump_type_Integer64:
printf("%lld\n", wrpc_get_64(p));
break;
case dump_type_Integer32:
printf("%i\n", wrpc_get_i32(p));
break;
case dump_type_UInteger32:
printf("%li\n", wrpc_get_l32(p));
break;
case dump_type_UInteger8:
case dump_type_Integer8:
case dump_type_Enumeration8:
case dump_type_UInteger4:
printf("%i\n", *(unsigned char *)p);
break;
case dump_type_UInteger16:
case dump_type_Integer16:
printf("%i\n", wrpc_get_16(p));
break;
case dump_type_yes_no_Boolean:
printf("%d", i);
if (i == 0)
print_str("no");
else if (i == 1)
print_str("yes");
else
print_str("unknown");
printf("\n");
break;
case dump_type_pp_time:
{
struct pp_time localt;
localt.secs = wrpc_get_64(&t->secs);
localt.scaled_nsecs = wrpc_get_64(&t->scaled_nsecs);
printf("correct %i: %25s rawps: 0x%04x\n",
!is_incorrect(&localt),
timeToString(&localt,buf),
(int)(localt.scaled_nsecs & 0xffff)
);
break;
}
case dump_type_ClockIdentity: /* Same as binary */
for (i = 0; i < sizeof(ClockIdentity); i++)
printf("%02x%c", ((unsigned char *)p)[i],
i == sizeof(ClockIdentity) - 1 ? '\n' : ':');
break;
case dump_type_PortIdentity: /* Same as above plus port */
for (i = 0; i < sizeof(ClockIdentity); i++)
printf("%02x%c", ((unsigned char *)p)[i],
i == sizeof(ClockIdentity) - 1 ? '.' : ':');
printf("%04x (%i)\n", wrpc_get_16(&pi->portNumber),
wrpc_get_16(&pi->portNumber));
break;
case dump_type_ClockQuality:
printf("class %i, accuracy %02x (%i), logvariance %i\n",
cq->clockClass, cq->clockAccuracy, cq->clockAccuracy,
wrpc_get_16(&cq->offsetScaledLogVariance));
break;
case dump_type_TimeInterval:
printf("%15s, ", timeIntervalToString(wrpc_get_64(ti), buf));
printf("raw: %15lld\n", wrpc_get_64(p));
break;
case dump_type_RelativeDifference:
printf("%15s, ", relativeDifferenceToString(wrpc_get_64(rd), buf));
printf("raw: %15lld\n", wrpc_get_64(p));
break;
case dump_type_FixedDelta:
/* FixedDelta has defined order of msb and lsb,
* which is different than in 64bit type (e.g. uint64_t) on host */
printf("%lld\n", ((unsigned long long)wrpc_get_l32(p)
|((unsigned long long)wrpc_get_l32(p+4))<<32
)>>16);
break;
case dump_type_delay_mechanism:
i = wrpc_get_i32(p);
switch(i) {
ENUM_TO_P_IN_CASE(MECH_E2E, char_p);
ENUM_TO_P_IN_CASE(MECH_P2P, char_p);
ENUM_TO_P_IN_CASE(MECH_COMMON_P2P, char_p);
ENUM_TO_P_IN_CASE(MECH_SPECIAL, char_p);
ENUM_TO_P_IN_CASE(MECH_NO_MECHANISM, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_protocol_extension:
i = wrpc_get_i32(p);
switch(i) {
ENUM_TO_P_IN_CASE(PPSI_EXT_NONE, char_p);
ENUM_TO_P_IN_CASE(PPSI_EXT_WR, char_p);
ENUM_TO_P_IN_CASE(PPSI_EXT_L1S, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_wrpc_mode_cfg:
i = wrpc_get_i32(p);
switch(i) {
ENUM_TO_P_IN_CASE(WRC_MODE_UNKNOWN, char_p);
ENUM_TO_P_IN_CASE(WRC_MODE_GM, char_p);
ENUM_TO_P_IN_CASE(WRC_MODE_MASTER, char_p);
ENUM_TO_P_IN_CASE(WRC_MODE_SLAVE, char_p);
ENUM_TO_P_IN_CASE(WRC_MODE_ABSCAL, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_timing_mode:
i = wrpc_get_i32(p);
switch(i) {
ENUM_TO_P_IN_CASE(WRH_TM_GRAND_MASTER, char_p);
ENUM_TO_P_IN_CASE(WRH_TM_FREE_MASTER, char_p);
ENUM_TO_P_IN_CASE(WRH_TM_BOUNDARY_CLOCK, char_p);
ENUM_TO_P_IN_CASE(WRH_TM_DISABLED, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_ppi_state:
case dump_type_ppi_state_Enumeration8:
switch(i) {
ENUM_TO_P_IN_CASE(PPS_END_OF_TABLE, char_p);
ENUM_TO_P_IN_CASE(PPS_INITIALIZING, char_p);
ENUM_TO_P_IN_CASE(PPS_FAULTY, char_p);
ENUM_TO_P_IN_CASE(PPS_DISABLED, char_p);
ENUM_TO_P_IN_CASE(PPS_LISTENING, char_p);
ENUM_TO_P_IN_CASE(PPS_PRE_MASTER, char_p);
ENUM_TO_P_IN_CASE(PPS_MASTER, char_p);
ENUM_TO_P_IN_CASE(PPS_PASSIVE, char_p);
ENUM_TO_P_IN_CASE(PPS_UNCALIBRATED, char_p);
ENUM_TO_P_IN_CASE(PPS_SLAVE, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_wr_config:
case dump_type_wr_config_Enumeration8:
switch(i) {
ENUM_TO_P_IN_CASE(NON_WR, char_p);
ENUM_TO_P_IN_CASE(WR_M_ONLY, char_p);
ENUM_TO_P_IN_CASE(WR_S_ONLY, char_p);
ENUM_TO_P_IN_CASE(WR_M_AND_S, char_p);
ENUM_TO_P_IN_CASE(WR_MODE_AUTO, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_wr_role:
case dump_type_wr_role_Enumeration8:
switch(i) {
ENUM_TO_P_IN_CASE(WR_ROLE_NONE, char_p);
ENUM_TO_P_IN_CASE(WR_MASTER, char_p);
ENUM_TO_P_IN_CASE(WR_SLAVE, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_pp_pdstate:
switch(i) {
ENUM_TO_P_IN_CASE(PP_PDSTATE_NONE, char_p);
ENUM_TO_P_IN_CASE(PP_PDSTATE_WAIT_MSG, char_p);
ENUM_TO_P_IN_CASE(PP_PDSTATE_PDETECTION, char_p);
ENUM_TO_P_IN_CASE(PP_PDSTATE_PDETECTED, char_p);
ENUM_TO_P_IN_CASE(PP_PDSTATE_FAILURE, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_exstate:
switch(i) {
ENUM_TO_P_IN_CASE(PP_EXSTATE_DISABLE, char_p);
ENUM_TO_P_IN_CASE(PP_EXSTATE_ACTIVE, char_p);
ENUM_TO_P_IN_CASE(PP_EXSTATE_PTP, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_pp_servo_flag:
switch(i) {
ENUM_TO_P_IN_CASE(PP_SERVO_FLAG_VALID, char_p);
ENUM_TO_P_IN_CASE(PP_SERVO_FLAG_WAIT_HW, char_p);
ENUM_TO_P_IN_CASE(PP_SERVO_FLAG_VALID | PP_SERVO_FLAG_WAIT_HW, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_pp_servo_state:
switch(i) {
ENUM_TO_P_IN_CASE(WRH_UNINITIALIZED, char_p);
ENUM_TO_P_IN_CASE(WRH_SYNC_TAI, char_p);
ENUM_TO_P_IN_CASE(WRH_SYNC_NSEC, char_p);
ENUM_TO_P_IN_CASE(WRH_SYNC_PHASE, char_p);
ENUM_TO_P_IN_CASE(WRH_TRACK_PHASE, char_p);
ENUM_TO_P_IN_CASE(WRH_WAIT_OFFSET_STABLE, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_wr_state:
switch(i) {
ENUM_TO_P_IN_CASE(WRS_IDLE, char_p);
ENUM_TO_P_IN_CASE(WRS_PRESENT, char_p);
ENUM_TO_P_IN_CASE(WRS_S_LOCK, char_p);
ENUM_TO_P_IN_CASE(WRS_M_LOCK, char_p);
ENUM_TO_P_IN_CASE(WRS_LOCKED, char_p);
ENUM_TO_P_IN_CASE(WRS_CALIBRATION, char_p);
ENUM_TO_P_IN_CASE(WRS_CALIBRATED, char_p);
ENUM_TO_P_IN_CASE(WRS_RESP_CALIB_REQ, char_p);
ENUM_TO_P_IN_CASE(WRS_WR_LINK_ON, char_p);
ENUM_TO_P_IN_CASE(WRS_ABSCAL, char_p);
ENUM_TO_P_IN_CASE(WRS_MAX_STATES, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_ppi_profile:
switch(i) {
ENUM_TO_P_IN_CASE(PPSI_PROFILE_PTP, char_p);
ENUM_TO_P_IN_CASE(PPSI_PROFILE_WR, char_p);
ENUM_TO_P_IN_CASE(PPSI_PROFILE_HA, char_p);
ENUM_TO_P_IN_CASE(PPSI_PROFILE_CUSTOM, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_ppi_proto:
switch(i) {
ENUM_TO_P_IN_CASE(PPSI_PROTO_RAW, char_p);
ENUM_TO_P_IN_CASE(PPSI_PROTO_UDP, char_p);
ENUM_TO_P_IN_CASE(PPSI_PROTO_VLAN, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_ppi_flag:
switch(i) {
case 0:
char_p = "None";
break;
ENUM_TO_P_IN_CASE(PPI_FLAG_WAITING_FOR_F_UP, char_p);
ENUM_TO_P_IN_CASE(PPI_FLAG_WAITING_FOR_RF_UP, char_p);
case PPI_FLAGS_WAITING:
char_p = "PPI_FLAG_WAITING_FOR_F_UP | PPI_FLAG_WAITING_FOR_RF_UP";
break;
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
}
}
#include <stdio.h>
#include <ppsi/ppsi.h>
#include <ppsi-wrs.h>
#include <time_lib.h>
#include "dump-info_ppsi.h"
#include "wrs_dump_shmem.h"
/* map for fields of ppsi structures */
#undef DUMP_STRUCT
#define DUMP_STRUCT struct pp_globals
......@@ -18,7 +19,10 @@ struct dump_info ppg_info [] = {
DUMP_FIELD(int, ebest_updated),
DUMP_FIELD(int, nlinks),
DUMP_FIELD(int, max_links),
// DUMP_FIELD(struct pp_globals_cfg cfg),
/* substructure pp_globals_cfg */
DUMP_FIELD(int, cfg.cfg_items),
DUMP_FIELD(int, cfg.cur_ppi_n),
DUMP_FIELD(int, rxdrop),
DUMP_FIELD(int, txdrop),
DUMP_FIELD(pointer, arch_data),
......@@ -35,10 +39,10 @@ struct dump_info dsd_info [] = {
DUMP_FIELD(UInteger8, priority1),
DUMP_FIELD(UInteger8, priority2),
DUMP_FIELD(UInteger8, domainNumber),
DUMP_FIELD(Boolean, slaveOnly),
DUMP_FIELD(Timestamp, currentTime),
DUMP_FIELD(Boolean, instanceEnable),
DUMP_FIELD(Boolean, externalPortConfigurationEnabled),
DUMP_FIELD(yes_no_Boolean, slaveOnly),
DUMP_FIELD(Timestamp, currentTime),
DUMP_FIELD(yes_no_Boolean, instanceEnable),
DUMP_FIELD(yes_no_Boolean, externalPortConfigurationEnabled),
DUMP_FIELD(Enumeration8, maxStepsRemoved),
DUMP_FIELD(Enumeration8, SdoId),
DUMP_FIELD(Enumeration8, instanceType),
......@@ -63,26 +67,26 @@ struct dump_info dsp_info [] = {
DUMP_FIELD(ClockQuality, grandmasterClockQuality),
DUMP_FIELD(UInteger8, grandmasterPriority1),
DUMP_FIELD(UInteger8, grandmasterPriority2),
DUMP_FIELD(UInteger8, newGrandmaster),
DUMP_FIELD(yes_no_Boolean, newGrandmaster),
};
#undef DUMP_STRUCT
#define DUMP_STRUCT timePropertiesDS_t /* Horrible typedef */
struct dump_info dstp_info [] = {
DUMP_FIELD(Integer16, currentUtcOffset),
DUMP_FIELD(Boolean, currentUtcOffsetValid),
DUMP_FIELD(Boolean, leap59),
DUMP_FIELD(Boolean, leap61),
DUMP_FIELD(Boolean, timeTraceable),
DUMP_FIELD(Boolean, frequencyTraceable),
DUMP_FIELD(Boolean, ptpTimescale),
DUMP_FIELD(yes_no_Boolean, currentUtcOffsetValid),
DUMP_FIELD(yes_no_Boolean, leap59),
DUMP_FIELD(yes_no_Boolean, leap61),
DUMP_FIELD(yes_no_Boolean, timeTraceable),
DUMP_FIELD(yes_no_Boolean, frequencyTraceable),
DUMP_FIELD(yes_no_Boolean, ptpTimescale),
DUMP_FIELD(Enumeration8, timeSource),
};
#undef DUMP_STRUCT
#define DUMP_STRUCT struct pp_servo
struct dump_info servo_state_info [] = {
DUMP_FIELD(int , state),
DUMP_FIELD(pp_servo_state , state),
DUMP_FIELD(time, delayMM),
DUMP_FIELD(time, delayMS),
DUMP_FIELD(long_long, obs_drift),
......@@ -91,7 +95,7 @@ struct dump_info servo_state_info [] = {
DUMP_FIELD(Integer64, mpd_fltr.s_exp),
DUMP_FIELD(time, meanDelay),
DUMP_FIELD(time, offsetFromMaster),
DUMP_FIELD(unsigned_long, flags),
DUMP_FIELD(pp_servo_flag, flags),
DUMP_FIELD(time, update_time),
DUMP_FIELD(UInteger32, update_count),
DUMP_FIELD(time, t1),
......@@ -101,7 +105,8 @@ struct dump_info servo_state_info [] = {
DUMP_FIELD(time, t5),
DUMP_FIELD(time, t6),
DUMP_FIELD_SIZE(char, servo_state_name,32),
DUMP_FIELD(int, servo_locked),
DUMP_FIELD(yes_no, servo_locked),
DUMP_FIELD(yes_no, got_sync),
};
#if CONFIG_HAS_EXT_L1SYNC || CONFIG_HAS_EXT_WR
......@@ -203,8 +208,8 @@ struct dump_info portDS_info [] = {
DUMP_FIELD(UInteger4, minorVersionNumber),
DUMP_FIELD(TimeInterval, delayAsymmetry),
DUMP_FIELD(RelativeDifference, delayAsymCoeff),
DUMP_FIELD(Boolean, portEnable),
DUMP_FIELD(Boolean, masterOnly)
DUMP_FIELD(yes_no_Boolean, portEnable),
DUMP_FIELD(yes_no_Boolean, masterOnly)
};
#undef DUMP_STRUCT
......@@ -221,28 +226,29 @@ struct dump_info dsfm_info [] = {
DUMP_FIELD(UInteger16, sequenceId),
DUMP_FIELD(UInteger16, stepsRemoved),
DUMP_FIELD(Integer16, currentUtcOffset),
DUMP_FIELD(Boolean, qualified),
DUMP_FIELD(yes_no_Boolean, qualified),
DUMP_FIELD(unsigned_long, lastAnnounceMsgMs),
DUMP_FIELD_SIZE(bina, peer_mac, 6),
};
#undef DUMP_STRUCT
#define DUMP_STRUCT struct pp_instance
struct dump_info ppi_info [] = {
DUMP_FIELD(int, state),
DUMP_FIELD(int, next_state),
DUMP_FIELD(ppi_state, state),
DUMP_FIELD(ppi_state, next_state),
DUMP_FIELD(int, next_delay),
DUMP_FIELD(int, is_new_state),
DUMP_FIELD(int,extState),
DUMP_FIELD(int,pdstate),
DUMP_FIELD(yes_no, is_new_state),
DUMP_FIELD(exstate,extState),
DUMP_FIELD(pp_pdstate,pdstate),
DUMP_FIELD(pointer, arch_data),
DUMP_FIELD(pointer, ext_data),
DUMP_FIELD(int, protocol_extension),
DUMP_FIELD(protocol_extension, protocol_extension),
DUMP_FIELD(pointer, ext_hooks),
DUMP_FIELD(pointer, servo), /* FIXME: follow this */
DUMP_FIELD(unsigned_long, d_flags),
DUMP_FIELD(unsigned_char, flags),
DUMP_FIELD(int, proto),
DUMP_FIELD(int, delayMechanism),
DUMP_FIELD(ppi_flag, flags),
DUMP_FIELD(ppi_proto, proto),
DUMP_FIELD(delay_mechanism, delayMechanism),
DUMP_FIELD(pointer, glbs),
DUMP_FIELD(pointer, n_ops),
DUMP_FIELD(pointer, t_ops),
......@@ -258,14 +264,15 @@ struct dump_info ppi_info [] = {
DUMP_FIELD(pointer, ch[0].custom),
DUMP_FIELD(pointer, ch[0].arch_data),
DUMP_FIELD_SIZE(bina, ch[0].addr, 6),
DUMP_FIELD(int, ch[0].pkt_present),
DUMP_FIELD(yes_no, ch[0].pkt_present),
DUMP_FIELD(int, ch[1].fd),
DUMP_FIELD(pointer, ch[1].custom),
DUMP_FIELD(pointer, ch[1].arch_data),
DUMP_FIELD_SIZE(bina, ch[1].addr, 6),
DUMP_FIELD(int, ch[1].pkt_present),
DUMP_FIELD(yes_no, ch[1].pkt_present),
DUMP_FIELD(ip_address, mcast_addr),
DUMP_FIELD(ip_address, mcast_addr[0]),
DUMP_FIELD(ip_address, mcast_addr[1]),
DUMP_FIELD(int, tx_offset),
DUMP_FIELD(int, rx_offset),
DUMP_FIELD_SIZE(bina, peer, 6),
......@@ -288,20 +295,20 @@ struct dump_info ppi_info [] = {
DUMP_FIELD(UInteger32, frgn_master_time_window_ms),
DUMP_FIELD(pointer,frgn_master),
DUMP_FIELD(pointer, portDS),
DUMP_FIELD(Boolean,asymmetryCorrectionPortDS.enable),
DUMP_FIELD(yes_no_Boolean,asymmetryCorrectionPortDS.enable),
DUMP_FIELD(TimeInterval,asymmetryCorrectionPortDS.constantAsymmetry),
DUMP_FIELD(RelativeDifference,asymmetryCorrectionPortDS.scaledDelayCoefficient),
DUMP_FIELD(TimeInterval,timestampCorrectionPortDS.egressLatency),
DUMP_FIELD(TimeInterval,timestampCorrectionPortDS.ingressLatency),
DUMP_FIELD(TimeInterval,timestampCorrectionPortDS.messageTimestampPointLatency),
DUMP_FIELD(TimeInterval,timestampCorrectionPortDS.semistaticLatency),
DUMP_FIELD(Enumeration8,externalPortConfigurationPortDS.desiredState),
DUMP_FIELD(ppi_state_Enumeration8,externalPortConfigurationPortDS.desiredState),
//DUMP_FIELD(unsigned long tmo_cfg[PP_TO_COUNT]), /* dump separately */
DUMP_FIELD(UInteger16, recv_sync_sequence_id),
//DUMP_FIELD(UInteger16 sent_seq[__PP_NR_MESSAGES_TYPES]),
DUMP_FIELD_SIZE(bina, received_ptp_header, sizeof(MsgHeader)),
DUMP_FIELD(Boolean, link_up),
DUMP_FIELD(yes_no_Boolean, link_up),
DUMP_FIELD_SIZE(pointer, iface_name,16),
DUMP_FIELD_SIZE(pointer, port_name,16),
......@@ -314,7 +321,8 @@ struct dump_info ppi_info [] = {
/* sub structure */
DUMP_FIELD_SIZE(char, cfg.port_name, 16),
DUMP_FIELD_SIZE(char, cfg.iface_name, 16),
DUMP_FIELD(int, cfg.profile),
DUMP_FIELD(ppi_profile, cfg.profile),
DUMP_FIELD(delay_mechanism, cfg.delayMechanism),
DUMP_FIELD(unsigned_long, ptp_tx_count),
DUMP_FIELD(unsigned_long, ptp_rx_count),
......@@ -332,9 +340,10 @@ struct dump_info timeouts_info [] = {
#undef DUMP_STRUCT
#define DUMP_STRUCT struct wr_dsport
struct dump_info wr_ext_portDS_info [] = {
DUMP_FIELD(int,state),
DUMP_FIELD(Boolean,wrModeOn),
DUMP_FIELD(Boolean,parentWrModeOn),
DUMP_FIELD(wr_state,state),
DUMP_FIELD(wr_state, next_state),
DUMP_FIELD(yes_no_Boolean, wrModeOn),
DUMP_FIELD(yes_no_Boolean, parentWrModeOn),
DUMP_FIELD(scaledPicoseconds, deltaTx),
DUMP_FIELD(scaledPicoseconds, deltaRx),
DUMP_FIELD(UInteger16, otherNodeCalSendPattern),
......@@ -342,6 +351,11 @@ struct dump_info wr_ext_portDS_info [] = {
DUMP_FIELD(UInteger32, otherNodeCalPeriod),
DUMP_FIELD(scaledPicoseconds, otherNodeDeltaTx),
DUMP_FIELD(scaledPicoseconds, otherNodeDeltaRx),
DUMP_FIELD(wr_config_Enumeration8, wrConfig),
DUMP_FIELD(wr_config_Enumeration8, parentWrConfig),
DUMP_FIELD(wr_role_Enumeration8, wrMode),
DUMP_FIELD(PortIdentity, parentAnnPortIdentity),
DUMP_FIELD(UInteger16, parentAnnSequenceId),
};
#endif
......@@ -349,12 +363,389 @@ struct dump_info wr_ext_portDS_info [] = {
#undef DUMP_STRUCT
#define DUMP_STRUCT struct wrs_arch_data_t
struct dump_info wrs_arch_data_info [] = {
DUMP_FIELD(int,timingMode),
DUMP_FIELD(timing_mode,timingMode),
DUMP_FIELD(int,timingModeLockingState),
DUMP_FIELD(int,gmUnlockErr)
};
#endif
void print_str(char *s);
int dump_one_field_type_ppsi_wrs(int type, int size, void *p)
{
int i;
switch(type) {
case dump_type_yes_no_Boolean:
case dump_type_ppi_state:
case dump_type_ppi_state_Enumeration8:
case dump_type_wr_config:
case dump_type_wr_config_Enumeration8:
case dump_type_wr_role:
case dump_type_wr_role_Enumeration8:
case dump_type_pp_pdstate:
case dump_type_exstate:
case dump_type_pp_servo_flag:
case dump_type_pp_servo_state:
case dump_type_wr_state:
case dump_type_ppi_profile:
case dump_type_ppi_proto:
case dump_type_ppi_flag:
if (size == 1)
i = *(uint8_t *)p;
else if (size == 2)
i = *(uint16_t *)(p);
else
i = *(uint32_t *)(p);
break;
default:
i = 0;
}
return i;
}
/* create fancy macro to shorten the switch statements, assign val as a string to p */
#define ENUM_TO_P_IN_CASE(val, p) \
case val: \
p = #val;\
break;
void dump_one_field_ppsi_wrs(int type, int size, void *p, int i)
{
struct pp_time *t = p;
struct PortIdentity *pi = p;
struct ClockQuality *cq = p;
TimeInterval *ti=p;
RelativeDifference *rd=p;
char buf[128];
char *char_p;
Timestamp *ts=p;
/* check the size of Boolean, which is declared as Enum */
if (type == dump_type_Boolean) {
switch(size) {
case 1:
type = dump_type_UInteger8;
break;
case 2:
type = dump_type_UInteger16;
break;
case 4:
default:
type = dump_type_UInteger32;
break;
}
}
switch(type) {
case dump_type_UInteger64:
printf("%lld\n", *(unsigned long long *)p);
break;
case dump_type_Integer64:
printf("%lld\n", *(long long *)p);
break;
case dump_type_Integer32:
printf("%i\n", *(int *)p);
break;
case dump_type_UInteger32:
printf("%u\n", *(uint32_t *)p);
break;
case dump_type_UInteger8:
case dump_type_Integer8:
case dump_type_Enumeration8:
case dump_type_Boolean:
printf("%i\n", *(unsigned char *)p);
break;
case dump_type_UInteger4:
printf("%i\n", *(unsigned char *)p & 0xF);
break;
case dump_type_UInteger16:
printf("%i\n", *(unsigned short *)p);
break;
case dump_type_Integer16:
printf("%i\n", *(short *)p);
break;
case dump_type_Timestamp:
printf("%s\n",timestampToString(ts,buf));
break;
case dump_type_TimeInterval:
printf("%15s, ", timeIntervalToString(*ti, buf));
printf("raw: %15lld\n", *(unsigned long long *)p);
break;
case dump_type_yes_no_Boolean:
printf("%d", i);
if (i == 0)
print_str("no");
else if (i == 1)
print_str("yes");
else
print_str("unknown");
printf("\n");
break;
case dump_type_pp_time:
{
struct pp_time localt;
localt.secs = t->secs;
localt.scaled_nsecs = t->scaled_nsecs;
printf("correct %i: %25s rawps: 0x%04x\n",
!is_incorrect(&localt),
timeToString(&localt,buf),
(int)(localt.scaled_nsecs & 0xffff)
);
break;
}
case dump_type_RelativeDifference:
printf("%15s, ", relativeDifferenceToString(*rd, buf));
printf("raw: %15lld\n", *(unsigned long long *)p);
break;
case dump_type_ClockIdentity: /* Same as binary */
for (i = 0; i < sizeof(ClockIdentity); i++)
printf("%02x%c", ((unsigned char *)p)[i],
i == sizeof(ClockIdentity) - 1 ? '\n' : ':');
break;
case dump_type_PortIdentity: /* Same as above plus port */
for (i = 0; i < sizeof(ClockIdentity); i++)
printf("%02x%c", ((unsigned char *)p)[i],
i == sizeof(ClockIdentity) - 1 ? '.' : ':');
printf("%04x (%i)\n", pi->portNumber, pi->portNumber);
break;
case dump_type_ClockQuality:
printf("class=%i, accuracy=0x%02x (%i), logvariance=%i\n",
cq->clockClass, cq->clockAccuracy, cq->clockAccuracy,
cq->offsetScaledLogVariance);
break;
case dump_type_scaledPicoseconds:
printf("%lld\n", (*(unsigned long long *)p)>>16);
break;
case dump_type_delay_mechanism:
i = *(uint32_t *)p;
switch(i) {
ENUM_TO_P_IN_CASE(MECH_E2E, char_p);
ENUM_TO_P_IN_CASE(MECH_P2P, char_p);
ENUM_TO_P_IN_CASE(MECH_COMMON_P2P, char_p);
ENUM_TO_P_IN_CASE(MECH_SPECIAL, char_p);
ENUM_TO_P_IN_CASE(MECH_NO_MECHANISM, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_protocol_extension:
i = *(uint32_t *)p;
switch(i) {
ENUM_TO_P_IN_CASE(PPSI_EXT_NONE, char_p);
ENUM_TO_P_IN_CASE(PPSI_EXT_WR, char_p);
ENUM_TO_P_IN_CASE(PPSI_EXT_L1S, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_timing_mode:
i = *(uint32_t *)p;
switch(i) {
ENUM_TO_P_IN_CASE(WRH_TM_GRAND_MASTER, char_p);
ENUM_TO_P_IN_CASE(WRH_TM_FREE_MASTER, char_p);
ENUM_TO_P_IN_CASE(WRH_TM_BOUNDARY_CLOCK, char_p);
ENUM_TO_P_IN_CASE(WRH_TM_DISABLED, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_ppi_state:
case dump_type_ppi_state_Enumeration8:
switch(i) {
ENUM_TO_P_IN_CASE(PPS_END_OF_TABLE, char_p);
ENUM_TO_P_IN_CASE(PPS_INITIALIZING, char_p);
ENUM_TO_P_IN_CASE(PPS_FAULTY, char_p);
ENUM_TO_P_IN_CASE(PPS_DISABLED, char_p);
ENUM_TO_P_IN_CASE(PPS_LISTENING, char_p);
ENUM_TO_P_IN_CASE(PPS_PRE_MASTER, char_p);
ENUM_TO_P_IN_CASE(PPS_MASTER, char_p);
ENUM_TO_P_IN_CASE(PPS_PASSIVE, char_p);
ENUM_TO_P_IN_CASE(PPS_UNCALIBRATED, char_p);
ENUM_TO_P_IN_CASE(PPS_SLAVE, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_wr_config:
case dump_type_wr_config_Enumeration8:
switch(i) {
ENUM_TO_P_IN_CASE(NON_WR, char_p);
ENUM_TO_P_IN_CASE(WR_M_ONLY, char_p);
ENUM_TO_P_IN_CASE(WR_S_ONLY, char_p);
ENUM_TO_P_IN_CASE(WR_M_AND_S, char_p);
ENUM_TO_P_IN_CASE(WR_MODE_AUTO, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_wr_role:
case dump_type_wr_role_Enumeration8:
switch(i) {
ENUM_TO_P_IN_CASE(WR_ROLE_NONE, char_p);
ENUM_TO_P_IN_CASE(WR_MASTER, char_p);
ENUM_TO_P_IN_CASE(WR_SLAVE, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_pp_pdstate:
switch(i) {
ENUM_TO_P_IN_CASE(PP_PDSTATE_NONE, char_p);
ENUM_TO_P_IN_CASE(PP_PDSTATE_WAIT_MSG, char_p);
ENUM_TO_P_IN_CASE(PP_PDSTATE_PDETECTION, char_p);
ENUM_TO_P_IN_CASE(PP_PDSTATE_PDETECTED, char_p);
ENUM_TO_P_IN_CASE(PP_PDSTATE_FAILURE, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_exstate:
switch(i) {
ENUM_TO_P_IN_CASE(PP_EXSTATE_DISABLE, char_p);
ENUM_TO_P_IN_CASE(PP_EXSTATE_ACTIVE, char_p);
ENUM_TO_P_IN_CASE(PP_EXSTATE_PTP, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_pp_servo_flag:
switch(i) {
ENUM_TO_P_IN_CASE(PP_SERVO_FLAG_VALID, char_p);
ENUM_TO_P_IN_CASE(PP_SERVO_FLAG_WAIT_HW, char_p);
ENUM_TO_P_IN_CASE(PP_SERVO_FLAG_VALID | PP_SERVO_FLAG_WAIT_HW, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_pp_servo_state:
switch(i) {
ENUM_TO_P_IN_CASE(WRH_UNINITIALIZED, char_p);
ENUM_TO_P_IN_CASE(WRH_SYNC_TAI, char_p);
ENUM_TO_P_IN_CASE(WRH_SYNC_NSEC, char_p);
ENUM_TO_P_IN_CASE(WRH_SYNC_PHASE, char_p);
ENUM_TO_P_IN_CASE(WRH_TRACK_PHASE, char_p);
ENUM_TO_P_IN_CASE(WRH_WAIT_OFFSET_STABLE, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_wr_state:
switch(i) {
ENUM_TO_P_IN_CASE(WRS_IDLE, char_p);
ENUM_TO_P_IN_CASE(WRS_PRESENT, char_p);
ENUM_TO_P_IN_CASE(WRS_S_LOCK, char_p);
ENUM_TO_P_IN_CASE(WRS_M_LOCK, char_p);
ENUM_TO_P_IN_CASE(WRS_LOCKED, char_p);
ENUM_TO_P_IN_CASE(WRS_CALIBRATION, char_p);
ENUM_TO_P_IN_CASE(WRS_CALIBRATED, char_p);
ENUM_TO_P_IN_CASE(WRS_RESP_CALIB_REQ, char_p);
ENUM_TO_P_IN_CASE(WRS_WR_LINK_ON, char_p);
ENUM_TO_P_IN_CASE(WRS_ABSCAL, char_p);
ENUM_TO_P_IN_CASE(WRS_MAX_STATES, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_ppi_profile:
switch(i) {
ENUM_TO_P_IN_CASE(PPSI_PROFILE_PTP, char_p);
ENUM_TO_P_IN_CASE(PPSI_PROFILE_WR, char_p);
ENUM_TO_P_IN_CASE(PPSI_PROFILE_HA, char_p);
ENUM_TO_P_IN_CASE(PPSI_PROFILE_CUSTOM, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_ppi_proto:
switch(i) {
ENUM_TO_P_IN_CASE(PPSI_PROTO_RAW, char_p);
ENUM_TO_P_IN_CASE(PPSI_PROTO_UDP, char_p);
ENUM_TO_P_IN_CASE(PPSI_PROTO_VLAN, char_p);
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
case dump_type_ppi_flag:
switch(i) {
case 0:
char_p = "None";
break;
ENUM_TO_P_IN_CASE(PPI_FLAG_WAITING_FOR_F_UP, char_p);
ENUM_TO_P_IN_CASE(PPI_FLAG_WAITING_FOR_RF_UP, char_p);
case PPI_FLAGS_WAITING:
char_p = "PPI_FLAG_WAITING_FOR_F_UP | PPI_FLAG_WAITING_FOR_RF_UP";
break;
default:
char_p = "Unknown";
}
printf("%d", i);
print_str(char_p);
printf("\n");
break;
}
}
extern struct dump_info shm_head [5];
int dump_ppsi_mem(struct wrs_shm_head *head)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment