forked from epics_driver_modules/motorBase
Allow a OSI omsLib to be built, but not ran.
This commit is contained in:
@@ -9,10 +9,7 @@ include $(TOP)/configure/CONFIG
|
||||
|
||||
DBD += devOms.dbd
|
||||
|
||||
LIBRARY_IOC_vxWorks = oms
|
||||
|
||||
# The following is required for all OMS device drivers.
|
||||
SRCS += devOmsCom.cc
|
||||
LIBRARY_IOC = oms
|
||||
|
||||
# The following is required for the OMS VME8/44 (i.e., devOMS) device driver.
|
||||
SRCS += devOms.cc drvOms.cc
|
||||
@@ -23,6 +20,12 @@ SRCS += devOms58.cc drvOms58.cc
|
||||
# The following is required for the OMS MAXv device driver.
|
||||
SRCS += devMAXv.cc drvMAXv.cc
|
||||
|
||||
# The following is required for all OMS device drivers.
|
||||
SRCS += devOmsCom.cc
|
||||
|
||||
oms_LIBS += motor
|
||||
oms_LIBS += $(EPICS_BASE_IOC_LIBS)
|
||||
|
||||
include $(TOP)/configure/RULES
|
||||
#----------------------------------------
|
||||
# ADD RULES AFTER THIS LINE
|
||||
|
||||
+63
-60
@@ -2,9 +2,9 @@
|
||||
FILENAME... drvMAXv.cc
|
||||
USAGE... Motor record driver level support for OMS model MAXv.
|
||||
|
||||
Version: $Revision: 1.4 $
|
||||
Version: $Revision: 1.5 $
|
||||
Modified By: $Author: sluiter $
|
||||
Last Modified: $Date: 2004-12-20 22:00:58 $
|
||||
Last Modified: $Date: 2005-03-23 22:16:11 $
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -48,27 +48,17 @@ Last Modified: $Date: 2004-12-20 22:00:58 $
|
||||
* - eliminate calls to devConnectInterrupt() due to C++
|
||||
* problems with devLib.h; i.e. "sorry, not implemented:
|
||||
* `tree_list' not supported..." compiler error message.
|
||||
*
|
||||
* 04 03-21-05 rls - Make MAXv OSI.
|
||||
*/
|
||||
|
||||
#include <vxLib.h>
|
||||
#include <sysLib.h>
|
||||
#include <string.h>
|
||||
#include <rebootLib.h>
|
||||
#include <logLib.h>
|
||||
#include <taskLib.h>
|
||||
#include <dbCommon.h>
|
||||
#include <drvSup.h>
|
||||
#include <epicsVersion.h>
|
||||
#if EPICS_MODIFICATION <= 4
|
||||
extern "C" {
|
||||
#include <devLib.h>
|
||||
}
|
||||
#else
|
||||
#include <devLib.h>
|
||||
#endif
|
||||
#include <dbAccess.h>
|
||||
#include <epicsThread.h>
|
||||
#include <epicsExit.h>
|
||||
|
||||
#include "motorRecord.h" /* For Driver Power Monitor feature only. */
|
||||
#include "motor.h"
|
||||
@@ -90,14 +80,19 @@ extern "C" {
|
||||
|
||||
|
||||
/*----------------debugging-----------------*/
|
||||
#ifdef DEBUG
|
||||
volatile int drvMAXvdebug = 0;
|
||||
#define Debug(l, f, args...) { if(l<=drvMAXvdebug) printf(f,## args); }
|
||||
#ifdef __GNUG__
|
||||
#ifdef DEBUG
|
||||
#define Debug(l, f, args...) {if (l <= drvMAXvdebug) printf(f, ## args);}
|
||||
#else
|
||||
#define Debug(l, f, args...)
|
||||
#endif
|
||||
#else
|
||||
#define Debug(l, f, args...)
|
||||
#define Debug
|
||||
#endif
|
||||
volatile int drvMAXvdebug = 0;
|
||||
extern "C" {epicsExportAddress(int, drvMAXvdebug);}
|
||||
|
||||
#define pack2x16(p) ((uint32_t)(((p[0])<<16)|(p[1])))
|
||||
#define pack2x16(p) ((epicsUInt32)(((p[0])<<16)|(p[1])))
|
||||
#define INITSTR_SIZE 150 /* 150 byte intialization string. */
|
||||
|
||||
/* Global data. */
|
||||
@@ -127,7 +122,7 @@ RTN_STATUS send_mess(int, char const *, char *);
|
||||
int recv_mess(int, char *, int);
|
||||
static void motorIsr(int);
|
||||
static int motor_init();
|
||||
static void MAXv_reset();
|
||||
static void MAXv_reset(void *);
|
||||
static char *readbuf(volatile struct MAXv_motor *, char *);
|
||||
|
||||
static void start_status(int card);
|
||||
@@ -186,7 +181,7 @@ static long report(int level)
|
||||
printf(" Oms MAXv motor card #%d not found.\n", card);
|
||||
else
|
||||
printf(" Oms MAXv motor card #%d @ 0x%X, id: %s \n", card,
|
||||
(uint_t) motor_state[card]->localaddr,
|
||||
(epicsUInt32) motor_state[card]->localaddr,
|
||||
motor_state[card]->ident);
|
||||
}
|
||||
}
|
||||
@@ -388,8 +383,8 @@ static int set_status(int card, int signal)
|
||||
struct motor_trans *trans = (struct motor_trans *) nodeptr->mrecord->dpvt;
|
||||
if (trans->dpm == true)
|
||||
{
|
||||
logMsg((char *) "Drive power failure at MAXv card#%d motor#%d\n",
|
||||
card, signal, 0, 0, 0, 0);
|
||||
errlogPrintf("Drive power failure at MAXv card#%d motor#%d\n",
|
||||
card, signal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,7 +412,7 @@ static int set_status(int card, int signal)
|
||||
|
||||
/* Copy device directive to buffer. */
|
||||
strncpy(buffer, nodeptr->postmsgptr, size);
|
||||
buffer[size] = NULL;
|
||||
buffer[size] = (char) NULL;
|
||||
|
||||
if (strncmp(buffer, "@PUT(", 5) != 0)
|
||||
goto errorexit;
|
||||
@@ -487,21 +482,19 @@ RTN_STATUS send_mess(int card, char const *com, char *name)
|
||||
|
||||
if (strlen(com) > MAX_MSG_SIZE)
|
||||
{
|
||||
logMsg((char *) "drvMAXv.cc:send_mess(); message size violation.\n",
|
||||
0, 0, 0, 0, 0, 0);
|
||||
errlogPrintf("drvMAXv.cc:send_mess(); message size violation.\n");
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
/* Check that card exists */
|
||||
if (!motor_state[card])
|
||||
{
|
||||
logMsg((char *) "drvMAXv.cc:send_mess() - invalid card #%d\n", card,
|
||||
0, 0, 0, 0, 0);
|
||||
errlogPrintf("drvMAXv.cc:send_mess() - invalid card #%d\n", card);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
pmotor = (struct MAXv_motor *) motor_state[card]->localaddr;
|
||||
Debug(9, "send_mess: pmotor = %x\n", (uint_t) pmotor);
|
||||
Debug(9, "send_mess: pmotor = %x\n", (epicsUInt32) pmotor);
|
||||
|
||||
return_code = OK;
|
||||
|
||||
@@ -541,12 +534,14 @@ RTN_STATUS send_mess(int card, char const *com, char *name)
|
||||
|
||||
while (pmotor->outPutIndex != pmotor->outGetIndex)
|
||||
{
|
||||
epicsInt16 deltaIndex;
|
||||
|
||||
Debug(5, "send_mess: Waiting for ack: index delta=%d\n",
|
||||
(((deltaIndex = pmotor->outPutIndex - pmotor->outGetIndex) < 0) ?
|
||||
BUFFER_SIZE + deltaIndex : deltaIndex));
|
||||
taskDelay(0);
|
||||
#ifdef DEBUG
|
||||
epicsInt16 deltaIndex, delta;
|
||||
|
||||
deltaIndex = pmotor->outPutIndex - pmotor->outGetIndex;
|
||||
delta = (deltaIndex < 0) ? BUFFER_SIZE + deltaIndex : deltaIndex;
|
||||
Debug(5, "send_mess: Waiting for ack: index delta=%d\n", delta);
|
||||
#endif
|
||||
epicsThreadSleep(epicsThreadSleepQuantum());
|
||||
};
|
||||
|
||||
return (return_code);
|
||||
@@ -611,7 +606,7 @@ int recv_mess(int card, char *com, int amount)
|
||||
}
|
||||
|
||||
bufptr = com;
|
||||
*bufptr = NULL;
|
||||
*bufptr = (char) NULL;
|
||||
|
||||
do
|
||||
{
|
||||
@@ -678,7 +673,7 @@ static char *readbuf(volatile struct MAXv_motor *pmotor, char *bufptr)
|
||||
getIndex -= BUFFER_SIZE;
|
||||
|
||||
bufptr += (bufsize - 1);
|
||||
*bufptr = NULL;
|
||||
*bufptr = (char) NULL;
|
||||
|
||||
while (getIndex != pmotor->inPutIndex)
|
||||
{
|
||||
@@ -718,9 +713,10 @@ RTN_VALUES MAXvSetup(int num_cards, /* maximum number of cards in rack */
|
||||
{
|
||||
case 16:
|
||||
MAXv_ADDRS_TYPE = atVMEA16;
|
||||
if ((uint32_t) addrs & 0xFFFF0000)
|
||||
if ((epicsUInt32) addrs & 0xFFFF0000)
|
||||
{
|
||||
errlogPrintf("MAXvSetup(): invalid A16 address = 0x%X.\n", (uint_t) addrs);
|
||||
errlogPrintf("MAXvSetup(): invalid A16 address = 0x%X.\n",
|
||||
(epicsUInt32) addrs);
|
||||
rtnind = ERROR;
|
||||
}
|
||||
else
|
||||
@@ -728,9 +724,10 @@ RTN_VALUES MAXvSetup(int num_cards, /* maximum number of cards in rack */
|
||||
break;
|
||||
case 24:
|
||||
MAXv_ADDRS_TYPE = atVMEA24;
|
||||
if ((uint32_t) addrs & 0xF0000000)
|
||||
if ((epicsUInt32) addrs & 0xF0000000)
|
||||
{
|
||||
errlogPrintf("MAXvSetup(): invalid A24 address = 0x%X.\n", (uint_t) addrs);
|
||||
errlogPrintf("MAXvSetup(): invalid A24 address = 0x%X.\n",
|
||||
(epicsUInt32) addrs);
|
||||
rtnind = ERROR;
|
||||
}
|
||||
else
|
||||
@@ -741,14 +738,15 @@ RTN_VALUES MAXvSetup(int num_cards, /* maximum number of cards in rack */
|
||||
MAXv_addrs = (char *) addrs;
|
||||
break;
|
||||
default:
|
||||
errlogPrintf("MAXvSetup(): invalid VME address type = %d.\n", (uint_t) addrs_type);
|
||||
errlogPrintf("MAXvSetup(): invalid VME address type = %d.\n", addrs_type);
|
||||
rtnind = ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((uint32_t) addrs & 0x00000FFF)
|
||||
if ((epicsUInt32) addrs & 0x00000FFF)
|
||||
{
|
||||
errlogPrintf("MAXvSetup(): address = 0x%X, not aligned on 4K boundary.\n", (uint_t) addrs);
|
||||
errlogPrintf("MAXvSetup(): address = 0x%X, not aligned on 4K boundary.\n",
|
||||
(epicsUInt32) addrs);
|
||||
rtnind = ERROR;
|
||||
}
|
||||
|
||||
@@ -782,7 +780,7 @@ RTN_VALUES MAXvSetup(int num_cards, /* maximum number of cards in rack */
|
||||
for (itera = 0, strptr = &initstring[0]; itera < MAXv_num_cards; itera++, strptr++)
|
||||
{
|
||||
*strptr = (char *) malloc(INITSTR_SIZE);
|
||||
**strptr = NULL;
|
||||
**strptr = (char) NULL;
|
||||
}
|
||||
|
||||
return(rtnind);
|
||||
@@ -817,7 +815,7 @@ static void motorIsr(int card)
|
||||
|
||||
if (card >= total_cards || (pmotorState = motor_state[card]) == NULL)
|
||||
{
|
||||
logMsg((char *) "Invalid entry-card #%d\n", card, 0, 0, 0, 0, 0);
|
||||
errlogPrintf("Invalid entry-card #%d\n", card);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -832,8 +830,8 @@ static void motorIsr(int card)
|
||||
|
||||
}
|
||||
if (status1_flag.Bits.cmndError)
|
||||
logMsg((char *) "command error detected by motorISR() on card %d\n",
|
||||
card, 0, 0, 0, 0, 0);
|
||||
errlogPrintf("command error detected by motorISR() on card %d\n",
|
||||
card);
|
||||
|
||||
if (status1_flag.Bits.text_response != 0) /* Don't clear this. */
|
||||
status1_flag.Bits.text_response = 0;
|
||||
@@ -851,6 +849,8 @@ static int motorIsrSetup(int card)
|
||||
|
||||
pmotor = (struct MAXv_motor *) (motor_state[card]->localaddr);
|
||||
|
||||
#ifdef vxWorks
|
||||
|
||||
status = pdevLibVirtualOS->pDevConnectInterruptVME(
|
||||
MAXvInterruptVector + card, (void (*)()) motorIsr, (void *) card);
|
||||
|
||||
@@ -868,6 +868,8 @@ static int motorIsrSetup(int card)
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Setup card for interrupt-on-done */
|
||||
status1_irq.All = 0;
|
||||
status1_irq.Bits.done = 0xFF;
|
||||
@@ -913,7 +915,7 @@ static int motor_init()
|
||||
|
||||
total_cards = MAXv_num_cards;
|
||||
|
||||
if (rebootHookAdd((FUNCPTR) MAXv_reset) == ERROR)
|
||||
if (epicsAtExit(MAXv_reset, NULL) == ERROR)
|
||||
Debug(1, "MAXv motor_init: MAXv_reset disabled\n");
|
||||
|
||||
for (card_index = 0; card_index < MAXv_num_cards; card_index++)
|
||||
@@ -927,16 +929,19 @@ static int motor_init()
|
||||
startAddr = (int8_t *) probeAddr;
|
||||
endAddr = startAddr + MAXv_BRD_SIZE;
|
||||
|
||||
Debug(9, "motor_init: devNoResponseProbe() on addr 0x%x\n", (uint_t) probeAddr);
|
||||
Debug(9, "motor_init: devNoResponseProbe() on addr 0x%x\n",
|
||||
(epicsUInt32) probeAddr);
|
||||
/* Scan memory space to assure card id */
|
||||
#ifdef vxWorks
|
||||
do
|
||||
{
|
||||
status = devNoResponseProbe(MAXv_ADDRS_TYPE, (unsigned int) startAddr, 2);
|
||||
startAddr += 0x100;
|
||||
} while (PROBE_SUCCESS(status) && startAddr < endAddr);
|
||||
|
||||
#endif
|
||||
if (PROBE_SUCCESS(status))
|
||||
{
|
||||
#ifdef vxWorks
|
||||
status = devRegisterAddress(__FILE__, MAXv_ADDRS_TYPE,
|
||||
(size_t) probeAddr, MAXv_BRD_SIZE,
|
||||
(volatile void **) &localaddr);
|
||||
@@ -947,8 +952,9 @@ static int motor_init()
|
||||
(unsigned int) probeAddr);
|
||||
return (ERROR);
|
||||
}
|
||||
#endif
|
||||
|
||||
Debug(9, "motor_init: localaddr = %x\n", (uint_t) localaddr);
|
||||
Debug(9, "motor_init: localaddr = %x\n", (epicsUInt32) localaddr);
|
||||
pmotor = (struct MAXv_motor *) localaddr;
|
||||
|
||||
if (pmotor->firmware_status.Bits.running == 0)
|
||||
@@ -1064,7 +1070,8 @@ static int motor_init()
|
||||
recv_mess(card_index, axis_pos, 1);
|
||||
}
|
||||
|
||||
Debug(2, "motor_init: Init Address=0x%8.8x\n", (uint_t) localaddr);
|
||||
Debug(2, "motor_init: Init Address=0x%8.8x\n",
|
||||
(epicsUInt32) localaddr);
|
||||
Debug(3, "motor_init: Total encoders = %d\n", total_encoders);
|
||||
Debug(3, "motor_init: Total with PID = %d\n", total_pidcnt);
|
||||
}
|
||||
@@ -1091,7 +1098,7 @@ static int motor_init()
|
||||
|
||||
/* Deallocate memory for initialization strings. */
|
||||
for (itera = 0, strptr = &initstring[0]; itera < MAXv_num_cards; itera++, strptr++)
|
||||
cfree(*strptr);
|
||||
free(*strptr);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -1099,21 +1106,17 @@ static int motor_init()
|
||||
|
||||
/* Disables interrupts. Called on CTL X reboot. */
|
||||
|
||||
static void MAXv_reset()
|
||||
static void MAXv_reset(void *arg)
|
||||
{
|
||||
short card;
|
||||
volatile struct MAXv_motor *pmotor;
|
||||
short status;
|
||||
|
||||
for (card = 0; card < total_cards; card++)
|
||||
{
|
||||
if (motor_state[card] != NULL)
|
||||
{
|
||||
pmotor = (struct MAXv_motor *) motor_state[card]->localaddr;
|
||||
if (vxMemProbe((char *) pmotor, READ, sizeof(short), (char *) &status) == OK)
|
||||
{
|
||||
pmotor->status1_irq_enable.All = 0;
|
||||
}
|
||||
pmotor->status1_irq_enable.All = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+50
-50
@@ -2,9 +2,9 @@
|
||||
FILENAME... drvOms.cc
|
||||
USAGE... Driver level support for OMS models VME8, VME44 and VS4.
|
||||
|
||||
Version: $Revision: 1.20 $
|
||||
Version: $Revision: 1.21 $
|
||||
Modified By: $Author: sluiter $
|
||||
Last Modified: $Date: 2004-12-21 15:18:48 $
|
||||
Last Modified: $Date: 2005-03-23 22:16:12 $
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -67,6 +67,7 @@ Last Modified: $Date: 2004-12-21 15:18:48 $
|
||||
* - eliminate calls to devConnectInterrupt() due to C++
|
||||
* problems with devLib.h; i.e. "sorry, not implemented:
|
||||
* `tree_list' not supported..." compiler error message.
|
||||
* .11 03-23-05 rls - Make OSI.
|
||||
*/
|
||||
|
||||
/*========================stepper motor driver ========================
|
||||
@@ -86,17 +87,15 @@ Last Modified: $Date: 2004-12-21 15:18:48 $
|
||||
|
||||
========================stepper motor driver ========================*/
|
||||
|
||||
#include <vxLib.h>
|
||||
#include <sysLib.h>
|
||||
#include <string.h>
|
||||
#include <rebootLib.h>
|
||||
#include <logLib.h>
|
||||
#include <drvSup.h>
|
||||
#include <epicsVersion.h>
|
||||
#include <devLib.h>
|
||||
#include <dbAccess.h>
|
||||
#include <epicsThread.h>
|
||||
#include <epicsInterrupt.h>
|
||||
#include <epicsExit.h>
|
||||
#include <epicsEvent.h>
|
||||
|
||||
#include "motor.h"
|
||||
#include "drvOms.h"
|
||||
@@ -115,12 +114,17 @@ Last Modified: $Date: 2004-12-21 15:18:48 $
|
||||
#define DONE_QUERY "RA"
|
||||
|
||||
/*----------------debugging-----------------*/
|
||||
#ifdef DEBUG
|
||||
volatile int drvOMSdebug = 0;
|
||||
#define Debug(l, f, args...) { if(l<=drvOMSdebug) printf(f,## args); }
|
||||
#ifdef __GNUG__
|
||||
#ifdef DEBUG
|
||||
#define Debug(l, f, args...) {if (l <= drvOMSdebug) printf(f, ## args);}
|
||||
#else
|
||||
#define Debug(l, f, args...)
|
||||
#endif
|
||||
#else
|
||||
#define Debug(l, f, args...)
|
||||
#define Debug
|
||||
#endif
|
||||
volatile int drvOMSdebug = 0;
|
||||
extern "C" {epicsExportAddress(int, drvOMSdebug);}
|
||||
|
||||
/* Global data. */
|
||||
int oms44_num_cards = 0;
|
||||
@@ -146,7 +150,7 @@ static RTN_STATUS send_mess(int, char const *, char *);
|
||||
static int recv_mess(int, char *, int);
|
||||
static void motorIsr(int);
|
||||
static int motor_init();
|
||||
static void oms_reset();
|
||||
static void oms_reset(void *);
|
||||
|
||||
static int omsGet(int card, char *pcom, bool timeout);
|
||||
static RTN_STATUS omsPut(int card, char *pcom);
|
||||
@@ -202,7 +206,7 @@ static long report(int level)
|
||||
for (card = 0; card < oms44_num_cards; card++)
|
||||
if (motor_state[card])
|
||||
printf(" Oms VME8/44 motor card %d @ 0x%X, id: %s \n", card,
|
||||
(uint_t) motor_state[card]->localaddr,
|
||||
(epicsUInt32) motor_state[card]->localaddr,
|
||||
motor_state[card]->ident);
|
||||
}
|
||||
return (0);
|
||||
@@ -371,7 +375,7 @@ static int set_status(int card, int signal)
|
||||
|
||||
/* Copy device directive to buffer. */
|
||||
strncpy(buffer, nodeptr->postmsgptr, size);
|
||||
buffer[size] = NULL;
|
||||
buffer[size] = (char) NULL;
|
||||
|
||||
if (strncmp(buffer, "@PUT(", 5) != 0)
|
||||
goto errorexit;
|
||||
@@ -426,16 +430,14 @@ static RTN_STATUS send_mess(int card, char const *com, char *name)
|
||||
|
||||
if (strlen(com) > MAX_MSG_SIZE)
|
||||
{
|
||||
logMsg((char *) "drvOms.cc:send_mess(); message size violation.\n",
|
||||
0, 0, 0, 0, 0, 0);
|
||||
errlogPrintf("drvOms.cc:send_mess(); message size violation.\n");
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
/* Check that card exists */
|
||||
if (!motor_state[card])
|
||||
{
|
||||
logMsg((char *) "drvOms.cc:send_mess() - invalid card #%d\n", card,
|
||||
0, 0, 0, 0, 0);
|
||||
errlogPrintf("drvOms.cc:send_mess() - invalid card #%d\n", card);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
@@ -636,7 +638,7 @@ static int omsGet(int card, char *pchar, bool timeout)
|
||||
}
|
||||
if (!irqdata->recv_rng->isEmpty())
|
||||
{
|
||||
*pchar = (char) irqdata->recv_rng->pop();
|
||||
*pchar = (char) ((epicsUInt32) irqdata->recv_rng->pop() & 0xFF);
|
||||
getCnt = 1;
|
||||
}
|
||||
}
|
||||
@@ -679,13 +681,13 @@ static RTN_STATUS omsPut(int card, char *pmess)
|
||||
{
|
||||
putptr = pmess;
|
||||
/* Put string into isr transmitt buffer */
|
||||
while (*putptr != NULL)
|
||||
while (*putptr != (char) NULL)
|
||||
{
|
||||
char outchar = *putptr;
|
||||
if (!irqdata->send_rng->push((char *) outchar))
|
||||
{
|
||||
logMsg((char *) "omsPut: card %d send ring full, lost '%c'\n", card,
|
||||
*putptr, 0, 0, 0, 0);
|
||||
errlogPrintf("omsPut: card %d send ring full, lost '%c'\n",
|
||||
card, *putptr);
|
||||
return(ERROR);
|
||||
}
|
||||
putptr++;
|
||||
@@ -786,7 +788,7 @@ static void motorIsr(int card)
|
||||
|
||||
if (card >= total_cards || (pmotorState = motor_state[card]) == NULL)
|
||||
{
|
||||
logMsg((char *) "Invalid entry-card #%d\n", card, 0, 0, 0, 0, 0);
|
||||
errlogPrintf("Invalid entry-card #%d\n", card);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -806,8 +808,7 @@ static void motorIsr(int card)
|
||||
|
||||
#ifdef DEBUG
|
||||
if (drvOMSdebug >= 10)
|
||||
logMsg((char *) "entry card #%d,status=0x%X,done=0x%X\n", card,
|
||||
status, doneFlags, 0, 0, 0);
|
||||
errlogPrintf("entry card #%d,status=0x%X,done=0x%X\n", card, status, doneFlags);
|
||||
#endif
|
||||
|
||||
/* Motion done handling */
|
||||
@@ -823,8 +824,7 @@ static void motorIsr(int card)
|
||||
/* Send null character to indicate error */
|
||||
#ifdef DEBUG
|
||||
if (drvOMSdebug >= 1)
|
||||
logMsg((char *) "command error detected on card %d\n", card, 0, 0,
|
||||
0, 0, 0);
|
||||
errlogPrintf("command error detected on card %d\n", card);
|
||||
#endif
|
||||
irqdata->irqErrno |= STAT_ERROR;
|
||||
}
|
||||
@@ -835,7 +835,7 @@ static void motorIsr(int card)
|
||||
if (irqdata->send_rng->isEmpty())
|
||||
control &= ~IRQ_TRANS_BUF; /* Transmit done - disable irq */
|
||||
else
|
||||
pmotor->data = (char) irqdata->send_rng->pop();
|
||||
pmotor->data = (char) ((epicsUInt32) irqdata->send_rng->pop() & 0xFF);
|
||||
}
|
||||
|
||||
/* Read Response */
|
||||
@@ -845,8 +845,8 @@ static void motorIsr(int card)
|
||||
|
||||
if (!irqdata->recv_rng->push((char *) dataChar))
|
||||
{
|
||||
logMsg((char *) "card %d recv ring full, lost '%c'\n", card,
|
||||
dataChar, 0, 0, 0, 0);
|
||||
errlogPrintf("card %d recv ring full, lost '%c'\n", card,
|
||||
dataChar);
|
||||
irqdata->irqErrno |= STAT_INPUT_BUF_FULL;
|
||||
}
|
||||
irqdata->recv_sem->signal();
|
||||
@@ -869,7 +869,7 @@ static int motorIsrEnable(int card)
|
||||
irqdata = (struct irqdatastr *) pmotorState->DevicePrivate;
|
||||
pmotor = (struct vmex_motor *) (pmotorState->localaddr);
|
||||
|
||||
|
||||
#ifdef vxWorks
|
||||
status = pdevLibVirtualOS->pDevConnectInterruptVME(
|
||||
omsInterruptVector + card, (void (*)()) motorIsr, (void *) card);
|
||||
|
||||
@@ -894,6 +894,8 @@ static int motorIsrEnable(int card)
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Setup card for interrupt-on-done */
|
||||
pmotor->vector = omsInterruptVector + card;
|
||||
|
||||
@@ -910,7 +912,6 @@ static int motorIsrEnable(int card)
|
||||
|
||||
/* enable interrupt-when-done and input-buffer-full interrupts */
|
||||
pmotor->control = IRQ_ENABLE_ALL;
|
||||
|
||||
return (OK);
|
||||
}
|
||||
|
||||
@@ -930,8 +931,10 @@ static void motorIsrDisable(int card)
|
||||
/* Disable interrupts */
|
||||
pmotor->control = 0;
|
||||
|
||||
#ifdef vxWorks
|
||||
status = pdevLibVirtualOS->pDevDisconnectInterruptVME(
|
||||
omsInterruptVector + card, (void (*)(void *)) motorIsr);
|
||||
#endif
|
||||
|
||||
if (!RTN_SUCCESS(status))
|
||||
errPrintf(status, __FILE__, __LINE__, "Can't disconnect vector %d\n",
|
||||
@@ -963,9 +966,9 @@ int omsSetup(int num_cards, /* maximum number of cards in rack */
|
||||
oms44_num_cards = num_cards;
|
||||
|
||||
/* Check boundary(16byte) on base address */
|
||||
if ((uint32_t) addrs & 0xF)
|
||||
if ((epicsUInt32) addrs & 0xF)
|
||||
{
|
||||
Debug(1, "omsSetup: invalid base address 0x%X\n", (uint_t) addrs);
|
||||
Debug(1, "omsSetup: invalid base address 0x%X\n", (epicsUInt32) addrs);
|
||||
oms_addrs = (char *) OMS_NUM_ADDRS;
|
||||
}
|
||||
else
|
||||
@@ -1033,10 +1036,10 @@ static int motor_init()
|
||||
/* allocate structure space for each motor present */
|
||||
|
||||
total_cards = oms44_num_cards;
|
||||
|
||||
if (rebootHookAdd((FUNCPTR) oms_reset) == ERROR)
|
||||
|
||||
if (epicsAtExit(oms_reset, NULL) == ERROR)
|
||||
Debug(1, "vme8/44 motor_init: oms_reset disabled\n");
|
||||
|
||||
|
||||
for (card_index = 0; card_index < oms44_num_cards; card_index++)
|
||||
{
|
||||
int8_t *startAddr;
|
||||
@@ -1048,18 +1051,21 @@ static int motor_init()
|
||||
startAddr = (int8_t *) probeAddr + 1;
|
||||
endAddr = startAddr + OMS_BRD_SIZE;
|
||||
|
||||
Debug(9, "motor_init: devNoResponseProbe() on addr 0x%x\n", (uint_t) probeAddr);
|
||||
Debug(9, "motor_init: devNoResponseProbe() on addr 0x%x\n",
|
||||
(epicsUInt32) probeAddr);
|
||||
/* Scan memory space to assure card id */
|
||||
#ifdef vxWorks
|
||||
do
|
||||
{
|
||||
status = devNoResponseProbe(OMS_ADDRS_TYPE, (unsigned int) startAddr, 1);
|
||||
startAddr += 0x2;
|
||||
} while (PROBE_SUCCESS(status) && startAddr < endAddr);
|
||||
|
||||
#endif
|
||||
if (PROBE_SUCCESS(status))
|
||||
{
|
||||
struct irqdatastr *irqdata;
|
||||
|
||||
#ifdef vxWorks
|
||||
status = devRegisterAddress(__FILE__, OMS_ADDRS_TYPE,
|
||||
(size_t) probeAddr, OMS_BRD_SIZE,
|
||||
(volatile void **) &localaddr);
|
||||
@@ -1071,8 +1077,8 @@ static int motor_init()
|
||||
"Can't register address 0x%x\n", (unsigned) probeAddr);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
Debug(9, "motor_init: localaddr = %x\n", (int) localaddr);
|
||||
#endif
|
||||
Debug(9, "motor_init: localaddr = %x\n", (epicsUInt32) localaddr);
|
||||
pmotor = (struct vmex_motor *) localaddr;
|
||||
|
||||
Debug(9, "motor_init: malloc'ing motor_state\n");
|
||||
@@ -1149,8 +1155,8 @@ static int motor_init()
|
||||
set_status(card_index, motor_index);
|
||||
}
|
||||
|
||||
Debug(2, "Init Address=0x%08.8x\n", (uint_t) localaddr);
|
||||
Debug(3, "Total encoders = %d\n\n", (int) total_encoders);
|
||||
Debug(2, "Init Address=0x%8.8x\n", (epicsUInt32) localaddr);
|
||||
Debug(3, "Total encoders = %d\n\n", total_encoders);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1177,23 +1183,17 @@ static int motor_init()
|
||||
|
||||
/* Disables interrupts. Called on CTL X reboot. */
|
||||
|
||||
static void oms_reset()
|
||||
static void oms_reset(void *arg)
|
||||
{
|
||||
short card;
|
||||
struct vmex_motor *pmotor;
|
||||
short status;
|
||||
|
||||
for (card = 0; card < total_cards; card++)
|
||||
{
|
||||
if (motor_state[card] != NULL)
|
||||
{
|
||||
char *memptr, byteread;
|
||||
|
||||
pmotor = (struct vmex_motor *) motor_state[card]->localaddr;
|
||||
memptr = (char *) &pmotor->data;
|
||||
status = vxMemProbe(memptr, READ, sizeof(char), (char *) &byteread);
|
||||
if (status == OK)
|
||||
pmotor->control = 0; /* Disable all interrupts. */
|
||||
pmotor->control = 0; /* Disable all interrupts. */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+59
-55
@@ -2,9 +2,9 @@
|
||||
FILENAME... drvOms58.cc
|
||||
USAGE... Motor record driver level support for OMS model VME58.
|
||||
|
||||
Version: $Revision: 1.13 $
|
||||
Version: $Revision: 1.14 $
|
||||
Modified By: $Author: sluiter $
|
||||
Last Modified: $Date: 2004-12-21 15:19:34 $
|
||||
Last Modified: $Date: 2005-03-23 22:16:12 $
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -86,20 +86,17 @@ Last Modified: $Date: 2004-12-21 15:19:34 $
|
||||
* - eliminate calls to devConnectInterrupt() due to C++
|
||||
* problems with devLib.h; i.e. "sorry, not implemented:
|
||||
* `tree_list' not supported..." compiler error message.
|
||||
* .30 03-23-05 rls - Make OSI.
|
||||
*/
|
||||
|
||||
#include <vxLib.h>
|
||||
#include <sysLib.h>
|
||||
#include <string.h>
|
||||
#include <rebootLib.h>
|
||||
#include <logLib.h>
|
||||
#include <taskLib.h>
|
||||
#include <dbCommon.h>
|
||||
#include <drvSup.h>
|
||||
#include <epicsVersion.h>
|
||||
#include <devLib.h>
|
||||
#include <dbAccess.h>
|
||||
#include <epicsThread.h>
|
||||
#include <epicsExit.h>
|
||||
|
||||
#include "motorRecord.h" /* For Driver Power Monitor feature only. */
|
||||
#include "motor.h"
|
||||
@@ -123,14 +120,20 @@ Last Modified: $Date: 2004-12-21 15:19:34 $
|
||||
|
||||
|
||||
/*----------------debugging-----------------*/
|
||||
#ifdef DEBUG
|
||||
volatile int drvOms58debug = 0;
|
||||
#define Debug(l, f, args...) { if(l<=drvOms58debug) printf(f,## args); }
|
||||
#else
|
||||
#ifdef __GNUG__
|
||||
#ifdef DEBUG
|
||||
#define Debug(l, f, args...) {if (l <= drvOms58debug) \
|
||||
errlogPrintf(f, ## args);}
|
||||
#else
|
||||
#define Debug(l, f, args...)
|
||||
#endif
|
||||
#else
|
||||
#define Debug
|
||||
#endif
|
||||
volatile int drvOms58debug = 0;
|
||||
extern "C" {epicsExportAddress(int, drvOms58debug);}
|
||||
|
||||
#define pack2x16(p) ((uint32_t)(((p[0])<<16)|(p[1])))
|
||||
#define pack2x16(p) ((epicsUInt32)(((p[0])<<16)|(p[1])))
|
||||
|
||||
/* Global data. */
|
||||
int oms58_num_cards = 0;
|
||||
@@ -145,6 +148,7 @@ static volatile epicsUInt8 omsInterruptLevel = OMS_INT_LEVEL;
|
||||
static volatile int max_io_tries = MAX_COUNT;
|
||||
static volatile int motionTO = 10;
|
||||
static char *oms58_axis[] = {"X", "Y", "Z", "T", "U", "V", "R", "S"};
|
||||
static double quantum;
|
||||
|
||||
/*----------------functions-----------------*/
|
||||
|
||||
@@ -157,7 +161,7 @@ static RTN_STATUS send_mess(int, char const *, char *);
|
||||
static int recv_mess(int, char *, int);
|
||||
static void motorIsr(int card);
|
||||
static int motor_init();
|
||||
static void oms_reset();
|
||||
static void oms_reset(void *);
|
||||
|
||||
static void start_status(int card);
|
||||
static int motorIsrSetup(int card);
|
||||
@@ -215,7 +219,7 @@ static long report(int level)
|
||||
printf(" Oms Vme58 motor card #%d not found.\n", card);
|
||||
else
|
||||
printf(" Oms Vme58 motor card #%d @ 0x%X, id: %s \n", card,
|
||||
(uint_t) brdptr->localaddr,
|
||||
(epicsUInt32) brdptr->localaddr,
|
||||
brdptr->ident);
|
||||
}
|
||||
}
|
||||
@@ -239,7 +243,7 @@ static void query_done(int card, int axis, struct mess_node *nodeptr)
|
||||
|
||||
#if (CPU == PPC604 || CPU == PPC603)
|
||||
if (strcmp(motor_state[card]->ident, "VME58 ver 2.35-8") == 0)
|
||||
taskDelay(1); /* Work around for intermittent wrong LS status. */
|
||||
epicsThreadSleep(quantum * 2.0); /* Work around for intermittent wrong LS status. */
|
||||
#endif
|
||||
|
||||
if (nodeptr->status.Bits.RA_PROBLEM)
|
||||
@@ -269,7 +273,7 @@ static void start_status(int card)
|
||||
while(cntrlReg.Bits.update != 0)
|
||||
{
|
||||
Debug(1, "start_status(): Update Wait: card #%d\n", card);
|
||||
taskDelay(0);
|
||||
epicsThreadSleep(quantum);
|
||||
cntrlReg.All = pmotor->control.cntrlReg;
|
||||
};
|
||||
|
||||
@@ -289,7 +293,7 @@ static void start_status(int card)
|
||||
while(cntrlReg.Bits.update != 0)
|
||||
{
|
||||
Debug(1, "start_status(): Update Wait: card #%d\n", index);
|
||||
taskDelay(0);
|
||||
epicsThreadSleep(quantum);
|
||||
cntrlReg.All = pmotor->control.cntrlReg;
|
||||
};
|
||||
|
||||
@@ -437,7 +441,7 @@ static int set_status(int card, int signal)
|
||||
|
||||
/* Wait for data area update to complete on card */
|
||||
while (cntrlReg.All & pmotor->control.cntrlReg)
|
||||
taskDelay(0);
|
||||
epicsThreadSleep(quantum);
|
||||
|
||||
pmotorData = &pmotor->data[signal];
|
||||
|
||||
@@ -491,8 +495,8 @@ static int set_status(int card, int signal)
|
||||
{
|
||||
status.Bits.RA_PLUS_LS = 1; /* Turn on both limit switches. */
|
||||
status.Bits.RA_MINUS_LS = 1;
|
||||
logMsg((char *) "Drive power failure at VME58 card#%d motor#%d\n",
|
||||
card, signal, 0, 0, 0, 0);
|
||||
errlogPrintf("Drive power failure at VME58 card#%d motor#%d\n",
|
||||
card, signal);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -521,7 +525,7 @@ static int set_status(int card, int signal)
|
||||
|
||||
/* Copy device directive to buffer. */
|
||||
strncpy(buffer, nodeptr->postmsgptr, size);
|
||||
buffer[size] = NULL;
|
||||
buffer[size] = (char) NULL;
|
||||
|
||||
if (strncmp(buffer, "@PUT(", 5) != 0)
|
||||
goto errorexit;
|
||||
@@ -591,21 +595,19 @@ static RTN_STATUS send_mess(int card, char const *com, char *name)
|
||||
|
||||
if (strlen(com) > MAX_MSG_SIZE)
|
||||
{
|
||||
logMsg((char *) "drvOms58.cc:send_mess(); message size violation.\n",
|
||||
0, 0, 0, 0, 0, 0);
|
||||
errlogPrintf("drvOms58.cc:send_mess(); message size violation.\n");
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
/* Check that card exists */
|
||||
if (!motor_state[card])
|
||||
{
|
||||
logMsg((char *) "drvOms58.cc:send_mess() - invalid card #%d\n", card,
|
||||
0, 0, 0, 0, 0);
|
||||
errlogPrintf("drvOms58.cc:send_mess() - invalid card #%d\n", card);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
pmotor = (struct vmex_motor *) motor_state[card]->localaddr;
|
||||
Debug(9, "send_mess: pmotor = %x\n", (uint_t) pmotor);
|
||||
Debug(9, "send_mess: pmotor = %x\n", (epicsUInt32) pmotor);
|
||||
|
||||
return_code = OK;
|
||||
|
||||
@@ -649,12 +651,14 @@ static RTN_STATUS send_mess(int card, char const *com, char *name)
|
||||
|
||||
while (pmotor->outPutIndex != pmotor->outGetIndex)
|
||||
{
|
||||
epicsInt16 deltaIndex;
|
||||
|
||||
Debug(5, "send_mess: Waiting for ack: index delta=%d\n",
|
||||
(((deltaIndex = pmotor->outPutIndex - pmotor->outGetIndex) < 0) ?
|
||||
BUFFER_SIZE + deltaIndex : deltaIndex));
|
||||
taskDelay(0);
|
||||
#ifdef DEBUG
|
||||
epicsInt16 deltaIndex, delta;
|
||||
|
||||
deltaIndex = pmotor->outPutIndex - pmotor->outGetIndex;
|
||||
delta = (deltaIndex < 0) ? BUFFER_SIZE + deltaIndex : deltaIndex;
|
||||
Debug(5, "send_mess: Waiting for ack: index delta=%d\n", delta);
|
||||
#endif
|
||||
epicsThreadSleep(quantum);
|
||||
};
|
||||
|
||||
return (return_code);
|
||||
@@ -825,9 +829,9 @@ int oms58Setup(int num_cards, /* maximum number of cards in rack */
|
||||
oms58_num_cards = num_cards;
|
||||
|
||||
/* Check range and boundary(4K) on base address */
|
||||
if (addrs > (void *) 0xF000 || ((uint32_t) addrs & 0xFFF))
|
||||
if (addrs > (void *) 0xF000 || ((epicsUInt32) addrs & 0xFFF))
|
||||
{
|
||||
Debug(1, "omsSetup: invalid base address 0x%X\n", (uint_t) addrs);
|
||||
Debug(1, "omsSetup: invalid base address 0x%X\n", (epicsUInt32) addrs);
|
||||
oms_addrs = (char *) OMS_NUM_ADDRS;
|
||||
}
|
||||
else
|
||||
@@ -873,7 +877,7 @@ static void motorIsr(int card)
|
||||
|
||||
if (card >= total_cards || (pmotorState = motor_state[card]) == NULL)
|
||||
{
|
||||
logMsg((char *) "Invalid entry-card #%d\n", card, 0, 0, 0, 0, 0);
|
||||
errlogPrintf("Invalid entry-card #%d\n", card);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -907,8 +911,8 @@ static void motorIsr(int card)
|
||||
|
||||
#ifdef DEBUG
|
||||
if (drvOms58debug >= 10)
|
||||
logMsg((char *) "entry card #%d,status=0x%X,done=0x%X\n", card,
|
||||
statusBuf.All, doneFlags, 0, 0, 0);
|
||||
errlogPrintf("entry card #%d,status=0x%X,done=0x%X\n", card,
|
||||
statusBuf.All, doneFlags);
|
||||
#endif
|
||||
|
||||
/* Motion done handling */
|
||||
@@ -917,12 +921,12 @@ static void motorIsr(int card)
|
||||
motor_sem.signal();
|
||||
|
||||
if (statusBuf.Bits.cmndError)
|
||||
logMsg((char *) "command error detected by motorISR() on card %d\n",
|
||||
card, 0, 0, 0, 0, 0);
|
||||
errlogPrintf("command error detected by motorISR() on card %d\n", card);
|
||||
}
|
||||
|
||||
static int motorIsrSetup(int card)
|
||||
{
|
||||
#ifdef vxWorks
|
||||
volatile struct vmex_motor *pmotor;
|
||||
long status;
|
||||
CNTRL_REG cntrlBuf;
|
||||
@@ -963,6 +967,7 @@ static int motorIsrSetup(int card)
|
||||
cntrlBuf.Bits.intReqEna = 1;
|
||||
|
||||
pmotor->control.cntrlReg = cntrlBuf.All;
|
||||
#endif
|
||||
return (OK);
|
||||
}
|
||||
|
||||
@@ -985,6 +990,7 @@ static int motor_init()
|
||||
void *probeAddr;
|
||||
|
||||
tok_save = NULL;
|
||||
quantum = epicsThreadSleepQuantum();
|
||||
|
||||
/* Check for setup */
|
||||
if (oms58_num_cards <= 0)
|
||||
@@ -1001,7 +1007,7 @@ static int motor_init()
|
||||
|
||||
total_cards = oms58_num_cards;
|
||||
|
||||
if (rebootHookAdd((FUNCPTR) oms_reset) == ERROR)
|
||||
if (epicsAtExit(oms_reset, NULL) == ERROR)
|
||||
Debug(1, "vme58 motor_init: oms_reset disabled\n");
|
||||
|
||||
for (card_index = 0; card_index < oms58_num_cards; card_index++)
|
||||
@@ -1015,16 +1021,18 @@ static int motor_init()
|
||||
startAddr = (int8_t *) probeAddr;
|
||||
endAddr = startAddr + OMS_BRD_SIZE;
|
||||
|
||||
Debug(9, "motor_init: devNoResponseProbe() on addr 0x%x\n", (uint_t) probeAddr);
|
||||
Debug(9, "motor_init: devNoResponseProbe() on addr 0x%x\n", (epicsUInt32) probeAddr);
|
||||
/* Scan memory space to assure card id */
|
||||
#ifdef vxWorks
|
||||
do
|
||||
{
|
||||
status = devNoResponseProbe(OMS_ADDRS_TYPE, (unsigned int) startAddr, 2);
|
||||
startAddr += 0x100;
|
||||
} while (PROBE_SUCCESS(status) && startAddr < endAddr);
|
||||
|
||||
#endif
|
||||
if (PROBE_SUCCESS(status))
|
||||
{
|
||||
#ifdef vxWorks
|
||||
status = devRegisterAddress(__FILE__, OMS_ADDRS_TYPE,
|
||||
(size_t) probeAddr, OMS_BRD_SIZE,
|
||||
(volatile void **) &localaddr);
|
||||
@@ -1035,8 +1043,8 @@ static int motor_init()
|
||||
(unsigned int) probeAddr);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
Debug(9, "motor_init: localaddr = %x\n", (uint_t) localaddr);
|
||||
#endif
|
||||
Debug(9, "motor_init: localaddr = %x\n", (epicsUInt32) localaddr);
|
||||
pmotor = (struct vmex_motor *) localaddr;
|
||||
|
||||
Debug(9, "motor_init: malloc'ing motor_state\n");
|
||||
@@ -1078,7 +1086,7 @@ static int motor_init()
|
||||
/* Test if motor has an encoder. */
|
||||
send_mess(card_index, ENCODER_QUERY, oms58_axis[motor_index]);
|
||||
while (!pmotor->control.doneReg) /* Wait for command to complete. */
|
||||
taskDelay(1);
|
||||
epicsThreadSleep(quantum * 2.0);
|
||||
|
||||
statusReg.All = pmotor->control.statusReg;
|
||||
|
||||
@@ -1098,7 +1106,7 @@ static int motor_init()
|
||||
send_mess(card_index, PID_QUERY, oms58_axis[motor_index]);
|
||||
do /* Wait for command to complete. */
|
||||
{
|
||||
taskDelay(1);
|
||||
epicsThreadSleep(quantum);
|
||||
statusReg.All = pmotor->control.statusReg;
|
||||
} while(statusReg.Bits.done == 0);
|
||||
|
||||
@@ -1141,7 +1149,7 @@ static int motor_init()
|
||||
recv_mess(card_index, axis_pos, 1);
|
||||
}
|
||||
|
||||
Debug(2, "motor_init: Init Address=0x%08.8x\n", (uint_t) localaddr);
|
||||
Debug(2, "motor_init: Init Address=0x%8.8x\n", (epicsUInt32) localaddr);
|
||||
Debug(3, "motor_init: Total encoders = %d\n", total_encoders);
|
||||
Debug(3, "motor_init: Total with PID = %d\n", total_pidcnt);
|
||||
}
|
||||
@@ -1171,11 +1179,10 @@ static int motor_init()
|
||||
|
||||
/* Disables interrupts. Called on CTL X reboot. */
|
||||
|
||||
static void oms_reset()
|
||||
static void oms_reset(void *arg)
|
||||
{
|
||||
short card;
|
||||
volatile struct vmex_motor *pmotor;
|
||||
short status;
|
||||
CNTRL_REG cntrlBuf;
|
||||
|
||||
for (card = 0; card < total_cards; card++)
|
||||
@@ -1183,12 +1190,9 @@ static void oms_reset()
|
||||
if (motor_state[card] != NULL)
|
||||
{
|
||||
pmotor = (struct vmex_motor *) motor_state[card]->localaddr;
|
||||
if (vxMemProbe((char *) pmotor, READ, sizeof(short), (char *) &status) == OK)
|
||||
{
|
||||
cntrlBuf.All = pmotor->control.cntrlReg;
|
||||
cntrlBuf.Bits.intReqEna = 0;
|
||||
pmotor->control.cntrlReg = cntrlBuf.All;
|
||||
}
|
||||
cntrlBuf.All = pmotor->control.cntrlReg;
|
||||
cntrlBuf.Bits.intReqEna = 0;
|
||||
pmotor->control.cntrlReg = cntrlBuf.All;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user