Commit 68c31bc5 authored by kpetersn's avatar kpetersn
Browse files

Created the beginning of the asynPortDriver

parent c6b98eb5
#include <stdio.h>
#include "dllImports.h"
#include <iocsh.h>
#include <epicsExport.h>
#include "Linkam_T96.h"
// Is this needed?
using namespace std;
Linkam::Linkam(const char *portName) : asynPortDriver(portName, MAX_CONTROLLERS,
asynInt32Mask | asynFloat64Mask | asynDrvUserMask,
asynInt32Mask | asynFloat64Mask,
ASYN_MULTIDEVICE, 1, /* ASYN_CANBLOCK=0, ASYN_MULTIDEVICE=1, autoConnect=1 */
0, 0) /* Default priority and stack size */
{
static const char *functionName = "Linkam";
createParam(temperatureInValueString, asynParamFloat64, &temperatureInValue_);
// Must be in the directory with the DLL when this line is executed
LoadMonoLibrary("LinkamCommsDll.dll");
//
wrapperVersion_ = GetWrapperVersion();
printf("Using Wrapper Version %s\n", wrapperVersion_);
libraryVersion_ = GetDllVersion();
printf("Comms Library Version %s\n", libraryVersion_);
// TODO: should this be moved to an init method?
// Open communication with the device [Wrapped call to LinkamCommsDll.Comms.OpenComms()]
OpenComms(true, 0, 0);
// Start poller?
// For now just read the temp and exit
temperatureRbv_ = GetValue(0);
printf("Stage temperature:%f °C\n", temperatureRbv_);
// Disconnect
OpenComms(false, 0, 0);
}
int test(void) {
LoadMonoLibrary("LinkamCommsDll.dll");
/*
......@@ -33,22 +69,30 @@ int test(void) {
return 0;
}
extern "C" int LinkamConfig(void) {
extern "C" int LinkamConfig(const char *portName)
{
new Linkam(portName);
return(asynSuccess);
}
extern "C" int LinkamTest(void) {
int retval;
retval = test();
return retval;
}
static const iocshArg * const testArgs[] = {};
static const iocshFuncDef testFuncDef = {"LinkamConfig", 0, testArgs};
static void testCallFunc(const iocshArgBuf *args)
static const iocshArg linkamArg0 = { "Port name", iocshArgString};
static const iocshArg * const linkamArgs[1] = {&linkamArg0};
static const iocshFuncDef linkamFuncDef = {"LinkamConfig", 0, linkamArgs};
static void linkamCallFunc(const iocshArgBuf *args)
{
LinkamConfig();
LinkamConfig(args[0].sval);
}
void drvLinkamRegister(void)
{
iocshRegister(&testFuncDef,testCallFunc);
iocshRegister(&linkamFuncDef,linkamCallFunc);
}
extern "C" {
......
/*
*
*
*
*/
#include <asynPortDriver.h>
static const char *driverName = "Linkam";
#define MAX_CONTROLLERS 1
/* These are the drvInfo strings that are used to identify the parameters.
* They are used by asyn clients, including standard asyn device support */
#define temperatureInValueString "TEMPERATURE_IN_VALUE" /* asynFloat64 r/o */
/*
* Class definition for the Linkam class
*/
class Linkam : public asynPortDriver {
public:
Linkam(const char *portName);
/* These are the methods that we override from asynPortDriver */
protected:
int temperatureInValue_;
#define FIRST_LINKAM_PARAM temperatureInValue_;
#define LAST_LINKAM_PARAM temperatureInValue_;
private:
float temperatureRbv_;
char* wrapperVersion_;
char* libraryVersion_;
};
#define NUM_PARAMS ((int)(&LAST_LINKAM_PARAM - &FIRST_LINKAM_PARAM + 1))
......@@ -21,7 +21,7 @@ DBD += LinkamSupport.dbd
Linkam_SRCS_Linux += Linkam_T96.cpp
Linkam_LIBS_Linux += Wrapper
#!Linkam_Libs += asyn
Linkam_Libs += asyn
Linkam_LIBS += $(EPICS_BASE_IOC_LIBS)
#===========================
......
......@@ -24,6 +24,8 @@ TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top
# If using the sequencer, point SNCSEQ at its top directory:
#SNCSEQ=$(EPICS_BASE)/../modules/soft/seq
ASYN=/home/KPETERSN/Current/9idc_Linkam/support/asyn
# EPICS_BASE usually appears last so other apps can override stuff:
EPICS_BASE=/APSshare/epics/base-3.14.12.5
......
......@@ -26,6 +26,7 @@ TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top
#
LINKAM=$(TOP)/../..
-include $(LINKAM)/configure/RELEASE
# EPICS_BASE usually appears last so other apps can override stuff:
EPICS_BASE=/APSshare/epics/base-3.14.12.5
......
......@@ -16,7 +16,7 @@ linkam_registerRecordDeviceDriver pdbbase
## Run Linkam C# code
cd "${TOP}/bin/${ARCH}"
LinkamConfig
LinkamConfig("linkam1")
cd "${TOP}/iocBoot/${IOC}"
iocInit
......
......@@ -18,6 +18,7 @@ BIN_INSTALLS += ${LINKAM}/bin/${EPICS_HOST_ARCH}/libWrapper.so
# linkam.dbd will be made up from these files:
linkam_DBD += base.dbd
linkam_DBD += asyn.dbd
# Include dbd files from all support applications:
linkam_DBD += LinkamSupport.dbd
......@@ -27,6 +28,7 @@ PROD_SYS_LIBS_Linux += mono-2.0
linkam_LIBS_Linux += Linkam
# The following line isn't necessary, but it makes the depenency explicit
linkam_LIBS_Linux += Wrapper
linkam_LIBS_Linux += asyn
# linkam_registerRecordDeviceDriver.cpp derives from linkam.dbd
linkam_SRCS += linkam_registerRecordDeviceDriver.cpp
......
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