Commit 515af578 authored by baujc's avatar baujc

Big update 2

. Better integrate of code optimization with PPSi Kconfig
. PPSi Kconfig changes to simplify the code in PPSi and avoid #ifdef ..
. Improve code optimization
. Move some declaration in ppsi.h in other files to ligthen ppsi.h
. Improvement of timers: global or instance dependent, dyn. allocation,
renaming for better diagnostics, disabling allowed, ...
. New behaviour for the PPS output generation (configurable,...)
. Move control of the timing mode from HAL to PPSi
. Optimization of code when a Protocol extension is not available
. BMCA: Calculate the ebest,... only one time and then trigger all
instances to execute the bmca state descision
. Fix bug in the calculation of the clockIdentity to bring it into
compliance with PTP spec 2008 document
. Fix a bug related to Announce message received in SLAVE/UNCALIB
. WR ext: use dynamic timer and adapt to new PPS generation
. HA ext: Fix bug in fault injection mechanism
parent 519c9c27
......@@ -70,6 +70,32 @@ config ARCH
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"
......@@ -101,7 +127,7 @@ menu "PTP Protocol Options"
endmenu
menu "Profiles"
menu "Enabled profiles"
config PROFILE_WR
bool "WhiteRabbit"
......@@ -117,53 +143,53 @@ menu "Profiles"
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 PROFILE_PTP
bool
default y
config EXT_WR
bool
default y if PROFILE_WR
config HAS_EXT_WR
int
range 0 1
default 1 if PROFILE_WR
default 0
config EXT_L1SYNC
bool
default y if PROFILE_HA
config EXT_NONE
bool
default y if !(PROFILE_WR || PROFILE_HA || PROFILE_CUSTOM)
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 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"
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
......@@ -199,8 +225,7 @@ config MAX_VLANS_PER_PORT
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
......@@ -208,18 +233,234 @@ config VLAN_ARRAY_SIZE
default 1 if !HAS_MULTIPLE_VLAN
default MAX_VLANS_PER_PORT
config DISABLE_OPTIMIZATION
bool "Disable -O2, to ease running a debugger"
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)
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 -ggdb)"
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
int
default 0 if DISABLE_OPTIMIZATION
default 2
string
default "-Os" if OPTIMIZATION_SIZE_SPEED
default "-O2" if OPTIMIZATION_SPEED
default "-Og -ggdb" if OPTIMIZATION_DEBUGGING
default "-ggdb" if OPTIMIZATION_NONE_DEBUGGING
default ""
config WRPC_FAULTS
bool "Add the fault injection mechanism and shell command for wrpc"
depends on ARCH_WRPC
config FAULT_INJECTION_MECHANISM
bool "Add fault injection mechanism"
help
This adds a "fault" shell command, with subcommands.
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
......@@ -47,14 +47,17 @@ all: $(TARGET).o
# CFLAGS to use. Both this Makefile (later) and app-makefile may grow CFLAGS
CFLAGS = $(USER_CFLAGS)
CFLAGS += -Wall -Wstrict-prototypes -Wmissing-prototypes
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -O$(CONFIG_OPTIMIZATION)
export CFLAGS_OPTIMIZATION:= ${shell echo $(CONFIG_OPTIMIZATION)}
CFLAGS += -ggdb -Iinclude -fno-common
CFLAGS += $(CFLAGS_OPTIMIZATION)
CFLAGS += -Iinclude -fno-common
CFLAGS += -DPPSI_VERSION=\"$(VERSION)\"
# to avoid ifdef as much as possible, I use the kernel trick for OBJ variables
OBJ-y := fsm.o diag.o timeout.o msgtype.o
OBJ-y := fsm.o diag.o timeout.o msgtype.o port_controller.o
# Include arch code. Each arch chooses its own time directory..
include arch-$(ARCH)/Makefile
......@@ -67,7 +70,7 @@ OBJ-y += pp_printf/pp-printf.o
pp_printf/pp-printf.o: $(wildcard pp_printf/*.[ch])
CFLAGS="$(ARCH_PP_PRINTF_CFLAGS)" \
$(MAKE) -C pp_printf pp-printf.o CC="$(CC)" LD="$(LD)" \
CONFIG_PRINTF_64BIT=y
CONFIG_PRINTF_64BIT=y CFLAGS_OPTIMIZATION="$(CFLAGS_OPTIMIZATION)"
endif
# We need this -I so <arch/arch.h> can be found
......@@ -75,10 +78,10 @@ CFLAGS += -Iarch-$(ARCH)/include
# proto-standard is always included, as it provides default function
# so the extension can avoid duplication of code.
ifeq ($(CONFIG_EXT_WR),y)
ifeq ($(CONFIG_HAS_EXT_WR),1)
include proto-ext-whiterabbit/Makefile
endif
ifeq ($(CONFIG_EXT_L1SYNC),y)
ifeq ($(CONFIG_HAS_EXT_L1SYNC),1)
include proto-ext-l1sync/Makefile
endif
include proto-standard/Makefile
......@@ -99,7 +102,7 @@ export CFLAGS
# libraries: see proto-standard/Makefile as an example.
$(TARGET).o: $(OBJ-y)
$(LD) -Map $(TARGET).map1 -r -o $@ $(PPSI_O_LDFLAGS) \
$(LD) --gc-sections --entry=main -Map $(TARGET).map1 -r -o $@ $(PPSI_O_LDFLAGS) \
--start-group $(OBJ-y) --end-group
$(OBJ-y): .config $(wildcard include/ppsi/*.h)
......
......@@ -25,7 +25,8 @@ OBJ-y += \
lib/dump-funcs.o \
lib/drop.o \
lib/div64.o \
lib/time-arith.o
lib/time-arith.o \
lib/iicomm.o
OBJ-$(CONFIG_WRPC_FAULTS) += $A/faults.o
......
......@@ -2,9 +2,6 @@
#define __ARCH_H__
#include <assert.h> /* wrpc-sw includes assert already */
/* This arch exports wr functions, so include this for consistency checking */
#include "../proto-ext-whiterabbit/wr-api.h"
/* Architecture-specific defines, included by top-level stuff */
#ifndef htons /* If we build as host process, we have them LE already */
......@@ -16,14 +13,5 @@
#endif
/* Code optimization for WRPC architecture */
#ifndef CODEOPT_BMCA
#define CODEOPT_BMCA 1 /* Code optimization for BMCA. Can be overwritten in the makefile*/
#endif
#define CODEOPT_ONE_PORT() (1 && CODEOPT_BMCA==1) /* Code optimization when only one port is used. */
#define CODEOPT_ROLE_MASTER_SLAVE_ONLY() (1 && CODEOPT_BMCA==1) /* Code optimization when only one port is used. */
#define abs(x) ((x >= 0) ? x : -x)
#endif /* __ARCH_H__ */
# All files are under A (short for ARCH): I'm lazy
A := arch-$(ARCH)
# classic cross-compilation tool-set
SIZE = $(CROSS_COMPILE)size
CFLAGS += -Itools
# Prevent a warning for a missing prototype in pp_printf, bug since ever
ARCH_PP_PRINTF_CFLAGS += -include ../$A/include/strnlen.h
OBJ-y += $A/wrs-startup.o \
$A/hal_minirpc.o \
$A/main-loop.o \
$A/wrs-io.o \
$A/wrs-conf.o \
......@@ -22,6 +26,9 @@ OBJ-y += $A/wrs-startup.o \
lib/div64.o \
lib/time-arith.o
export size_db_file:=size_wrs_db.txt
export size_info_file:=size_wrs_info.txt
# We only support "wrs" time operations
TIME = wrs
include time-$(TIME)/Makefile
......@@ -37,7 +44,7 @@ MINIPC_LIB := $(MINIPC_DIR)/libminipc.a
CFLAGS += -I$(MINIPC_DIR)
.PHONY: $(MINIPC_LIB)
$(MINIPC_LIB):
$(MAKE) -C $(MINIPC_DIR)
$(MAKE) -C $(MINIPC_DIR) CFLAGS_OPTIMIZATION="$(CFLAGS_OPTIMIZATION)"
OBJ-y += $(MINIPC_LIB)
......@@ -47,4 +54,8 @@ all: $(TARGET)
# were not selected yet (e.g., pp_init_globals() ).
$(TARGET): $(TARGET).o
$(CC) -Wl,-Map,$(TARGET).map2 -o $@ $(TARGET).o -lrt
$(SIZE) $@
./arch-wrs/save_size.sh $(SIZE) $@
cat $(size_info_file)
#ifndef __HAL_EXPORTS_C
#define __HAL_EXPORTS_C
#include <minipc.h>
#include <hal_exports.h>
/* Export structures, shared by server and client for argument matching */
struct minipc_pd __rpcdef_check_running = {
.name = "check_running",
.retval = MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
.args = {
MINIPC_ARG_END,
},
};
//int halexp_reset_port(const char *port_name);
struct minipc_pd __rpcdef_reset_port = {
.name = "reset_port",
.retval = MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
.args = {
MINIPC_ARG_ENCODE(MINIPC_ATYPE_STRING, char *),
MINIPC_ARG_END,
},
};
//int halexp_calibration_cmd(const char *port_name, int command, int on_off);
struct minipc_pd __rpcdef_calibration_cmd = {
.name = "calibration_cmd",
.retval = MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
.args = {
MINIPC_ARG_ENCODE(MINIPC_ATYPE_STRING, char *),
MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
MINIPC_ARG_END,
},
};
//int halexp_lock_cmd(const char *port_name, int command, int priority);
struct minipc_pd __rpcdef_lock_cmd = {
.name = "lock_cmd",
.retval = MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
.args = {
MINIPC_ARG_ENCODE(MINIPC_ATYPE_STRING, char *),
MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
MINIPC_ARG_END,
},
};
//int halexp_pps_cmd(int cmd, hexp_pps_params_t *params);
struct minipc_pd __rpcdef_pps_cmd = {
.name = "pps_cmd",
.retval = MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
.args = {
MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
MINIPC_ARG_ENCODE(MINIPC_ATYPE_STRUCT, hexp_pps_params_t),
MINIPC_ARG_END,
},
};
struct minipc_pd __rpcdef_get_timing_state = {
.name = "get_timing_state",
.retval = MINIPC_ARG_ENCODE(MINIPC_ATYPE_STRUCT, hexp_timing_state_t),
.args = {
MINIPC_ARG_END,
},
};
#endif
......@@ -38,6 +38,9 @@
#define HEXP_PPSG_CMD_ADJUST_NSEC 3
#define HEXP_PPSG_CMD_POLL 4
#define HEXP_PPSG_CMD_SET_VALID 5
#define HEXP_PPSG_CMD_SET_TIMING_MODE 6
#define HEXP_PPSG_CMD_GET_TIMING_MODE 7
#define HEXP_PPSG_CMD_GET_TIMING_MODE_STATE 8
#define HEXP_ON 1
#define HEXP_OFF 0
......@@ -56,6 +59,11 @@
#define HAL_TIMING_MODE_GRAND_MASTER 0
#define HAL_TIMING_MODE_FREE_MASTER 1
#define HAL_TIMING_MODE_BC 2
#define HAL_TIMING_MODE_DISABLED 3
#define HAL_TIMING_MODE_TMDT_UNLOCKED 0
#define HAL_TIMING_MODE_TMDT_LOCKED 1
#define HAL_TIMING_MODE_TMDT_HOLDHOVER 2
typedef struct {
......@@ -72,14 +80,17 @@ typedef struct {
uint64_t current_sec;
uint32_t current_nsec;
uint32_t timing_mode;
} hexp_pps_params_t;
/* Port modes (hal_port_state.mode) */
#define HEXP_PORT_MODE_WR_M_AND_S 4
#define HEXP_PORT_MODE_WR_MASTER 1
#define HEXP_PORT_MODE_WR_SLAVE 2
#define HEXP_PORT_MODE_NON_WR 3
#define HEXP_PORT_MODE_WR_M_AND_S 4
#define HEXP_PORT_MODE_NONE 5
#define FIX_ALPHA_FRACBITS 40
/*
#define HEXP_PORT_TSC_RISING 1
#define HEXP_PORT_TSC_FALLING 2
......@@ -99,71 +110,4 @@ extern int halexp_lock_cmd(const char *port_name, int command, int priority);
extern int halexp_pps_cmd(int cmd, hexp_pps_params_t *params);
extern int halexp_get_timing_state(hexp_timing_state_t *state);
/* Export structures, shared by server and client for argument matching */
#ifdef HAL_EXPORT_STRUCTURES
//int halexp_check_running();
struct minipc_pd __rpcdef_check_running = {
.name = "check_running",
.retval = MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
.args = {
MINIPC_ARG_END,
},
};
//int halexp_reset_port(const char *port_name);
struct minipc_pd __rpcdef_reset_port = {
.name = "reset_port",
.retval = MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
.args = {
MINIPC_ARG_ENCODE(MINIPC_ATYPE_STRING, char *),
MINIPC_ARG_END,
},
};
//int halexp_calibration_cmd(const char *port_name, int command, int on_off);
struct minipc_pd __rpcdef_calibration_cmd = {
.name = "calibration_cmd",
.retval = MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
.args = {
MINIPC_ARG_ENCODE(MINIPC_ATYPE_STRING, char *),
MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
MINIPC_ARG_END,
},
};
//int halexp_lock_cmd(const char *port_name, int command, int priority);
struct minipc_pd __rpcdef_lock_cmd = {
.name = "lock_cmd",
.retval = MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
.args = {
MINIPC_ARG_ENCODE(MINIPC_ATYPE_STRING, char *),
MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
MINIPC_ARG_END,
},
};
//int halexp_pps_cmd(int cmd, hexp_pps_params_t *params);
struct minipc_pd __rpcdef_pps_cmd = {
.name = "pps_cmd",
.retval = MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
.args = {
MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
MINIPC_ARG_ENCODE(MINIPC_ATYPE_STRUCT, hexp_pps_params_t),
MINIPC_ARG_END,
},
};
struct minipc_pd __rpcdef_get_timing_state = {
.name = "get_timing_state",
.retval = MINIPC_ARG_ENCODE(MINIPC_ATYPE_STRUCT, hexp_timing_state_t),
.args = {
MINIPC_ARG_END,
},
};
#endif /* HAL_EXPORT_STRUCTURES */
#endif
......@@ -10,8 +10,10 @@
*/
#include <minipc.h>
#include <hw-specific/wrh.h>
#include <libwr/shmem.h>
#include <libwr/hal_shmem.h>
#include <ppsi/timeout_def.h>
#define WRS_NUMBER_PHYSICAL_PORTS 18 /* Number of physical ports on a WR switch */
......@@ -59,11 +61,16 @@ int wrs_read_correction_data(struct pp_instance *ppi, int64_t *fixAlpha,
/* wrs-time.c (some should moce to wrs-spll.c) */
int wrs_locking_enable(struct pp_instance *ppi);
int wrs_locking_poll(struct pp_instance *ppi, int grandmaster);
int wrs_locking_poll(struct pp_instance *ppi);
int wrs_locking_disable(struct pp_instance *ppi);
int wrs_locking_reset(struct pp_instance *ppi);
int wrs_enable_ptracker(struct pp_instance *ppi);
int wrs_adjust_in_progress(void);
int wrs_adjust_counters(int64_t adjust_sec, int32_t adjust_nsec);
int wrs_adjust_phase(int32_t phase_ps);
int wrs_enable_timing_output(struct pp_instance *ppi, int enable);
int wrs_enable_timing_output(struct pp_globals *,int enable);
timing_mode_t wrs_get_timing_mode(struct pp_globals *);
timing_mode_state_t wrs_get_timing_mode_state(struct pp_globals *);
int wrs_set_timing_mode(struct pp_globals *,timing_mode_t tm);
......@@ -59,7 +59,7 @@ static int run_all_state_machines(struct pp_globals *ppg)
pp_diag(ppi, fsm, 1, "Cannot read bit_slide value values\n");
bit_slide_ps=0;
}
pp_diag(ppi, fsm, 1, "semistaticLatency(bit-slide)=%u [ps]\n",bit_slide_ps);
pp_diag(ppi, fsm, 1, "semistaticLatency(bit-slide)=%u [ps]\n",(unsigned int)bit_slide_ps);
ppi->timestampCorrectionPortDS.semistaticLatency= picos_to_interval(bit_slide_ps);
}
else {
......@@ -87,6 +87,18 @@ static int run_all_state_machines(struct pp_globals *ppg)
delay_ms = delay_ms_j;
}
/* BMCA must run at least once per announce interval 9.2.6.8 */
if (pp_gtimeout(ppg, PP_TO_BMC)) {
bmc_calculate_ebest(ppg); /* Calculation of erbest, ebest ,... */
pp_gtimeout_set(ppg, PP_TO_BMC,TMO_DEFAULT_BMCA_MS);
delay_ms=0;