From ad6a16d7c4967266fa7941e07a56a5261ae1bac6 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 18 Aug 2017 11:33:17 -0500 Subject: [PATCH 1/7] Update EPICS_TIMEZONE settings, extend to 2022 --- configure/CONFIG_SITE_ENV | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/configure/CONFIG_SITE_ENV b/configure/CONFIG_SITE_ENV index 9605b29bb..271fd7134 100644 --- a/configure/CONFIG_SITE_ENV +++ b/configure/CONFIG_SITE_ENV @@ -13,7 +13,7 @@ # # CONFIG_SITE_ENV - EPICS Environment Parameter Site configuration file # -# This file is read by the script base/src/libCom/env/bldEnvdata.pl +# This file is read by the script base/src/libCom/env/bldEnvData.pl # Variable definitions must take the form # VAR = VALUE # or @@ -26,31 +26,46 @@ # Time service: # EPICS_TIMEZONE -# local timezone info for vxWorks and RTEMS IOCs. The format is +# Local timezone info for vxWorks and RTEMS. The format is # :::: # where the start and end are mmddhh - that is month,day,hour -# e.g. for ANL in 2016: EPICS_TIMEZONE=CUS::360:031302:110602 +# e.g. for ANL in 2018: EPICS_TIMEZONE=CUS::360:031102:110402 +# The future dates below assume the rules don't get changed; +# see http://www.timeanddate.com/time/dst/2018.html to check. # -# DST for 2016 US: Mar 13 - Nov 06 -# EU: Mar 27 - Oct 30 # DST for 2017 US: Mar 12 - Nov 05 # EU: Mar 26 - Oct 29 +EPICS_TIMEZONE = CUS::360:031202:110502 +#EPICS_TIMEZONE = MET::-60:032602:102902 +# # DST for 2018 US: Mar 11 - Nov 04 # EU: Mar 25 - Oct 28 +#EPICS_TIMEZONE = CUS::360:031102:110402 +#EPICS_TIMEZONE = MET::-60:032502:102802 +# # DST for 2019 US: Mar 10 - Nov 03 # EU: Mar 31 - Oct 27 +#EPICS_TIMEZONE = CUS::360:031002:110302 +#EPICS_TIMEZONE = MET::-60:033102:102702 +# # DST for 2020 US: Mar 08 - Nov 01 # EU: Mar 29 - Oct 25 +#EPICS_TIMEZONE = CUS::360:030802:110102 +#EPICS_TIMEZONE = MET::-60:032902:102502 +# # DST for 2021 US: Mar 14 - Nov 07 # EU: Mar 28 - Oct 31 -# (see: http://www.timeanddate.com/time/dst/2016.html etc. ) +#EPICS_TIMEZONE = CUS::360:031402:110702 +#EPICS_TIMEZONE = MET::-60:032802:103102 # -# These values are for 2016: -EPICS_TIMEZONE=CUS::360:031302:110602 -#EPICS_TIMEZONE=MET::-60:032702:103002 +# DST for 2022 US: Mar 13 - Nov 06 +# EU: Mar 27 - Oct 30 +#EPICS_TIMEZONE = CUS::360:031302:110602 +#EPICS_TIMEZONE = MET::-60:032702:103002 # EPICS_TS_NTP_INET -# NTP time server ip address. Uses boot host if not set. +# NTP time server ip address for VxWorks and RTEMS. +# IOC will use its boot host if this is not set. EPICS_TS_NTP_INET= # IOC Shell: From 5d5f27a48667b8dc7f0c5c976cfe54d840dfbc87 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 18 Aug 2017 11:57:50 -0500 Subject: [PATCH 2/7] Don't set RPATH if STATIC_BUILD=YES --- configure/os/CONFIG.Common.linuxCommon | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/configure/os/CONFIG.Common.linuxCommon b/configure/os/CONFIG.Common.linuxCommon index dc6979b68..348d1b476 100644 --- a/configure/os/CONFIG.Common.linuxCommon +++ b/configure/os/CONFIG.Common.linuxCommon @@ -21,13 +21,15 @@ STATIC_LDFLAGS_YES= -Wl,-Bstatic STATIC_LDFLAGS_NO= STATIC_LDLIBS_YES= -Wl,-Bdynamic -# Set runtime path for shared libraries -SHRLIBDIR_RPATH_LDFLAGS_YES += $(SHRLIB_DEPLIB_DIRS:%=-Wl,-rpath,%) -SHRLIBDIR_LDFLAGS += $(SHRLIBDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH)) +# Set runtime path for shared libraries if USE_RPATH=YES and STATIC_BUILD=NO +SHRLIBDIR_RPATH_LDFLAGS_YES_NO = $(SHRLIB_DEPLIB_DIRS:%=-Wl,-rpath,%) +SHRLIBDIR_LDFLAGS += \ + $(SHRLIBDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH)_$(STATIC_BUILD)) -# Set runtime path for products -PRODDIR_RPATH_LDFLAGS_YES += $(PROD_DEPLIB_DIRS:%=-Wl,-rpath,%) -PRODDIR_LDFLAGS += $(PRODDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH)) +# Set runtime path for products if USE_RPATH=YES and STATIC_BUILD=NO +PRODDIR_RPATH_LDFLAGS_YES_NO = $(PROD_DEPLIB_DIRS:%=-Wl,-rpath,%) +PRODDIR_LDFLAGS += \ + $(PRODDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH)_$(STATIC_BUILD)) # Link libraries controlled by COMMANDLINE_LIBRARY # The newest Linux versions only need readline, older ones need both From dc9859cee99714622e4367d31e352dab0749acca Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 18 Aug 2017 11:59:17 -0500 Subject: [PATCH 3/7] Fix RPATH and readline for linux-arm cross-builds --- configure/os/CONFIG.linux-x86.linux-arm | 21 +++++++----------- configure/os/CONFIG_SITE.linux-x86.linux-arm | 23 +++++++++++++++++--- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/configure/os/CONFIG.linux-x86.linux-arm b/configure/os/CONFIG.linux-x86.linux-arm index e2cf36a52..63bd5d8be 100644 --- a/configure/os/CONFIG.linux-x86.linux-arm +++ b/configure/os/CONFIG.linux-x86.linux-arm @@ -11,19 +11,14 @@ GNU_TARGET = arm-linux CMPLR_SUFFIX = CMPLR_PREFIX = $(addsuffix -,$(GNU_TARGET)) -# Provide a link-time path for shared libraries -SHRLIBDIR_RPATH_LDFLAGS_YES += $(SHRLIB_DEPLIB_DIRS:%=-Wl,-rpath-link,%) -SHRLIBDIR_LDFLAGS += $(SHRLIBDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH)) - -# Provide a link-time path for products -PRODDIR_RPATH_LDFLAGS_YES += $(PROD_DEPLIB_DIRS:%=-Wl,-rpath-link,%) -PRODDIR_LDFLAGS += $(PRODDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH)) - -# Provide a link-time path for readline -RUNTIME_LDFLAGS_READLINE_YES = -Wl,-rpath-link,$(GNU_DIR)/lib -RUNTIME_LDFLAGS_READLINE = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH)) -RUNTIME_LDFLAGS_READLINE_CURSES = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH)) -RUNTIME_LDFLAGS_READLINE_NCURSES = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH)) +# Provide a link-time path for readline if needed +OP_SYS_INCLUDES += $(READLINE_DIR:%=-I%/include) +READLINE_LDFLAGS = $(READLINE_DIR:%=-L%/lib) +RUNTIME_LDFLAGS_READLINE_YES_NO = $(READLINE_DIR:%=-Wl,-rpath,%/lib) +RUNTIME_LDFLAGS += \ + $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH)_$(STATIC_BUILD)) +SHRLIBDIR_LDFLAGS += $(READLINE_LDFLAGS) +PRODDIR_LDFLAGS += $(READLINE_LDFLAGS) # Library flags STATIC_LDFLAGS_YES= -Wl,-Bstatic diff --git a/configure/os/CONFIG_SITE.linux-x86.linux-arm b/configure/os/CONFIG_SITE.linux-x86.linux-arm index 1500c4526..a1edb423d 100644 --- a/configure/os/CONFIG_SITE.linux-x86.linux-arm +++ b/configure/os/CONFIG_SITE.linux-x86.linux-arm @@ -7,8 +7,25 @@ GNU_TARGET = arm-xilinx-linux-gnueabi # Set GNU tools install path -# This is the install path at APS: +# Examples are installations at the APS: GNU_DIR = /usr/local/vw/zynq-2011.09 +#GNU_DIR = /usr/local/Xilinx/SDK/2016.3/gnu/arm/lin +#GNU_DIR = /APSshare/XilinxSDK/2015.4/gnu/arm/lin + +# If cross-building shared libraries and the paths on the target machine are +# different than on the build host, you should uncomment the lines below to +# disable putting runtime library paths in products and shared libraries. +# You will also need to provide another way for programs to find their shared +# libraries at runtime, such as by setting LD_LIBRARY_PATH or by using +# mechanisms related to /etc/ld.so.conf +#SHRLIBDIR_RPATH_LDFLAGS_YES_NO = +#PRODDIR_RPATH_LDFLAGS_YES_NO = +# Note: It may be simpler to just set STATIC_BUILD=YES here and not +# try to use shared libraries at all in these circumstances. + +# To use libreadline, point this to its install prefix +#READLINE_DIR = $(GNU_DIR) +#READLINE_DIR = /tools/cross/linux-x86.linux-arm/readline +# See CONFIG_SITE.Common.linux-arm for other COMMANDLINE_LIBRARY values +#COMMANDLINE_LIBRARY = READLINE -# With a Xilinx SDK, it'll be something like -#GNU_DIR = /usr/local/zynq/Xilinx/SDK/2015.4/gnu/arm/lin From 238f6772bd1caef2457a2266f502b57756103352 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 18 Aug 2017 15:06:38 -0500 Subject: [PATCH 4/7] Dirk's simpler VxWorks version rules --- configure/os/CONFIG.Common.vxWorksCommon | 24 ++++--------------- configure/os/CONFIG_SITE.Common.vxWorksCommon | 21 ++++------------ 2 files changed, 9 insertions(+), 36 deletions(-) diff --git a/configure/os/CONFIG.Common.vxWorksCommon b/configure/os/CONFIG.Common.vxWorksCommon index 0696e3e22..ad73ac20f 100644 --- a/configure/os/CONFIG.Common.vxWorksCommon +++ b/configure/os/CONFIG.Common.vxWorksCommon @@ -122,20 +122,10 @@ GNU_DIR_6 = $(WIND_BASE)/gnu/$(VX_GNU_VERSION)-vxworks-$(VXWORKS_VERSION)/$(WIND GNU_DIR = $(GNU_DIR_$(VXWORKS_MAJOR_VERSION)) #-------------------------------------------------- -# Wind River moved nm out of GNU_BIN in some versions +# This finds nm on any supported VxWorks version -WORKBENCH_BIN = $(WIND_BASE)/workbench-$(WORKBENCH_VERSION)/$(WIND_HOST_TYPE)/bin -UTILITIES_BIN = $(WIND_BASE)/utilities-$(UTILITIES_VERSION)/$(WIND_HOST_TYPE)/bin - -NM_DIR_6.4 = $(WORKBENCH_BIN) -NM_DIR_6.5 = $(WORKBENCH_BIN) -NM_DIR_6.6 = $(WORKBENCH_BIN) -NM_DIR_6.7 = $(GNU_BIN) -NM_DIR_6.8 = $(UTILITIES_BIN) -NM_DIR_6.9 = $(UTILITIES_BIN) -NM_DIR = $(firstword $(NM_DIR_$(VXWORKS_VERSION)) $(GNU_BIN)) - -NM = $(NM_DIR)/$(CMPLR_PREFIX)nm$(CMPLR_SUFFIX)$(HOSTEXE) +NMPROG = $(CMPLR_PREFIX)nm$(CMPLR_SUFFIX)$(HOSTEXE) +NM = $(firstword $(wildcard $(WIND_BASE)/*/$(WIND_HOST_TYPE)/bin/$(NMPROG))) #-------------------------------------------------- # A linker script is essential for munching from vxWorks 6.6 onwards @@ -146,14 +136,10 @@ MUNCH_LDFLAGS_6 = -T $(VX_DIR)/target/h/tool/gnu/ldscripts/link.OUT MUNCH_LDFLAGS = $(MUNCH_LDFLAGS_$(VXWORKS_MAJOR_VERSION)) #-------------------------------------------------- -# The follow 2 exports prevent gnu cross-compiler -# from finding wrong assembler (as). +# These are required by some of the Wind River tools export WIND_BASE +export WIND_HOME = $(WIND_BASE) export WIND_HOST_TYPE - -#-------------------------------------------------- -# Tornado2.2 -# The follow export allows vxWorks.h to include gnu header files export TOOL_FAMILY = GNU #-------------------------------------------------- diff --git a/configure/os/CONFIG_SITE.Common.vxWorksCommon b/configure/os/CONFIG_SITE.Common.vxWorksCommon index 17696fd36..fc70230cd 100644 --- a/configure/os/CONFIG_SITE.Common.vxWorksCommon +++ b/configure/os/CONFIG_SITE.Common.vxWorksCommon @@ -10,7 +10,7 @@ # Note: vxWorks 5.3 (Tornado 1.x) is not supported #VXWORKS_VERSION = 5.4 -VXWORKS_VERSION = 5.5 +#VXWORKS_VERSION = 5.5 #VXWORKS_VERSION = 6.0 #VXWORKS_VERSION = 6.1 #VXWORKS_VERSION = 6.2 @@ -20,7 +20,7 @@ VXWORKS_VERSION = 5.5 #VXWORKS_VERSION = 6.6 #VXWORKS_VERSION = 6.7 #VXWORKS_VERSION = 6.8 -#VXWORKS_VERSION = 6.9 +VXWORKS_VERSION = 6.9 # Sites may override the following path for a particular host @@ -31,19 +31,6 @@ VXWORKS_VERSION = 5.5 # Under vxWorks 6.x this is *not* the same as the old VX_DIR setting #WIND_BASE = /usr/local/vw/tornado202p1 -WIND_BASE = /usr/local/vw/tornado22-$(ARCH_CLASS) -#WIND_BASE = /usr/local/vw/vxWorks-$(VXWORKS_VERSION) +#WIND_BASE = /usr/local/vw/tornado22-$(ARCH_CLASS) +WIND_BASE = /usr/local/vw/vxWorks-$(VXWORKS_VERSION) #WIND_BASE = /ade/vxWorks/$(VXWORKS_VERSION) - - -# WorkBench Version number, required for vxWorks 6.x - -#WORKBENCH_VERSION = 2.6 -#WORKBENCH_VERSION = 3.0 -#WORKBENCH_VERSION = 3.2 -#WORKBENCH_VERSION = 3.3 - - -# Utilities Version number, required from vxWorks 6.8 and later - -#UTILITIES_VERSION = 1.0 From 80dbc7aeefb1bfabcc57eef23a84e0f9bbfada5b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 18 Aug 2017 15:10:13 -0500 Subject: [PATCH 5/7] Clean up the cross-build rules slightly --- configure/CONFIG.CrossCommon | 12 ++++++------ configure/os/CONFIG.Common.vxWorksCommon | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/configure/CONFIG.CrossCommon b/configure/CONFIG.CrossCommon index 2fa6460d7..65e62dfb1 100644 --- a/configure/CONFIG.CrossCommon +++ b/configure/CONFIG.CrossCommon @@ -17,14 +17,14 @@ BUILD_CLASS = CROSS # ifdef CROSS looks better than ifeq ($(BUILD_CLASS),CROSS) CROSS = YES -GNU_TARGET_INCLUDE_DIR = $(GNU_TARGET:%= $(GNU_DIR)/%/include) -GNU_TARGET_LIB_DIR = $(GNU_TARGET:%= $(GNU_DIR)/%/lib) +GNU_TARGET_INCLUDE_DIR = $(wildcard $(GNU_TARGET:%=$(GNU_DIR)/%/include)) +GNU_TARGET_LIB_DIR = $(wildcard $(GNU_TARGET:%=$(GNU_DIR)/%/lib)) -CROSS_INCLUDES = $(addprefix -I,$(GNU_TARGET_INCLUDE_DIR)) -CROSS_LDFLAGS = $(addprefix -L,$(GNU_TARGET_LIB_DIR)) +CROSS_INCLUDES = $(GNU_TARGET_INCLUDE_DIR:%=-I%) +CROSS_LDFLAGS = $(GNU_TARGET_LIB_DIR:%=-L%) -CMPLR_PREFIX_CROSS=$(addsuffix -,$(GNU_TARGET)) -CMPLR_PREFIX=$(CMPLR_PREFIX_$(BUILD_CLASS)) +CMPLR_PREFIX_CROSS = $(addsuffix -,$(GNU_TARGET)) +CMPLR_PREFIX = $(CMPLR_PREFIX_$(BUILD_CLASS)) # Cross builds usually use the gnu compiler include $(CONFIG)/CONFIG.gnuCommon diff --git a/configure/os/CONFIG.Common.vxWorksCommon b/configure/os/CONFIG.Common.vxWorksCommon index ad73ac20f..2d5d95739 100644 --- a/configure/os/CONFIG.Common.vxWorksCommon +++ b/configure/os/CONFIG.Common.vxWorksCommon @@ -182,6 +182,8 @@ OSITHREAD_USE_DEFAULT_STACK = NO #-------------------------------------------------- # Link definitions +CROSS_LDFLAGS = +# LINK.cpp = $(LD) -o $@ $(STATIC_LDFLAGS) $(PRODDIR_LDFLAGS) $(LDFLAGS) LINK.cpp += $(PROD_LDFLAGS) $(PROD_LD_OBJS) $(PROD_LD_RESS) $(PROD_LDLIBS) From 4ab56518a00811b4e485689b11186d4093c67ff2 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 18 Aug 2017 15:14:42 -0500 Subject: [PATCH 6/7] Add readline support to linux-xscale_be rules Also moves cross-build config to the right host-arch's --- configure/os/CONFIG.Common.linux-xscale_be | 11 ++++++++++- configure/os/CONFIG_SITE.Common.linux-xscale_be | 8 +------- configure/os/CONFIG_SITE.linux-x86.linux-xscale_be | 11 +++++++++++ configure/os/CONFIG_SITE.linux-x86_64.linux-xscale_be | 7 +++++++ 4 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 configure/os/CONFIG_SITE.linux-x86.linux-xscale_be create mode 100644 configure/os/CONFIG_SITE.linux-x86_64.linux-xscale_be diff --git a/configure/os/CONFIG.Common.linux-xscale_be b/configure/os/CONFIG.Common.linux-xscale_be index 8597aa208..462320f66 100644 --- a/configure/os/CONFIG.Common.linux-xscale_be +++ b/configure/os/CONFIG.Common.linux-xscale_be @@ -15,5 +15,14 @@ ARCH_CLASS = xscale ifeq ($(BUILD_CLASS),CROSS) VALID_BUILDS = Ioc GNU_TARGET = xscale_be - CMPLR_PREFIX = $(addsuffix -,$(GNU_TARGET)) + CMPLR_PREFIX = $(GNU_TARGET:%=%-) + + # Configure for readline if requested + OP_SYS_INCLUDES += $(READLINE_DIR:%=-I%/include) + READLINE_LDFLAGS = $(READLINE_DIR:%=-L%/lib) + RUNTIME_LDFLAGS_READLINE_YES_NO = $(READLINE_DIR:%=-Wl,-rpath,%/lib) + RUNTIME_LDFLAGS += \ + $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH)_$(STATIC_BUILD)) + SHRLIBDIR_LDFLAGS += $(READLINE_LDFLAGS) + PRODDIR_LDFLAGS += $(READLINE_LDFLAGS) endif diff --git a/configure/os/CONFIG_SITE.Common.linux-xscale_be b/configure/os/CONFIG_SITE.Common.linux-xscale_be index 69efd6ffa..015229647 100644 --- a/configure/os/CONFIG_SITE.Common.linux-xscale_be +++ b/configure/os/CONFIG_SITE.Common.linux-xscale_be @@ -1,10 +1,4 @@ # CONFIG_SITE.Common.linux-xscale_be # -# Site specific definitions for linux-xscale_be target builds. +# Site specific definitions for all linux-xscale_be target builds. #------------------------------------------------------- - -# Set GNU_DIR to point to directory containing the tool-chain - -# APS: -GNU_DIR = /usr/local/vw/xscale_be - diff --git a/configure/os/CONFIG_SITE.linux-x86.linux-xscale_be b/configure/os/CONFIG_SITE.linux-x86.linux-xscale_be new file mode 100644 index 000000000..6df78db19 --- /dev/null +++ b/configure/os/CONFIG_SITE.linux-x86.linux-xscale_be @@ -0,0 +1,11 @@ +# CONFIG_SITE.linux-x86.linux-xscale_be +# +# Site specific definitions for linux-x86 host - linux-xscale_be targets +#------------------------------------------------------- + +# Set GNU_DIR to point to directory containing the tool-chain +GNU_DIR = /usr/local/vw/xscale_be + +# If readline is available, configure it +READLINE_DIR = $(GNU_DIR)/target/usr +COMMANDLINE_LIBRARY = READLINE diff --git a/configure/os/CONFIG_SITE.linux-x86_64.linux-xscale_be b/configure/os/CONFIG_SITE.linux-x86_64.linux-xscale_be new file mode 100644 index 000000000..d016ce985 --- /dev/null +++ b/configure/os/CONFIG_SITE.linux-x86_64.linux-xscale_be @@ -0,0 +1,7 @@ +# CONFIG_SITE.linux-x86_64.linux-xscale_be +# +# Site specific settings for linux-x86_64 host - linux-xscale_be target +#------------------------------------------------------- + +# Inherit setting from linux-x86 +include $(CONFIG)/os/CONFIG_SITE.linux-x86.linux-xscale_be From 2e4634853ce85a90521a726d05b6fae9f50c3b00 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 2 Sep 2017 23:35:07 -0500 Subject: [PATCH 7/7] Don't inherit alarm severity from self-referential links This behavior was present in 3.14 and got lost in my link changes. Includes a new regression test to detect the broken behavior. --- src/ioc/db/dbLink.c | 18 ++++++++--------- src/ioc/db/dbLink.h | 2 +- src/std/rec/test/regressLinkMS.db | 13 +++++++++++++ src/std/rec/test/regressTest.c | 32 ++++++++++++++++++++++++++++++- 4 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 src/std/rec/test/regressLinkMS.db diff --git a/src/ioc/db/dbLink.c b/src/ioc/db/dbLink.c index af135cff6..423a51ec5 100644 --- a/src/ioc/db/dbLink.c +++ b/src/ioc/db/dbLink.c @@ -213,7 +213,7 @@ static long dbConstGetNelements(const struct link *plink, long *nelements) } static long dbConstGetLink(struct link *plink, short dbrType, void *pbuffer, - epicsEnum16 *pstat, epicsEnum16 *psevr, long *pnRequest) + long *pnRequest) { if (pnRequest) *pnRequest = 0; @@ -291,7 +291,7 @@ static long dbDbGetElements(const struct link *plink, long *nelements) } static long dbDbGetValue(struct link *plink, short dbrType, void *pbuffer, - epicsEnum16 *pstat, epicsEnum16 *psevr, long *pnRequest) + long *pnRequest) { struct pv_link *ppv_link = &plink->value.pv_link; DBADDR *paddr = ppv_link->pvt; @@ -308,8 +308,6 @@ static long dbDbGetValue(struct link *plink, short dbrType, void *pbuffer, if (status) return status; } - *pstat = paddr->precord->stat; - *psevr = paddr->precord->sevr; if (ppv_link->getCvt && ppv_link->lastGetdbrType == dbrType) { status = ppv_link->getCvt(paddr->pfield, pbuffer, paddr); @@ -330,6 +328,9 @@ static long dbDbGetValue(struct link *plink, short dbrType, void *pbuffer, } ppv_link->lastGetdbrType = dbrType; } + if (!status && precord != paddr->precord) + inherit_severity(ppv_link, precord, + paddr->precord->stat, paddr->precord->sevr); return status; } @@ -639,14 +640,15 @@ long dbGetLink(struct link *plink, short dbrType, void *pbuffer, switch (plink->type) { case CONSTANT: - status = dbConstGetLink(plink, dbrType, pbuffer, &stat, &sevr, - pnRequest); + status = dbConstGetLink(plink, dbrType, pbuffer, pnRequest); break; case DB_LINK: - status = dbDbGetValue(plink, dbrType, pbuffer, &stat, &sevr, pnRequest); + status = dbDbGetValue(plink, dbrType, pbuffer, pnRequest); break; case CA_LINK: status = dbCaGetLink(plink, dbrType, pbuffer, &stat, &sevr, pnRequest); + if (!status) + inherit_severity(&plink->value.pv_link, precord, stat, sevr); break; default: cantProceed("dbGetLinkValue: Illegal link type %d\n", plink->type); @@ -654,8 +656,6 @@ long dbGetLink(struct link *plink, short dbrType, void *pbuffer, } if (status) { recGblSetSevr(precord, LINK_ALARM, INVALID_ALARM); - } else { - inherit_severity(&plink->value.pv_link, precord, stat, sevr); } return status; } diff --git a/src/ioc/db/dbLink.h b/src/ioc/db/dbLink.h index 1a4524b14..a5fcb6b4d 100644 --- a/src/ioc/db/dbLink.h +++ b/src/ioc/db/dbLink.h @@ -34,7 +34,7 @@ typedef struct lset { int (*getDBFtype)(const struct link *plink); long (*getElements)(const struct link *plink, long *nelements); long (*getValue)(struct link *plink, short dbrType, void *pbuffer, - epicsEnum16 *pstat, epicsEnum16 *psevr, long *pnRequest); + long *pnRequest); long (*getControlLimits)(const struct link *plink, double *lo, double *hi); long (*getGraphicLimits)(const struct link *plink, double *lo, double *hi); long (*getAlarmLimits)(const struct link *plink, double *lolo, double *lo, diff --git a/src/std/rec/test/regressLinkMS.db b/src/std/rec/test/regressLinkMS.db new file mode 100644 index 000000000..612c18afa --- /dev/null +++ b/src/std/rec/test/regressLinkMS.db @@ -0,0 +1,13 @@ +record(ai, "alarm") { + field(HIGH, 1) + field(HSV, MINOR) + field(HIHI, 2) + field(HHSV, MAJOR) + field(FLNK, "latch") +} + +record(calc, "latch") { + field(INPA, "alarm NPP MS") + field(INPB, "latch NPP MS") + field(CALC, "A") +} diff --git a/src/std/rec/test/regressTest.c b/src/std/rec/test/regressTest.c index 8028630b3..bcf195485 100644 --- a/src/std/rec/test/regressTest.c +++ b/src/std/rec/test/regressTest.c @@ -92,11 +92,41 @@ void testHexConstantLinks(void) testdbCleanup(); } +static +void testLinkMS(void) +{ + startRegressTestIoc("regressLinkMS.db"); + + testdbPutFieldOk("alarm", DBF_DOUBLE, 0.5); + testdbGetFieldEqual("latch", DBR_DOUBLE, 0.5); + testdbGetFieldEqual("latch.SEVR", DBR_LONG, 0); + + testdbPutFieldOk("alarm", DBF_DOUBLE, 1.5); + testdbGetFieldEqual("latch", DBR_DOUBLE, 1.5); + testdbGetFieldEqual("latch.SEVR", DBR_LONG, 1); + + testdbPutFieldOk("alarm", DBF_DOUBLE, 0.5); + testdbGetFieldEqual("latch", DBR_DOUBLE, 0.5); + testdbGetFieldEqual("latch.SEVR", DBR_LONG, 0); + + testdbPutFieldOk("alarm", DBF_DOUBLE, 2.5); + testdbGetFieldEqual("latch", DBR_DOUBLE, 2.5); + testdbGetFieldEqual("latch.SEVR", DBR_LONG, 2); + + testdbPutFieldOk("alarm", DBF_DOUBLE, 0.5); + testdbGetFieldEqual("latch", DBR_DOUBLE, 0.5); + testdbGetFieldEqual("latch.SEVR", DBR_LONG, 0); + + testIocShutdownOk(); + testdbCleanup(); +} + MAIN(regressTest) { - testPlan(16); + testPlan(31); testArrayLength1(); testHexConstantLinks(); + testLinkMS(); return testDone(); }