forked from epics_driver_modules/motorBase
New file for Newport XPSC8 controller
This commit is contained in:
Executable
+244
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
DESCRIPTION
|
||||
This module implements a client which periodically
|
||||
sends a request to the slave spawned by a concurrent
|
||||
server. This code illustrates how many clients
|
||||
to be handled in parallel if the server has a
|
||||
concurrent architecture.
|
||||
*/
|
||||
|
||||
/* includes */
|
||||
|
||||
#ifdef vxWorks
|
||||
#else
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
typedef int BOOL;
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <osiSock.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <time.h>
|
||||
|
||||
/* defines */
|
||||
|
||||
#define MAX_MSG_SIZE 80
|
||||
#define TIMEOUT 0.5
|
||||
#define SIZEBUFFER 256
|
||||
#define CONNREFUSED -1
|
||||
#define CREATESOCKETFAILED -2
|
||||
#define OPTREFUSED -3
|
||||
|
||||
#define MAX_NB_SOCKETS 100
|
||||
|
||||
/* typedefs */
|
||||
|
||||
typedef int SOCK_FD;
|
||||
|
||||
/* global variables */
|
||||
|
||||
SOCK_FD sockFd[MAX_NB_SOCKETS];
|
||||
BOOL UsedSocket[MAX_NB_SOCKETS] = { FALSE };
|
||||
double TimeoutSocket[MAX_NB_SOCKETS];
|
||||
int ErrorSocket[MAX_NB_SOCKETS];
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************************************************************************/
|
||||
int ConnectToServer(char *Ip_Address, int Ip_Port, double TimeOut)
|
||||
{
|
||||
/* printf("Socket.cpp ConnectToServer: Top/n");*/
|
||||
int flag = 1;
|
||||
u_long srvInet;
|
||||
struct sockaddr_in srvAddr;
|
||||
int SocketIndex = 0;
|
||||
|
||||
int status;
|
||||
char * optval=0;
|
||||
osiSocklen_t optlen;
|
||||
status = getsockopt (SocketIndex,IPPROTO_TCP,TCP_NODELAY, optval, &optlen);
|
||||
|
||||
/* Select a free socket */
|
||||
while ((UsedSocket[SocketIndex] == TRUE) && (SocketIndex < MAX_NB_SOCKETS))
|
||||
{
|
||||
SocketIndex++;
|
||||
}
|
||||
|
||||
if (SocketIndex == MAX_NB_SOCKETS)
|
||||
return -1;
|
||||
|
||||
/* Create socket */
|
||||
ErrorSocket[SocketIndex] = 0;
|
||||
if ((sockFd[SocketIndex] = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0 )
|
||||
{
|
||||
ErrorSocket[SocketIndex] = CREATESOCKETFAILED;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Convert the server's IP address from ASCII dot notation to */
|
||||
/* a network byte-ordered integer */
|
||||
srvInet = inet_addr (Ip_Address);
|
||||
|
||||
/* Initialize servers address */
|
||||
memset ((char *)&srvAddr, 0, sizeof(srvAddr));
|
||||
srvAddr.sin_family = AF_INET;
|
||||
srvAddr.sin_port = htons (Ip_Port);
|
||||
srvAddr.sin_addr.s_addr = srvInet;
|
||||
|
||||
if (setsockopt (sockFd[SocketIndex],
|
||||
IPPROTO_TCP,
|
||||
TCP_NODELAY,
|
||||
(char *)&flag,
|
||||
(int)sizeof(flag)) != 0 )
|
||||
{
|
||||
ErrorSocket[SocketIndex] = OPTREFUSED;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Connect to server */
|
||||
if (connect(sockFd[SocketIndex], (sockaddr *)&srvAddr, sizeof(srvAddr)) < 0)
|
||||
{
|
||||
ErrorSocket[SocketIndex] = CONNREFUSED;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (TimeOut > 0) TimeoutSocket[SocketIndex] = TimeOut;
|
||||
else TimeoutSocket[SocketIndex] = TIMEOUT;
|
||||
UsedSocket[SocketIndex] = TRUE;
|
||||
|
||||
return SocketIndex;
|
||||
}
|
||||
|
||||
/***************************************************************************************/
|
||||
void SetTCPTimeout(int SocketIndex, double TimeOut)
|
||||
{
|
||||
if ((SocketIndex >= 0) && (SocketIndex < MAX_NB_SOCKETS) && (UsedSocket[SocketIndex] == TRUE))
|
||||
{
|
||||
if (TimeOut > 0) TimeoutSocket[SocketIndex] = TimeOut;
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************************/
|
||||
void SendAndReceive (int SocketIndex, char *buffer, char *valueRtrn)
|
||||
{
|
||||
char pBuf[SIZEBUFFER]={'\0'};
|
||||
int iRvcd=0;
|
||||
clock_t start, finish;
|
||||
double timeEllapse = 0.0;
|
||||
|
||||
if ((SocketIndex >= 0) && (SocketIndex < MAX_NB_SOCKETS) && (UsedSocket[SocketIndex] == TRUE))
|
||||
{
|
||||
/* Send String to controller and wait for response */
|
||||
|
||||
write (sockFd[SocketIndex], buffer, strlen(buffer) + 1);
|
||||
/* printf("SendAndRecieve after write\n");*/
|
||||
/* Read error ? */
|
||||
iRvcd = read (sockFd[SocketIndex], pBuf, SIZEBUFFER);
|
||||
start = clock();
|
||||
/* printf("SendAndRecieve after read\n");*/
|
||||
|
||||
while ((iRvcd <= 0) && (timeEllapse < TimeoutSocket[SocketIndex]))
|
||||
{
|
||||
iRvcd = read (sockFd[SocketIndex], pBuf, SIZEBUFFER);
|
||||
finish = clock();
|
||||
timeEllapse = (double)(finish - start) / CLOCKS_PER_SEC;
|
||||
/* waiting ... */
|
||||
}
|
||||
}
|
||||
if (iRvcd > 0) pBuf[iRvcd] = '\0';
|
||||
strcpy(valueRtrn, pBuf);
|
||||
}
|
||||
/***************************************************************************************/
|
||||
void SendOnly (int SocketIndex, char *buffer, char *valueRtrn)
|
||||
{
|
||||
char pBuf[SIZEBUFFER]={'\0'};
|
||||
int iRvcd=0;
|
||||
clock_t start, finish;
|
||||
double timeEllapse = 0.0;
|
||||
|
||||
if ((SocketIndex >= 0) && (SocketIndex < MAX_NB_SOCKETS) && (UsedSocket[SocketIndex] == TRUE))
|
||||
{
|
||||
/* Send String to controller and wait for response */
|
||||
|
||||
write (sockFd[SocketIndex], buffer, strlen(buffer) + 1);
|
||||
/* printf("---------------------SendOnly after write\n");*/
|
||||
/* Read error ? */
|
||||
/* iRvcd = read (sockFd[SocketIndex], pBuf, SIZEBUFFER);
|
||||
start = clock();
|
||||
printf("SendAndRecieve after read\n");
|
||||
|
||||
while ((iRvcd <= 0) && (timeEllapse < TimeoutSocket[SocketIndex]))
|
||||
{
|
||||
iRvcd = read (sockFd[SocketIndex], pBuf, SIZEBUFFER);
|
||||
finish = clock();
|
||||
timeEllapse = (double)(finish - start) / CLOCKS_PER_SEC;
|
||||
|
||||
}*/
|
||||
}
|
||||
/*if (iRvcd > 0) pBuf[iRvcd] = '\0';*/
|
||||
pBuf[iRvcd] = '\0';
|
||||
strcpy(valueRtrn, pBuf);
|
||||
}
|
||||
|
||||
/***************************************************************************************/
|
||||
void CloseSocket(int SocketIndex)
|
||||
{
|
||||
if ((SocketIndex >= 0) && (SocketIndex < MAX_NB_SOCKETS) && (UsedSocket[SocketIndex] == TRUE))
|
||||
{
|
||||
close (sockFd[SocketIndex]);
|
||||
TimeoutSocket[SocketIndex] = TIMEOUT;
|
||||
ErrorSocket[SocketIndex] = 0;
|
||||
UsedSocket[SocketIndex] = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************************/
|
||||
void CloseAllSockets(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < MAX_NB_SOCKETS; i++)
|
||||
{
|
||||
if (UsedSocket[i] == TRUE)
|
||||
{
|
||||
close (sockFd[i]);
|
||||
TimeoutSocket[i] = TIMEOUT;
|
||||
ErrorSocket[i] = 0;
|
||||
UsedSocket[i] = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************************/
|
||||
void ResetAllSockets(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < MAX_NB_SOCKETS; i++)
|
||||
{
|
||||
if (UsedSocket[i] == TRUE)
|
||||
UsedSocket[i] = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************/
|
||||
char * GetError(int SocketIndex)
|
||||
{
|
||||
if ((SocketIndex >= 0) && (SocketIndex < MAX_NB_SOCKETS) && (UsedSocket[SocketIndex] == TRUE))
|
||||
{
|
||||
switch (ErrorSocket[SocketIndex])
|
||||
{
|
||||
case CONNREFUSED: return("The attempt to connect was rejected.");
|
||||
case CREATESOCKETFAILED: return("Create Socket failed.");
|
||||
case OPTREFUSED: return("SetSockOption() Refused.");
|
||||
}
|
||||
}
|
||||
return("");
|
||||
}
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
|
||||
int ConnectToServer (char *Ip_Address, int Ip_Port, double Timeout);
|
||||
void SetTCPTimeout(int SocketIndex, double TimeOut);
|
||||
void SendAndReceive (int SocketIndex, char *buffer, char *valueRtrn);
|
||||
void SendOnly (int SocketIndex, char *buffer, char *valueRtrn);
|
||||
void CloseSocket (int SocketIndex);
|
||||
void CloseAllSockets (void);
|
||||
void ResetAllSockets (void);
|
||||
char * GetError (int SocketIndex);
|
||||
Executable
+437
@@ -0,0 +1,437 @@
|
||||
/* File: devXPSC8.cc */
|
||||
|
||||
/* Device Support Routines for motor record for XPS C8 Motor Controller */
|
||||
/*
|
||||
* Original Author: Jon Kelly
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define VERSION 1.00
|
||||
|
||||
#include <string.h>
|
||||
#include <epicsMutex.h>
|
||||
#include <epicsExport.h>
|
||||
#include <epicsThread.h>
|
||||
#include "motorRecord.h"
|
||||
#include "motor.h"
|
||||
#include "motordevCom.h"
|
||||
#include "drvXPSC8.h"
|
||||
|
||||
/*#define DLL _declspec(dllexport)*/
|
||||
#include "xps_c8_driver.h"
|
||||
|
||||
#define STATIC static
|
||||
extern struct driver_table XPSC8_access;
|
||||
|
||||
#define NINT(f) (long)((f)>0 ? (f)+0.5 : (f)-0.5)
|
||||
#define MIN(a,b) ((a)<(b) ? (a) : (b))
|
||||
#define ABS(f) ((f)>0 ? (f) : -(f))
|
||||
|
||||
#define MOVING 1
|
||||
|
||||
|
||||
#ifdef NODEBUG
|
||||
#define Debug(L,FMT,V) ;
|
||||
#else
|
||||
volatile int devXPSC8Debug = 0;
|
||||
epicsExportAddress(int, devXPSC8Debug);
|
||||
/* To make the var available to the shell */
|
||||
|
||||
#define Debug(L,FMT,V...) { if(L <= devXPSC8Debug) \
|
||||
{ printf("%s(%d):",__FILE__,__LINE__); \
|
||||
printf(FMT,##V); } }
|
||||
#endif
|
||||
|
||||
/* Debugging levels:
|
||||
* devXPSC8Debug >= 3 Print new part of command and command string so far
|
||||
* at the end of XPSC8_build_trans
|
||||
*/
|
||||
|
||||
|
||||
/* ----------------Create the dsets for devXPSC8----------------- */
|
||||
STATIC struct driver_table *drvtabptr;
|
||||
STATIC long XPSC8_init(int);
|
||||
STATIC long XPSC8_init_record(struct motorRecord *);
|
||||
STATIC long XPSC8_start_trans(struct motorRecord *);
|
||||
STATIC RTN_STATUS XPSC8_build_trans(motor_cmnd, double *, struct motorRecord *);
|
||||
STATIC RTN_STATUS XPSC8_end_trans(struct motorRecord *);
|
||||
|
||||
struct motor_dset devXPSC8 =
|
||||
{
|
||||
{8, NULL, (DEVSUPFUN)XPSC8_init, (DEVSUPFUN)XPSC8_init_record, NULL},
|
||||
motor_update_values,
|
||||
XPSC8_start_trans,
|
||||
XPSC8_build_trans,
|
||||
XPSC8_end_trans
|
||||
};
|
||||
epicsExportAddress(dset,devXPSC8);
|
||||
|
||||
|
||||
/* --------------------------- program data --------------------- */
|
||||
/* This table is used to define the command types */
|
||||
|
||||
static msg_types XPSC8_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 */
|
||||
};
|
||||
|
||||
|
||||
static struct board_stat **XPSC8_cards;
|
||||
|
||||
/* --------------------------- program data --------------------- */
|
||||
|
||||
|
||||
|
||||
/* initialize device support for XPSC8 stepper motor */
|
||||
STATIC long XPSC8_init(int after)
|
||||
{
|
||||
long rtnval;
|
||||
|
||||
Debug(1, "XPSC8_init, after=%d\n", after);
|
||||
if (after == 0) {
|
||||
drvtabptr = &XPSC8_access;
|
||||
Debug(1, "XPSC8_init, calling driver initialization\n");
|
||||
(drvtabptr->init)();
|
||||
}
|
||||
|
||||
rtnval = motor_init_com(after, *drvtabptr->cardcnt_ptr, drvtabptr,
|
||||
&XPSC8_cards);
|
||||
Debug(1, "XPSC8_init, end of function\n");
|
||||
return(rtnval);
|
||||
}
|
||||
|
||||
|
||||
/* initialize a record instance */
|
||||
STATIC long XPSC8_init_record(struct motorRecord *mr)
|
||||
{
|
||||
long rtnval;
|
||||
struct motor_trans *trans;
|
||||
struct mess_node *motor_call;
|
||||
struct controller *brdptr;
|
||||
struct XPSC8controller *control;
|
||||
struct XPSC8axis *cntrl;
|
||||
int card, signal;
|
||||
|
||||
Debug(1, "--------XPSC8_init_record \n");
|
||||
rtnval = motor_init_record_com(mr, *drvtabptr->cardcnt_ptr,
|
||||
drvtabptr, XPSC8_cards);
|
||||
/* We have a logic problem here. motor_init has read in the motor
|
||||
* position in engineering units, but it did not yet know the resolution
|
||||
* to convert to steps. It thus did a divide by zero.
|
||||
* We have to wait till after calling
|
||||
* motor_init_record_com for mr->dpvt to be initialized, and then set
|
||||
* the rmp field of the record again */
|
||||
trans = (struct motor_trans *) mr->dpvt;
|
||||
motor_call = &(trans->motor_call);
|
||||
card = mr->out.value.vmeio.card;
|
||||
signal = mr->out.value.vmeio.signal;
|
||||
brdptr = (*trans->tabptr->card_array)[card];
|
||||
control = (struct XPSC8controller *) brdptr->DevicePrivate;
|
||||
cntrl = (struct XPSC8axis *)&control->axis[signal];
|
||||
cntrl->resolution = mr->mres; /* Set the motor resolution */
|
||||
mr->rmp = NINT(cntrl->currentposition[1] / cntrl->resolution);
|
||||
Debug(1, "XPSC8_init_record: card=%d, signal=%d, currentposition[1]=%f"
|
||||
" resolution=%f, mr->rmp=%d\n",
|
||||
card, signal, cntrl->currentposition[1], cntrl->resolution, mr->rmp);
|
||||
return(rtnval);
|
||||
}
|
||||
|
||||
|
||||
/* start building a transaction */
|
||||
STATIC long XPSC8_start_trans(struct motorRecord *mr)
|
||||
{
|
||||
Debug(1, "--------XPSC8_start_trans\n");
|
||||
long rtnval;
|
||||
rtnval = motor_start_trans_com(mr, XPSC8_cards);
|
||||
return(rtnval);
|
||||
}
|
||||
|
||||
|
||||
/* end building a transaction */
|
||||
STATIC RTN_STATUS XPSC8_end_trans(struct motorRecord *mr)
|
||||
{
|
||||
Debug(1, "--------XPSC8_end_trans\n");
|
||||
RTN_STATUS rtnval;
|
||||
rtnval = motor_end_trans_com(mr, drvtabptr);
|
||||
return(rtnval);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* add a part to the transaction */
|
||||
STATIC RTN_STATUS XPSC8_build_trans(motor_cmnd command, double *parms, struct motorRecord *mr)
|
||||
{
|
||||
struct motor_trans *trans = (struct motor_trans *) mr->dpvt;
|
||||
struct mess_node *motor_call;
|
||||
struct controller *brdptr;
|
||||
struct XPSC8controller *control;
|
||||
struct XPSC8axis *cntrl;
|
||||
double dval=0.,resolution,steps;
|
||||
int ival=0;
|
||||
RTN_STATUS rtnval=OK;
|
||||
int card, signal;
|
||||
|
||||
int positioner, status;
|
||||
|
||||
positioner = 1; /* Means only move one axis at a time */
|
||||
if (parms != NULL){
|
||||
dval = parms[0]; /* I assume this is the record DVAL which you set*/
|
||||
/* to move e.g. dval = 10mm and command = MOVE_ABS*/
|
||||
ival = NINT(parms[0]);
|
||||
}
|
||||
|
||||
motor_call = &(trans->motor_call);
|
||||
card = motor_call->card;
|
||||
signal = motor_call->signal;
|
||||
brdptr = (*trans->tabptr->card_array)[card];
|
||||
|
||||
Debug(11, "XPSC8_build_trans: After brdptr command\n");
|
||||
|
||||
if (brdptr == NULL)
|
||||
return(rtnval = ERROR);
|
||||
|
||||
control = (struct XPSC8controller *) brdptr->DevicePrivate;
|
||||
cntrl = (struct XPSC8axis *)&control->axis[signal];
|
||||
|
||||
resolution = cntrl->resolution;
|
||||
steps = resolution * dval;
|
||||
|
||||
/* mr->dllm = cntrl->minlimit;*/ /* set the epics limits to the XPS limits */
|
||||
/* mr->dhlm = cntrl->maxlimit; */
|
||||
|
||||
Debug(1, "XPSC8_build_trans: card=%d, signal=%d, command=%d, ival=%d"
|
||||
" dval=%f, steps=%f\n",
|
||||
card, signal, command, ival, dval, steps);
|
||||
|
||||
Debug(1, "XPSC8_build_trans: resolution=%f\n",resolution);
|
||||
if (XPSC8_table[command] > motor_call->type)
|
||||
motor_call->type = XPSC8_table[command];
|
||||
Debug(11, "XPSC8_build_trans: After cntrl command\n");
|
||||
if (trans->state != BUILD_STATE)
|
||||
return(rtnval = ERROR);
|
||||
Debug(11, "XPSC8_build_trans: After cntrl command\n");
|
||||
/* Take a lock so that only 1 thread can be talking to the XPSC8 at
|
||||
* once. I don't know if this is needed? */
|
||||
epicsMutexLock(control->XPSC8Lock);
|
||||
|
||||
/* No need to deal with initialization, premove or postmove strings,
|
||||
XPSC8 does not support */
|
||||
|
||||
Debug(1, "build_trans: Top Of Switch command=%d, cntrl->moving=%d"
|
||||
" GStat=%d-\n", command,cntrl->moving,cntrl->groupstatus);
|
||||
|
||||
switch (command) {
|
||||
case MOVE_ABS:/* command 0*/
|
||||
|
||||
Debug(1, "XPSC8_build_trans: command=%d, Move_ABS moving=%d steps=%f\n",
|
||||
command,cntrl->moving, steps);
|
||||
|
||||
if ((cntrl->moving) == MOVING) {
|
||||
printf("--STILL MOVING--\n");
|
||||
goto done;
|
||||
} /* This is set in drvXPSC8.cc*/
|
||||
|
||||
Debug(11, "Move_ABS socket=%d posiname=%s posit=%d dval=%f\n",
|
||||
cntrl->socket, cntrl->positionername, positioner, dval);
|
||||
epicsThreadSleep(0.1);
|
||||
|
||||
status = GroupMoveAbsolute(cntrl->socket, cntrl->positionername,
|
||||
positioner, &steps);
|
||||
if (status != 0) {
|
||||
printf(" Error performing GroupMoveAbsolute\n");
|
||||
}
|
||||
|
||||
Debug(1, "--After GroupMoveAbsolute command=%d,Move_ABS moving=%d \n",
|
||||
command,cntrl->moving);
|
||||
|
||||
break;
|
||||
|
||||
case MOVE_REL:
|
||||
/* Using the SGamma setings in stages.ini */
|
||||
if (cntrl->moving == MOVING) goto done;
|
||||
/* This is set in drvXPSC8.cc*/
|
||||
status = GroupMoveRelative(cntrl->socket, cntrl->positionername,
|
||||
positioner, &steps);
|
||||
if (status != 0) printf(" Error performing GroupMoveRelative\n");
|
||||
break;
|
||||
|
||||
case HOME_FOR:
|
||||
case HOME_REV:
|
||||
/* If motion has been killed the group will need to be initialized*/
|
||||
/* and homed before the motors can be driven again */
|
||||
if (cntrl->groupstatus < 10 ) {
|
||||
/* ie not initialized state!*/
|
||||
status = GroupInitialize(cntrl->pollsocket,cntrl->groupname);
|
||||
if (status != 0) {
|
||||
printf("HOME Command Error performing GroupInitialise\n");
|
||||
}
|
||||
status = GroupStatusGet(cntrl->pollsocket, cntrl->groupname,
|
||||
&cntrl->groupstatus);
|
||||
if (status != 0) {
|
||||
printf(" Error performing GroupStatusGet\n");
|
||||
}
|
||||
Debug(1, "XPSC8_build_trans:****** Perform GroupInitialize\n");
|
||||
status = GroupHomeSearch(cntrl->socket,cntrl->groupname);
|
||||
if (status != 0) {
|
||||
printf(" Error performing GroupHomeSearch\n");
|
||||
}
|
||||
Debug(1, "XPSC8_build_trans:******* Perform GroupHomeSearch\n");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
status = GroupKill(cntrl->pollsocket,cntrl->groupname);
|
||||
if (status != 0) {
|
||||
printf(" Error performing GroupKill\n");
|
||||
}
|
||||
|
||||
status = GroupInitialize(cntrl->pollsocket,cntrl->groupname);
|
||||
if (status != 0) {
|
||||
printf("HOME Command Error performing GroupInitialise\n");
|
||||
}
|
||||
|
||||
|
||||
status = GroupStatusGet(cntrl->pollsocket, cntrl->groupname,
|
||||
&cntrl->groupstatus);
|
||||
if (status != 0) {
|
||||
printf(" Error performing GroupStatusGet\n");
|
||||
}
|
||||
Debug(1, "XPSC8_build_trans:****** Perform GroupInitialize\n");
|
||||
|
||||
status = GroupHomeSearch(cntrl->socket,cntrl->groupname);
|
||||
if (status != 0) {
|
||||
printf(" Error performing GroupHomeSearch\n");
|
||||
}
|
||||
Debug(1, "XPSC8_build_trans:******* Perform GroupHomeSearch\n");
|
||||
|
||||
/*}*/
|
||||
|
||||
/* if (cntrl->groupstatus == NOTREF ){ */
|
||||
/* you must kill a group before homing*/
|
||||
/*}*/
|
||||
break;
|
||||
|
||||
case LOAD_POS:
|
||||
/* command 4 I assume it means just update the position value? */
|
||||
/*status = GroupPositionCurrentGet(cntrl->socket,
|
||||
cntrl->positionername,
|
||||
positioner,
|
||||
&cntrl->currentposition[1]);
|
||||
if (status != 0)
|
||||
printf(" Error performing GroupPositionCurrentGet Load Pos\n");*/
|
||||
break;
|
||||
|
||||
case SET_VEL_BASE:
|
||||
/* The XPS does not have a different Base velocity!!!*/
|
||||
break;
|
||||
case SET_VELOCITY:
|
||||
/* The XPS does not have a different Base velocity!!!!!
|
||||
So I perform the same operation for VEL_BASE and VEL*/
|
||||
|
||||
status = PositionerSGammaParametersSet(cntrl->pollsocket,
|
||||
cntrl->positionername, steps,
|
||||
cntrl->accel,
|
||||
cntrl->minjerktime,
|
||||
cntrl->maxjerktime);
|
||||
if (status != 0)
|
||||
printf(" Error performing PositionerSGammaParameters Set Vel\n");
|
||||
else cntrl->velocity = steps;
|
||||
break;
|
||||
|
||||
case SET_ACCEL: /* command 7 */
|
||||
status = PositionerSGammaParametersSet(cntrl->pollsocket,
|
||||
cntrl->positionername,
|
||||
cntrl->velocity,
|
||||
steps, cntrl->minjerktime,
|
||||
cntrl->maxjerktime);
|
||||
if (status != 0)
|
||||
printf(" Error performing PositionerSGammaParameters Set Accel\n");
|
||||
else cntrl->accel = steps;
|
||||
break;
|
||||
|
||||
case GO:
|
||||
break;
|
||||
|
||||
case SET_ENC_RATIO: /* These must be set in the Stages.ini file */
|
||||
break;
|
||||
|
||||
case GET_INFO: /* Again I don't know what this is intended to do? */
|
||||
break;
|
||||
|
||||
case STOP_AXIS:
|
||||
/* The whole group must stop, not just 1 axis */
|
||||
if (cntrl->groupstatus > 42) {
|
||||
/* Then the group is moving! */
|
||||
status = GroupMoveAbort(cntrl->pollsocket,cntrl->groupname);
|
||||
if (status != 0) printf(" Error performing GroupMoveAbort(\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case JOG:
|
||||
/* I need more commandds to impliment this i.e. enable/disable
|
||||
set velocity and acceleration */
|
||||
break;
|
||||
|
||||
case SET_PGAIN:
|
||||
case SET_IGAIN:
|
||||
case SET_DGAIN:
|
||||
/* These can be implimented but there are so many variables */
|
||||
/* It makes sense to do it in the stages.ini file */
|
||||
case ENABLE_TORQUE:
|
||||
case DISABL_TORQUE:
|
||||
/* The XPSC8 does not support gain or torque commands */
|
||||
break;
|
||||
|
||||
case SET_HIGH_LIMIT:
|
||||
Debug(1, "XPSC8_build_trans highlimit: socket=%d, posname=%s, "
|
||||
"minlim=%f, steps=%f\n",
|
||||
cntrl->socket, cntrl->positionername, cntrl->minlimit, steps);
|
||||
|
||||
status = PositionerUserTravelLimitsSet(cntrl->pollsocket,
|
||||
cntrl->positionername,
|
||||
cntrl->minlimit, steps);
|
||||
if (status != 0)
|
||||
printf(" Error performing PositionerUserTravelLimitsGet "
|
||||
" Max Limit status=%d\n",status);
|
||||
else cntrl->maxlimit = steps;
|
||||
break;
|
||||
|
||||
case SET_LOW_LIMIT:
|
||||
status = PositionerUserTravelLimitsSet(cntrl->pollsocket,
|
||||
cntrl->positionername,
|
||||
steps, cntrl->maxlimit);
|
||||
if (status != 0)
|
||||
printf("Error performing PositionerUserTravelLimitsGet Min Limit\n");
|
||||
else cntrl->minlimit = steps;
|
||||
break;
|
||||
|
||||
default:
|
||||
rtnval = ERROR;
|
||||
}
|
||||
|
||||
done:
|
||||
/* Free the lock */
|
||||
epicsMutexUnlock(control->XPSC8Lock);
|
||||
Debug(1, "End Of Build_trans after Switch\n");
|
||||
return (rtnval);
|
||||
}
|
||||
Executable
+699
@@ -0,0 +1,699 @@
|
||||
/*
|
||||
* drvXPSC8.cc
|
||||
* Motor record driver level support for Newport XPSC8 motor controller.
|
||||
*
|
||||
* Original Author: Mark Rivers
|
||||
* Date: 10-May-2000
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <epicsThread.h>
|
||||
#include <epicsMutex.h>
|
||||
#include <epicsExport.h>
|
||||
#include <epicsString.h>
|
||||
#include <drvSup.h>
|
||||
#include "motor.h"
|
||||
#include "drvXPSC8.h"
|
||||
|
||||
#include "xps_c8_driver.h"
|
||||
|
||||
#define STATIC static
|
||||
|
||||
/*----------------debugging-----------------*/
|
||||
#ifdef NODEBUG
|
||||
#define Debug(l, f, args...);
|
||||
#else
|
||||
/*#define Debug(L,FMT,V...) { if(L <= drvXPSC8Debug) \
|
||||
{ printf("%s(%d):",__FILE__,__LINE__); \
|
||||
printf(FMT,##V); } }*/
|
||||
|
||||
int drvXPSC8Debug = 0;
|
||||
epicsExportAddress(int, drvXPSC8Debug);
|
||||
/* To make the var available to the shell */
|
||||
#define Debug(l, f, args...) { if(l<=drvXPSC8Debug) printf(f,## args); }
|
||||
#endif
|
||||
|
||||
/* --- Local data. --- */
|
||||
int XPSC8_num_cards = 0;
|
||||
|
||||
/* Local data required for every driver; see "motordrvComCode.h" */
|
||||
#include "motordrvComCode.h"
|
||||
|
||||
/* Why are not all the functions declared here? */
|
||||
|
||||
/*----------------functions-----------------*/
|
||||
STATIC int recv_mess(int, char *, int);
|
||||
STATIC RTN_STATUS send_mess(int card, const char *com, char c);
|
||||
STATIC void start_status(int card);
|
||||
/*STATIC void XPSC8Status(int card);*/
|
||||
STATIC int set_status(int card, int signal);
|
||||
static long report(int level);
|
||||
static long init();
|
||||
STATIC int motor_init();
|
||||
STATIC void query_done(int, int, struct mess_node *);
|
||||
STATIC void readXPSC8Status(int card);
|
||||
|
||||
/*----------------functions-----------------*/
|
||||
|
||||
struct driver_table XPSC8_access =
|
||||
{
|
||||
motor_init,
|
||||
motor_send,
|
||||
motor_free,
|
||||
motor_card_info,
|
||||
motor_axis_info,
|
||||
&mess_queue,
|
||||
&queue_lock,
|
||||
&free_list,
|
||||
&freelist_lock,
|
||||
&motor_sem,
|
||||
&motor_state,
|
||||
&total_cards,
|
||||
&any_motor_in_motion,
|
||||
send_mess,
|
||||
recv_mess,
|
||||
set_status,
|
||||
query_done,
|
||||
start_status,
|
||||
&initialized
|
||||
};
|
||||
|
||||
|
||||
struct
|
||||
{
|
||||
long number;
|
||||
#ifdef __cplusplus
|
||||
long (*report) (int);
|
||||
long (*init) (void);
|
||||
#else
|
||||
DRVSUPFUN report;
|
||||
DRVSUPFUN init;
|
||||
#endif
|
||||
} drvXPSC8 = {2, report, init};
|
||||
|
||||
epicsExportAddress(drvet, drvXPSC8);
|
||||
|
||||
/* I don't know where the XPSC8_access is set?*/
|
||||
STATIC struct thread_args targs = {SCAN_RATE, &XPSC8_access};
|
||||
|
||||
/*********************************************************
|
||||
* Print out driver status report
|
||||
*********************************************************/
|
||||
|
||||
static long report(int level) /*########## XPSC8 Version */
|
||||
{
|
||||
int card;
|
||||
|
||||
if (XPSC8_num_cards <=0)
|
||||
printf(" No XPSC8 controllers configured.\n");
|
||||
else {
|
||||
for (card = 0; card < XPSC8_num_cards; card++) {
|
||||
struct controller *brdptr = motor_state[card];
|
||||
if (brdptr == NULL)
|
||||
printf(" XPSC8 controller %d connection failed.\n", card);
|
||||
else {
|
||||
struct XPSC8controller *control;
|
||||
|
||||
control = (struct XPSC8controller *) brdptr->DevicePrivate;
|
||||
printf(" XPSC8 driver %d, axis:%s \n",
|
||||
card, brdptr->ident);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
static long init()
|
||||
{
|
||||
if (XPSC8_num_cards <= 0)
|
||||
{
|
||||
Debug(1, "init(): XPSC8 driver disabled. XPSC8etup() missing from startup script.\n");
|
||||
}
|
||||
return ((long) 0);
|
||||
}
|
||||
|
||||
STATIC void query_done(int card, int axis, struct mess_node *nodeptr)
|
||||
{
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
* Read the status and position of all motors on a card
|
||||
* start_status(int card)
|
||||
* if card == -1 then start all cards
|
||||
*********************************************************/
|
||||
|
||||
STATIC void start_status(int card)
|
||||
{
|
||||
int itera;
|
||||
|
||||
Debug(2, "start_status: card=%d total_cards=%d\n", card,total_cards);
|
||||
if (card >= 0) {
|
||||
readXPSC8Status(card);
|
||||
} else {
|
||||
for (itera = 0; itera < total_cards; itera++) {
|
||||
if (motor_state[itera]) readXPSC8Status(itera);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* Read in the motion parameters such as velocity, Accel, Position etc
|
||||
*****************************************************************/
|
||||
|
||||
STATIC void readXPSC8Status(int card)
|
||||
{
|
||||
struct XPSC8controller *control =
|
||||
(struct XPSC8controller *) motor_state[card]->DevicePrivate;
|
||||
struct XPSC8axis *cntrl;
|
||||
int status,statuserror;
|
||||
int XPSC8_num_axes;
|
||||
int positioner,i; /* this = 1 because we are talking to 1 axis at a time */
|
||||
|
||||
struct mess_node *nodeptr; /* These are to print the DONE flag */
|
||||
register struct mess_info *motor_info;
|
||||
msta_field statusflags;
|
||||
|
||||
positioner = 1;
|
||||
statuserror = 0; /* this = 1 if an error occurs */
|
||||
XPSC8_num_axes = motor_state[card]->total_axis;
|
||||
|
||||
Debug(2, "XPSC8:readXPSC8Status card=%d num_axes=%d\n",card,XPSC8_num_axes);
|
||||
|
||||
/* Take a lock so that only 1 thread can be talking to the Neport XPSC8
|
||||
*/
|
||||
epicsMutexLock(control->XPSC8Lock);
|
||||
|
||||
for (i=0; i<XPSC8_num_axes;i++) {
|
||||
|
||||
motor_info = &(motor_state[card]->motor_info[i]); /*To print DONE flag*/
|
||||
nodeptr = motor_info->motor_motion;
|
||||
statusflags.All = motor_info->status.All;
|
||||
|
||||
Debug(9, "XPSC8:readXPSC8Status RA_DONE=%d, RA_MOVING=%d, "
|
||||
"RA_PROBLEM=%d\n",
|
||||
statusflags.Bits.RA_DONE, statusflags.Bits.RA_MOVING,
|
||||
statusflags.Bits.RA_PROBLEM);
|
||||
|
||||
control = (struct XPSC8controller *) motor_state[card]->DevicePrivate;
|
||||
cntrl = (struct XPSC8axis *)&control->axis[i];
|
||||
|
||||
Debug(2, "XPSC8:readXPSC8Status card=%d axis=%d sock=%d gp=%s\n",card,i,
|
||||
cntrl->socket,cntrl->groupname);
|
||||
|
||||
/* Where I have used "&" the func requires an pointer */
|
||||
status = GroupStatusGet(cntrl->pollsocket, cntrl->groupname,
|
||||
&cntrl->groupstatus);
|
||||
if (status != 0) {
|
||||
printf(" Error performing GroupStatusGet status=%d\n", status);
|
||||
statuserror =1;
|
||||
}
|
||||
|
||||
status = PositionerSGammaParametersGet(cntrl->pollsocket,
|
||||
cntrl->positionername,
|
||||
&cntrl->velocity,
|
||||
&cntrl->accel,
|
||||
&cntrl->minjerktime,
|
||||
&cntrl->maxjerktime);
|
||||
if (status != 0) {
|
||||
printf(" Error performing PositionerSGammaParametersGet\n");
|
||||
statuserror =1;
|
||||
}
|
||||
|
||||
/* The jog function is not enabled*/
|
||||
/*
|
||||
status = GroupJogParametersGet(cntrl->pollsocket,
|
||||
cntrl->groupname,
|
||||
positioner,
|
||||
&cntrl->jogvelocity,
|
||||
&cntrl->jogaccel);
|
||||
if (status != 0) {
|
||||
printf(" Error performing GroupJogParametersGet\n");
|
||||
statuserror =1;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
status = GroupPositionCurrentGet(cntrl->pollsocket,
|
||||
cntrl->positionername,
|
||||
positioner,
|
||||
&cntrl->currentposition[1]);
|
||||
if (status != 0) {
|
||||
printf(" Error performing GroupPositionCurrentGet\n");
|
||||
statuserror =1;
|
||||
}
|
||||
|
||||
|
||||
status = GroupPositionTargetGet(cntrl->pollsocket,
|
||||
cntrl->positionername,
|
||||
positioner,
|
||||
&cntrl->targetposition[1]);
|
||||
if (status != 0) {
|
||||
printf(" Error performing GroupPositionTargetGet\n");
|
||||
statuserror =1;
|
||||
}
|
||||
|
||||
|
||||
status = GroupPositionSetpointGet(cntrl->pollsocket,
|
||||
cntrl->positionername,
|
||||
positioner,
|
||||
&cntrl->setpointposition[1]);
|
||||
if (status != 0) {
|
||||
printf(" Error performing GroupPositionSetpointGet\n");
|
||||
statuserror =1;
|
||||
}
|
||||
|
||||
status = PositionerErrorGet(cntrl->pollsocket,
|
||||
cntrl->positionername,
|
||||
&cntrl->positionererror);
|
||||
if (status != 0) {
|
||||
printf(" Error performing PositionerErrorGet\n");
|
||||
statuserror =1;
|
||||
}
|
||||
|
||||
/* We probably don't need to poll this because the limits are set to
|
||||
* the database values on startup*/
|
||||
|
||||
status = PositionerUserTravelLimitsGet(cntrl->pollsocket,
|
||||
cntrl->positionername,
|
||||
&cntrl->minlimit,
|
||||
&cntrl->maxlimit);
|
||||
if (status != 0) {
|
||||
printf(" Error performing PositionerUserTravelLimitsGet\n");
|
||||
statuserror =1;
|
||||
}
|
||||
|
||||
Debug(11, "readXPSC8Status, socket=%d, groupname=%s, minlim=%f\n",
|
||||
cntrl->socket,cntrl->groupname,cntrl->minlimit);
|
||||
|
||||
if (status == 1)
|
||||
cntrl->status = XPSC8_COMM_ERR; /* This is checked in set_status */
|
||||
else
|
||||
cntrl->status = OK;
|
||||
}
|
||||
|
||||
/* Free the lock */
|
||||
epicsMutexUnlock(control->XPSC8Lock);
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
* Parse status and position for a card and signal
|
||||
* set_status()
|
||||
************************************************************/
|
||||
|
||||
STATIC int set_status(int card, int signal)
|
||||
{
|
||||
struct XPSC8controller *control;
|
||||
struct XPSC8axis *cntrl;
|
||||
struct mess_node *nodeptr;
|
||||
register struct mess_info *motor_info;
|
||||
|
||||
int positionererror;
|
||||
int rtn_state, groupstatus;
|
||||
double motorData, pos,resolution;
|
||||
bool ls_active = false;
|
||||
msta_field status;
|
||||
|
||||
control = (struct XPSC8controller *) motor_state[card]->DevicePrivate;
|
||||
cntrl = (struct XPSC8axis *)&control->axis[signal];
|
||||
|
||||
resolution = cntrl->resolution;
|
||||
motor_info = &(motor_state[card]->motor_info[signal]);
|
||||
nodeptr = motor_info->motor_motion;
|
||||
status.All = motor_info->status.All;
|
||||
|
||||
/* Lock access to global data structure */
|
||||
epicsMutexLock(control->XPSC8Lock);
|
||||
|
||||
Debug(2, "XPSC8:set_status entry: card=%d, signal=%d\n", card, signal);
|
||||
|
||||
/* Parse the error and position values read within the readXPSC8Status
|
||||
function */
|
||||
positionererror = cntrl->positionererror;
|
||||
pos = cntrl->currentposition[1];
|
||||
groupstatus = cntrl->groupstatus;
|
||||
Debug(2, "XPSC8:set_status entry: positionererror=%d, pos=%f,"
|
||||
" resolution=%f\n",
|
||||
positionererror, pos, resolution);
|
||||
Debug(11, "XPSC8:set_status entry: pos0=%f, pos1=%f\n",
|
||||
cntrl->currentposition[0], cntrl->currentposition[1]);
|
||||
|
||||
if (cntrl->velocity >= 0)
|
||||
status.Bits.RA_DIRECTION = 1;
|
||||
else
|
||||
status.Bits.RA_DIRECTION=0;
|
||||
|
||||
if (groupstatus > 9 && groupstatus < 20) {
|
||||
/* These states mean ready from move/home/jog etc*/
|
||||
status.Bits.RA_DONE=1; /* 1 means cd ready */
|
||||
Debug(2, "Set_status: Done -->groupstatus=%d\n", groupstatus);
|
||||
} else {
|
||||
status.Bits.RA_DONE=0;
|
||||
Debug(2, "Set_status: Not Done -->groupstatus=%d\n", groupstatus);
|
||||
}
|
||||
status.Bits.RA_PLUS_LS=0;
|
||||
status.Bits.RA_MINUS_LS=0;
|
||||
|
||||
cntrl->moving = 0 ; /* not moving */
|
||||
|
||||
if (groupstatus > 42 && groupstatus < 49) {
|
||||
/* These states mean it is moving/homeing/jogging etc*/
|
||||
cntrl->moving = 1;
|
||||
}
|
||||
|
||||
/* These are hard limits */
|
||||
if (positionererror & XPSC8_END_OF_RUN_MINUS ) {
|
||||
/* I am unsure of the use of & !!*/
|
||||
status.Bits.RA_MINUS_LS=1; /* defined in drvXPSC8.h */
|
||||
ls_active = true;
|
||||
}
|
||||
|
||||
if (positionererror & XPSC8_END_OF_RUN_PLUS ) {
|
||||
status.Bits.RA_PLUS_LS=1;
|
||||
ls_active = true;
|
||||
}
|
||||
|
||||
status.Bits.RA_HOME=0;
|
||||
if (groupstatus == 11) status.Bits.RA_HOME=1; /* ready from home state */
|
||||
|
||||
status.Bits.EA_POSITION=0; /* position maintenence disabled */
|
||||
|
||||
/* encoder status */
|
||||
status.Bits.EA_SLIP=0;
|
||||
status.Bits.EA_SLIP_STALL=0;
|
||||
status.Bits.EA_HOME=0;
|
||||
|
||||
/* Motor position */
|
||||
motorData = pos / resolution;
|
||||
|
||||
if (motorData == motor_info->position)
|
||||
motor_info->no_motion_count++;
|
||||
else
|
||||
{
|
||||
motor_info->position = NINT(motorData);
|
||||
if (motor_state[card]->motor_info[signal].encoder_present == YES)
|
||||
motor_info->encoder_position = (int32_t) motorData;
|
||||
else
|
||||
motor_info->encoder_position = 0;
|
||||
|
||||
motor_info->no_motion_count = 0;
|
||||
}
|
||||
|
||||
status.Bits.RA_PROBLEM=0;
|
||||
|
||||
Debug(11, "--------above inisialisation test \n");
|
||||
if (groupstatus < 9 || (groupstatus > 19 && groupstatus < 43)) {
|
||||
/* not initialized or disabled*/
|
||||
/* Set the Hard limits To show that it is unable to move */
|
||||
status.Bits.RA_MINUS_LS=1;
|
||||
status.Bits.RA_PLUS_LS=1;
|
||||
status.Bits.RA_PROBLEM=1; /*This variable is to do with polling*/
|
||||
Debug(1, "--------Set Status Not initialised state! \n");
|
||||
|
||||
}
|
||||
|
||||
motor_info->velocity = (int)cntrl->velocity;
|
||||
/* I don't know what this is used for */
|
||||
|
||||
/* if (status.Bits.RA_DIRECTION==0)
|
||||
motor_info->velocity *= -1;*/
|
||||
|
||||
rtn_state = (!motor_info->no_motion_count || ls_active == true ||
|
||||
(status.Bits.RA_DONE | status.Bits.RA_PROBLEM)) ? 1 : 0;
|
||||
|
||||
Debug(1, "--------set_status rtn_state=%d \n",rtn_state);
|
||||
|
||||
|
||||
if (cntrl->status == XPSC8_COMM_ERR)
|
||||
/* I defined this to be -1! */
|
||||
status.Bits.CNTRL_COMM_ERR=1;
|
||||
else
|
||||
status.Bits.CNTRL_COMM_ERR=0;
|
||||
|
||||
/* Free the lock */
|
||||
epicsMutexUnlock(control->XPSC8Lock);
|
||||
motor_info->status.All = status.All;
|
||||
return(rtn_state);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************/
|
||||
/* send a message to the XPS board */
|
||||
/* send_mess() */
|
||||
/*****************************************************/
|
||||
STATIC RTN_STATUS send_mess(int card, char const *com, char inchar)
|
||||
{
|
||||
/* This is a no-op for the XPS, but must be present */
|
||||
return (OK);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************/
|
||||
/* receive a message from the XPS board */
|
||||
/* recv_mess() */
|
||||
/*****************************************************/
|
||||
STATIC int recv_mess(int card, char *com, int flag)
|
||||
{
|
||||
/* This is a no-op for the XPS, but must be present */
|
||||
/* Set the returned message to a null string */
|
||||
*com = '\0';
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************/
|
||||
/* Setup system configuration */
|
||||
/* XPSC8Setup() */
|
||||
/*****************************************************/
|
||||
RTN_STATUS XPSC8Setup(int num_cards, /* number of controllers in system. */
|
||||
int scan_rate) /* I think this is for the epicsthread */
|
||||
{
|
||||
Debug(1, "XPSC8Setup: Controllers=%d Scan Rate=%d\n",num_cards,scan_rate);
|
||||
int itera;
|
||||
if (num_cards > XPSC8_NUM_CHANNELS)
|
||||
printf(" Error in setup too many channels\n");
|
||||
|
||||
if (num_cards < 1)
|
||||
XPSC8_num_cards = 1;
|
||||
else
|
||||
XPSC8_num_cards = num_cards;
|
||||
|
||||
/* Set motor polling task rate */
|
||||
if (scan_rate >= 1 && scan_rate <= 60)
|
||||
targs.motor_scan_rate = scan_rate;
|
||||
else
|
||||
targs.motor_scan_rate = SCAN_RATE;
|
||||
|
||||
/* Allocate space for pointers to motor_state structures. */
|
||||
motor_state = (struct controller **) malloc(XPSC8_num_cards *
|
||||
sizeof(struct controller *));
|
||||
|
||||
for (itera = 0; itera < XPSC8_num_cards; itera++)
|
||||
motor_state[itera] = (struct controller *) NULL;
|
||||
|
||||
return (OK);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************/
|
||||
/* Configure a Newport XPS controller one command */
|
||||
/* For each controller */
|
||||
/* XPSC8Config() */
|
||||
/*****************************************************/
|
||||
RTN_STATUS XPSC8Config(int card, /* Controller number */
|
||||
const char *ip, /* XPS IP address*/
|
||||
int port, /* This may be 5001 */
|
||||
int totalaxes) /* Number of axis/positioners used*/
|
||||
|
||||
{
|
||||
struct XPSC8controller *control;
|
||||
struct XPSC8axis *cntrl;
|
||||
int statuserror, status, socket, pollsocket, axis;
|
||||
char *ipchar, List[1000];
|
||||
statuserror = 0;
|
||||
status = 0;
|
||||
ipchar = (char *)ip;
|
||||
socket = 0;
|
||||
pollsocket = 0;
|
||||
|
||||
|
||||
Debug(1, "XPSC8Config: IP=%s, Port=%d, Card=%d, totalaxes=%d\n",
|
||||
ipchar, port, card, totalaxes);
|
||||
|
||||
if (totalaxes < 0 || totalaxes > XPSC8_NUM_CHANNELS) {return (ERROR);}
|
||||
|
||||
motor_state[card] = (struct controller *) calloc(1,
|
||||
sizeof(struct controller));
|
||||
motor_state[card]->DevicePrivate = calloc(1,
|
||||
sizeof(struct XPSC8controller));
|
||||
control = (struct XPSC8controller *) motor_state[card]->DevicePrivate;
|
||||
|
||||
motor_state[card]->total_axis = totalaxes;
|
||||
|
||||
|
||||
|
||||
for (axis=0; axis<totalaxes; axis++) {
|
||||
socket = TCP_ConnectToServer(ipchar,port,TIMEOUT);
|
||||
/* Find a socket number */
|
||||
if (socket < 0) {
|
||||
printf(" Error TCP_ConnectToServer for move-socket\n");
|
||||
statuserror =1;
|
||||
}
|
||||
|
||||
pollsocket = TCP_ConnectToServer(ipchar,port,TIMEOUT);
|
||||
/* Find a socket number */
|
||||
if (pollsocket < 0) {
|
||||
printf(" Error TCP_ConnectToServer for pollsocket\n");
|
||||
statuserror =1;
|
||||
}
|
||||
|
||||
cntrl = (struct XPSC8axis *)&control->axis[axis];
|
||||
Debug(11, "XPSC8Config: axis=%d, cntrl=%p\n", axis, cntrl);
|
||||
|
||||
cntrl->pollsocket = pollsocket;
|
||||
cntrl->socket = socket;
|
||||
cntrl->ip = epicsStrDup(ip);
|
||||
|
||||
|
||||
Debug(1, "XPSC8Config: Socket=%d, PollSock=%d, ip=%s, port=%d,"
|
||||
" axis=%d controller=%d\n",
|
||||
cntrl->socket,cntrl->pollsocket,ip,port,axis,card);
|
||||
}
|
||||
Debug(11, "XPSC8Config: Above OjectsListGet\n");
|
||||
status = ObjectsListGet(socket, List);
|
||||
if (status != 0)
|
||||
printf(" Error performing Object List Get\n");
|
||||
else
|
||||
printf("Start of Object List From Controller: %.40s\n",List);
|
||||
|
||||
Debug(11, "XPSC8Config: End\n");
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*********************************************************/
|
||||
/* Pass the group and positioner names */
|
||||
/* Call this for each axis */
|
||||
/* */
|
||||
/*********************************************************/
|
||||
RTN_STATUS XPSC8NameConfig(int card, /*specify which controller 0-up*/
|
||||
int axis, /*axis number 0-7*/
|
||||
const char *gpname, /*group name e.g. Diffractometer */
|
||||
const char *posname) /*positioner name e.g. Diffractometer.Phi*/
|
||||
|
||||
{
|
||||
struct XPSC8controller *control;
|
||||
struct XPSC8axis *cntrl;
|
||||
|
||||
Debug(1, "XPSC8NameConfig: card=%d axis=%d, group=%s, positioner=%s\n",
|
||||
card, axis, gpname, posname);
|
||||
|
||||
control = (struct XPSC8controller *) motor_state[card]->DevicePrivate;
|
||||
cntrl = (struct XPSC8axis *)&control->axis[axis];
|
||||
|
||||
cntrl->groupname = epicsStrDup(gpname);
|
||||
cntrl->positionername = epicsStrDup(posname);
|
||||
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*****************************************************/
|
||||
/* initialize all software and hardware */
|
||||
/* This is called from the init() */
|
||||
/* motor_init() */
|
||||
/*****************************************************/
|
||||
STATIC int motor_init()
|
||||
{
|
||||
|
||||
struct controller *brdptr;
|
||||
struct XPSC8controller *control;
|
||||
struct XPSC8axis *cntrl;
|
||||
int card_index, motor_index;
|
||||
int status, totalaxes;
|
||||
|
||||
bool errind;
|
||||
|
||||
initialized = true; /* Indicate that driver is initialized. */
|
||||
|
||||
/* Check for setup */
|
||||
Debug(1, "XPSC8:motor_init: num_cards=%d\n", XPSC8_num_cards);
|
||||
if (XPSC8_num_cards <= 0){
|
||||
printf("Error num_cards <=0");
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
for (card_index = 0; card_index < XPSC8_num_cards; card_index++) {
|
||||
totalaxes = motor_state[card_index]->total_axis;
|
||||
Debug(5, "XPSC8:motor_init: Card init loop card_index=%d\n",card_index);
|
||||
brdptr = motor_state[card_index];
|
||||
total_cards = card_index + 1;
|
||||
Debug(5, "XPSC8:motor_init: Above control def card_index=%d\n",
|
||||
card_index);
|
||||
control = (struct XPSC8controller *) brdptr->DevicePrivate;
|
||||
|
||||
cntrl = (struct XPSC8axis *)&control->axis[0];
|
||||
/* Just for the test below!*/
|
||||
|
||||
control->XPSC8Lock = epicsMutexCreate();
|
||||
errind = false;
|
||||
|
||||
/* just to test status, 0 means the call worked*/
|
||||
status = GroupStatusGet(cntrl->socket,cntrl->groupname,
|
||||
&cntrl->groupstatus);
|
||||
if (status !=0) errind = true;
|
||||
Debug(5, "XPSC8:motor_init: card_index=%d, errind=%d\n",
|
||||
card_index, errind);
|
||||
|
||||
if (errind == false) {
|
||||
brdptr->localaddr = (char *) NULL;
|
||||
brdptr->motor_in_motion = 0;
|
||||
|
||||
/*brdptr->total_axis = XPSC8_NUM_CHANNELS;*/
|
||||
/* I have set this to be the no. used inConfig*/
|
||||
|
||||
for (motor_index = 0; motor_index<totalaxes; motor_index++) {
|
||||
brdptr->motor_info[motor_index].motor_motion = NULL;
|
||||
}
|
||||
|
||||
strcpy(brdptr->ident, "XPS_C8_controller");
|
||||
|
||||
start_status(card_index);
|
||||
/*Read in all the parameters vel/accel ect */
|
||||
|
||||
Debug(5, "XPSC8:motor_init: called start_status OK\n");
|
||||
for (motor_index = 0; motor_index < totalaxes; motor_index++) {
|
||||
struct mess_info *motor_info = &brdptr->motor_info[motor_index];
|
||||
motor_info->status.All = 0;
|
||||
motor_info->no_motion_count = 0;
|
||||
motor_info->encoder_position = 0;
|
||||
motor_info->position = 0;
|
||||
/* Read status of each motor */
|
||||
Debug(5, " XPSC8:motor_init: calling set_status for motor %d\n",
|
||||
motor_index);
|
||||
set_status(card_index, motor_index);
|
||||
}
|
||||
}
|
||||
else
|
||||
motor_state[card_index] = (struct controller *) NULL;
|
||||
}
|
||||
Debug(5, "XPSC8:motor_init: done with start_status and set_status\n");
|
||||
|
||||
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(5, "XPSC8:motor_init: spawning XPSC8_motor task\n");
|
||||
|
||||
epicsThreadCreate((char *) "XPSC8_motor", 64, 5000,
|
||||
(EPICSTHREADFUNC) motor_task, (void *) &targs);
|
||||
|
||||
return (OK);
|
||||
}
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
/* File: drvXPSC8.h */
|
||||
|
||||
/* Device Driver Support definitions for motor
|
||||
*
|
||||
* Original Author: Jon Kelly
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INCdrvXPSC8h
|
||||
#define INCdrvXPSC8h 1
|
||||
|
||||
#include "motordrvCom.h"
|
||||
|
||||
#define XPSC8_END_OF_RUN_MINUS 0x80000100
|
||||
#define XPSC8_END_OF_RUN_PLUS 0x80000200
|
||||
#define XPSC8_NUM_CHANNELS 8
|
||||
#define XPSC8_COMM_ERR -1
|
||||
#define TIMEOUT 1
|
||||
#define NOTREF 42
|
||||
|
||||
/*------ This defines the XPSC8 specific property structure */
|
||||
struct XPSC8axis
|
||||
{
|
||||
int socket;
|
||||
int pollsocket; /* This is the same for all motors to poll!*/
|
||||
double currentposition[1]; /* the XPS commands want an array */
|
||||
double setpointposition[1];
|
||||
double targetposition[1];
|
||||
double velocity;
|
||||
double accel;
|
||||
double minjerktime; /* for the SGamma function */
|
||||
double maxjerktime;
|
||||
double jogvelocity;
|
||||
double jogaccel;
|
||||
double maxlimit;
|
||||
double minlimit;
|
||||
double resolution;
|
||||
|
||||
char *ip;
|
||||
char *positionername; /* read in using NameConfig*/
|
||||
char *groupname;
|
||||
int groupstatus;
|
||||
int positionererror;
|
||||
int moving; /* 1 = moving! */
|
||||
int status; /* Included to fit in with the camac driver template
|
||||
Not a value from the XPS controller!*/
|
||||
|
||||
};
|
||||
|
||||
struct XPSC8controller{
|
||||
epicsMutexId XPSC8Lock;
|
||||
struct XPSC8axis axis[XPSC8_NUM_CHANNELS];
|
||||
};
|
||||
|
||||
/* Global function, used by both driver and device support */
|
||||
|
||||
|
||||
#endif /* INCdrvXPSC8h */
|
||||
Executable
+4025
File diff suppressed because it is too large
Load Diff
Executable
+157
@@ -0,0 +1,157 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Created header file api.h for API headings
|
||||
//
|
||||
|
||||
|
||||
/*#ifndef DLL
|
||||
#define DLL _declspec(dllimport)
|
||||
#endif*/
|
||||
#ifdef WINDOWS /* Copied from old version*/
|
||||
#ifndef DLL
|
||||
#define DLL _declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define __stdcall
|
||||
#define DLL
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
DLL int __stdcall TCP_ConnectToServer(char *Ip_Address, int Ip_Port, double TimeOut);
|
||||
DLL void __stdcall TCP_SetTimeout(int SocketIndex, double Timeout);
|
||||
DLL void __stdcall TCP_CloseSocket(int SocketIndex);
|
||||
DLL char * __stdcall TCP_GetError(int SocketIndex);
|
||||
DLL char * __stdcall GetLibraryVersion(void);
|
||||
DLL int __stdcall ElapsedTimeGet (int SocketIndex, double * ElapsedTime);
|
||||
DLL int __stdcall ErrorStringGet (int SocketIndex, int ErrorCode, char * ErrorString);
|
||||
DLL int __stdcall FirmwareVersionGet (int SocketIndex, char * Version);
|
||||
DLL int __stdcall TCLScriptExecute (int SocketIndex, char * TCLFileName, char * TaskName, char * ParametersList);
|
||||
DLL int __stdcall TCLScriptKill (int SocketIndex, char * TaskName);
|
||||
DLL int __stdcall TimerGet (int SocketIndex, char * TimerName, int * FrequencyTicks);
|
||||
DLL int __stdcall TimerSet (int SocketIndex, char * TimerName, int FrequencyTicks);
|
||||
DLL int __stdcall Reboot (int SocketIndex);
|
||||
DLL int __stdcall EventAdd (int SocketIndex, char * PositionerName, char * EventName, char * EventParameter, char * ActionName, char * ActionParameter1, char * ActionParameter2, char * ActionParameter3);
|
||||
DLL int __stdcall EventGet (int SocketIndex, char * PositionerName, char * EventsAndActionsList);
|
||||
DLL int __stdcall EventRemove (int SocketIndex, char * PositionerName, char * EventName, char * EventParameter);
|
||||
DLL int __stdcall EventWait (int SocketIndex, char * PositionerName, char * EventName, char * EventParameter);
|
||||
DLL int __stdcall GatheringConfigurationGet (int SocketIndex, char * Type);
|
||||
DLL int __stdcall GatheringConfigurationSet (int SocketIndex, int NbElements, char * TypeList);
|
||||
DLL int __stdcall GatheringCurrentNumberGet (int SocketIndex, int * CurrentNumber, int * MaximumSamplesNumber);
|
||||
DLL int __stdcall GatheringStopAndSave (int SocketIndex);
|
||||
DLL int __stdcall GatheringExternalConfigurationSet (int SocketIndex, int NbElements, char * TypeList);
|
||||
DLL int __stdcall GatheringExternalConfigurationGet (int SocketIndex, char * Type);
|
||||
DLL int __stdcall GatheringExternalCurrentNumberGet (int SocketIndex, int * CurrentNumber, int * MaximumSamplesNumber);
|
||||
DLL int __stdcall GatheringExternalStopAndSave (int SocketIndex);
|
||||
DLL int __stdcall GlobalArrayGet (int SocketIndex, int Number, char * ValueString);
|
||||
DLL int __stdcall GlobalArraySet (int SocketIndex, int Number, char * ValueString);
|
||||
DLL int __stdcall GPIOAnalogGet (int SocketIndex, int NbElements, char * GPIONameList, double AnalogValue[]);
|
||||
DLL int __stdcall GPIOAnalogSet (int SocketIndex, int NbElements, char * GPIONameList, double AnalogOutputValue[]);
|
||||
DLL int __stdcall GPIOAnalogGainGet (int SocketIndex, int NbElements, char * GPIONameList, int AnalogInputGainValue[]);
|
||||
DLL int __stdcall GPIOAnalogGainSet (int SocketIndex, int NbElements, char * GPIONameList, int AnalogInputGainValue[]);
|
||||
DLL int __stdcall GPIODigitalGet (int SocketIndex, char * GPIOName, unsigned short * DigitalValue);
|
||||
DLL int __stdcall GPIODigitalSet (int SocketIndex, char * GPIOName, unsigned short Mask, unsigned short DigitalOutputValue);
|
||||
DLL int __stdcall GroupAnalogTrackingModeEnable (int SocketIndex, char * GroupName, char * Type);
|
||||
DLL int __stdcall GroupAnalogTrackingModeDisable (int SocketIndex, char * GroupName);
|
||||
DLL int __stdcall GroupHomeSearch (int SocketIndex, char * GroupName);
|
||||
DLL int __stdcall GroupHomeSearchAndRelativeMove (int SocketIndex, char * GroupName, int NbElements, double TargetDisplacement[]);
|
||||
DLL int __stdcall GroupInitialize (int SocketIndex, char * GroupName);
|
||||
DLL int __stdcall GroupJogParametersSet (int SocketIndex, char * GroupName, int NbElements, double Velocity[], double Acceleration[]);
|
||||
DLL int __stdcall GroupJogParametersGet (int SocketIndex, char * GroupName, int NbElements, double Velocity[], double Acceleration[]);
|
||||
DLL int __stdcall GroupJogCurrentGet (int SocketIndex, char * GroupName, int NbElements, double Velocity[], double Acceleration[]);
|
||||
DLL int __stdcall GroupJogModeEnable (int SocketIndex, char * GroupName);
|
||||
DLL int __stdcall GroupJogModeDisable (int SocketIndex, char * GroupName);
|
||||
DLL int __stdcall GroupKill (int SocketIndex, char * GroupName);
|
||||
DLL int __stdcall GroupMoveAbort (int SocketIndex, char * GroupName);
|
||||
DLL int __stdcall GroupMoveAbsolute (int SocketIndex, char * GroupName, int NbElements, double TargetPosition[]);
|
||||
DLL int __stdcall GroupMoveRelative (int SocketIndex, char * GroupName, int NbElements, double TargetDisplacement[]);
|
||||
DLL int __stdcall GroupMotionDisable (int SocketIndex, char * GroupName);
|
||||
DLL int __stdcall GroupMotionEnable (int SocketIndex, char * GroupName);
|
||||
DLL int __stdcall GroupPositionCurrentGet (int SocketIndex, char * GroupName, int NbElements, double CurrentEncoderPosition[]);
|
||||
DLL int __stdcall GroupPositionSetpointGet (int SocketIndex, char * GroupName, int NbElements, double SetPointPosition[]);
|
||||
DLL int __stdcall GroupPositionTargetGet (int SocketIndex, char * GroupName, int NbElements, double TargetPosition[]);
|
||||
DLL int __stdcall GroupStatusGet (int SocketIndex, char * GroupName, int * Status);
|
||||
DLL int __stdcall GroupStatusStringGet (int SocketIndex, int GroupStatusCode, char * GroupStatusString);
|
||||
DLL int __stdcall KillAll (int SocketIndex);
|
||||
DLL int __stdcall PositionerAnalogTrackingPositionParametersGet (int SocketIndex, char * PositionerName, char * GPIOName, double * Offset, double * Scale, double * Velocity, double * Acceleration);
|
||||
DLL int __stdcall PositionerAnalogTrackingPositionParametersSet (int SocketIndex, char * PositionerName, char * GPIOName, double Offset, double Scale, double Velocity, double Acceleration);
|
||||
DLL int __stdcall PositionerAnalogTrackingVelocityParametersGet (int SocketIndex, char * PositionerName, char * GPIOName, double * Offset, double * Scale, double * DeadBandThreshold, int * Order, double * Velocity, double * Acceleration);
|
||||
DLL int __stdcall PositionerAnalogTrackingVelocityParametersSet (int SocketIndex, char * PositionerName, char * GPIOName, double Offset, double Scale, double DeadBandThreshold, int Order, double Velocity, double Acceleration);
|
||||
DLL int __stdcall PositionerBacklashGet (int SocketIndex, char * PositionerName, double * BacklashValue, char * BacklaskStatus);
|
||||
DLL int __stdcall PositionerBacklashSet (int SocketIndex, char * PositionerName, double BacklashValue);
|
||||
DLL int __stdcall PositionerBacklashEnable (int SocketIndex, char * PositionerName);
|
||||
DLL int __stdcall PositionerBacklashDisable (int SocketIndex, char * PositionerName);
|
||||
DLL int __stdcall PositionerCorrectorNotchFiltersSet (int SocketIndex, char * PositionerName, double NotchFrequency1, double NotchBandwith1, double NotchGain1, double NotchFrequency2, double NotchBandwith2, double NotchGain2);
|
||||
DLL int __stdcall PositionerCorrectorNotchFiltersGet (int SocketIndex, char * PositionerName, double * NotchFrequency1, double * NotchBandwith1, double * NotchGain1, double * NotchFrequency2, double * NotchBandwith2, double * NotchGain2);
|
||||
DLL int __stdcall PositionerCorrectorPIDFFAccelerationSet (int SocketIndex, char * PositionerName, bool ClosedLoopStatus, double KP, double KI, double KD, double KS, double IntegrationTime, double DerivativeFilterCutOffFrequency, double GKP, double GKI, double GKD, double KForm, double FeedForwardGainAcceleration);
|
||||
DLL int __stdcall PositionerCorrectorPIDFFAccelerationGet (int SocketIndex, char * PositionerName, bool * ClosedLoopStatus, double * KP, double * KI, double * KD, double * KS, double * IntegrationTime, double * DerivativeFilterCutOffFrequency, double * GKP, double * GKI, double * GKD, double * KForm, double * FeedForwardGainAcceleration);
|
||||
DLL int __stdcall PositionerCorrectorPIDFFVelocitySet (int SocketIndex, char * PositionerName, bool ClosedLoopStatus, double KP, double KI, double KD, double KS, double IntegrationTime, double DerivativeFilterCutOffFrequency, double GKP, double GKI, double GKD, double KForm, double FeedForwardGainVelocity);
|
||||
DLL int __stdcall PositionerCorrectorPIDFFVelocityGet (int SocketIndex, char * PositionerName, bool * ClosedLoopStatus, double * KP, double * KI, double * KD, double * KS, double * IntegrationTime, double * DerivativeFilterCutOffFrequency, double * GKP, double * GKI, double * GKD, double * KForm, double * FeedForwardGainVelocity);
|
||||
DLL int __stdcall PositionerCorrectorPIDDualFFVoltageSet (int SocketIndex, char * PositionerName, bool ClosedLoopStatus, double KP, double KI, double KD, double KS, double IntegrationTime, double DerivativeFilterCutOffFrequency, double GKP, double GKI, double GKD, double KForm, double FeedForwardGainVelocity, double FeedForwardGainAcceleration, double Friction);
|
||||
DLL int __stdcall PositionerCorrectorPIDDualFFVoltageGet (int SocketIndex, char * PositionerName, bool * ClosedLoopStatus, double * KP, double * KI, double * KD, double * KS, double * IntegrationTime, double * DerivativeFilterCutOffFrequency, double * GKP, double * GKI, double * GKD, double * KForm, double * FeedForwardGainVelocity, double * FeedForwardGainAcceleration, double * Friction);
|
||||
DLL int __stdcall PositionerCorrectorPIPositionSet (int SocketIndex, char * PositionerName, bool ClosedLoopStatus, double KP, double KI, double IntegrationTime);
|
||||
DLL int __stdcall PositionerCorrectorPIPositionGet (int SocketIndex, char * PositionerName, bool * ClosedLoopStatus, double * KP, double * KI, double * IntegrationTime);
|
||||
DLL int __stdcall PositionerCorrectorTypeGet (int SocketIndex, char * PositionerName, char * CorrectorType);
|
||||
DLL int __stdcall PositionerErrorGet (int SocketIndex, char * PositionerName, int * ErrorCode);
|
||||
DLL int __stdcall PositionerErrorStringGet (int SocketIndex, int PositionerErrorCode, char * PositionerErrorString);
|
||||
DLL int __stdcall PositionerHardwareStatusGet (int SocketIndex, char * PositionerName, int * HardwareStatus);
|
||||
DLL int __stdcall PositionerHardwareStatusStringGet (int SocketIndex, int PositionerHardwareStatus, char * PositonerHardwareStatusString);
|
||||
DLL int __stdcall PositionerHardInterpolatorFactorGet (int SocketIndex, char * PositionerName, int * InterpolationFactor);
|
||||
DLL int __stdcall PositionerHardInterpolatorFactorSet (int SocketIndex, char * PositionerName, int InterpolationFactor);
|
||||
DLL int __stdcall PositionerMotionDoneGet (int SocketIndex, char * PositionerName, double * PositionWindow, double * VelocityWindow, double * CheckingTime, double * MeanPeriod, double * TimeOut);
|
||||
DLL int __stdcall PositionerMotionDoneSet (int SocketIndex, char * PositionerName, double PositionWindow, double VelocityWindow, double CheckingTime, double MeanPeriod, double TimeOut);
|
||||
DLL int __stdcall PositionerPositionCompareGet (int SocketIndex, char * PositionerName, double * MinimumPosition, double * MaximumPosition, double * PositionStep, bool * EnableState);
|
||||
DLL int __stdcall PositionerPositionCompareSet (int SocketIndex, char * PositionerName, double MinimumPosition, double MaximumPosition, double PositionStep);
|
||||
DLL int __stdcall PositionerPositionCompareEnable (int SocketIndex, char * PositionerName);
|
||||
DLL int __stdcall PositionerPositionCompareDisable (int SocketIndex, char * PositionerName);
|
||||
DLL int __stdcall PositionerPreviousMotionTimesGet (int SocketIndex, char * PositionerName, double * SettingTime, double * SettlingTime);
|
||||
DLL int __stdcall PositionerSGammaParametersGet (int SocketIndex, char * PositionerName, double * Velocity, double * Acceleration, double * MinimumTjerkTime, double * MaximumTjerkTime);
|
||||
DLL int __stdcall PositionerSGammaParametersSet (int SocketIndex, char * PositionerName, double Velocity, double Acceleration, double MinimumTjerkTime, double MaximumTjerkTime);
|
||||
DLL int __stdcall PositionerSGammaExactVelocityAjustedDisplacementGet (int SocketIndex, char * PositionerName, double DesiredDisplacement, double * AdjustedDisplacement);
|
||||
DLL int __stdcall PositionerUserTravelLimitsGet (int SocketIndex, char * PositionerName, double * UserMinimumTarget, double * UserMaximumTarget);
|
||||
DLL int __stdcall PositionerUserTravelLimitsSet (int SocketIndex, char * PositionerName, double UserMinimumTarget, double UserMaximumTarget);
|
||||
DLL int __stdcall MultipleAxesPVTVerification (int SocketIndex, char * GroupName, char * FileName);
|
||||
DLL int __stdcall MultipleAxesPVTVerificationResultGet (int SocketIndex, char * PositionerName, char * FileName, double * MinimumPosition, double * MaximumPosition, double * MaximumVelocity, double * MaximumAcceleration);
|
||||
DLL int __stdcall MultipleAxesPVTExecution (int SocketIndex, char * GroupName, char * FileName, int ExecutionNumber);
|
||||
DLL int __stdcall MultipleAxesPVTParametersGet (int SocketIndex, char * GroupName, char * FileName, int * CurrentElementNumber);
|
||||
DLL int __stdcall SingleAxisSlaveModeEnable (int SocketIndex, char * GroupName);
|
||||
DLL int __stdcall SingleAxisSlaveModeDisable (int SocketIndex, char * GroupName);
|
||||
DLL int __stdcall SingleAxisSlaveParametersSet (int SocketIndex, char * GroupName, char * PositionerName, double Ratio);
|
||||
DLL int __stdcall SingleAxisSlaveParametersGet (int SocketIndex, char * GroupName, char * PositionerName, double * Ratio);
|
||||
DLL int __stdcall XYLineArcVerification (int SocketIndex, char * GroupName, char * FileName);
|
||||
DLL int __stdcall XYLineArcVerificationResultGet (int SocketIndex, char * PositionerName, char * FileName, double * MinimumPosition, double * MaximumPosition, double * MaximumVelocity, double * MaximumAcceleration);
|
||||
DLL int __stdcall XYLineArcExecution (int SocketIndex, char * GroupName, char * FileName, double Velocity, double Acceleration, int ExecutionNumber);
|
||||
DLL int __stdcall XYLineArcParametersGet (int SocketIndex, char * GroupName, char * FileName, double * Velocity, double * Acceleration, int * CurrentElementNumber);
|
||||
DLL int __stdcall XYZSplineVerification (int SocketIndex, char * GroupName, char * FileName);
|
||||
DLL int __stdcall XYZSplineVerificationResultGet (int SocketIndex, char * PositionerName, char * FileName, double * MinimumPosition, double * MaximumPosition, double * MaximumVelocity, double * MaximumAcceleration);
|
||||
DLL int __stdcall XYZSplineExecution (int SocketIndex, char * GroupName, char * FileName, double Velocity, double Acceleration);
|
||||
DLL int __stdcall XYZSplineParametersGet (int SocketIndex, char * GroupName, char * FileName, double * Velocity, double * Acceleration, int * CurrentElementNumber);
|
||||
DLL int __stdcall EEPROMCIESet (int SocketIndex, int CardNumber, char * ReferenceString);
|
||||
DLL int __stdcall EEPROMDACOffsetCIESet (int SocketIndex, int PlugNumber, double DAC1Offset, double DAC2Offset);
|
||||
DLL int __stdcall EEPROMDriverSet (int SocketIndex, int PlugNumber, char * ReferenceString);
|
||||
DLL int __stdcall EEPROMINTSet (int SocketIndex, int CardNumber, char * ReferenceString);
|
||||
DLL int __stdcall ActionListGet (int SocketIndex, char * ActionList);
|
||||
DLL int __stdcall APIExtendedListGet (int SocketIndex, char * Method);
|
||||
DLL int __stdcall APIListGet (int SocketIndex, char * Method);
|
||||
DLL int __stdcall ErrorListGet (int SocketIndex, char * ErrorsList);
|
||||
DLL int __stdcall EventListGet (int SocketIndex, char * EventList);
|
||||
DLL int __stdcall GatheringListGet (int SocketIndex, char * list);
|
||||
DLL int __stdcall GatheringExtendedListGet (int SocketIndex, char * list);
|
||||
DLL int __stdcall GatheringExternalListGet (int SocketIndex, char * list);
|
||||
DLL int __stdcall GroupStatusListGet (int SocketIndex, char * GroupStatusList);
|
||||
DLL int __stdcall HardwareInternalListGet (int SocketIndex, char * InternalHardwareList);
|
||||
DLL int __stdcall HardwareDriverAndStageGet (int SocketIndex, int PlugNumber, char * DriverName, char * StageName);
|
||||
DLL int __stdcall ObjectsListGet (int SocketIndex, char * ObjectsList);
|
||||
DLL int __stdcall PositionerErrorListGet (int SocketIndex, char * PositionerErrorList);
|
||||
DLL int __stdcall PositionerHardwareStatusListGet (int SocketIndex, char * PositionerHardwareStatusList);
|
||||
DLL int __stdcall GatheringUserDatasGet (int SocketIndex, double * UserData1, double * UserData2, double * UserData3, double * UserData4, double * UserData5, double * UserData6, double * UserData7, double * UserData8);
|
||||
DLL int __stdcall TestTCP (int SocketIndex, char * InputString, char * ReturnString);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user