diff --git a/.gitmodules b/.gitmodules index d351db3f..a9e36ecf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -49,3 +49,6 @@ [submodule "modules/motorThorLabs"] path = modules/motorThorLabs url = https://github.com/epics-motor/motorThorLabs.git +[submodule "modules/motorAcs"] + path = modules/motorAcs + url = https://github.com/epics-motor/motorAcs.git diff --git a/iocBoot/iocWithAsyn/motor.substitutions.mcb4b b/iocBoot/iocWithAsyn/motor.substitutions.mcb4b deleted file mode 100644 index efb3f856..00000000 --- a/iocBoot/iocWithAsyn/motor.substitutions.mcb4b +++ /dev/null @@ -1,9 +0,0 @@ -file "$(TOP)/db/basic_asyn_motor.db" -{ -pattern -{P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT} -{IOC:, 1, "m$(N)", "asynMotor", MCB4B1, 0, "Bottom", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, -.001, 3, 16, 0, ""} -{IOC:, 2, "m$(N)", "asynMotor", MCB4B1, 1, "Top", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, -.001, 3, 16, 0, ""} -{IOC:, 3, "m$(N)", "asynMotor", MCB4B1, 2, "Inboard", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, -.001, 3, 16, 0, ""} -{IOC:, 4, "m$(N)", "asynMotor", MCB4B1, 3, "Outboard", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, -.001, 3, 16, 0, ""} -} diff --git a/iocBoot/iocWithAsyn/st.cmd.Vx b/iocBoot/iocWithAsyn/st.cmd.Vx index 7e55abaa..418d0043 100644 --- a/iocBoot/iocWithAsyn/st.cmd.Vx +++ b/iocBoot/iocWithAsyn/st.cmd.Vx @@ -44,19 +44,6 @@ dbLoadRecords("$(MOTOR)/db/motorUtil.db", "P=IOC:") #!IM483PLConfig(0, "a-Serial[0]") #!drvIM483PLdebug=4 -# MCB-4B driver setup parameters: -# (1) maximum # of controllers, -# (2) motor task polling rate (min=1Hz, max=60Hz) -#!MCB4BSetup(1, 10) - -# MCB-4B driver configuration parameters: -# (1) controller -# (2) ASYN port name -#!MCB4BConfig(0, "a-Serial[0]") -#!asynOctetSetInputEos("a-Serial[0]",0,"\r") -#!asynOctetSetOutputEos("a-Serial[0]",0,"\r") -#!drvMCB4BDebug=4 - # New Focus Picomotor Network Controller (model 8750/2) (setup parameters: # (1) maximum number of controllers in system # (2) maximum number of drivers per controller (1 - 3) diff --git a/iocBoot/iocWithAsyn/st.cmd.mcb4b b/iocBoot/iocWithAsyn/st.cmd.mcb4b deleted file mode 100644 index 7c18b1bb..00000000 --- a/iocBoot/iocWithAsyn/st.cmd.mcb4b +++ /dev/null @@ -1,31 +0,0 @@ -#errlogInit(5000) -< envPaths -# Tell EPICS all about the record types, device-support modules, drivers, -# etc. in this build from CARS -dbLoadDatabase("../../dbd/WithAsyn.dbd") -WithAsyn_registerRecordDeviceDriver(pdbbase) - -drvAsynIPPortConfigure("serial1", "164.54.160.36:4002",0,0,0) -asynOctetSetInputEos("serial1",0,"\r") -asynOctetSetOutputEos("serial1",0,"\r") -asynSetTraceIOMask("serial1", 0, 2) -#asynSetTraceMask("serial1", 0, 255) - -MCB4BCreateController("MCB4B1", "serial1", 4, 100, 5000) - -### Motors -dbLoadTemplate "motor.substitutions.mcb4b" - -dbLoadRecords("$(ASYN)/db/asynRecord.db","P=IOC:,R=serial1,PORT=serial1,ADDR=0,OMAX=80,IMAX=80") - -iocInit - -# This IOC does not use save/restore, so set values of some PVs -dbpf("IOC:m1.RTRY", "0") -dbpf("IOC:m1.TWV", "0.1") -dbpf("IOC:m2.RTRY", "0") -dbpf("IOC:m2.TWV", "0.1") -dbpf("IOC:m3.RTRY", "0") -dbpf("IOC:m3.TWV", "0.1") -dbpf("IOC:m4.RTRY", "0") -dbpf("IOC:m4.TWV", "0.1") diff --git a/iocBoot/iocWithAsyn/st.cmd.unix b/iocBoot/iocWithAsyn/st.cmd.unix index 97b51dee..401e8160 100644 --- a/iocBoot/iocWithAsyn/st.cmd.unix +++ b/iocBoot/iocWithAsyn/st.cmd.unix @@ -37,19 +37,6 @@ asynSetOption("L0", -1, "crtscts", "N") #!IM483PLConfig(0, "L0") #!var drvIM483PLdebug 4 -# MCB-4B driver setup parameters: -# (1) maximum # of controllers, -# (2) motor task polling rate (min=1Hz, max=60Hz) -#!MCB4BSetup(1, 10) - -# MCB-4B driver configuration parameters: -# (1) controller -# (2) ASYN port name -#!MCB4BConfig(0, "L0") -#!asynOctetSetInputEos("L0",0,"\r") -#!asynOctetSetOutputEos("L0",0,"\r") -#!var drvMCB4BDebug 4 - # Micos MoCo driver setup parameters: # Load MicosSetup once. # (1) max # of controller groups. Controller groups are per serial diff --git a/iocBoot/iocWithAsyn/st.cmd.win32 b/iocBoot/iocWithAsyn/st.cmd.win32 index fb90ba90..e7fc9442 100755 --- a/iocBoot/iocWithAsyn/st.cmd.win32 +++ b/iocBoot/iocWithAsyn/st.cmd.win32 @@ -26,19 +26,6 @@ dbLoadRecords("$(MOTOR)/db/motorUtil.db", "P=IOC:") #!IM483PLConfig(0, "L0") #!var drvIM483PLdebug 4 -# MCB-4B driver setup parameters: -# (1) maximum # of controllers, -# (2) motor task polling rate (min=1Hz, max=60Hz) -#!MCB4BSetup(1, 10) - -# MCB-4B driver configuration parameters: -# (1) controller -# (2) ASYN port name -#!MCB4BConfig(0, "L0") -#!asynOctetSetInputEos("L0",0,"\r") -#!asynOctetSetOutputEos("L0",0,"\r") -#!var drvMCB4BDebug 4 - # Micos MoCo driver setup parameters: # Load MicosSetup once. # (1) max # of controller groups. Controller groups are per serial diff --git a/iocsh/ACS_MCB4B.iocsh b/iocsh/ACS_MCB4B.iocsh deleted file mode 100644 index cc24ccce..00000000 --- a/iocsh/ACS_MCB4B.iocsh +++ /dev/null @@ -1,25 +0,0 @@ -# ### ACS_MCB4B.iocsh ### - -#- ################################################### -#- PORT - Serial port for communications -#- INSTANCE - Name of asyn port to create -#- -#- NUM_AXES - Optional: Number of axes to create for this controller -#- Default: 1 -#- -#- MOVING_POLL - Optional: Moving poll rate (ms) -#- Default: POLL_RATE -#- -#- IDLE_POLL - Optional: Idle poll rate (ms) -#- Default: POLL_RATE -#- -#- POLL_RATE - Optional: Poll rate (ms) -#- Default: 100 -#- ################################################### - -# ACS MCB-4B serial connection settings -iocshLoad("$(IP)/iocsh/setSerialParams.iocsh", "PORT=$(PORT), BAUD=19200, BITS=8, STOP=1, PARITY=none") -asynOctetSetInputEos( "$(PORT)", -1, "\r") -asynOctetSetOutputEos("$(PORT)", -1, "\r") - -MCB4BCreateController("$(INSTANCE)", "$(PORT)", $(NUM_AXES=1), $(MOVING_POLL=$(POLL_RATE=100)), $(IDLE_POLL=$(POLL_RATE=100))) diff --git a/modules/Makefile b/modules/Makefile index 6a304d4d..bc11ac30 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -5,6 +5,7 @@ include $(TOP)/configure/CONFIG #SUBMODULES += motorVendor SUBMODULES += motorOms SUBMODULES += motorNewport +SUBMODULES += motorAcs SUBMODULES += motorAcsTech80 SUBMODULES += motorAttocube SUBMODULES += motorDeltaTau diff --git a/modules/motorAcs b/modules/motorAcs new file mode 160000 index 00000000..2fac33f0 --- /dev/null +++ b/modules/motorAcs @@ -0,0 +1 @@ +Subproject commit 2fac33f011ca7dfd6c43516cbc19587708ff44c1 diff --git a/motorApp/AcsSrc/AcsRegister.cc b/motorApp/AcsSrc/AcsRegister.cc deleted file mode 100644 index 384d5fb6..00000000 --- a/motorApp/AcsSrc/AcsRegister.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* -FILENAME... AcsRegister.cc -USAGE... Register ACS motor device driver shell commands. - -*/ - -/***************************************************************** - COPYRIGHT NOTIFICATION -***************************************************************** - -(C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO - -This software was developed under a United States Government license -described on the COPYRIGHT_UniversityOfChicago file included as part -of this distribution. -**********************************************************************/ - -#include -#include "AcsRegister.h" -#include "epicsExport.h" - -extern "C" -{ - -// ACS Setup arguments -static const iocshArg setupArg0 = {"Max. controller count", iocshArgInt}; -static const iocshArg setupArg1 = {"Polling rate", iocshArgInt}; -// ACS Config arguments -static const iocshArg configArg0 = {"Card being configured", iocshArgInt}; -static const iocshArg configArg1 = {"asyn port name", iocshArgString}; - -static const iocshArg * const MCB4BSetupArgs[2] = {&setupArg0, &setupArg1}; -static const iocshArg * const MCB4BConfigArgs[2] = {&configArg0, &configArg1}; - -static const iocshFuncDef setupMCB4B = {"MCB4BSetup", 2, MCB4BSetupArgs}; -static const iocshFuncDef configMCB4B = {"MCB4BConfig", 2, MCB4BConfigArgs}; - -static void setupMCB4BCallFunc(const iocshArgBuf *args) -{ - MCB4BSetup(args[0].ival, args[1].ival); -} -static void configMCB4BCallFunc(const iocshArgBuf *args) -{ - MCB4BConfig(args[0].ival, args[1].sval); -} - -static void AcsRegister(void) -{ - iocshRegister(&setupMCB4B, setupMCB4BCallFunc); - iocshRegister(&configMCB4B, configMCB4BCallFunc); -} - -epicsExportRegistrar(AcsRegister); - -} // extern "C" diff --git a/motorApp/AcsSrc/AcsRegister.h b/motorApp/AcsSrc/AcsRegister.h deleted file mode 100644 index 00e0480f..00000000 --- a/motorApp/AcsSrc/AcsRegister.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -FILENAME... AcsRegister.h -USAGE... This file contains function prototypes for ACS IOC shell commands. - -*/ - -/* - * Original Author: Ron Sluiter - * Date: 05/19/03 - * - * Experimental Physics and Industrial Control System (EPICS) - * - * Copyright 1991, the Regents of the University of California, - * and the University of Chicago Board of Governors. - * - * This software was produced under U.S. Government contracts: - * (W-7405-ENG-36) at the Los Alamos National Laboratory, - * and (W-31-109-ENG-38) at Argonne National Laboratory. - * - * Initial development by: - * The Controls and Automation Group (AT-8) - * Ground Test Accelerator - * Accelerator Technology Division - * Los Alamos National Laboratory - * - * Co-developed with - * The Controls and Computing Group - * Accelerator Systems Division - * Advanced Photon Source - * Argonne National Laboratory - * - * Modification Log: - * ----------------- - */ - -#include "motor.h" -#include "motordrvCom.h" - -/* Function prototypes. */ -extern RTN_STATUS MCB4BSetup(int, int); -extern RTN_STATUS MCB4BConfig(int, const char *); - diff --git a/motorApp/AcsSrc/MCB4BDriver.cpp b/motorApp/AcsSrc/MCB4BDriver.cpp deleted file mode 100644 index ca1e8d26..00000000 --- a/motorApp/AcsSrc/MCB4BDriver.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/* -FILENAME... MCB4BDriver.cpp -USAGE... Motor driver support for the ACS MCB-4B controller. - -Mark Rivers -March 1, 2012 - -*/ - - -#include -#include -#include -#include - -#include -#include - -#include - -#include -#include "MCB4BDriver.h" - -#define NINT(f) (int)((f)>0 ? (f)+0.5 : (f)-0.5) - -/** Creates a new MCB4BController object. - * \param[in] portName The name of the asyn port that will be created for this driver - * \param[in] MCB4BPortName The name of the drvAsynSerialPort that was created previously to connect to the MCB4B controller - * \param[in] numAxes The number of axes that this controller supports - * \param[in] movingPollPeriod The time between polls when any axis is moving - * \param[in] idlePollPeriod The time between polls when no axis is moving - */ -MCB4BController::MCB4BController(const char *portName, const char *MCB4BPortName, int numAxes, - double movingPollPeriod, double idlePollPeriod) - : asynMotorController(portName, numAxes, NUM_MCB4B_PARAMS, - 0, // No additional interfaces beyond those in base class - 0, // No additional callback interfaces beyond those in base class - ASYN_CANBLOCK | ASYN_MULTIDEVICE, - 1, // autoconnect - 0, 0) // Default priority and stack size -{ - int axis; - asynStatus status; - MCB4BAxis *pAxis; - static const char *functionName = "MCB4BController::MCB4BController"; - - /* Connect to MCB4B controller */ - status = pasynOctetSyncIO->connect(MCB4BPortName, 0, &pasynUserController_, NULL); - if (status) { - asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, - "%s: cannot connect to MCB-4B controller\n", - functionName); - } - for (axis=0; axis 0 then information is printed about each axis. - * After printing controller-specific information it calls asynMotorController::report() - */ -void MCB4BController::report(FILE *fp, int level) -{ - fprintf(fp, "MCB-4B motor driver %s, numAxes=%d, moving poll period=%f, idle poll period=%f\n", - this->portName, numAxes_, movingPollPeriod_, idlePollPeriod_); - - // Call the base class method - asynMotorController::report(fp, level); -} - -/** Returns a pointer to an MCB4BAxis object. - * Returns NULL if the axis number encoded in pasynUser is invalid. - * \param[in] pasynUser asynUser structure that encodes the axis index number. */ -MCB4BAxis* MCB4BController::getAxis(asynUser *pasynUser) -{ - return static_cast(asynMotorController::getAxis(pasynUser)); -} - -/** Returns a pointer to an MCB4BAxis object. - * Returns NULL if the axis number encoded in pasynUser is invalid. - * \param[in] axisNo Axis index number. */ -MCB4BAxis* MCB4BController::getAxis(int axisNo) -{ - return static_cast(asynMotorController::getAxis(axisNo)); -} - - -// These are the MCB4BAxis methods - -/** Creates a new MCB4BAxis object. - * \param[in] pC Pointer to the MCB4BController to which this axis belongs. - * \param[in] axisNo Index number of this axis, range 0 to pC->numAxes_-1. - * - * Initializes register numbers, etc. - */ -MCB4BAxis::MCB4BAxis(MCB4BController *pC, int axisNo) - : asynMotorAxis(pC, axisNo), - pC_(pC) -{ -} - -/** Reports on status of the axis - * \param[in] fp The file pointer on which report information will be written - * \param[in] level The level of report detail desired - * - * After printing device-specific information calls asynMotorAxis::report() - */ -void MCB4BAxis::report(FILE *fp, int level) -{ - if (level > 0) { - fprintf(fp, " axis %d\n", - axisNo_); - } - - // Call the base class method - asynMotorAxis::report(fp, level); -} - -asynStatus MCB4BAxis::sendAccelAndVelocity(double acceleration, double velocity) -{ - asynStatus status; - int ival; - // static const char *functionName = "MCB4B::sendAccelAndVelocity"; - - // Send the velocity - ival = NINT(fabs(115200./velocity)); - if (ival < 2) ival=2; - if (ival > 255) ival = 255; - sprintf(pC_->outString_, "#%02dV=%d", axisNo_, ival); - status = pC_->writeReadController(); - - // Send the acceleration - // acceleration is in steps/sec/sec - // MCB is programmed with Ramp Index (R) where: - // dval (steps/sec/sec) = 720,000/(256-R) */ - // or R=256-(720,000/dval) */ - ival = NINT(256-(720000./acceleration)); - if (ival < 1) ival=1; - if (ival > 255) ival=255; - sprintf(pC_->outString_, "#%02dR=%d", axisNo_, ival); - status = pC_->writeReadController(); - return status; -} - - -asynStatus MCB4BAxis::move(double position, int relative, double minVelocity, double maxVelocity, double acceleration) -{ - asynStatus status; - // static const char *functionName = "MCB4BAxis::move"; - - status = sendAccelAndVelocity(acceleration, maxVelocity); - - if (relative) { - sprintf(pC_->outString_, "#%02dI%+d", axisNo_, NINT(position)); - } else { - sprintf(pC_->outString_, "#%02dG%+d", axisNo_, NINT(position)); - } - status = pC_->writeReadController(); - return status; -} - -asynStatus MCB4BAxis::home(double minVelocity, double maxVelocity, double acceleration, int forwards) -{ - asynStatus status; - // static const char *functionName = "MCB4BAxis::home"; - - status = sendAccelAndVelocity(acceleration, maxVelocity); - - if (forwards) { - sprintf(pC_->outString_, "#%02dH+", axisNo_); - } else { - sprintf(pC_->outString_, "#%02dH-", axisNo_); - } - status = pC_->writeReadController(); - return status; -} - -asynStatus MCB4BAxis::moveVelocity(double minVelocity, double maxVelocity, double acceleration) -{ - asynStatus status; - static const char *functionName = "MCB4BAxis::moveVelocity"; - - asynPrint(pasynUser_, ASYN_TRACE_FLOW, - "%s: minVelocity=%f, maxVelocity=%f, acceleration=%f\n", - functionName, minVelocity, maxVelocity, acceleration); - - status = sendAccelAndVelocity(acceleration, maxVelocity); - - /* MCB-4B does not have jog command. Move 1 million steps */ - if (maxVelocity > 0.) { - /* This is a positive move in MCB4B coordinates */ - sprintf(pC_->outString_, "#%02dI+1000000", axisNo_); - } else { - /* This is a negative move in MCB4B coordinates */ - sprintf(pC_->outString_, "#%02dI-1000000", axisNo_); - } - status = pC_->writeReadController(); - return status; -} - -asynStatus MCB4BAxis::stop(double acceleration ) -{ - asynStatus status; - //static const char *functionName = "MCB4BAxis::stop"; - - sprintf(pC_->outString_, "#%02dQ", axisNo_); - status = pC_->writeReadController(); - return status; -} - -asynStatus MCB4BAxis::setPosition(double position) -{ - asynStatus status; - //static const char *functionName = "MCB4BAxis::setPosition"; - - sprintf(pC_->outString_, "#%02dP=%+d", axisNo_, NINT(position)); - status = pC_->writeReadController(); - return status; -} - -asynStatus MCB4BAxis::setClosedLoop(bool closedLoop) -{ - asynStatus status; - //static const char *functionName = "MCB4BAxis::setClosedLoop"; - - sprintf(pC_->outString_, "#%02dW=%d", axisNo_, closedLoop ? 1:0); - status = pC_->writeReadController(); - return status; -} - -/** Polls the axis. - * This function reads the motor position, the limit status, the home status, the moving status, - * and the drive power-on status. - * It calls setIntegerParam() and setDoubleParam() for each item that it polls, - * and then calls callParamCallbacks() at the end. - * \param[out] moving A flag that is set indicating that the axis is moving (true) or done (false). */ -asynStatus MCB4BAxis::poll(bool *moving) -{ - int done; - int driveOn; - int limit; - double position; - asynStatus comStatus; - - // Read the current motor position - sprintf(pC_->outString_, "#%02dP", axisNo_); - comStatus = pC_->writeReadController(); - if (comStatus) goto skip; - // The response string is of the form "#01P=+1000" - position = atof(&pC_->inString_[5]); - setDoubleParam(pC_->motorPosition_, position); - - // Read the moving status of this motor - sprintf(pC_->outString_, "#%02dX", axisNo_); - comStatus = pC_->writeReadController(); - if (comStatus) goto skip; - // The response string is of the form "#01X=1" - done = (pC_->inString_[5] == '0') ? 1:0; - setIntegerParam(pC_->motorStatusDone_, done); - *moving = done ? false:true; - - // Read the limit status - sprintf(pC_->outString_, "#%02dE", axisNo_); - comStatus = pC_->writeReadController(); - if (comStatus) goto skip; - // The response string is of the form "#01E=1" - limit = (pC_->inString_[5] == '1') ? 1:0; - setIntegerParam(pC_->motorStatusHighLimit_, limit); - limit = (pC_->inString_[6] == '1') ? 1:0; - setIntegerParam(pC_->motorStatusLowLimit_, limit); - limit = (pC_->inString_[7] == '1') ? 1:0; - setIntegerParam(pC_->motorStatusAtHome_, limit); - - // Read the drive power on status - sprintf(pC_->outString_, "#%02dW", axisNo_); - comStatus = pC_->writeReadController(); - if (comStatus) goto skip; - driveOn = (pC_->inString_[5] == '1') ? 1:0; - setIntegerParam(pC_->motorStatusPowerOn_, driveOn); - setIntegerParam(pC_->motorStatusProblem_, 0); - - skip: - setIntegerParam(pC_->motorStatusProblem_, comStatus ? 1:0); - callParamCallbacks(); - return comStatus ? asynError : asynSuccess; -} - -/** Code for iocsh registration */ -static const iocshArg MCB4BCreateControllerArg0 = {"Port name", iocshArgString}; -static const iocshArg MCB4BCreateControllerArg1 = {"MCB-4B port name", iocshArgString}; -static const iocshArg MCB4BCreateControllerArg2 = {"Number of axes", iocshArgInt}; -static const iocshArg MCB4BCreateControllerArg3 = {"Moving poll period (ms)", iocshArgInt}; -static const iocshArg MCB4BCreateControllerArg4 = {"Idle poll period (ms)", iocshArgInt}; -static const iocshArg * const MCB4BCreateControllerArgs[] = {&MCB4BCreateControllerArg0, - &MCB4BCreateControllerArg1, - &MCB4BCreateControllerArg2, - &MCB4BCreateControllerArg3, - &MCB4BCreateControllerArg4}; -static const iocshFuncDef MCB4BCreateControllerDef = {"MCB4BCreateController", 5, MCB4BCreateControllerArgs}; -static void MCB4BCreateContollerCallFunc(const iocshArgBuf *args) -{ - MCB4BCreateController(args[0].sval, args[1].sval, args[2].ival, args[3].ival, args[4].ival); -} - -static void MCB4BRegister(void) -{ - iocshRegister(&MCB4BCreateControllerDef, MCB4BCreateContollerCallFunc); -} - -extern "C" { -epicsExportRegistrar(MCB4BRegister); -} diff --git a/motorApp/AcsSrc/MCB4BDriver.h b/motorApp/AcsSrc/MCB4BDriver.h deleted file mode 100644 index b13365fb..00000000 --- a/motorApp/AcsSrc/MCB4BDriver.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -FILENAME... MCB4BDriver.h -USAGE... Motor driver support for the ACS MCB-4B controller. - -Mark Rivers -March 1, 2012 - -*/ - -#include "asynMotorController.h" -#include "asynMotorAxis.h" - -#define MAX_MCB4B_AXES 4 - -// No controller-specific parameters yet -#define NUM_MCB4B_PARAMS 0 - -class epicsShareClass MCB4BAxis : public asynMotorAxis -{ -public: - /* These are the methods we override from the base class */ - MCB4BAxis(class MCB4BController *pC, int axis); - void report(FILE *fp, int level); - asynStatus move(double position, int relative, double min_velocity, double max_velocity, double acceleration); - asynStatus moveVelocity(double min_velocity, double max_velocity, double acceleration); - asynStatus home(double min_velocity, double max_velocity, double acceleration, int forwards); - asynStatus stop(double acceleration); - asynStatus poll(bool *moving); - asynStatus setPosition(double position); - asynStatus setClosedLoop(bool closedLoop); - -private: - MCB4BController *pC_; /**< Pointer to the asynMotorController to which this axis belongs. - * Abbreviated because it is used very frequently */ - asynStatus sendAccelAndVelocity(double accel, double velocity); - -friend class MCB4BController; -}; - -class epicsShareClass MCB4BController : public asynMotorController { -public: - MCB4BController(const char *portName, const char *MCB4BPortName, int numAxes, double movingPollPeriod, double idlePollPeriod); - - void report(FILE *fp, int level); - MCB4BAxis* getAxis(asynUser *pasynUser); - MCB4BAxis* getAxis(int axisNo); - -friend class MCB4BAxis; -}; diff --git a/motorApp/AcsSrc/Makefile b/motorApp/AcsSrc/Makefile deleted file mode 100644 index 7b97758b..00000000 --- a/motorApp/AcsSrc/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# Makefile -TOP = ../.. -include $(TOP)/configure/CONFIG - -# The following are used for debugging messages. -USR_CXXFLAGS += -DDEBUG - -DBD += devAcsMotor.dbd - -LIBRARY_IOC = Acs - -SRCS += AcsRegister.cc - -# Advanced Control Systems driver support. -SRCS += devMCB4B.c drvMCB4B.c -SRCS += MCB4BDriver.cpp - -Acs_LIBS += motor asyn -Acs_LIBS += $(EPICS_BASE_IOC_LIBS) - -include $(TOP)/configure/RULES - diff --git a/motorApp/AcsSrc/devAcsMotor.dbd b/motorApp/AcsSrc/devAcsMotor.dbd deleted file mode 100644 index 1764a62a..00000000 --- a/motorApp/AcsSrc/devAcsMotor.dbd +++ /dev/null @@ -1,11 +0,0 @@ -# Advanced Control Systems driver support. - -# Model 1 (non-asyn) driver -device(motor,VME_IO,devMCB4B,"ACS MCB-4B") -driver(drvMCB4B) -registrar(AcsRegister) - -# Model 3 driver -registrar(MCB4BRegister) - - diff --git a/motorApp/AcsSrc/devMCB4B.cc b/motorApp/AcsSrc/devMCB4B.cc deleted file mode 100644 index 73e43d17..00000000 --- a/motorApp/AcsSrc/devMCB4B.cc +++ /dev/null @@ -1,331 +0,0 @@ -/* File: devMCB4B.cc */ - -/* Device Support Routines for motor */ -/* - * Original Author: Mark Rivers - * Date: 02-24-2002 - * - * Modification Log: - * ----------------- - * .00 02-24-2002 mlr initialized from devPM304.c - * .01 05-23-2003 rls Converted to R3.14.x. - * .02 02-19-2004 mlr Bug fix when not sending anything - */ - - -#define VERSION 1.00 - -#include -#include -#include "motorRecord.h" -#include "motor.h" -#include "motordevCom.h" -#include "drvMCB4B.h" -#include "epicsExport.h" - -#define STATIC static - -extern struct driver_table MCB4B_access; - -#define NINT(f) (long)((f)>0 ? (f)+0.5 : (f)-0.5) - -volatile int devMCB4BDebug = 0; -extern "C" {epicsExportAddress(int, devMCB4BDebug);} - -static inline void Debug(int level, const char *format, ...) { - #ifdef DEBUG - if (level < devMCB4BDebug) - { - va_list pVar; - va_start(pVar, format); - vprintf(format, pVar); - va_end(pVar); - } - #endif -} - -/* Debugging levels: - * devMCB4BDebug >= 3 Print new part of command and command string so far - * at the end of MCB4B_build_trans - */ - - -/* ----------------Create the dsets for devMCB4B----------------- */ -STATIC struct driver_table *drvtabptr; -STATIC long MCB4B_init(int); -STATIC long MCB4B_init_record(void *); -STATIC long MCB4B_start_trans(struct motorRecord *); -STATIC RTN_STATUS MCB4B_build_trans(motor_cmnd, double *, struct motorRecord *); -STATIC RTN_STATUS MCB4B_end_trans(struct motorRecord *); - -struct motor_dset devMCB4B = -{ - {8, NULL, (DEVSUPFUN) MCB4B_init, (DEVSUPFUN) MCB4B_init_record, NULL}, - motor_update_values, - MCB4B_start_trans, - MCB4B_build_trans, - MCB4B_end_trans -}; - -extern "C" {epicsExportAddress(dset,devMCB4B);} - - -/* --------------------------- program data --------------------- */ -/* This table is used to define the command types */ - -static msg_types MCB4B_table[] = { - MOTION, /* MOVE_ABS */ - MOTION, /* MOVE_REL */ - MOTION, /* HOME_FOR */ - MOTION, /* HOME_REV */ - IMMEDIATE, /* LOAD_POS */ - IMMEDIATE, /* SET_VEL_BASE */ - IMMEDIATE, /* SET_VELOCITY */ - IMMEDIATE, /* SET_ACCEL */ - IMMEDIATE, /* GO */ - IMMEDIATE, /* SET_ENC_RATIO */ - INFO, /* GET_INFO */ - MOVE_TERM, /* STOP_AXIS */ - VELOCITY, /* JOG */ - IMMEDIATE, /* SET_PGAIN */ - IMMEDIATE, /* SET_IGAIN */ - IMMEDIATE, /* SET_DGAIN */ - IMMEDIATE, /* ENABLE_TORQUE */ - IMMEDIATE, /* DISABL_TORQUE */ - IMMEDIATE, /* PRIMITIVE */ - IMMEDIATE, /* SET_HIGH_LIMIT */ - IMMEDIATE, /* SET_LOW_LIMIT */ - VELOCITY /* JOB_VELOCITY */ -}; - - -static struct board_stat **MCB4B_cards; - -/* --------------------------- program data --------------------- */ - - -/* initialize device support for MCB4B stepper motor */ -STATIC long MCB4B_init(int after) -{ - long rtnval; - - Debug(5, "MCB4B_init: entry\n"); - if (!after) - { - drvtabptr = &MCB4B_access; - (drvtabptr->init)(); - } - - rtnval = motor_init_com(after, *drvtabptr->cardcnt_ptr, drvtabptr, &MCB4B_cards); - Debug(5, "MCB4B_init: exit\n"); - return(rtnval); -} - - -/* initialize a record instance */ -STATIC long MCB4B_init_record(void *arg) -{ - struct motorRecord *mr = (struct motorRecord *) arg; - long rtnval; - - Debug(5, "MCB4B_init_record: entry\n"); - rtnval = motor_init_record_com(mr, *drvtabptr->cardcnt_ptr, - drvtabptr, MCB4B_cards); - return(rtnval); - Debug(5, "MCB4B_init_record: exit\n"); -} - - -/* start building a transaction */ -STATIC long MCB4B_start_trans(struct motorRecord *mr) -{ - return(OK); -} - - -/* end building a transaction */ -STATIC RTN_STATUS MCB4B_end_trans(struct motorRecord *mr) -{ - return(OK); -} - -/* add a part to the transaction */ -STATIC RTN_STATUS MCB4B_build_trans(motor_cmnd command, double *parms, struct motorRecord *mr) -{ - struct motor_trans *trans = (struct motor_trans *) mr->dpvt; - struct mess_node *motor_call; - struct controller *brdptr; - struct MCB4Bcontroller *cntrl; - char buff[30]; - int axis, card; - RTN_STATUS rtnval; - double dval; - long ival; - bool send; - - send = true; - rtnval = OK; - buff[0] = '\0'; - /* Protect against NULL pointer with WRTITE_MSG(GO/STOP_AXIS/GET_INFO, NULL). */ - dval = (parms == NULL) ? 0.0 : *parms; - ival = NINT(dval); - - rtnval = (RTN_STATUS) motor_start_trans_com(mr, MCB4B_cards); - Debug(5, "MCB4B_build_trans: entry, motor_start_trans_com=%d\n", rtnval); - - motor_call = &(trans->motor_call); - motor_call->type = MCB4B_table[command]; - card = motor_call->card; - axis = motor_call->signal; - brdptr = (*trans->tabptr->card_array)[card]; - Debug(5, "MCB4B_build_trans: axis=%d, command=%d\n", axis, command); - if (brdptr == NULL) - return(rtnval = ERROR); - - cntrl = (struct MCB4Bcontroller *) brdptr->DevicePrivate; - - - if (trans->state != BUILD_STATE) - return(rtnval = ERROR); - - if (command == PRIMITIVE && mr->init != NULL && strlen(mr->init) != 0) - { - strcpy(motor_call->message, mr->init); - rtnval = motor_end_trans_com(mr, drvtabptr); - rtnval = (RTN_STATUS) motor_start_trans_com(mr, MCB4B_cards); - motor_call->type = MCB4B_table[command]; - } - - switch (command) - { - case MOVE_ABS: - case MOVE_REL: - case HOME_FOR: - case HOME_REV: - case JOG: - if (strlen(mr->prem) != 0) - { - strcpy(motor_call->message, mr->prem); - rtnval = motor_end_trans_com(mr, drvtabptr); - rtnval = (RTN_STATUS) motor_start_trans_com(mr, MCB4B_cards); - motor_call->type = MCB4B_table[command]; - } - if (strlen(mr->post) != 0) - motor_call->postmsgptr = (char *) &mr->post; - break; - - default: - break; - } - - switch (command) - { - case MOVE_ABS: - sprintf(motor_call->message, "#%02dG%+ld", axis, ival); - break; - case MOVE_REL: - sprintf(motor_call->message, "#%02dI%+ld", axis, ival); - break; - case HOME_FOR: - sprintf(motor_call->message, "#%02dH+", axis); - break; - case HOME_REV: - sprintf(motor_call->message, "#%02dH-", axis); - break; - case LOAD_POS: - sprintf(motor_call->message, "#%02dP=%+ld", axis, ival); - break; - case SET_VEL_BASE: - send=false; - trans->state = IDLE_STATE; - break; /* MCB4B does not use base velocity */ - case SET_VELOCITY: - ival = (int) (fabs(115200./dval) + 0.5); - if (ival < 2) ival=2; - if (ival > 255) ival = 255; - sprintf(motor_call->message, "#%02dV=%ld", axis, ival); - break; - case SET_ACCEL: - /* dval is acceleration in steps/sec/sec */ - /* MCB is programmed with Ramp Index (R) where: */ - /* dval (steps/sec/sec) = 720,000/(256-R) */ - /* or R=256-(720,000/dval) */ - ival = (int) (256-(720000./dval)+0.5); - if (ival < 1) ival=1; - if (ival > 255) ival=255; - sprintf(motor_call->message, "#%02dR=%ld", axis, ival); - break; - case GO: - /* - * The MCB4B starts moving immediately on move commands, GO command - * does nothing - */ - send=false; - trans->state = IDLE_STATE; - break; - case SET_ENC_RATIO: - /* - * The MCB4B does not have the concept of encoder ratio, ignore this - * command - */ - send=false; - trans->state = IDLE_STATE; - break; - case GET_INFO: - /* These commands are not actually done by sending a message, but - rather they will indirectly cause the driver to read the status - of all motors */ - break; - case STOP_AXIS: - sprintf(motor_call->message, "#%02dQ", axis); - break; - case JOG: - /* MCB-4B does not have jog command. Move 1 million steps */ - ival = (int) (fabs(115200./dval) + 0.5); - if (ival < 2) ival=2; - if (ival > 65535) ival = 65535; - sprintf(motor_call->message, "#%02dC=%ld", axis, ival); - rtnval = motor_end_trans_com(mr, drvtabptr); - rtnval = (RTN_STATUS) motor_start_trans_com(mr, MCB4B_cards); - motor_call->type = MCB4B_table[command]; - if (dval > 0.) { - /* This is a positive move in MCB4B coordinates */ - sprintf(motor_call->message, "#%02dM+1000000", axis); - } else { - /* This is a negative move in MCB4B coordinates */ - sprintf(motor_call->message, "#%02dM-1000000", axis); - } - break; - case SET_PGAIN: - case SET_IGAIN: - case SET_DGAIN: - send=false; - trans->state = IDLE_STATE; - break; - - case ENABLE_TORQUE: - sprintf(motor_call->message, "#%02dW=1", axis); - break; - - case DISABL_TORQUE: - sprintf(motor_call->message, "#%02dW=0", axis); - break; - - case SET_HIGH_LIMIT: - case SET_LOW_LIMIT: - send=false; - trans->state = IDLE_STATE; - break; - - default: - rtnval = ERROR; - } - - if(send == false) - return(rtnval); - else { - rtnval = motor_end_trans_com(mr, drvtabptr); - Debug(5, "MCB4B_send_msg: motor_end_trans_com status=%d, exit\n", rtnval); - return (rtnval); - } -} diff --git a/motorApp/AcsSrc/drvMCB4B.cc b/motorApp/AcsSrc/drvMCB4B.cc deleted file mode 100644 index d888947b..00000000 --- a/motorApp/AcsSrc/drvMCB4B.cc +++ /dev/null @@ -1,529 +0,0 @@ -/* File: drvMCB4B.cc */ - -/* Device Driver Support routines for motor */ -/* - * Original Author: Mark Rivers - * Date: 2/24/2002 - * - * Modification Log: - * ----------------- - * .01 02-24-2002 mlr initialized from drvPM304.c - * .02 07-03-2002 rls replaced RA_OVERTRAVEL with RA_PLUS_LS and RA_MINUS_LS - * .03 05-23-2003 rls Converted to R3.14.x. - * .04 02-03-2004 rls Eliminate erroneous "Motor motion timeout ERROR". - * .05 07-09-2004 rls - removed unused Setup() argument. - * - added "\" at end of long Debug stmt's for SunPro. - * .06 09-20-2004 rls send_mess() argument changed to char * for - * 32axis/controller support. - */ - - -#include -#include -#include -#include -#include -#include "motor.h" -#include "AcsRegister.h" -#include "drvMCB4B.h" -#include "asynOctetSyncIO.h" -#include "epicsExport.h" - -#define STATIC static - -#define WAIT 1 - -#define TIMEOUT 2.0 /* Command timeout in sec */ - -#define BUFF_SIZE 100 /* Maximum length of string to/from MCB4B */ - -volatile int drvMCB4BDebug = 0; -extern "C" {epicsExportAddress(int, drvMCB4BDebug);} - -static inline void Debug(int level, const char *format, ...) { - #ifdef DEBUG - if (level < drvMCB4BDebug) - { - va_list pVar; - va_start(pVar, format); - vprintf(format, pVar); - va_end(pVar); - } - #endif -} - -/* Debugging notes: - * drvMCB4BDebug == 0 No debugging information is printed - * drvMCB4BDebug >= 1 Warning information is printed - * drvMCB4BDebug >= 2 Time-stamped messages are printed for each string - * sent to and received from the controller - * drvMCB4BDebug >= 3 Additional debugging messages - */ - -int MCB4B_num_cards = 0; - -/* Local data required for every driver; see "motordrvComCode.h" */ -#include "motordrvComCode.h" - - -/*----------------functions-----------------*/ -STATIC int recv_mess(int, char *, int); -STATIC RTN_STATUS send_mess(int, const char *, char *); -STATIC void start_status(int card); -STATIC int set_status(int card, int signal); -static long report(int level); -static long init(); -STATIC int motor_init(); -STATIC void query_done(int, int, struct mess_node *); - -/*----------------functions-----------------*/ - -struct driver_table MCB4B_access = -{ - motor_init, - motor_send, - motor_free, - motor_card_info, - motor_axis_info, - &mess_queue, - &queue_lock, - &free_list, - &freelist_lock, - &motor_sem, - &motor_state, - &total_cards, - &any_motor_in_motion, - send_mess, - recv_mess, - set_status, - query_done, - start_status, - &initialized, - NULL -}; - -struct drvMCB4B_drvet -{ - long number; - long (*report) (int); - long (*init) (void); -} drvMCB4B = {2, report, init}; - -extern "C" {epicsExportAddress(drvet, drvMCB4B);} - -STATIC struct thread_args targs = {SCAN_RATE, &MCB4B_access, 0.0}; - - -/********************************************************* - * Print out driver status report - *********************************************************/ -static long report(int level) -{ - int card; - struct MCB4Bcontroller *cntrl; - - if (MCB4B_num_cards <=0) - printf(" NO MCB4B controllers found\n"); - else - { - for (card = 0; card < MCB4B_num_cards; card++) { - if (motor_state[card]) { - cntrl = (struct MCB4Bcontroller *) motor_state[card]->DevicePrivate; - printf(" MCB4B controller %d, port=%s, id: %s \n", - card, cntrl->port, - motor_state[card]->ident); - } - } - } - return (0); -} - - -static long init() -{ - /* - * We cannot call motor_init() here, because that function can do GPIB I/O, - * and hence requires that the drvGPIB have already been initialized. - * That cannot be guaranteed, so we need to call motor_init from device - * support - */ - /* Check for setup */ - if (MCB4B_num_cards <= 0) - { - Debug(1, "init: *MCB4B driver disabled*\n"); - Debug(1, "MCB4BSetup() is missing from startup script.\n"); - return (ERROR); - } - - return ((long) 0); -} - -STATIC void query_done(int card, int axis, struct mess_node *nodeptr) -{ -} - - -/********************************************************* - * Read the status and position of all motors on a card - * start_status(int card) - * if card == -1 then start all cards - *********************************************************/ -STATIC void start_status(int card) -{ - /* The MCB4B cannot query status or positions of all axes with a - * single command. This needs to be done on an axis-by-axis basis, - * so this function does nothing - */ -} - - -/************************************************************** - * Query position and status for an axis - * set_status() - ************************************************************/ - -STATIC int set_status(int card, int signal) -{ - register struct mess_info *motor_info; - char command[BUFF_SIZE]; - char response[BUFF_SIZE]; - struct mess_node *nodeptr; - int rtn_state; - long motorData; - char buff[BUFF_SIZE]; - bool ls_active = false; - msta_field status; - - motor_info = &(motor_state[card]->motor_info[signal]); - nodeptr = motor_info->motor_motion; - status.All = motor_info->status.All; - - /* Request the moving status of this motor */ - sprintf(command, "#%02dX", signal); - send_mess(card, command, 0); - recv_mess(card, response, WAIT); - /* The response string is of the form "#01X=1" */ - - status.Bits.RA_DONE = (response[5] == '1') ? 0 : 1; - - /* Request the limit status of this motor */ - sprintf(command, "#%02dE", signal); - send_mess(card, command, 0); - recv_mess(card, response, WAIT); - /* The response string is of the form "#01E=1" */ - status.Bits.RA_PLUS_LS = 0; - status.Bits.RA_MINUS_LS = 0; - if (response[5] == '1') { - status.Bits.RA_PLUS_LS = 1; - status.Bits.RA_DIRECTION = 1; - ls_active = true; - } - if (response[6] == '1') { - status.Bits.RA_MINUS_LS = 1; - status.Bits.RA_DIRECTION = 0; - ls_active = true; - } - - /* encoder status */ - status.Bits.EA_SLIP = 0; - status.Bits.EA_POSITION = 0; - status.Bits.EA_SLIP_STALL = 0; - status.Bits.EA_HOME = 0; - - /* Request the position of this motor */ - sprintf(command, "#%02dP", signal); - send_mess(card, command, 0); - recv_mess(card, response, WAIT); - /* The response string is of the form "#01P=+1000" */ - motorData = atoi(&response[5]); - - if (motorData == motor_info->position) - { - if (nodeptr != 0) /* Increment counter only if motor is moving. */ - motor_info->no_motion_count++; - } - else - { - status.Bits.RA_DIRECTION = (motorData >= motor_info->position) ? 1 : 0; - motor_info->position = motorData; - motor_info->encoder_position = motorData; - motor_info->no_motion_count = 0; - } - - /* Parse motor velocity? */ - /* NEEDS WORK */ - - motor_info->velocity = 0; - - if (!status.Bits.RA_DIRECTION) - motor_info->velocity *= -1; - - rtn_state = (!motor_info->no_motion_count || ls_active == true || - status.Bits.RA_DONE | status.Bits.RA_PROBLEM) ? 1 : 0; - - /* Test for post-move string. */ - if ((status.Bits.RA_DONE || ls_active == true) && nodeptr != 0 && nodeptr->postmsgptr != 0) - { - send_mess(card, nodeptr->postmsgptr, (char*) NULL); - /* The MCB4B always sends back a response, read it and discard */ - recv_mess(card, buff, WAIT); - nodeptr->postmsgptr = NULL; - } - - motor_info->status.All = status.All; - return (rtn_state); -} - - -/*****************************************************/ -/* send a message to the MCB4B board */ -/* send_mess() */ -/*****************************************************/ -STATIC RTN_STATUS send_mess(int card, const char *com, char *name) -{ - struct MCB4Bcontroller *cntrl; - size_t nwrite; - - /* Check that card exists */ - if (!motor_state[card]) - { - errlogPrintf("send_mess - invalid card #%d\n", card); - return (ERROR); - } - - /* If the string is NULL just return */ - if (strlen(com) == 0) return(OK); - cntrl = (struct MCB4Bcontroller *) motor_state[card]->DevicePrivate; - - Debug(2, "send_mess: sending message to card %d, message=%s\n",\ - card, com); - - pasynOctetSyncIO->write(cntrl->pasynUser, com, strlen(com), TIMEOUT, &nwrite); - - return (OK); -} - - -/*****************************************************/ -/* Read a response string from the MCB4B board */ -/* recv_mess() */ -/*****************************************************/ -STATIC int recv_mess(int card, char *com, int flag) -{ - double timeout; - size_t nread=0; - asynStatus status; - struct MCB4Bcontroller *cntrl; - int flush; - int eomReason; - - /* Check that card exists */ - if (!motor_state[card]) - { - errlogPrintf("recv_mess - invalid card #%d\n", card); - return (-1); - } - - cntrl = (struct MCB4Bcontroller *) motor_state[card]->DevicePrivate; - - Debug(3, "recv_mess entry: card %d, flag=%d\n",\ - card, flag); - if (flag == FLUSH) { - flush = 1; - timeout = 0.; - } else { - flush = 0; - timeout = TIMEOUT; - } - if (flush) status = pasynOctetSyncIO->flush(cntrl->pasynUser); - status = pasynOctetSyncIO->read(cntrl->pasynUser, com, MAX_MSG_SIZE, - timeout, &nread, &eomReason); - - if (nread < 1) - com[0] = '\0'; - - if (nread > 0) { - Debug(2, "recv_mess: card %d, message = \"%s\"\n",\ - card, com); - } - if (nread == 0) { - if (flag != FLUSH) { - Debug(1, "recv_mess: card %d ERROR: no response\n",\ - card); - } else { - Debug(3, "recv_mess: card %d flush returned no characters\n",\ - card); - } - } - - return (nread); -} - - - -/*****************************************************/ -/* Setup system configuration */ -/* MCB4BSetup() */ -/*****************************************************/ -RTN_STATUS -MCB4BSetup(int num_cards, /* maximum number of controllers in system */ - int scan_rate) /* polling rate - 1/60 sec units */ -{ - int itera; - - if (num_cards < 1 || num_cards > MCB4B_NUM_CARDS) - MCB4B_num_cards = MCB4B_NUM_CARDS; - else - MCB4B_num_cards = num_cards; - - /* Set motor polling task rate */ - if (scan_rate >= 1 && scan_rate <= 60) - targs.motor_scan_rate = scan_rate; - else - targs.motor_scan_rate = SCAN_RATE; - - /* - * Allocate space for motor_state structure pointers. Note this must be done - * before MCB4BConfig is called, so it cannot be done in motor_init() - * This means that we must allocate space for a card without knowing - * if it really exists, which is not a serious problem since this is just - * an array of pointers. - */ - motor_state = (struct controller **) malloc(MCB4B_num_cards * - sizeof(struct controller *)); - - for (itera = 0; itera < MCB4B_num_cards; itera++) - motor_state[itera] = (struct controller *) NULL; - return (OK); -} - - -/*****************************************************/ -/* Configure a controller */ -/* MCB4BConfig() */ -/*****************************************************/ -RTN_STATUS -MCB4BConfig(int card, /* card being configured */ - const char *name) /* port name for asyn */ -{ - struct MCB4Bcontroller *cntrl; - - if (card < 0 || card >= MCB4B_num_cards) - return (ERROR); - - motor_state[card] = (struct controller *) malloc(sizeof(struct controller)); - motor_state[card]->DevicePrivate = malloc(sizeof(struct MCB4Bcontroller)); - cntrl = (struct MCB4Bcontroller *) motor_state[card]->DevicePrivate; - strcpy(cntrl->port, name); - return (OK); -} - - - -/*****************************************************/ -/* initialize all software and hardware */ -/* This is called from the initialization routine in */ -/* device support. */ -/* motor_init() */ -/*****************************************************/ -STATIC int motor_init() -{ - struct controller *brdptr; - struct MCB4Bcontroller *cntrl; - int card_index, motor_index; - char buff[BUFF_SIZE]; - int total_axis = 0; - int status = 0; - int success_rtn; - - initialized = true; /* Indicate that driver is initialized. */ - - /* Check for setup */ - if (MCB4B_num_cards <= 0) - { - Debug(1, "motor_init: *MCB4B driver disabled*\n"); - Debug(1, "MCB4BSetup() is missing from startup script.\n"); - return (ERROR); - } - - for (card_index = 0; card_index < MCB4B_num_cards; card_index++) - { - if (!motor_state[card_index]) - continue; - - brdptr = motor_state[card_index]; - total_cards = card_index + 1; - cntrl = (struct MCB4Bcontroller *) brdptr->DevicePrivate; - - /* Initialize communications channel */ - success_rtn = pasynOctetSyncIO->connect(cntrl->port, 0, &cntrl->pasynUser, NULL); - Debug(1, "motor_init, return from pasynOctetSyncIO->connect for port %s = %d, pasynUser=%p\n",\ - cntrl->port, success_rtn, cntrl->pasynUser); - - if (success_rtn == 0) - { - int retry = 0; - - /* Send a message to the board, see if it exists */ - /* flush any junk at input port - should not be any data available */ - pasynOctetSyncIO->flush(cntrl->pasynUser); - do - { - send_mess(card_index, "#00X", 0); - status = recv_mess(card_index, buff, WAIT); - retry++; - /* Return value is length of response string */ - } while(status == 0 && retry < 3); - } - - - if (success_rtn == 0 && status > 0) - { - brdptr->localaddr = (char *) NULL; - brdptr->motor_in_motion = 0; - brdptr->cmnd_response = true; - - /* Assume that this controller has 4 axes. */ - total_axis = 4; - brdptr->total_axis = total_axis; - start_status(card_index); - for (motor_index = 0; motor_index < total_axis; motor_index++) - { - struct mess_info *motor_info = &brdptr->motor_info[motor_index]; - brdptr->motor_info[motor_index].motor_motion = NULL; - /* Don't turn on motor power, too dangerous */ - sprintf(buff,"#%02dW=1", motor_index); - /* send_mess(card_index, buff, 0); */ - /* Stop motor */ - sprintf(buff,"#%02dQ", motor_index); - send_mess(card_index, buff, 0); - recv_mess(card_index, buff, WAIT); /* Throw away response */ - strcpy(brdptr->ident, "MCB-4B"); - motor_info->status.All = 0; - motor_info->no_motion_count = 0; - motor_info->encoder_position = 0; - motor_info->position = 0; - set_status(card_index, motor_index); /* Read status of each motor */ - } - - } - else - motor_state[card_index] = (struct controller *) NULL; - } - - any_motor_in_motion = 0; - - mess_queue.head = (struct mess_node *) NULL; - mess_queue.tail = (struct mess_node *) NULL; - - free_list.head = (struct mess_node *) NULL; - free_list.tail = (struct mess_node *) NULL; - - Debug(3, "motor_init: spawning motor task\n"); - - epicsThreadCreate((char *) "tMCB4B", epicsThreadPriorityMedium, - epicsThreadGetStackSize(epicsThreadStackMedium), - (EPICSTHREADFUNC) motor_task, (void *) &targs); - - return(OK); -} diff --git a/motorApp/AcsSrc/drvMCB4B.h b/motorApp/AcsSrc/drvMCB4B.h deleted file mode 100644 index 08b35695..00000000 --- a/motorApp/AcsSrc/drvMCB4B.h +++ /dev/null @@ -1,34 +0,0 @@ -/* File: drvMCB4B.h */ - - -/* Device Driver Support definitions for motor */ -/* - * Original Author: Mark Rivers - * Current Author: Mark Rivers - * Date: 2/24/3002 - * - * Modification Log: - * ----------------- - * .01 02/24/2002 mlr initialized from drvPM304.h - */ - -#ifndef INCdrvMCB4Bh -#define INCdrvMCB4Bh 1 - -#include "motordrvCom.h" -#include "asynDriver.h" - -/* MCB4B default profile. */ - -#define MCB4B_NUM_CARDS 4 -#define MCB4B_NUM_CHANNELS 4 - -#define OUTPUT_TERMINATOR "\r" - -struct MCB4Bcontroller -{ - asynUser *pasynUser; /* asynUser structure */ - char port[80]; /* asyn port name */ -}; - -#endif /* INCdrvMCB4Bh */ diff --git a/motorApp/Makefile b/motorApp/Makefile index d1c5802e..627202de 100644 --- a/motorApp/Makefile +++ b/motorApp/Makefile @@ -24,9 +24,6 @@ MotorSimSrc_DEPEND_DIRS = MotorSrc DIRS += ImsSrc ImsSrc_DEPEND_DIRS = MotorSrc -DIRS += AcsSrc -AcsSrc_DEPEND_DIRS = MotorSrc - DIRS += PIGCS2Src PIGCS2Src_DEPEND_DIRS = MotorSrc diff --git a/motorExApp/WithAsyn/Makefile b/motorExApp/WithAsyn/Makefile index 05aa730f..16a40ec6 100644 --- a/motorExApp/WithAsyn/Makefile +++ b/motorExApp/WithAsyn/Makefile @@ -12,7 +12,6 @@ PROD_IOC_vxWorks = WithAsynVx COMMONDBDS = base.dbd COMMONDBDS += motorSupport.dbd -COMMONDBDS += devAcsMotor.dbd COMMONDBDS += devImsMotor.dbd COMMONDBDS += devMicos.dbd ifdef SNCSEQ @@ -64,7 +63,6 @@ WithAsyn_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary COMMONLIBS += Aerotech COMMONLIBS += Micos COMMONLIBS += PI -COMMONLIBS += Acs COMMONLIBS += Ims COMMONLIBS += softMotor COMMONLIBS += motorSimSupport