Skip to content

Commit

Permalink
Upgrade to ADCore R3-0
Browse files Browse the repository at this point in the history
Change the build files to use the ADCore R3-0 build files structure.

Fix the plugin constructor arguments to the super constructor by
removing numParams and adding maxThreads.  (These ADCore changes were
introduced in R3-0 in commit 3af87bd.)

Fix the super call in processCallbacks to call NDPluginDriver's
beginProcessCallbacks method since processCallbacks in NDPluginDriver
was renamed to beginProcessCallbacks.  (This ADCore change was
introduced in R3-0 in commit 3af87bd.)

Call start() in adPythonPluginConfigure, and rename the start variable
in processCallbacks to startTime to avoid shadowing the start method.
(The start method was added in ADCore in R2-5 in commit b1a2f13.)
  • Loading branch information
jlmuir committed Sep 20, 2018
1 parent a030175 commit 5d6917d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
2 changes: 2 additions & 0 deletions adPythonApp/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@ endif

USR_CXXFLAGS += -DDATADIRS=\"$(shell cd ..; pwd):$(shell cd ../../scripts; pwd)\"

include $(ADCORE)/ADApp/commonLibraryMakefile

include $(TOP)/configure/RULES
15 changes: 8 additions & 7 deletions adPythonApp/src/adPythonPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ adPythonPlugin::adPythonPlugin(const char *portNameArg, const char *filename,
const char *NDArrayPort, int NDArrayAddr, int maxBuffers,
size_t maxMemory, int priority, int stackSize)
: NDPluginDriver(portNameArg, queueSize, blockingCallbacks,
NDArrayPort, NDArrayAddr, 1, NUM_ADPYTHONPLUGIN_PARAMS,
NDArrayPort, NDArrayAddr, 1,
maxBuffers, maxMemory,
asynGenericPointerMask|asynFloat64ArrayMask,
asynGenericPointerMask|asynFloat64ArrayMask,
ASYN_MULTIDEVICE, 1, priority, stackSize)
ASYN_MULTIDEVICE, 1, priority, stackSize, 1)
{
// Initialise some params
this->pInstance = NULL;
Expand Down Expand Up @@ -131,7 +131,7 @@ void adPythonPlugin::initThreads()
*/
void adPythonPlugin::processCallbacks(NDArray *pArray) {
// First call the base class method
NDPluginDriver::processCallbacks(pArray);
NDPluginDriver::beginProcessCallbacks(pArray);

// Make sure we are in a good state, otherwise do nothing
if (this->pluginState != GOOD) return;
Expand All @@ -148,8 +148,8 @@ void adPythonPlugin::processCallbacks(NDArray *pArray) {
this->lock();

// Store the time at the beginning of processing for profiling
epicsTimeStamp start, end;
epicsTimeGetCurrent(&start);
epicsTimeStamp startTime, endTime;
epicsTimeGetCurrent(&startTime);

// Update the attribute dict
this->updateAttrDict(pArray);
Expand Down Expand Up @@ -177,8 +177,8 @@ void adPythonPlugin::processCallbacks(NDArray *pArray) {
this->updateAttrList(pArray);

// timestamp
epicsTimeGetCurrent(&end);
setDoubleParam(adPythonTime, epicsTimeDiffInSeconds(&end, &start)*1000);
epicsTimeGetCurrent(&endTime);
setDoubleParam(adPythonTime, epicsTimeDiffInSeconds(&endTime, &startTime)*1000);
callParamCallbacks();

// release GIL and dict Mutex
Expand Down Expand Up @@ -848,6 +848,7 @@ static int adPythonPluginConfigure(const char *portNameArg, const char *filename
NDArrayPort, NDArrayAddr, maxBuffers, maxMemory,
priority, stackSize);
adp->initThreads();
adp->start();
return(asynSuccess);
}

Expand Down
9 changes: 9 additions & 0 deletions configure/CONFIG_SITE
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ CROSS_COMPILER_TARGET_ARCHS =
# You must rebuild in the iocBoot directory for this to
# take effect.
#IOCS_APPL_TOP = </IOC/path/to/application/top>

# Get settings from AREA_DETECTOR, so that we only have to configure once
-include $(AREA_DETECTOR)/configure/CONFIG_SITE
-include $(AREA_DETECTOR)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH)
-include $(AREA_DETECTOR)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).Common
ifdef T_A
-include $(AREA_DETECTOR)/configure/CONFIG_SITE.Common.$(T_A)
-include $(AREA_DETECTOR)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A)
endif
11 changes: 4 additions & 7 deletions configure/RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@
# Build settings that are NOT module paths should appear in a
# CONFIG_SITE file.

TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top
SUPPORT=/dls_sw/prod/R3.14.12.3/support
-include $(TOP)/../configure/RELEASE_LIBS_INCLUDE
-include $(TOP)/RELEASE.local
-include $(TOP)/configure/RELEASE.local

WORK=/dls_sw/work/R3.14.12.3/support
TOOLS_BASE=/dls_sw/prod/tools/RHEL6-x86_64

ASYN=$(SUPPORT)/asyn/4-26
ADCORE=$(SUPPORT)/ADCore/2-4dls8
PYTHON_PREFIX=$(TOOLS_BASE)/Python/2-7-3/prefix

# EPICS_BASE usually appears last so other apps can override stuff:
EPICS_BASE=/dls_sw/epics/R3.14.12.3/base

# Set RULES here if you want to take build rules from somewhere
# other than EPICS_BASE:
#RULES=/path/to/epics/support/module/rules/x-y

0 comments on commit 5d6917d

Please sign in to comment.