Commit 43f319b5 authored by Adam Wujek's avatar Adam Wujek Committed by Adam Wujek

Kconfig: add options to configure PTP atributes (like prio1) for WRPC

Signed-off-by: 's avatarAdam Wujek <adam.wujek@creotech.pl>
parent 9a8c56f8
......@@ -120,6 +120,90 @@ menu "PTP Protocol Options"
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
......
......@@ -157,9 +157,9 @@ int wrc_ptp_set_mode(int mode)
/* 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 = -1;
ppg->rt_opts->clock_quality_offsetScaledLogVariance = -1;
ppg->rt_opts->timeSource = -1;
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;
......
......@@ -15,6 +15,14 @@ CONFIG_ARCH_LDFLAGS=""
# 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
#
......@@ -56,6 +64,7 @@ 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
......
......@@ -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
......
......@@ -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
......
......@@ -6,9 +6,9 @@
*/
#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
......
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