Substituted string "mcb4b" with "md90".

The following case replacements were applied (in order):
	mcb4b -> md90
	MCB4B -> MD90
	mcb-4b -> md-90
	MCB-4B -> MD-90
	MCB -> MD-90
This commit is contained in:
2024-05-22 11:38:43 -05:00
parent a92fda6560
commit 417802a9b4
14 changed files with 223 additions and 223 deletions

View File

@@ -27,7 +27,7 @@ R1-1 is a release based on the master branch.
* None * None
#### Modifications to existing features #### Modifications to existing features
* Commit [1bd580a](https://github.com/epics-motor/motorDsm/commit/1bd580a87869fb140939978c0b06856917282da9): ``iocsh`` dir moved into ``dsmApp`` dir; ``DSM_MCB4B.iocsh`` is now installed at build time * Commit [1bd580a](https://github.com/epics-motor/motorDsm/commit/1bd580a87869fb140939978c0b06856917282da9): ``iocsh`` dir moved into ``dsmApp`` dir; ``DSM_MD90.iocsh`` is now installed at build time
#### Bug fixes #### Bug fixes
* Commit [5ab502c](https://github.com/epics-motor/motorDsm/commit/5ab502c53ac81885e2a511ade95f22d0a0db4f43): Include ``$(MOTOR)/modules/RELEASE.$(EPICS_HOST_ARCH).local`` instead of ``$(MOTOR)/configure/RELEASE`` * Commit [5ab502c](https://github.com/epics-motor/motorDsm/commit/5ab502c53ac81885e2a511ade95f22d0a0db4f43): Include ``$(MOTOR)/modules/RELEASE.$(EPICS_HOST_ARCH).local`` instead of ``$(MOTOR)/configure/RELEASE``

View File

@@ -1,4 +1,4 @@
# ### DSM_MCB4B.iocsh ### # ### DSM_MD90.iocsh ###
#- ################################################### #- ###################################################
#- PORT - Serial port for communications #- PORT - Serial port for communications
@@ -17,9 +17,9 @@
#- Default: 100 #- Default: 100
#- ################################################### #- ###################################################
# DSM MCB-4B serial connection settings # DSM MD-90 serial connection settings
iocshLoad("$(IP)/iocsh/setSerialParams.iocsh", "PORT=$(PORT), BAUD=19200, BITS=8, STOP=1, PARITY=none") iocshLoad("$(IP)/iocsh/setSerialParams.iocsh", "PORT=$(PORT), BAUD=19200, BITS=8, STOP=1, PARITY=none")
asynOctetSetInputEos( "$(PORT)", -1, "\r") asynOctetSetInputEos( "$(PORT)", -1, "\r")
asynOctetSetOutputEos("$(PORT)", -1, "\r") asynOctetSetOutputEos("$(PORT)", -1, "\r")
MCB4BCreateController("$(INSTANCE)", "$(PORT)", $(NUM_AXES=1), $(MOVING_POLL=$(POLL_RATE=100)), $(IDLE_POLL=$(POLL_RATE=100))) MD90CreateController("$(INSTANCE)", "$(PORT)", $(NUM_AXES=1), $(MOVING_POLL=$(POLL_RATE=100)), $(IDLE_POLL=$(POLL_RATE=100)))

View File

@@ -1,6 +1,6 @@
TOP = ../.. TOP = ../..
include $(TOP)/configure/CONFIG include $(TOP)/configure/CONFIG
IOCSH += DSM_MCB4B.iocsh IOCSH += DSM_MD90.iocsh
include $(TOP)/configure/RULES include $(TOP)/configure/RULES

View File

@@ -1,6 +1,6 @@
/* /*
FILENAME... MCB4BDriver.cpp FILENAME... MD90Driver.cpp
USAGE... Motor driver support for the DSM MCB-4B controller. USAGE... Motor driver support for the DSM MD-90 controller.
Mark Rivers Mark Rivers
March 1, 2012 March 1, 2012
@@ -19,20 +19,20 @@ March 1, 2012
#include <asynOctetSyncIO.h> #include <asynOctetSyncIO.h>
#include <epicsExport.h> #include <epicsExport.h>
#include "MCB4BDriver.h" #include "MD90Driver.h"
#define NINT(f) (int)((f)>0 ? (f)+0.5 : (f)-0.5) #define NINT(f) (int)((f)>0 ? (f)+0.5 : (f)-0.5)
/** Creates a new MCB4BController object. /** Creates a new MD90Controller object.
* \param[in] portName The name of the asyn port that will be created for this driver * \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] MD90PortName The name of the drvAsynSerialPort that was created previously to connect to the MD90 controller
* \param[in] numAxes The number of axes that this controller supports * \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] movingPollPeriod The time between polls when any axis is moving
* \param[in] idlePollPeriod The time between polls when no 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, MD90Controller::MD90Controller(const char *portName, const char *MD90PortName, int numAxes,
double movingPollPeriod, double idlePollPeriod) double movingPollPeriod, double idlePollPeriod)
: asynMotorController(portName, numAxes, NUM_MCB4B_PARAMS, : asynMotorController(portName, numAxes, NUM_MD90_PARAMS,
0, // No additional interfaces beyond those in base class 0, // No additional interfaces beyond those in base class
0, // No additional callback interfaces beyond those in base class 0, // No additional callback interfaces beyond those in base class
ASYN_CANBLOCK | ASYN_MULTIDEVICE, ASYN_CANBLOCK | ASYN_MULTIDEVICE,
@@ -41,38 +41,38 @@ MCB4BController::MCB4BController(const char *portName, const char *MCB4BPortName
{ {
int axis; int axis;
asynStatus status; asynStatus status;
MCB4BAxis *pAxis; MD90Axis *pAxis;
static const char *functionName = "MCB4BController::MCB4BController"; static const char *functionName = "MD90Controller::MD90Controller";
/* Connect to MCB4B controller */ /* Connect to MD90 controller */
status = pasynOctetSyncIO->connect(MCB4BPortName, 0, &pasynUserController_, NULL); status = pasynOctetSyncIO->connect(MD90PortName, 0, &pasynUserController_, NULL);
if (status) { if (status) {
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
"%s: cannot connect to MCB-4B controller\n", "%s: cannot connect to MD-90 controller\n",
functionName); functionName);
} }
for (axis=0; axis<numAxes; axis++) { for (axis=0; axis<numAxes; axis++) {
pAxis = new MCB4BAxis(this, axis); pAxis = new MD90Axis(this, axis);
} }
startPoller(movingPollPeriod, idlePollPeriod, 2); startPoller(movingPollPeriod, idlePollPeriod, 2);
} }
/** Creates a new MCB4BController object. /** Creates a new MD90Controller object.
* Configuration command, called directly or from iocsh * Configuration command, called directly or from iocsh
* \param[in] portName The name of the asyn port that will be created for this driver * \param[in] portName The name of the asyn port that will be created for this driver
* \param[in] MCB4BPortName The name of the drvAsynIPPPort that was created previously to connect to the MCB4B controller * \param[in] MD90PortName The name of the drvAsynIPPPort that was created previously to connect to the MD90 controller
* \param[in] numAxes The number of axes that this controller supports * \param[in] numAxes The number of axes that this controller supports
* \param[in] movingPollPeriod The time in ms between polls when any axis is moving * \param[in] movingPollPeriod The time in ms between polls when any axis is moving
* \param[in] idlePollPeriod The time in ms between polls when no axis is moving * \param[in] idlePollPeriod The time in ms between polls when no axis is moving
*/ */
extern "C" int MCB4BCreateController(const char *portName, const char *MCB4BPortName, int numAxes, extern "C" int MD90CreateController(const char *portName, const char *MD90PortName, int numAxes,
int movingPollPeriod, int idlePollPeriod) int movingPollPeriod, int idlePollPeriod)
{ {
MCB4BController *pMCB4BController MD90Controller *pMD90Controller
= new MCB4BController(portName, MCB4BPortName, numAxes, movingPollPeriod/1000., idlePollPeriod/1000.); = new MD90Controller(portName, MD90PortName, numAxes, movingPollPeriod/1000., idlePollPeriod/1000.);
pMCB4BController = NULL; pMD90Controller = NULL;
return(asynSuccess); return(asynSuccess);
} }
@@ -83,41 +83,41 @@ extern "C" int MCB4BCreateController(const char *portName, const char *MCB4BPort
* If details > 0 then information is printed about each axis. * If details > 0 then information is printed about each axis.
* After printing controller-specific information it calls asynMotorController::report() * After printing controller-specific information it calls asynMotorController::report()
*/ */
void MCB4BController::report(FILE *fp, int level) void MD90Controller::report(FILE *fp, int level)
{ {
fprintf(fp, "MCB-4B motor driver %s, numAxes=%d, moving poll period=%f, idle poll period=%f\n", fprintf(fp, "MD-90 motor driver %s, numAxes=%d, moving poll period=%f, idle poll period=%f\n",
this->portName, numAxes_, movingPollPeriod_, idlePollPeriod_); this->portName, numAxes_, movingPollPeriod_, idlePollPeriod_);
// Call the base class method // Call the base class method
asynMotorController::report(fp, level); asynMotorController::report(fp, level);
} }
/** Returns a pointer to an MCB4BAxis object. /** Returns a pointer to an MD90Axis object.
* Returns NULL if the axis number encoded in pasynUser is invalid. * Returns NULL if the axis number encoded in pasynUser is invalid.
* \param[in] pasynUser asynUser structure that encodes the axis index number. */ * \param[in] pasynUser asynUser structure that encodes the axis index number. */
MCB4BAxis* MCB4BController::getAxis(asynUser *pasynUser) MD90Axis* MD90Controller::getAxis(asynUser *pasynUser)
{ {
return static_cast<MCB4BAxis*>(asynMotorController::getAxis(pasynUser)); return static_cast<MD90Axis*>(asynMotorController::getAxis(pasynUser));
} }
/** Returns a pointer to an MCB4BAxis object. /** Returns a pointer to an MD90Axis object.
* Returns NULL if the axis number encoded in pasynUser is invalid. * Returns NULL if the axis number encoded in pasynUser is invalid.
* \param[in] axisNo Axis index number. */ * \param[in] axisNo Axis index number. */
MCB4BAxis* MCB4BController::getAxis(int axisNo) MD90Axis* MD90Controller::getAxis(int axisNo)
{ {
return static_cast<MCB4BAxis*>(asynMotorController::getAxis(axisNo)); return static_cast<MD90Axis*>(asynMotorController::getAxis(axisNo));
} }
// These are the MCB4BAxis methods // These are the MD90Axis methods
/** Creates a new MCB4BAxis object. /** Creates a new MD90Axis object.
* \param[in] pC Pointer to the MCB4BController to which this axis belongs. * \param[in] pC Pointer to the MD90Controller to which this axis belongs.
* \param[in] axisNo Index number of this axis, range 0 to pC->numAxes_-1. * \param[in] axisNo Index number of this axis, range 0 to pC->numAxes_-1.
* *
* Initializes register numbers, etc. * Initializes register numbers, etc.
*/ */
MCB4BAxis::MCB4BAxis(MCB4BController *pC, int axisNo) MD90Axis::MD90Axis(MD90Controller *pC, int axisNo)
: asynMotorAxis(pC, axisNo), : asynMotorAxis(pC, axisNo),
pC_(pC) pC_(pC)
{ {
@@ -129,7 +129,7 @@ MCB4BAxis::MCB4BAxis(MCB4BController *pC, int axisNo)
* *
* After printing device-specific information calls asynMotorAxis::report() * After printing device-specific information calls asynMotorAxis::report()
*/ */
void MCB4BAxis::report(FILE *fp, int level) void MD90Axis::report(FILE *fp, int level)
{ {
if (level > 0) { if (level > 0) {
fprintf(fp, " axis %d\n", fprintf(fp, " axis %d\n",
@@ -140,11 +140,11 @@ void MCB4BAxis::report(FILE *fp, int level)
asynMotorAxis::report(fp, level); asynMotorAxis::report(fp, level);
} }
asynStatus MCB4BAxis::sendAccelAndVelocity(double acceleration, double velocity) asynStatus MD90Axis::sendAccelAndVelocity(double acceleration, double velocity)
{ {
asynStatus status; asynStatus status;
int ival; int ival;
// static const char *functionName = "MCB4B::sendAccelAndVelocity"; // static const char *functionName = "MD90::sendAccelAndVelocity";
// Send the velocity // Send the velocity
ival = NINT(fabs(115200./velocity)); ival = NINT(fabs(115200./velocity));
@@ -155,7 +155,7 @@ asynStatus MCB4BAxis::sendAccelAndVelocity(double acceleration, double velocity)
// Send the acceleration // Send the acceleration
// acceleration is in steps/sec/sec // acceleration is in steps/sec/sec
// MCB is programmed with Ramp Index (R) where: // MD-90 is programmed with Ramp Index (R) where:
// dval (steps/sec/sec) = 720,000/(256-R) */ // dval (steps/sec/sec) = 720,000/(256-R) */
// or R=256-(720,000/dval) */ // or R=256-(720,000/dval) */
ival = NINT(256-(720000./acceleration)); ival = NINT(256-(720000./acceleration));
@@ -167,10 +167,10 @@ asynStatus MCB4BAxis::sendAccelAndVelocity(double acceleration, double velocity)
} }
asynStatus MCB4BAxis::move(double position, int relative, double minVelocity, double maxVelocity, double acceleration) asynStatus MD90Axis::move(double position, int relative, double minVelocity, double maxVelocity, double acceleration)
{ {
asynStatus status; asynStatus status;
// static const char *functionName = "MCB4BAxis::move"; // static const char *functionName = "MD90Axis::move";
status = sendAccelAndVelocity(acceleration, maxVelocity); status = sendAccelAndVelocity(acceleration, maxVelocity);
@@ -183,10 +183,10 @@ asynStatus MCB4BAxis::move(double position, int relative, double minVelocity, do
return status; return status;
} }
asynStatus MCB4BAxis::home(double minVelocity, double maxVelocity, double acceleration, int forwards) asynStatus MD90Axis::home(double minVelocity, double maxVelocity, double acceleration, int forwards)
{ {
asynStatus status; asynStatus status;
// static const char *functionName = "MCB4BAxis::home"; // static const char *functionName = "MD90Axis::home";
status = sendAccelAndVelocity(acceleration, maxVelocity); status = sendAccelAndVelocity(acceleration, maxVelocity);
@@ -199,10 +199,10 @@ asynStatus MCB4BAxis::home(double minVelocity, double maxVelocity, double accele
return status; return status;
} }
asynStatus MCB4BAxis::moveVelocity(double minVelocity, double maxVelocity, double acceleration) asynStatus MD90Axis::moveVelocity(double minVelocity, double maxVelocity, double acceleration)
{ {
asynStatus status; asynStatus status;
static const char *functionName = "MCB4BAxis::moveVelocity"; static const char *functionName = "MD90Axis::moveVelocity";
asynPrint(pasynUser_, ASYN_TRACE_FLOW, asynPrint(pasynUser_, ASYN_TRACE_FLOW,
"%s: minVelocity=%f, maxVelocity=%f, acceleration=%f\n", "%s: minVelocity=%f, maxVelocity=%f, acceleration=%f\n",
@@ -210,42 +210,42 @@ asynStatus MCB4BAxis::moveVelocity(double minVelocity, double maxVelocity, doubl
status = sendAccelAndVelocity(acceleration, maxVelocity); status = sendAccelAndVelocity(acceleration, maxVelocity);
/* MCB-4B does not have jog command. Move 1 million steps */ /* MD-90 does not have jog command. Move 1 million steps */
if (maxVelocity > 0.) { if (maxVelocity > 0.) {
/* This is a positive move in MCB4B coordinates */ /* This is a positive move in MD90 coordinates */
sprintf(pC_->outString_, "#%02dI+1000000", axisNo_); sprintf(pC_->outString_, "#%02dI+1000000", axisNo_);
} else { } else {
/* This is a negative move in MCB4B coordinates */ /* This is a negative move in MD90 coordinates */
sprintf(pC_->outString_, "#%02dI-1000000", axisNo_); sprintf(pC_->outString_, "#%02dI-1000000", axisNo_);
} }
status = pC_->writeReadController(); status = pC_->writeReadController();
return status; return status;
} }
asynStatus MCB4BAxis::stop(double acceleration ) asynStatus MD90Axis::stop(double acceleration )
{ {
asynStatus status; asynStatus status;
//static const char *functionName = "MCB4BAxis::stop"; //static const char *functionName = "MD90Axis::stop";
sprintf(pC_->outString_, "#%02dQ", axisNo_); sprintf(pC_->outString_, "#%02dQ", axisNo_);
status = pC_->writeReadController(); status = pC_->writeReadController();
return status; return status;
} }
asynStatus MCB4BAxis::setPosition(double position) asynStatus MD90Axis::setPosition(double position)
{ {
asynStatus status; asynStatus status;
//static const char *functionName = "MCB4BAxis::setPosition"; //static const char *functionName = "MD90Axis::setPosition";
sprintf(pC_->outString_, "#%02dP=%+d", axisNo_, NINT(position)); sprintf(pC_->outString_, "#%02dP=%+d", axisNo_, NINT(position));
status = pC_->writeReadController(); status = pC_->writeReadController();
return status; return status;
} }
asynStatus MCB4BAxis::setClosedLoop(bool closedLoop) asynStatus MD90Axis::setClosedLoop(bool closedLoop)
{ {
asynStatus status; asynStatus status;
//static const char *functionName = "MCB4BAxis::setClosedLoop"; //static const char *functionName = "MD90Axis::setClosedLoop";
sprintf(pC_->outString_, "#%02dW=%d", axisNo_, closedLoop ? 1:0); sprintf(pC_->outString_, "#%02dW=%d", axisNo_, closedLoop ? 1:0);
status = pC_->writeReadController(); status = pC_->writeReadController();
@@ -258,7 +258,7 @@ asynStatus MCB4BAxis::setClosedLoop(bool closedLoop)
* It calls setIntegerParam() and setDoubleParam() for each item that it polls, * It calls setIntegerParam() and setDoubleParam() for each item that it polls,
* and then calls callParamCallbacks() at the end. * 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). */ * \param[out] moving A flag that is set indicating that the axis is moving (true) or done (false). */
asynStatus MCB4BAxis::poll(bool *moving) asynStatus MD90Axis::poll(bool *moving)
{ {
int done; int done;
int driveOn; int driveOn;
@@ -310,27 +310,27 @@ asynStatus MCB4BAxis::poll(bool *moving)
} }
/** Code for iocsh registration */ /** Code for iocsh registration */
static const iocshArg MCB4BCreateControllerArg0 = {"Port name", iocshArgString}; static const iocshArg MD90CreateControllerArg0 = {"Port name", iocshArgString};
static const iocshArg MCB4BCreateControllerArg1 = {"MCB-4B port name", iocshArgString}; static const iocshArg MD90CreateControllerArg1 = {"MD-90 port name", iocshArgString};
static const iocshArg MCB4BCreateControllerArg2 = {"Number of axes", iocshArgInt}; static const iocshArg MD90CreateControllerArg2 = {"Number of axes", iocshArgInt};
static const iocshArg MCB4BCreateControllerArg3 = {"Moving poll period (ms)", iocshArgInt}; static const iocshArg MD90CreateControllerArg3 = {"Moving poll period (ms)", iocshArgInt};
static const iocshArg MCB4BCreateControllerArg4 = {"Idle poll period (ms)", iocshArgInt}; static const iocshArg MD90CreateControllerArg4 = {"Idle poll period (ms)", iocshArgInt};
static const iocshArg * const MCB4BCreateControllerArgs[] = {&MCB4BCreateControllerArg0, static const iocshArg * const MD90CreateControllerArgs[] = {&MD90CreateControllerArg0,
&MCB4BCreateControllerArg1, &MD90CreateControllerArg1,
&MCB4BCreateControllerArg2, &MD90CreateControllerArg2,
&MCB4BCreateControllerArg3, &MD90CreateControllerArg3,
&MCB4BCreateControllerArg4}; &MD90CreateControllerArg4};
static const iocshFuncDef MCB4BCreateControllerDef = {"MCB4BCreateController", 5, MCB4BCreateControllerArgs}; static const iocshFuncDef MD90CreateControllerDef = {"MD90CreateController", 5, MD90CreateControllerArgs};
static void MCB4BCreateContollerCallFunc(const iocshArgBuf *args) static void MD90CreateContollerCallFunc(const iocshArgBuf *args)
{ {
MCB4BCreateController(args[0].sval, args[1].sval, args[2].ival, args[3].ival, args[4].ival); MD90CreateController(args[0].sval, args[1].sval, args[2].ival, args[3].ival, args[4].ival);
} }
static void MCB4BRegister(void) static void MD90Register(void)
{ {
iocshRegister(&MCB4BCreateControllerDef, MCB4BCreateContollerCallFunc); iocshRegister(&MD90CreateControllerDef, MD90CreateContollerCallFunc);
} }
extern "C" { extern "C" {
epicsExportRegistrar(MCB4BRegister); epicsExportRegistrar(MD90Register);
} }

View File

@@ -1,6 +1,6 @@
/* /*
FILENAME... MCB4BDriver.h FILENAME... MD90Driver.h
USAGE... Motor driver support for the DSM MCB-4B controller. USAGE... Motor driver support for the DSM MD-90 controller.
Mark Rivers Mark Rivers
March 1, 2012 March 1, 2012
@@ -10,16 +10,16 @@ March 1, 2012
#include "asynMotorController.h" #include "asynMotorController.h"
#include "asynMotorAxis.h" #include "asynMotorAxis.h"
#define MAX_MCB4B_AXES 4 #define MAX_MD90_AXES 4
// No controller-specific parameters yet // No controller-specific parameters yet
#define NUM_MCB4B_PARAMS 0 #define NUM_MD90_PARAMS 0
class epicsShareClass MCB4BAxis : public asynMotorAxis class epicsShareClass MD90Axis : public asynMotorAxis
{ {
public: public:
/* These are the methods we override from the base class */ /* These are the methods we override from the base class */
MCB4BAxis(class MCB4BController *pC, int axis); MD90Axis(class MD90Controller *pC, int axis);
void report(FILE *fp, int level); void report(FILE *fp, int level);
asynStatus move(double position, int relative, double min_velocity, double max_velocity, double acceleration); 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 moveVelocity(double min_velocity, double max_velocity, double acceleration);
@@ -30,20 +30,20 @@ public:
asynStatus setClosedLoop(bool closedLoop); asynStatus setClosedLoop(bool closedLoop);
private: private:
MCB4BController *pC_; /**< Pointer to the asynMotorController to which this axis belongs. MD90Controller *pC_; /**< Pointer to the asynMotorController to which this axis belongs.
* Abbreviated because it is used very frequently */ * Abbreviated because it is used very frequently */
asynStatus sendAccelAndVelocity(double accel, double velocity); asynStatus sendAccelAndVelocity(double accel, double velocity);
friend class MCB4BController; friend class MD90Controller;
}; };
class epicsShareClass MCB4BController : public asynMotorController { class epicsShareClass MD90Controller : public asynMotorController {
public: public:
MCB4BController(const char *portName, const char *MCB4BPortName, int numAxes, double movingPollPeriod, double idlePollPeriod); MD90Controller(const char *portName, const char *MD90PortName, int numAxes, double movingPollPeriod, double idlePollPeriod);
void report(FILE *fp, int level); void report(FILE *fp, int level);
MCB4BAxis* getAxis(asynUser *pasynUser); MD90Axis* getAxis(asynUser *pasynUser);
MCB4BAxis* getAxis(int axisNo); MD90Axis* getAxis(int axisNo);
friend class MCB4BAxis; friend class MD90Axis;
}; };

View File

@@ -12,8 +12,8 @@ LIBRARY_IOC = dsm
SRCS += dsmRegister.cc SRCS += dsmRegister.cc
# Advanced Control Systems driver support. # Advanced Control Systems driver support.
SRCS += devMCB4B.c drvMCB4B.c SRCS += devMD90.c drvMD90.c
SRCS += MCB4BDriver.cpp SRCS += MD90Driver.cpp
dsm_LIBS += motor asyn dsm_LIBS += motor asyn
dsm_LIBS += $(EPICS_BASE_IOC_LIBS) dsm_LIBS += $(EPICS_BASE_IOC_LIBS)

View File

@@ -1,11 +1,11 @@
# Advanced Control Systems driver support. # Advanced Control Systems driver support.
# Model 1 (non-asyn) driver # Model 1 (non-asyn) driver
device(motor,VME_IO,devMCB4B,"DSM MCB-4B") device(motor,VME_IO,devMD90,"DSM MD-90")
driver(drvMCB4B) driver(drvMD90)
registrar(dsmRegister) registrar(dsmRegister)
# Model 3 driver # Model 3 driver
registrar(MCB4BRegister) registrar(MD90Register)

View File

@@ -1,4 +1,4 @@
/* File: devMCB4B.cc */ /* File: devMD90.cc */
/* Device Support Routines for motor */ /* Device Support Routines for motor */
/* /*
@@ -20,21 +20,21 @@
#include "motorRecord.h" #include "motorRecord.h"
#include "motor.h" #include "motor.h"
#include "motordevCom.h" #include "motordevCom.h"
#include "drvMCB4B.h" #include "drvMD90.h"
#include "epicsExport.h" #include "epicsExport.h"
#define STATIC static #define STATIC static
extern struct driver_table MCB4B_access; extern struct driver_table MD90_access;
#define NINT(f) (long)((f)>0 ? (f)+0.5 : (f)-0.5) #define NINT(f) (long)((f)>0 ? (f)+0.5 : (f)-0.5)
volatile int devMCB4BDebug = 0; volatile int devMD90Debug = 0;
extern "C" {epicsExportAddress(int, devMCB4BDebug);} extern "C" {epicsExportAddress(int, devMD90Debug);}
static inline void Debug(int level, const char *format, ...) { static inline void Debug(int level, const char *format, ...) {
#ifdef DEBUG #ifdef DEBUG
if (level < devMCB4BDebug) if (level < devMD90Debug)
{ {
va_list pVar; va_list pVar;
va_start(pVar, format); va_start(pVar, format);
@@ -45,35 +45,35 @@ static inline void Debug(int level, const char *format, ...) {
} }
/* Debugging levels: /* Debugging levels:
* devMCB4BDebug >= 3 Print new part of command and command string so far * devMD90Debug >= 3 Print new part of command and command string so far
* at the end of MCB4B_build_trans * at the end of MD90_build_trans
*/ */
/* ----------------Create the dsets for devMCB4B----------------- */ /* ----------------Create the dsets for devMD90----------------- */
STATIC struct driver_table *drvtabptr; STATIC struct driver_table *drvtabptr;
STATIC long MCB4B_init(int); STATIC long MD90_init(int);
STATIC long MCB4B_init_record(void *); STATIC long MD90_init_record(void *);
STATIC long MCB4B_start_trans(struct motorRecord *); STATIC long MD90_start_trans(struct motorRecord *);
STATIC RTN_STATUS MCB4B_build_trans(motor_cmnd, double *, struct motorRecord *); STATIC RTN_STATUS MD90_build_trans(motor_cmnd, double *, struct motorRecord *);
STATIC RTN_STATUS MCB4B_end_trans(struct motorRecord *); STATIC RTN_STATUS MD90_end_trans(struct motorRecord *);
struct motor_dset devMCB4B = struct motor_dset devMD90 =
{ {
{8, NULL, (DEVSUPFUN) MCB4B_init, (DEVSUPFUN) MCB4B_init_record, NULL}, {8, NULL, (DEVSUPFUN) MD90_init, (DEVSUPFUN) MD90_init_record, NULL},
motor_update_values, motor_update_values,
MCB4B_start_trans, MD90_start_trans,
MCB4B_build_trans, MD90_build_trans,
MCB4B_end_trans MD90_end_trans
}; };
extern "C" {epicsExportAddress(dset,devMCB4B);} extern "C" {epicsExportAddress(dset,devMD90);}
/* --------------------------- program data --------------------- */ /* --------------------------- program data --------------------- */
/* This table is used to define the command types */ /* This table is used to define the command types */
static msg_types MCB4B_table[] = { static msg_types MD90_table[] = {
MOTION, /* MOVE_ABS */ MOTION, /* MOVE_ABS */
MOTION, /* MOVE_REL */ MOTION, /* MOVE_REL */
MOTION, /* HOME_FOR */ MOTION, /* HOME_FOR */
@@ -99,63 +99,63 @@ static msg_types MCB4B_table[] = {
}; };
static struct board_stat **MCB4B_cards; static struct board_stat **MD90_cards;
/* --------------------------- program data --------------------- */ /* --------------------------- program data --------------------- */
/* initialize device support for MCB4B stepper motor */ /* initialize device support for MD90 stepper motor */
STATIC long MCB4B_init(int after) STATIC long MD90_init(int after)
{ {
long rtnval; long rtnval;
Debug(5, "MCB4B_init: entry\n"); Debug(5, "MD90_init: entry\n");
if (!after) if (!after)
{ {
drvtabptr = &MCB4B_access; drvtabptr = &MD90_access;
(drvtabptr->init)(); (drvtabptr->init)();
} }
rtnval = motor_init_com(after, *drvtabptr->cardcnt_ptr, drvtabptr, &MCB4B_cards); rtnval = motor_init_com(after, *drvtabptr->cardcnt_ptr, drvtabptr, &MD90_cards);
Debug(5, "MCB4B_init: exit\n"); Debug(5, "MD90_init: exit\n");
return(rtnval); return(rtnval);
} }
/* initialize a record instance */ /* initialize a record instance */
STATIC long MCB4B_init_record(void *arg) STATIC long MD90_init_record(void *arg)
{ {
struct motorRecord *mr = (struct motorRecord *) arg; struct motorRecord *mr = (struct motorRecord *) arg;
long rtnval; long rtnval;
Debug(5, "MCB4B_init_record: entry\n"); Debug(5, "MD90_init_record: entry\n");
rtnval = motor_init_record_com(mr, *drvtabptr->cardcnt_ptr, rtnval = motor_init_record_com(mr, *drvtabptr->cardcnt_ptr,
drvtabptr, MCB4B_cards); drvtabptr, MD90_cards);
return(rtnval); return(rtnval);
Debug(5, "MCB4B_init_record: exit\n"); Debug(5, "MD90_init_record: exit\n");
} }
/* start building a transaction */ /* start building a transaction */
STATIC long MCB4B_start_trans(struct motorRecord *mr) STATIC long MD90_start_trans(struct motorRecord *mr)
{ {
return(OK); return(OK);
} }
/* end building a transaction */ /* end building a transaction */
STATIC RTN_STATUS MCB4B_end_trans(struct motorRecord *mr) STATIC RTN_STATUS MD90_end_trans(struct motorRecord *mr)
{ {
return(OK); return(OK);
} }
/* add a part to the transaction */ /* add a part to the transaction */
STATIC RTN_STATUS MCB4B_build_trans(motor_cmnd command, double *parms, struct motorRecord *mr) STATIC RTN_STATUS MD90_build_trans(motor_cmnd command, double *parms, struct motorRecord *mr)
{ {
struct motor_trans *trans = (struct motor_trans *) mr->dpvt; struct motor_trans *trans = (struct motor_trans *) mr->dpvt;
struct mess_node *motor_call; struct mess_node *motor_call;
struct controller *brdptr; struct controller *brdptr;
struct MCB4Bcontroller *cntrl; struct MD90controller *cntrl;
char buff[30]; char buff[30];
int axis, card; int axis, card;
RTN_STATUS rtnval; RTN_STATUS rtnval;
@@ -170,19 +170,19 @@ STATIC RTN_STATUS MCB4B_build_trans(motor_cmnd command, double *parms, struct mo
dval = (parms == NULL) ? 0.0 : *parms; dval = (parms == NULL) ? 0.0 : *parms;
ival = NINT(dval); ival = NINT(dval);
rtnval = (RTN_STATUS) motor_start_trans_com(mr, MCB4B_cards); rtnval = (RTN_STATUS) motor_start_trans_com(mr, MD90_cards);
Debug(5, "MCB4B_build_trans: entry, motor_start_trans_com=%d\n", rtnval); Debug(5, "MD90_build_trans: entry, motor_start_trans_com=%d\n", rtnval);
motor_call = &(trans->motor_call); motor_call = &(trans->motor_call);
motor_call->type = MCB4B_table[command]; motor_call->type = MD90_table[command];
card = motor_call->card; card = motor_call->card;
axis = motor_call->signal; axis = motor_call->signal;
brdptr = (*trans->tabptr->card_array)[card]; brdptr = (*trans->tabptr->card_array)[card];
Debug(5, "MCB4B_build_trans: axis=%d, command=%d\n", axis, command); Debug(5, "MD90_build_trans: axis=%d, command=%d\n", axis, command);
if (brdptr == NULL) if (brdptr == NULL)
return(rtnval = ERROR); return(rtnval = ERROR);
cntrl = (struct MCB4Bcontroller *) brdptr->DevicePrivate; cntrl = (struct MD90controller *) brdptr->DevicePrivate;
if (trans->state != BUILD_STATE) if (trans->state != BUILD_STATE)
@@ -192,8 +192,8 @@ STATIC RTN_STATUS MCB4B_build_trans(motor_cmnd command, double *parms, struct mo
{ {
strcpy(motor_call->message, mr->init); strcpy(motor_call->message, mr->init);
rtnval = motor_end_trans_com(mr, drvtabptr); rtnval = motor_end_trans_com(mr, drvtabptr);
rtnval = (RTN_STATUS) motor_start_trans_com(mr, MCB4B_cards); rtnval = (RTN_STATUS) motor_start_trans_com(mr, MD90_cards);
motor_call->type = MCB4B_table[command]; motor_call->type = MD90_table[command];
} }
switch (command) switch (command)
@@ -207,8 +207,8 @@ STATIC RTN_STATUS MCB4B_build_trans(motor_cmnd command, double *parms, struct mo
{ {
strcpy(motor_call->message, mr->prem); strcpy(motor_call->message, mr->prem);
rtnval = motor_end_trans_com(mr, drvtabptr); rtnval = motor_end_trans_com(mr, drvtabptr);
rtnval = (RTN_STATUS) motor_start_trans_com(mr, MCB4B_cards); rtnval = (RTN_STATUS) motor_start_trans_com(mr, MD90_cards);
motor_call->type = MCB4B_table[command]; motor_call->type = MD90_table[command];
} }
if (strlen(mr->post) != 0) if (strlen(mr->post) != 0)
motor_call->postmsgptr = (char *) &mr->post; motor_call->postmsgptr = (char *) &mr->post;
@@ -238,7 +238,7 @@ STATIC RTN_STATUS MCB4B_build_trans(motor_cmnd command, double *parms, struct mo
case SET_VEL_BASE: case SET_VEL_BASE:
send=false; send=false;
trans->state = IDLE_STATE; trans->state = IDLE_STATE;
break; /* MCB4B does not use base velocity */ break; /* MD90 does not use base velocity */
case SET_VELOCITY: case SET_VELOCITY:
ival = (int) (fabs(115200./dval) + 0.5); ival = (int) (fabs(115200./dval) + 0.5);
if (ival < 2) ival=2; if (ival < 2) ival=2;
@@ -247,7 +247,7 @@ STATIC RTN_STATUS MCB4B_build_trans(motor_cmnd command, double *parms, struct mo
break; break;
case SET_ACCEL: case SET_ACCEL:
/* dval is acceleration in steps/sec/sec */ /* dval is acceleration in steps/sec/sec */
/* MCB is programmed with Ramp Index (R) where: */ /* MD-90 is programmed with Ramp Index (R) where: */
/* dval (steps/sec/sec) = 720,000/(256-R) */ /* dval (steps/sec/sec) = 720,000/(256-R) */
/* or R=256-(720,000/dval) */ /* or R=256-(720,000/dval) */
ival = (int) (256-(720000./dval)+0.5); ival = (int) (256-(720000./dval)+0.5);
@@ -257,7 +257,7 @@ STATIC RTN_STATUS MCB4B_build_trans(motor_cmnd command, double *parms, struct mo
break; break;
case GO: case GO:
/* /*
* The MCB4B starts moving immediately on move commands, GO command * The MD90 starts moving immediately on move commands, GO command
* does nothing * does nothing
*/ */
send=false; send=false;
@@ -265,7 +265,7 @@ STATIC RTN_STATUS MCB4B_build_trans(motor_cmnd command, double *parms, struct mo
break; break;
case SET_ENC_RATIO: case SET_ENC_RATIO:
/* /*
* The MCB4B does not have the concept of encoder ratio, ignore this * The MD90 does not have the concept of encoder ratio, ignore this
* command * command
*/ */
send=false; send=false;
@@ -280,19 +280,19 @@ STATIC RTN_STATUS MCB4B_build_trans(motor_cmnd command, double *parms, struct mo
sprintf(motor_call->message, "#%02dQ", axis); sprintf(motor_call->message, "#%02dQ", axis);
break; break;
case JOG: case JOG:
/* MCB-4B does not have jog command. Move 1 million steps */ /* MD-90 does not have jog command. Move 1 million steps */
ival = (int) (fabs(115200./dval) + 0.5); ival = (int) (fabs(115200./dval) + 0.5);
if (ival < 2) ival=2; if (ival < 2) ival=2;
if (ival > 65535) ival = 65535; if (ival > 65535) ival = 65535;
sprintf(motor_call->message, "#%02dC=%ld", axis, ival); sprintf(motor_call->message, "#%02dC=%ld", axis, ival);
rtnval = motor_end_trans_com(mr, drvtabptr); rtnval = motor_end_trans_com(mr, drvtabptr);
rtnval = (RTN_STATUS) motor_start_trans_com(mr, MCB4B_cards); rtnval = (RTN_STATUS) motor_start_trans_com(mr, MD90_cards);
motor_call->type = MCB4B_table[command]; motor_call->type = MD90_table[command];
if (dval > 0.) { if (dval > 0.) {
/* This is a positive move in MCB4B coordinates */ /* This is a positive move in MD90 coordinates */
sprintf(motor_call->message, "#%02dM+1000000", axis); sprintf(motor_call->message, "#%02dM+1000000", axis);
} else { } else {
/* This is a negative move in MCB4B coordinates */ /* This is a negative move in MD90 coordinates */
sprintf(motor_call->message, "#%02dM-1000000", axis); sprintf(motor_call->message, "#%02dM-1000000", axis);
} }
break; break;
@@ -325,7 +325,7 @@ STATIC RTN_STATUS MCB4B_build_trans(motor_cmnd command, double *parms, struct mo
return(rtnval); return(rtnval);
else { else {
rtnval = motor_end_trans_com(mr, drvtabptr); rtnval = motor_end_trans_com(mr, drvtabptr);
Debug(5, "MCB4B_send_msg: motor_end_trans_com status=%d, exit\n", rtnval); Debug(5, "MD90_send_msg: motor_end_trans_com status=%d, exit\n", rtnval);
return (rtnval); return (rtnval);
} }
} }

View File

@@ -1,4 +1,4 @@
/* File: drvMCB4B.cc */ /* File: drvMD90.cc */
/* Device Driver Support routines for motor */ /* Device Driver Support routines for motor */
/* /*
@@ -25,7 +25,7 @@
#include <errlog.h> #include <errlog.h>
#include "motor.h" #include "motor.h"
#include "dsmRegister.h" #include "dsmRegister.h"
#include "drvMCB4B.h" #include "drvMD90.h"
#include "asynOctetSyncIO.h" #include "asynOctetSyncIO.h"
#include "epicsExport.h" #include "epicsExport.h"
@@ -35,14 +35,14 @@
#define TIMEOUT 2.0 /* Command timeout in sec */ #define TIMEOUT 2.0 /* Command timeout in sec */
#define BUFF_SIZE 100 /* Maximum length of string to/from MCB4B */ #define BUFF_SIZE 100 /* Maximum length of string to/from MD90 */
volatile int drvMCB4BDebug = 0; volatile int drvMD90Debug = 0;
extern "C" {epicsExportAddress(int, drvMCB4BDebug);} extern "C" {epicsExportAddress(int, drvMD90Debug);}
static inline void Debug(int level, const char *format, ...) { static inline void Debug(int level, const char *format, ...) {
#ifdef DEBUG #ifdef DEBUG
if (level < drvMCB4BDebug) if (level < drvMD90Debug)
{ {
va_list pVar; va_list pVar;
va_start(pVar, format); va_start(pVar, format);
@@ -53,14 +53,14 @@ static inline void Debug(int level, const char *format, ...) {
} }
/* Debugging notes: /* Debugging notes:
* drvMCB4BDebug == 0 No debugging information is printed * drvMD90Debug == 0 No debugging information is printed
* drvMCB4BDebug >= 1 Warning information is printed * drvMD90Debug >= 1 Warning information is printed
* drvMCB4BDebug >= 2 Time-stamped messages are printed for each string * drvMD90Debug >= 2 Time-stamped messages are printed for each string
* sent to and received from the controller * sent to and received from the controller
* drvMCB4BDebug >= 3 Additional debugging messages * drvMD90Debug >= 3 Additional debugging messages
*/ */
int MCB4B_num_cards = 0; int MD90_num_cards = 0;
/* Local data required for every driver; see "motordrvComCode.h" */ /* Local data required for every driver; see "motordrvComCode.h" */
#include "motordrvComCode.h" #include "motordrvComCode.h"
@@ -78,7 +78,7 @@ STATIC void query_done(int, int, struct mess_node *);
/*----------------functions-----------------*/ /*----------------functions-----------------*/
struct driver_table MCB4B_access = struct driver_table MD90_access =
{ {
motor_init, motor_init,
motor_send, motor_send,
@@ -102,16 +102,16 @@ struct driver_table MCB4B_access =
NULL NULL
}; };
struct drvMCB4B_drvet struct drvMD90_drvet
{ {
long number; long number;
long (*report) (int); long (*report) (int);
long (*init) (void); long (*init) (void);
} drvMCB4B = {2, report, init}; } drvMD90 = {2, report, init};
extern "C" {epicsExportAddress(drvet, drvMCB4B);} extern "C" {epicsExportAddress(drvet, drvMD90);}
STATIC struct thread_args targs = {SCAN_RATE, &MCB4B_access, 0.0}; STATIC struct thread_args targs = {SCAN_RATE, &MD90_access, 0.0};
/********************************************************* /*********************************************************
@@ -120,16 +120,16 @@ STATIC struct thread_args targs = {SCAN_RATE, &MCB4B_access, 0.0};
static long report(int level) static long report(int level)
{ {
int card; int card;
struct MCB4Bcontroller *cntrl; struct MD90controller *cntrl;
if (MCB4B_num_cards <=0) if (MD90_num_cards <=0)
printf(" NO MCB4B controllers found\n"); printf(" NO MD90 controllers found\n");
else else
{ {
for (card = 0; card < MCB4B_num_cards; card++) { for (card = 0; card < MD90_num_cards; card++) {
if (motor_state[card]) { if (motor_state[card]) {
cntrl = (struct MCB4Bcontroller *) motor_state[card]->DevicePrivate; cntrl = (struct MD90controller *) motor_state[card]->DevicePrivate;
printf(" MCB4B controller %d, port=%s, id: %s \n", printf(" MD90 controller %d, port=%s, id: %s \n",
card, cntrl->port, card, cntrl->port,
motor_state[card]->ident); motor_state[card]->ident);
} }
@@ -148,10 +148,10 @@ static long init()
* support * support
*/ */
/* Check for setup */ /* Check for setup */
if (MCB4B_num_cards <= 0) if (MD90_num_cards <= 0)
{ {
Debug(1, "init: *MCB4B driver disabled*\n"); Debug(1, "init: *MD90 driver disabled*\n");
Debug(1, "MCB4BSetup() is missing from startup script.\n"); Debug(1, "MD90Setup() is missing from startup script.\n");
return (ERROR); return (ERROR);
} }
@@ -170,7 +170,7 @@ STATIC void query_done(int card, int axis, struct mess_node *nodeptr)
*********************************************************/ *********************************************************/
STATIC void start_status(int card) STATIC void start_status(int card)
{ {
/* The MCB4B cannot query status or positions of all axes with a /* The MD90 cannot query status or positions of all axes with a
* single command. This needs to be done on an axis-by-axis basis, * single command. This needs to be done on an axis-by-axis basis,
* so this function does nothing * so this function does nothing
*/ */
@@ -265,7 +265,7 @@ STATIC int set_status(int card, int signal)
if ((status.Bits.RA_DONE || ls_active == true) && nodeptr != 0 && nodeptr->postmsgptr != 0) if ((status.Bits.RA_DONE || ls_active == true) && nodeptr != 0 && nodeptr->postmsgptr != 0)
{ {
send_mess(card, nodeptr->postmsgptr, NULL); send_mess(card, nodeptr->postmsgptr, NULL);
/* The MCB4B always sends back a response, read it and discard */ /* The MD90 always sends back a response, read it and discard */
recv_mess(card, buff, WAIT); recv_mess(card, buff, WAIT);
nodeptr->postmsgptr = NULL; nodeptr->postmsgptr = NULL;
} }
@@ -276,12 +276,12 @@ STATIC int set_status(int card, int signal)
/*****************************************************/ /*****************************************************/
/* send a message to the MCB4B board */ /* send a message to the MD90 board */
/* send_mess() */ /* send_mess() */
/*****************************************************/ /*****************************************************/
STATIC RTN_STATUS send_mess(int card, const char *com, const char *name) STATIC RTN_STATUS send_mess(int card, const char *com, const char *name)
{ {
struct MCB4Bcontroller *cntrl; struct MD90controller *cntrl;
size_t nwrite; size_t nwrite;
/* Check that card exists */ /* Check that card exists */
@@ -293,7 +293,7 @@ STATIC RTN_STATUS send_mess(int card, const char *com, const char *name)
/* If the string is NULL just return */ /* If the string is NULL just return */
if (strlen(com) == 0) return(OK); if (strlen(com) == 0) return(OK);
cntrl = (struct MCB4Bcontroller *) motor_state[card]->DevicePrivate; cntrl = (struct MD90controller *) motor_state[card]->DevicePrivate;
Debug(2, "send_mess: sending message to card %d, message=%s\n",\ Debug(2, "send_mess: sending message to card %d, message=%s\n",\
card, com); card, com);
@@ -305,7 +305,7 @@ STATIC RTN_STATUS send_mess(int card, const char *com, const char *name)
/*****************************************************/ /*****************************************************/
/* Read a response string from the MCB4B board */ /* Read a response string from the MD90 board */
/* recv_mess() */ /* recv_mess() */
/*****************************************************/ /*****************************************************/
STATIC int recv_mess(int card, char *com, int flag) STATIC int recv_mess(int card, char *com, int flag)
@@ -313,7 +313,7 @@ STATIC int recv_mess(int card, char *com, int flag)
double timeout; double timeout;
size_t nread=0; size_t nread=0;
asynStatus status; asynStatus status;
struct MCB4Bcontroller *cntrl; struct MD90controller *cntrl;
int flush; int flush;
int eomReason; int eomReason;
@@ -324,7 +324,7 @@ STATIC int recv_mess(int card, char *com, int flag)
return (-1); return (-1);
} }
cntrl = (struct MCB4Bcontroller *) motor_state[card]->DevicePrivate; cntrl = (struct MD90controller *) motor_state[card]->DevicePrivate;
Debug(3, "recv_mess entry: card %d, flag=%d\n",\ Debug(3, "recv_mess entry: card %d, flag=%d\n",\
card, flag); card, flag);
@@ -363,18 +363,18 @@ STATIC int recv_mess(int card, char *com, int flag)
/*****************************************************/ /*****************************************************/
/* Setup system configuration */ /* Setup system configuration */
/* MCB4BSetup() */ /* MD90Setup() */
/*****************************************************/ /*****************************************************/
RTN_STATUS RTN_STATUS
MCB4BSetup(int num_cards, /* maximum number of controllers in system */ MD90Setup(int num_cards, /* maximum number of controllers in system */
int scan_rate) /* polling rate - 1/60 sec units */ int scan_rate) /* polling rate - 1/60 sec units */
{ {
int itera; int itera;
if (num_cards < 1 || num_cards > MCB4B_NUM_CARDS) if (num_cards < 1 || num_cards > MD90_NUM_CARDS)
MCB4B_num_cards = MCB4B_NUM_CARDS; MD90_num_cards = MD90_NUM_CARDS;
else else
MCB4B_num_cards = num_cards; MD90_num_cards = num_cards;
/* Set motor polling task rate */ /* Set motor polling task rate */
if (scan_rate >= 1 && scan_rate <= 60) if (scan_rate >= 1 && scan_rate <= 60)
@@ -384,15 +384,15 @@ MCB4BSetup(int num_cards, /* maximum number of controllers in system */
/* /*
* Allocate space for motor_state structure pointers. Note this must be done * Allocate space for motor_state structure pointers. Note this must be done
* before MCB4BConfig is called, so it cannot be done in motor_init() * before MD90Config is called, so it cannot be done in motor_init()
* This means that we must allocate space for a card without knowing * 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 * if it really exists, which is not a serious problem since this is just
* an array of pointers. * an array of pointers.
*/ */
motor_state = (struct controller **) malloc(MCB4B_num_cards * motor_state = (struct controller **) malloc(MD90_num_cards *
sizeof(struct controller *)); sizeof(struct controller *));
for (itera = 0; itera < MCB4B_num_cards; itera++) for (itera = 0; itera < MD90_num_cards; itera++)
motor_state[itera] = (struct controller *) NULL; motor_state[itera] = (struct controller *) NULL;
return (OK); return (OK);
} }
@@ -400,20 +400,20 @@ MCB4BSetup(int num_cards, /* maximum number of controllers in system */
/*****************************************************/ /*****************************************************/
/* Configure a controller */ /* Configure a controller */
/* MCB4BConfig() */ /* MD90Config() */
/*****************************************************/ /*****************************************************/
RTN_STATUS RTN_STATUS
MCB4BConfig(int card, /* card being configured */ MD90Config(int card, /* card being configured */
const char *name) /* port name for asyn */ const char *name) /* port name for asyn */
{ {
struct MCB4Bcontroller *cntrl; struct MD90controller *cntrl;
if (card < 0 || card >= MCB4B_num_cards) if (card < 0 || card >= MD90_num_cards)
return (ERROR); return (ERROR);
motor_state[card] = (struct controller *) malloc(sizeof(struct controller)); motor_state[card] = (struct controller *) malloc(sizeof(struct controller));
motor_state[card]->DevicePrivate = malloc(sizeof(struct MCB4Bcontroller)); motor_state[card]->DevicePrivate = malloc(sizeof(struct MD90controller));
cntrl = (struct MCB4Bcontroller *) motor_state[card]->DevicePrivate; cntrl = (struct MD90controller *) motor_state[card]->DevicePrivate;
strcpy(cntrl->port, name); strcpy(cntrl->port, name);
return (OK); return (OK);
} }
@@ -429,7 +429,7 @@ MCB4BConfig(int card, /* card being configured */
STATIC int motor_init() STATIC int motor_init()
{ {
struct controller *brdptr; struct controller *brdptr;
struct MCB4Bcontroller *cntrl; struct MD90controller *cntrl;
int card_index, motor_index; int card_index, motor_index;
char buff[BUFF_SIZE]; char buff[BUFF_SIZE];
int total_axis = 0; int total_axis = 0;
@@ -439,21 +439,21 @@ STATIC int motor_init()
initialized = true; /* Indicate that driver is initialized. */ initialized = true; /* Indicate that driver is initialized. */
/* Check for setup */ /* Check for setup */
if (MCB4B_num_cards <= 0) if (MD90_num_cards <= 0)
{ {
Debug(1, "motor_init: *MCB4B driver disabled*\n"); Debug(1, "motor_init: *MD90 driver disabled*\n");
Debug(1, "MCB4BSetup() is missing from startup script.\n"); Debug(1, "MD90Setup() is missing from startup script.\n");
return (ERROR); return (ERROR);
} }
for (card_index = 0; card_index < MCB4B_num_cards; card_index++) for (card_index = 0; card_index < MD90_num_cards; card_index++)
{ {
if (!motor_state[card_index]) if (!motor_state[card_index])
continue; continue;
brdptr = motor_state[card_index]; brdptr = motor_state[card_index];
total_cards = card_index + 1; total_cards = card_index + 1;
cntrl = (struct MCB4Bcontroller *) brdptr->DevicePrivate; cntrl = (struct MD90controller *) brdptr->DevicePrivate;
/* Initialize communications channel */ /* Initialize communications channel */
success_rtn = pasynOctetSyncIO->connect(cntrl->port, 0, &cntrl->pasynUser, NULL); success_rtn = pasynOctetSyncIO->connect(cntrl->port, 0, &cntrl->pasynUser, NULL);
@@ -498,7 +498,7 @@ STATIC int motor_init()
sprintf(buff,"#%02dQ", motor_index); sprintf(buff,"#%02dQ", motor_index);
send_mess(card_index, buff, 0); send_mess(card_index, buff, 0);
recv_mess(card_index, buff, WAIT); /* Throw away response */ recv_mess(card_index, buff, WAIT); /* Throw away response */
strcpy(brdptr->ident, "MCB-4B"); strcpy(brdptr->ident, "MD-90");
motor_info->status.All = 0; motor_info->status.All = 0;
motor_info->no_motion_count = 0; motor_info->no_motion_count = 0;
motor_info->encoder_position = 0; motor_info->encoder_position = 0;
@@ -521,7 +521,7 @@ STATIC int motor_init()
Debug(3, "motor_init: spawning motor task\n"); Debug(3, "motor_init: spawning motor task\n");
epicsThreadCreate((char *) "tMCB4B", epicsThreadPriorityMedium, epicsThreadCreate((char *) "tMD90", epicsThreadPriorityMedium,
epicsThreadGetStackSize(epicsThreadStackMedium), epicsThreadGetStackSize(epicsThreadStackMedium),
(EPICSTHREADFUNC) motor_task, (void *) &targs); (EPICSTHREADFUNC) motor_task, (void *) &targs);

View File

@@ -1,4 +1,4 @@
/* File: drvMCB4B.h */ /* File: drvMD90.h */
/* Device Driver Support definitions for motor */ /* Device Driver Support definitions for motor */
@@ -12,23 +12,23 @@
* .01 02/24/2002 mlr initialized from drvPM304.h * .01 02/24/2002 mlr initialized from drvPM304.h
*/ */
#ifndef INCdrvMCB4Bh #ifndef INCdrvMD90h
#define INCdrvMCB4Bh 1 #define INCdrvMD90h 1
#include "motordrvCom.h" #include "motordrvCom.h"
#include "asynDriver.h" #include "asynDriver.h"
/* MCB4B default profile. */ /* MD90 default profile. */
#define MCB4B_NUM_CARDS 4 #define MD90_NUM_CARDS 4
#define MCB4B_NUM_CHANNELS 4 #define MD90_NUM_CHANNELS 4
#define OUTPUT_TERMINATOR "\r" #define OUTPUT_TERMINATOR "\r"
struct MCB4Bcontroller struct MD90controller
{ {
asynUser *pasynUser; /* asynUser structure */ asynUser *pasynUser; /* asynUser structure */
char port[80]; /* asyn port name */ char port[80]; /* asyn port name */
}; };
#endif /* INCdrvMCB4Bh */ #endif /* INCdrvMD90h */

View File

@@ -29,25 +29,25 @@ static const iocshArg setupArg1 = {"Polling rate", iocshArgInt};
static const iocshArg configArg0 = {"Card being configured", iocshArgInt}; static const iocshArg configArg0 = {"Card being configured", iocshArgInt};
static const iocshArg configArg1 = {"asyn port name", iocshArgString}; static const iocshArg configArg1 = {"asyn port name", iocshArgString};
static const iocshArg * const MCB4BSetupArgs[2] = {&setupArg0, &setupArg1}; static const iocshArg * const MD90SetupArgs[2] = {&setupArg0, &setupArg1};
static const iocshArg * const MCB4BConfigArgs[2] = {&configArg0, &configArg1}; static const iocshArg * const MD90ConfigArgs[2] = {&configArg0, &configArg1};
static const iocshFuncDef setupMCB4B = {"MCB4BSetup", 2, MCB4BSetupArgs}; static const iocshFuncDef setupMD90 = {"MD90Setup", 2, MD90SetupArgs};
static const iocshFuncDef configMCB4B = {"MCB4BConfig", 2, MCB4BConfigArgs}; static const iocshFuncDef configMD90 = {"MD90Config", 2, MD90ConfigArgs};
static void setupMCB4BCallFunc(const iocshArgBuf *args) static void setupMD90CallFunc(const iocshArgBuf *args)
{ {
MCB4BSetup(args[0].ival, args[1].ival); MD90Setup(args[0].ival, args[1].ival);
} }
static void configMCB4BCallFunc(const iocshArgBuf *args) static void configMD90CallFunc(const iocshArgBuf *args)
{ {
MCB4BConfig(args[0].ival, args[1].sval); MD90Config(args[0].ival, args[1].sval);
} }
static void dsmRegister(void) static void dsmRegister(void)
{ {
iocshRegister(&setupMCB4B, setupMCB4BCallFunc); iocshRegister(&setupMD90, setupMD90CallFunc);
iocshRegister(&configMCB4B, configMCB4BCallFunc); iocshRegister(&configMD90, configMD90CallFunc);
} }
epicsExportRegistrar(dsmRegister); epicsExportRegistrar(dsmRegister);

View File

@@ -37,6 +37,6 @@ USAGE... This file contains function prototypes for DSM IOC shell commands.
#include "motordrvCom.h" #include "motordrvCom.h"
/* Function prototypes. */ /* Function prototypes. */
extern RTN_STATUS MCB4BSetup(int, int); extern RTN_STATUS MD90Setup(int, int);
extern RTN_STATUS MCB4BConfig(int, const char *); extern RTN_STATUS MD90Config(int, const char *);

View File

@@ -2,5 +2,5 @@ file "$(MOTOR)/db/basic_asyn_motor.db"
{ {
pattern pattern
{P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT} {P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT}
{DSM:, 0, "m$(N)", "asynMotor", MCB4B0, 0, "Bottom", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, -.001, 3, 16, 0, ""} {DSM:, 0, "m$(N)", "asynMotor", MD900, 0, "Bottom", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, -.001, 3, 16, 0, ""}
} }

View File

@@ -24,10 +24,10 @@ asynOctetSetOutputEos("serial0", 0, "\r")
asynSetTraceIOMask("serial0", 0, 2) asynSetTraceIOMask("serial0", 0, 2)
#asynSetTraceMask("serial0", 0, 255) #asynSetTraceMask("serial0", 0, 255)
MCB4BCreateController("MCB4B0", "serial0", 1, 100, 5000) MD90CreateController("MD900", "serial0", 1, 100, 5000)
### Motors ### Motors
dbLoadTemplate "motor.substitutions.mcb4b" dbLoadTemplate "motor.substitutions.md90"
dbLoadRecords("$(ASYN)/db/asynRecord.db", "P=DSM:,R=serial0,PORT=serial0,ADDR=0,OMAX=80,IMAX=80") dbLoadRecords("$(ASYN)/db/asynRecord.db", "P=DSM:,R=serial0,PORT=serial0,ADDR=0,OMAX=80,IMAX=80")