diff --git a/.gitmodules b/.gitmodules index 6c15eb1d..f9bf4ba7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -91,3 +91,6 @@ [submodule "modules/motorMotorSim"] path = modules/motorMotorSim url = https://github.com/epics-motor/motorMotorSim.git +[submodule "modules/motorMXmotor"] + path = modules/motorMXmotor + url = https://github.com/epics-motor/motorMXmotor.git diff --git a/iocBoot/iocNoAsyn/MXexample.dat b/iocBoot/iocNoAsyn/MXexample.dat deleted file mode 100644 index 51b8c910..00000000 --- a/iocBoot/iocNoAsyn/MXexample.dat +++ /dev/null @@ -1,17 +0,0 @@ -d_spacing variable inline double "" "" 1 1 3.13555 -Io device scaler soft_scaler "" "" 0 0 0 timer1 energy 101 ./i0.dat 0 -It device scaler soft_scaler "" "" 0 0 0 timer1 energy 101 ./it.dat 0 -#rls:m2 device motor soft_motor "" "" 250000 0 -20000000 20000000 0 -1 -1 5e-05 0 deg 10000 0 2000 -energy device motor energy_motor "" "" 0 0 0 1e+08 0 -1 -1 1 0 eV rls:m1 d_spacing 0.017453 -timer1 device timer soft_timer "" "" -# -# Newport test records -# -newport_rs232 interface rs232 tty "" "" 9600 8 N 1 N 0x0d 0x0d /dev/ttyb -newport interface generic mm4000 "" "" newport_rs232 -rls:m1 device motor mm4000_motor "" "" 0 0 -1.0e38 1.0e38 0 -1 -1 1 0 deg newport 1 -# -# IMS test records -# -#ims_rs232 interface rs232 tty "" "" 9600 8 N 1 N 0x0d0a 0x0d0a /dev/ttyS0 -#rls:m3 device motor panther_hi "" "" 0 0 -10000000 10000000 0 -1 -1 1 0 steps ims_rs232 0 18340 2001 5 5 8 F 1 6 50 -1 diff --git a/iocBoot/iocNoAsyn/Makefile b/iocBoot/iocNoAsyn/Makefile deleted file mode 100644 index 19285a0e..00000000 --- a/iocBoot/iocNoAsyn/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -TOP = ../.. -include $(TOP)/configure/CONFIG -ARCH = vxWorks-68040 -#!ARCH = vxWorks-ppc604_long -TARGETS = cdCommands -TARGETS += envPaths -include $(TOP)/configure/RULES.ioc - diff --git a/iocBoot/iocNoAsyn/README b/iocBoot/iocNoAsyn/README deleted file mode 100644 index e639fe36..00000000 --- a/iocBoot/iocNoAsyn/README +++ /dev/null @@ -1,29 +0,0 @@ -To build any examples; - -- in /configure/RELEASE: EPICS_BASE must be defined and, - #!MOTOR=$(TOP) must be uncommented. - -- in /Makefile: the following two lines must be uncommented; - #!DIRS := $(DIRS) $(filter-out $(DIRS), motorExApp) - #!DIRS := $(DIRS) $(filter-out $(DIRS), iocBoot) - -To build the OMS example in this directory; -- in /motorApp/Makefile: #!DIRS += OmsSrc must be uncommented. - -- in /motorExApp/Makefile: #!DIRS += NoAsyn must be uncommented. - -- in /motorExApp/NoAsyn/Makefile: #!NoAsynVx_LIBS += oms must be - uncommented. - -Finally, cd ; gnumake clean uninstall; gnumake - - -To run the MX example, uncomment the following; -in /motorExApp/NoAsyn/Makefile: #NoAsyn_LIBS += MXmotor -in /motorExApp/NoAsyn/NoAsynInclude.dbd: #include "devMXmotor.dbd" -and rebuild. - -Assuming the EPICS_HOST_ARCH environment variable is set correctly, -start the ioc from this directory by executing the following command. - -../../bin/${EPICS_HOST_ARCH}/NoAsyn st.cmd.mx diff --git a/iocBoot/iocNoAsyn/i0.dat b/iocBoot/iocNoAsyn/i0.dat deleted file mode 100644 index 785f9902..00000000 --- a/iocBoot/iocNoAsyn/i0.dat +++ /dev/null @@ -1,101 +0,0 @@ -8950 157555 -8951 157823 -8952 158170 -8953 158333 -8954 158463 -8955 158458 -8956 158788 -8957 159070 -8958 159189 -8959 159292 -8960 159053 -8961 159275 -8962 159347 -8963 159396 -8964 159627 -8965 159326 -8966 159460 -8967 159690 -8968 159627 -8969 159682 -8970 159745 -8971 159840 -8972 160053 -8973 160313 -8974 160410 -8975 160762 -8976 160887 -8977 160988 -8978 161028 -8979 161064 -8980 160984 -8981 161161 -8982 161015 -8983 161069 -8984 161088 -8985 161018 -8986 161200 -8987 161327 -8988 161337 -8989 161322 -8990 161497 -8991 161496 -8992 161410 -8993 161410 -8994 161614 -8995 161683 -8996 161831 -8997 161831 -8998 161877 -8999 161999 -9000 162046 -9001 162095 -9002 161911 -9003 162190 -9004 162038 -9005 162164 -9006 162293 -9007 162129 -9008 162230 -9009 162170 -9010 161890 -9011 162286 -9012 162331 -9013 162317 -9014 162374 -9015 162483 -9016 162509 -9017 162320 -9018 162310 -9019 162430 -9020 162345 -9021 162376 -9022 162439 -9023 162552 -9024 162582 -9025 162625 -9026 162761 -9027 162845 -9028 162663 -9029 162692 -9030 162701 -9031 162561 -9032 162617 -9033 162586 -9034 162531 -9035 162564 -9036 162557 -9037 162583 -9038 162535 -9039 162504 -9040 162304 -9041 161609 -9042 159694 -9043 160016 -9044 162222 -9045 162759 -9046 162825 -9047 162820 -9048 162698 -9049 162699 -9050 162860 diff --git a/iocBoot/iocNoAsyn/it.dat b/iocBoot/iocNoAsyn/it.dat deleted file mode 100644 index cd291a2e..00000000 --- a/iocBoot/iocNoAsyn/it.dat +++ /dev/null @@ -1,101 +0,0 @@ -8950 395527 -8951 397385 -8952 399842 -8953 400917 -8954 401645 -8955 401494 -8956 403659 -8957 405675 -8958 406268 -8959 406722 -8960 404554 -8961 405881 -8962 405794 -8963 405550 -8964 406522 -8965 403507 -8966 403562 -8967 404049 -8968 402105 -8969 400442 -8970 398177 -8971 394713 -8972 389458 -8973 377355 -8974 345928 -8975 280021 -8976 213430 -8977 187933 -8978 188234 -8979 193119 -8980 188754 -8981 178281 -8982 166890 -8983 156640 -8984 143264 -8985 127337 -8986 112287 -8987 99609 -8988 89420 -8989 83563 -8990 82755 -8991 85219 -8992 88971 -8993 92543 -8994 95141 -8995 95149 -8996 92518 -8997 87593 -8998 83236 -8999 81763 -9000 83340 -9001 86828 -9002 89978 -9003 93541 -9004 95689 -9005 98596 -9006 101057 -9007 101874 -9008 102134 -9009 101552 -9010 100100 -9011 99666 -9012 98004 -9013 95900 -9014 93743 -9015 91861 -9016 89868 -9017 87733 -9018 85903 -9019 84462 -9020 82911 -9021 82220 -9022 82327 -9023 83211 -9024 84657 -9025 86522 -9026 88822 -9027 91046 -9028 92728 -9029 94292 -9030 95520 -9031 96048 -9032 96604 -9033 96630 -9034 96310 -9035 95917 -9036 95300 -9037 94749 -9038 94274 -9039 94140 -9040 93972 -9041 93150 -9042 89742 -9043 89947 -9044 93355 -9045 93570 -9046 92953 -9047 92474 -9048 92023 -9049 91978 -9050 92163 diff --git a/iocBoot/iocNoAsyn/st.cmd.mx b/iocBoot/iocNoAsyn/st.cmd.mx deleted file mode 100644 index cf4dfbce..00000000 --- a/iocBoot/iocNoAsyn/st.cmd.mx +++ /dev/null @@ -1,13 +0,0 @@ -# This example if for running a motor record that uses the MX device -# driver support on a Unix host. This example does not require Asyn. - -# Start errlog Task before any possible error messsage to prevent -# erroneous "Interrupted system call" message on Linux OS host. -errlogInit(0) - -dbLoadDatabase("../../dbd/NoAsyn.dbd",0,0) -registerRecordDeviceDriver(pdbbase) -dbLoadRecords("../../db/NoAsyn_MX.db","user=rls") -MXmotorSetup(1, "MXexample.dat", 10) - -iocInit() diff --git a/modules/Makefile b/modules/Makefile index 23ddfbf8..c4e28ee3 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -23,6 +23,9 @@ SUBMODULES += motorMicos SUBMODULES += motorMicroMo SUBMODULES += motorMicronix SUBMODULES += motorMotorSim +ifdef MX +SUBMODULES += motorMXmotor +endif SUBMODULES += motorNewFocus SUBMODULES += motorNPoint SUBMODULES += motorOmsAsyn diff --git a/modules/motorMXmotor b/modules/motorMXmotor new file mode 160000 index 00000000..8f02e22d --- /dev/null +++ b/modules/motorMXmotor @@ -0,0 +1 @@ +Subproject commit 8f02e22db9dbc54182ff5f01f3dbe1fefd194a5c diff --git a/motorApp/MXmotorSrc/MXRegister.cc b/motorApp/MXmotorSrc/MXRegister.cc deleted file mode 100644 index 53b50ded..00000000 --- a/motorApp/MXmotorSrc/MXRegister.cc +++ /dev/null @@ -1,48 +0,0 @@ -/* -FILENAME... MXRegister.cc -USAGE... Register MX 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 -#include -#include -#include -#include "MXmotor.h" -#include "epicsExport.h" - -extern "C" -{ - -// MXmotorSetup -static const iocshArg setupArg0 = {"Max. motor #", iocshArgInt}; -static const iocshArg setupArg1 = {"MX data file", iocshArgString}; -static const iocshArg setupArg2 = {"Polling rate", iocshArgInt}; -static const iocshArg * const mxmotorArgs[3] = {&setupArg0, &setupArg1, &setupArg2}; -static const iocshFuncDef setupFuncDef = {"MXmotorSetup", 3, mxmotorArgs}; -static void setupCallFunc(const iocshArgBuf *args) -{ - MXmotorSetup(args[0].ival, args[1].sval, args[2].ival); -} - - -static void MXmotorRegister(void) -{ - iocshRegister(&setupFuncDef, setupCallFunc); -} - -epicsExportRegistrar(MXmotorRegister); - -} // extern "C" diff --git a/motorApp/MXmotorSrc/MXmotor.h b/motorApp/MXmotorSrc/MXmotor.h deleted file mode 100644 index a4edd682..00000000 --- a/motorApp/MXmotorSrc/MXmotor.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -FILENAME... MXmotor.h -USAGE... This file contains "include" information that is specific to - MX motor device driver support. - -*/ - -/* - * Original Author: Ron Sluiter - * Date: 11/12/02 - * - * 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: - * ----------------- - */ - -#ifndef INCMXmotorh -#define INCMXmotorh 1 - -#include "motor.h" -extern "C" -{ -#include -#include -} - -struct MXcontroller -{ - CALLBACK_VALUE callback_flag; - MX_RECORD *MXmotor_record; -}; - -RTN_STATUS MXmotorSetup(int, char const *, int); -extern MX_RECORD *MXmotor_record_list; - -#endif /* INCMXmotorh */ - diff --git a/motorApp/MXmotorSrc/Makefile b/motorApp/MXmotorSrc/Makefile deleted file mode 100644 index 836a76be..00000000 --- a/motorApp/MXmotorSrc/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# Makefile -TOP = ../.. -include $(TOP)/configure/CONFIG -#---------------------------------------- -# ADD MACRO DEFINITIONS AFTER THIS LINE - -# The following are used for debugging messages. -USR_CFLAGS += -DDEBUG -USR_CXXFLAGS += -DDEBUG - -DBD += devMXmotor.dbd - -LIBRARY_IOC_DEFAULT = MXmotor -LIBRARY_IOC_vxWorks = -nil- - -SRCS_DEFAULT += MXRegister.cc - -# The following is required for the Soft Channel (i.e., MotorSoft) device driver. -SRCS_DEFAULT += devMXmotor.cc drvMXmotor.cc - -MXmotor_LIBS += motor Mx -MXmotor_LIBS += $(EPICS_BASE_IOC_LIBS) - -include $(TOP)/configure/RULES -#---------------------------------------- -# ADD RULES AFTER THIS LINE - diff --git a/motorApp/MXmotorSrc/devMXmotor.cc b/motorApp/MXmotorSrc/devMXmotor.cc deleted file mode 100644 index 9f852089..00000000 --- a/motorApp/MXmotorSrc/devMXmotor.cc +++ /dev/null @@ -1,230 +0,0 @@ -/* -FILENAME... devMXmotor.cc -USAGE... Motor record device level support for MX device driver. - -*/ - -/* - * Original Author: Ron Sluiter - * Date: 06/15/99 - * - * Experimental Physics and Industrial Control System (EPICS) - * - * Copyright 1991, the University of Chicago Board of Governors. - * - * This software was produced under U.S. Government contract - * W-31-109-ENG-38 at Argonne National Laboratory. - * - * Beamline Controls & Data Acquisition Group - * Experimental Facilities Division - * Advanced Photon Source - * Argonne National Laboratory - * - * Modification Log: - * ----------------- - */ - -#include - -#include "motorRecord.h" -#include "motor.h" -#include "motordevCom.h" -#include "MXmotor.h" -#include "epicsExport.h" - -extern int MXmotor_num_cards; -extern struct driver_table MXmotor_access; - -/* ----------------Create the dsets for devMXmotor----------------- */ -static long MXmotor_init(int); -static long MXmotor_init_record(void *); -static long MXmotor_start_trans(struct motorRecord *); -static RTN_STATUS MXmotor_build(motor_cmnd, double *, struct motorRecord *); -static RTN_STATUS MXmotor_end_trans(struct motorRecord *); - -struct motor_dset devMXmotor = -{ - {8, NULL, (DEVSUPFUN) MXmotor_init, (DEVSUPFUN) MXmotor_init_record, NULL}, - motor_update_values, - MXmotor_start_trans, - MXmotor_build, - MXmotor_end_trans -}; - -extern "C" {epicsExportAddress(dset,devMXmotor);} - - -/* This table is used to define the command types */ -/* WARNING! this must match "motor_cmnd" in motor.h */ - -static msg_types MXmotor_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 /* JOG_VELOCITY */ -}; - -static struct board_stat **MXmotor_cards; -static const char errmsg[] = {"\n\n!!!ERROR!!! - MX driver uninitialized.\n"}; - -/* initialize device support for MX motor */ -static long MXmotor_init(int after) -{ - if (*(MXmotor_access.init_indicator) == NO) - { - errlogSevPrintf(errlogMinor, "%s", errmsg); - return(ERROR); - } - else - return(motor_init_com(after, MXmotor_num_cards, &MXmotor_access, - &MXmotor_cards)); -} - - -static long MXmotor_init_record(void *arg) -{ - struct motorRecord *mr = (struct motorRecord *) arg; - struct motor_trans *trans; - struct controller *brdptr; - struct MXcontroller *cntrl; - MX_RECORD *motor_record; - long rtnval; - - motor_record = mx_get_record(MXmotor_record_list, mr->name); - if (motor_record == NULL) - { - printf("Motor '%s' does not exist.\n", mr->name); - return(ERROR); - } - - rtnval = motor_init_record_com(mr, MXmotor_num_cards, &MXmotor_access, MXmotor_cards); - - trans = (struct motor_trans *) mr->dpvt; - brdptr = (*trans->tabptr->card_array)[mr->out.value.vmeio.card]; - if (brdptr == NULL) - return(rtnval = ERROR); - cntrl = (struct MXcontroller *) brdptr->DevicePrivate; - cntrl->MXmotor_record = motor_record; - - return(rtnval); -} - - -static long MXmotor_start_trans(struct motorRecord *mr) -{ - long rtnval; - return(rtnval); -} - - -static RTN_STATUS MXmotor_build(motor_cmnd command, double *parms, struct motorRecord *mr) -{ - struct motor_trans *trans = (struct motor_trans *) mr->dpvt; - struct mess_node *motor_call; - unsigned int size; - char buff[110]; - RTN_STATUS rtnval = OK; - bool send = true; /* Default to send motor command. */ - - struct controller *brdptr; - struct MXcontroller *cntrl; - - brdptr = (*trans->tabptr->card_array)[mr->card]; - if (brdptr == NULL) - return(rtnval = ERROR); - cntrl = (struct MXcontroller *) brdptr->DevicePrivate; - - buff[0] = '\0'; - - motor_start_trans_com(mr, MXmotor_cards); - - motor_call = &(trans->motor_call); - - if (MXmotor_table[command] > motor_call->type) - motor_call->type = MXmotor_table[command]; - - switch (command) - { - case MOVE_ABS: - sprintf(buff, "%d %f", command, *parms); - break; - - case MOVE_REL: - sprintf(buff, "%d %f", command, *parms); - break; - - case HOME_FOR: - sprintf(buff, "%d %d", command, 1); - break; - - case HOME_REV: - sprintf(buff, "%d %d", command, -1); - break; - - case LOAD_POS: - sprintf(buff, "%d %f", command, *parms); - break; - - case SET_VEL_BASE: - case SET_VELOCITY: - case SET_ACCEL: - sprintf(buff, "%d %f", command, *parms); - break; - - case GO: - send = false; - break; - - case GET_INFO: - /* This command is 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(buff, "%d", command); - break; - - default: - send = false; - rtnval = ERROR; - } - - size = strlen(buff); - if (send == false) - return(rtnval); - else if (size > sizeof(buff) || (strlen(motor_call->message) + size) > MAX_MSG_SIZE) - printf("MXmotor_build(): buffer overflow.\n"); - else - { - strcat(motor_call->message, buff); - motor_end_trans_com(mr, &MXmotor_access); - } - return(rtnval); -} - - -static RTN_STATUS MXmotor_end_trans(struct motorRecord *mr) -{ - RTN_STATUS rtnval = OK; - return(rtnval); -} - diff --git a/motorApp/MXmotorSrc/devMXmotor.dbd b/motorApp/MXmotorSrc/devMXmotor.dbd deleted file mode 100644 index 5dc88b31..00000000 --- a/motorApp/MXmotorSrc/devMXmotor.dbd +++ /dev/null @@ -1,6 +0,0 @@ -# Soft Channel driver support. -device(motor,VME_IO,devMXmotor,"MXmotor") -driver(drvMXmotor) -registrar(MXmotorRegister) - - diff --git a/motorApp/MXmotorSrc/drvMXmotor.cc b/motorApp/MXmotorSrc/drvMXmotor.cc deleted file mode 100644 index 342e58f6..00000000 --- a/motorApp/MXmotorSrc/drvMXmotor.cc +++ /dev/null @@ -1,404 +0,0 @@ -/* -FILENAME... drvMXmotor.cc -USAGE... Motor record driver level support for MX device driver. - -*/ - -/* - * Original Author: Ron Sluiter - * Date: 06/15/99 - * - * Experimental Physics and Industrial Control System (EPICS) - * - * Copyright 1991, the University of Chicago Board of Governors. - * - * This software was produced under U.S. Government contract - * W-31-109-ENG-38 at Argonne National Laboratory. - * - * Beamline Controls & Data Acquisition Group - * Experimental Facilities Division - * Advanced Photon Source - * Argonne National Laboratory - * - * Modification Log: - * ----------------- - */ - -#include -#include - -#include "motor.h" -#include "motordrvCom.h" -#include "MXmotor.h" -#include "epicsExport.h" - -/*----------------debugging-----------------*/ -volatile int drvMXmotordebug = 0; -extern "C" {epicsExportAddress(int, drvMXmotordebug);} - -static inline void Debug(int level, const char *format, ...) { - #ifdef DEBUG - if (level < drvMXmotordebug) { - va_list pVar; - va_start(pVar, format); - vprintf(format, pVar); - va_end(pVar); - } - #endif -} - -/* Global data. */ -int MXmotor_num_cards = 0; -MX_RECORD *MXmotor_record_list; - -/* Local data required for every driver; see "motordrvComCode.h" */ -#include "motordrvComCode.h" - -/* Common local function declarations. */ - -static long report(int level); -static long init(); -static void query_done(int, int, struct mess_node *); -static int set_status(int card, int signal); -static RTN_STATUS send_mess(int, char const *, char *); -static int recv_mess(int, char *, int); -static int motor_init(); - -struct driver_table MXmotor_access = -{ - NULL, - 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, - NULL, - &initialized, - NULL -}; - -struct -{ - long number; - long (*report) (int); - long (*init) (void); -} drvMXmotor = {2, report, init}; - -extern "C" {epicsExportAddress(drvet,drvMXmotor);} - -static struct thread_args targs = {SCAN_RATE, &MXmotor_access, 0.0}; - -/*----------------functions-----------------*/ - -static long report(int level) -{ - int card; - - if (MXmotor_num_cards <= 0) - printf(" No MX motors configured.\n"); - else - { - for (card = 0; card < MXmotor_num_cards; card++) - { - struct controller *brdptr = motor_state[card]; - - if (brdptr == NULL) - printf(" MX motor #%d not found.\n", card); - else - printf(" MX motor #%d\n", card); - } - } - return (0); -} - -static long init() -{ - initialized = true; /* Indicate that driver is initialized. */ - (void) motor_init(); - return ((long) 0); -} - - -static void query_done(int, int, struct mess_node *) -{ -} - - -RTN_STATUS MXmotorSetup(int max_motors, /* Maximum number of motors. */ - char const *filename, /* MX data file. */ - int scan_rate) /* polling rate - 1/60 sec units */ -{ - RTN_STATUS rtnval = OK; - mx_status_type mx_status; - - if (max_motors > 1000) - MXmotor_num_cards = 1000; - else if (max_motors < 0) - MXmotor_num_cards = 0; - else - MXmotor_num_cards = max_motors; - - mx_status = mx_setup_database(&MXmotor_record_list, (char *) filename); - if (mx_status.code != MXE_SUCCESS) - { - printf("MXmotorSetup: database setup error.\n"); - return(ERROR); - } - - /* 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; - - return(rtnval); -} - - -/* Initialize all MX. */ -static int motor_init() -{ - struct controller *pmotorState; - int card_index, motor_index; - int total_encoders = 0, total_axis = 0; - - /* Check for setup */ - if (MXmotor_num_cards <= 0) - { - Debug(1, "motor_init: *OMS driver disabled* \n omsSetup() is missing from startup script.\n"); - return (ERROR); - } - - /* allocate space for total number of motors */ - motor_state = (struct controller **) malloc(MXmotor_num_cards * - sizeof(struct controller *)); - - /* allocate structure space for each motor present */ - - total_cards = MXmotor_num_cards; - - for (card_index = 0; card_index < MXmotor_num_cards; card_index++) - { - Debug(2, "motor_init: card %d\n", card_index); - - motor_state[card_index] = (struct controller *) malloc(sizeof(struct controller)); - motor_state[card_index]->DevicePrivate = malloc(sizeof(struct MXcontroller)); - pmotorState = motor_state[card_index]; - strcpy(pmotorState->ident, "MXmotor"); - pmotorState->localaddr = (char *) 0; - pmotorState->motor_in_motion = 0; - pmotorState->cmnd_response = false; - - Debug(3, "Total axis = %d\n", total_axis); - pmotorState->total_axis = total_axis = 1; - - for (total_encoders = 0, motor_index = 0; motor_index < total_axis; motor_index++) - pmotorState->motor_info[motor_index].encoder_present = NO; - - for (motor_index = 0; motor_index < total_axis; motor_index++) - { - pmotorState->motor_info[motor_index].motor_motion = NULL; - pmotorState->motor_info[motor_index].status = 0; - pmotorState->motor_info[motor_index].no_motion_count = 0; - pmotorState->motor_info[motor_index].encoder_position = 0; - pmotorState->motor_info[motor_index].position = 0; - - if (pmotorState->motor_info[motor_index].encoder_present == YES) - pmotorState->motor_info[motor_index].status |= EA_PRESENT; - } - } - - 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, "Motors initialized\n"); - - epicsThreadCreate((const char *) "MX_motor", epicsThreadPriorityMedium, - epicsThreadGetStackSize(epicsThreadStackMedium), - (EPICSTHREADFUNC) motor_task, (void *) &targs); - - Debug(3, "Started motor_task\n"); - return (0); -} - - -static int set_status(int card, int signal) -{ - struct mess_info *motor_info; - - struct controller *brdptr; - struct MXcontroller *cntrl; - mx_status_type mx_status; - - int rtn_state; - bool plusdir, ls_active = false; - unsigned long status; - double motorData; - - brdptr = motor_state[card]; - motor_info = &(brdptr->motor_info[signal]); - cntrl = (struct MXcontroller *) brdptr->DevicePrivate; - - mx_status = mx_motor_get_extended_status(cntrl->MXmotor_record, &motorData, - &status); - if (mx_status.code != MXE_SUCCESS) - return(rtn_state = ERROR); - - if (status & MXSF_MTR_IS_BUSY ) - motor_info->status &= ~RA_DONE; - else - motor_info->status |= RA_DONE; - - if (motorData == motor_info->position) - motor_info->no_motion_count++; - else - { - epicsInt32 newposition; - - newposition = NINT(motorData); - if (newposition >= motor_info->position) - motor_info->status |= RA_DIRECTION; - else - motor_info->status &= ~RA_DIRECTION; - motor_info->position = newposition; - motor_info->no_motion_count = 0; - } - - plusdir = (motor_info->status & RA_DIRECTION) ? true : false; - - /* Set limit switch error indicators. */ - if (status & MXSF_MTR_POSITIVE_LIMIT_HIT) - { - motor_info->status |= RA_PLUS_LS; - if (plusdir == true) - ls_active = true; - } - else - motor_info->status &= ~RA_PLUS_LS; - - if (status & MXSF_MTR_NEGATIVE_LIMIT_HIT) - { - motor_info->status |= RA_MINUS_LS; - if (plusdir == false) - ls_active = true; - } - else - motor_info->status &= ~RA_MINUS_LS; - - if (status & MXSF_MTR_ERROR) - motor_info->status |= RA_PROBLEM; - else - motor_info->status &= ~RA_PROBLEM; - - rtn_state = (!motor_info->no_motion_count || ls_active == true || - (motor_info->status & (RA_DONE | RA_PROBLEM))) ? 1 : 0; - - return(rtn_state); -} - -static RTN_STATUS send_mess(int card, char const *com, char *name) -{ - struct controller *brdptr; - struct MXcontroller *cntrl; - motor_cmnd command; - mx_status_type mx_status; - char *cmndptr, *argptr; - double darg; - int iarg, flags = MXF_MTR_IGNORE_BACKLASH; - - brdptr = motor_state[card]; - cntrl = (struct MXcontroller *) brdptr->DevicePrivate; - - argptr = NULL; - cmndptr = strtok_r((char *) com, " ", &argptr); - if (cmndptr == NULL) - return(OK); - command = (motor_cmnd) atoi(cmndptr); - - switch (command) - { - case MOVE_ABS: - case MOVE_REL: - case LOAD_POS: - case SET_VEL_BASE: - case SET_VELOCITY: - darg = atof(argptr); - break; - - case HOME_FOR: - case HOME_REV: - iarg = atoi(argptr); - break; - - default: - break; - } - - - switch (command) - { - case MOVE_ABS: - mx_status = mx_motor_move_absolute(cntrl->MXmotor_record, darg, flags); - break; - - case MOVE_REL: - mx_status = mx_motor_move_relative(cntrl->MXmotor_record, darg, flags); - break; - - case HOME_FOR: - case HOME_REV: - mx_status = mx_motor_find_home_position(cntrl->MXmotor_record, iarg); - break; - - case SET_VEL_BASE: - mx_status = mx_motor_set_base_speed(cntrl->MXmotor_record, darg); - break; - - case SET_VELOCITY: - mx_status = mx_motor_set_speed(cntrl->MXmotor_record, darg); - break; - - case SET_ACCEL: - break; - - case LOAD_POS: - mx_status = mx_motor_set_position(cntrl->MXmotor_record, darg); - break; - - case STOP_AXIS: - mx_status = mx_motor_soft_abort(cntrl->MXmotor_record); - break; - - default: - break; - } - - if (mx_status.code != MXE_SUCCESS) - return(ERROR); - - return(OK); -} - - -static int recv_mess(int card, char *com, int amount) -{ - return (0); -} - - diff --git a/motorApp/Makefile b/motorApp/Makefile index 7f6fe141..67f90c84 100644 --- a/motorApp/Makefile +++ b/motorApp/Makefile @@ -15,10 +15,6 @@ SoftMotorSrc_DEPEND_DIRS = MotorSrc # Install the edl files #DIRS += opi -ifdef MX -DIRS += MXmotorSrc -endif - DIRS += Db include $(TOP)/configure/RULES_DIRS diff --git a/motorExApp/NoAsyn/Makefile b/motorExApp/NoAsyn/Makefile index 89bd38f2..db978572 100644 --- a/motorExApp/NoAsyn/Makefile +++ b/motorExApp/NoAsyn/Makefile @@ -17,7 +17,6 @@ PROD_IOC_vxWorks = NoAsynVx COMMONDBDS = base.dbd COMMONDBDS += motorRecord.dbd COMMONDBDS += devSoftMotor.dbd -#!COMMONDBDS += devMXmotor.dbd DBD += NoAsyn.dbd NoAsyn_DBD += $(COMMONDBDS) @@ -31,7 +30,6 @@ NoAsyn_SRCS += NoAsyn_registerRecordDeviceDriver.cpp NoAsyn_SRCS_DEFAULT += NoAsynMain.cpp NoAsynVx_SRCS += NoAsynVx_registerRecordDeviceDriver.cpp -#!COMMONLIBS += MXmotor COMMONLIBS += softMotor COMMONLIBS += motor diff --git a/motorExApp/WithAsyn/Makefile b/motorExApp/WithAsyn/Makefile index ef4daba7..61990efa 100644 --- a/motorExApp/WithAsyn/Makefile +++ b/motorExApp/WithAsyn/Makefile @@ -13,7 +13,6 @@ PROD_IOC_vxWorks = WithAsynVx COMMONDBDS = base.dbd COMMONDBDS += motorSupport.dbd COMMONDBDS += devSoftMotor.dbd -COMMONDBDS += motorSimSupport.dbd COMMONDBDS += asyn.dbd COMMONDBDS += drvAsynSerialPort.dbd COMMONDBDS += drvAsynIPPort.dbd @@ -48,7 +47,6 @@ WithAsynVx_SRCS += WithAsynVx_registerRecordDeviceDriver.cpp WithAsyn_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary COMMONLIBS += softMotor -COMMONLIBS += motorSimSupport COMMONLIBS += motor # Needed for SNL programs