Changed to C++ serialIO interface.

This commit is contained in:
Ron Sluiter
2003-05-28 14:57:30 +00:00
parent b120861a31
commit 4a5a521936
4 changed files with 46 additions and 55 deletions
+12 -15
View File
@@ -2,9 +2,9 @@
FILENAME... drvESP300.cc
USAGE... Motor record driver level support for Newport ESP300.
Version: $Revision: 1.2 $
Version: $Revision: 1.3 $
Modified By: $Author: sluiter $
Last Modified: $Date: 2003-05-23 18:39:20 $
Last Modified: $Date: 2003-05-28 14:56:11 $
*/
/*
@@ -420,7 +420,7 @@ STATIC RTN_STATUS send_mess(int card, char const *com, char inchar)
;
// gpibIOSend(cntrl->gpibInfo, local_buff, strlen(local_buff), GPIB_TIMEOUT);
else
serialIOSend(cntrl->serialInfo, local_buff, strlen(local_buff), SERIAL_TIMEOUT);
cntrl->serialInfo->serialIOSend(local_buff, strlen(local_buff), SERIAL_TIMEOUT);
return(OK);
}
@@ -491,15 +491,14 @@ STATIC int recv_mess(int card, char *com, int flag)
case RS232_PORT:
if (flag != FLUSH)
timeout = SERIAL_TIMEOUT;
len = serialIORecv(cntrl->serialInfo, com, BUFF_SIZE, (char *) "\n", timeout);
len = cntrl->serialInfo->serialIORecv(com, BUFF_SIZE, (char *) "\n", timeout);
if (len > 3 && com[0] == 'E')
{
long error;
error = strtol(&com[1], NULL, 0);
if (error >= 35 && error <= 42)
len = serialIORecv(cntrl->serialInfo, com, BUFF_SIZE,
(char *) "\n", timeout);
len = cntrl->serialInfo->serialIORecv(com, BUFF_SIZE, (char *) "\n", timeout);
}
break;
}
@@ -614,7 +613,7 @@ STATIC int motor_init()
char buff[BUFF_SIZE];
int total_axis = 0;
int status;
bool errind;
bool success_rtn;
initialized = true; /* Indicate that driver is initialized. */
@@ -633,7 +632,7 @@ STATIC int motor_init()
cntrl = (struct MMcontroller *) brdptr->DevicePrivate;
/* Initialize communications channel */
errind = false;
success_rtn = false;
switch (cntrl->port_type)
{
/*
@@ -641,18 +640,16 @@ STATIC int motor_init()
cntrl->gpibInfo = gpibIOInit(cntrl->gpib_link,
cntrl->gpib_address);
if (cntrl->gpibInfo == NULL)
errind = true;
success_rtn = true;
break;
*/
case RS232_PORT:
cntrl->serialInfo = serialIOInit(cntrl->serial_card,
cntrl->serial_task);
if (cntrl->serialInfo == NULL)
errind = true;
cntrl->serialInfo = new serialIO(cntrl->serial_card,
cntrl->serial_task, &success_rtn);
break;
}
if (errind == false)
if (success_rtn == true)
{
/* Send a message to the board, see if it exists */
/* flush any junk at input port - should not be any data available */
@@ -665,7 +662,7 @@ STATIC int motor_init()
/* Return value is length of response string */
}
if (errind == false && status > 0)
if (success_rtn == true && status > 0)
{
brdptr->localaddr = (char *) NULL;
brdptr->motor_in_motion = 0;
+12 -14
View File
@@ -2,9 +2,9 @@
FILENAME... drvMM3000.cc
USAGE... Motor record driver level support for Newport MM3000.
Version: $Revision: 1.2 $
Version: $Revision: 1.3 $
Modified By: $Author: sluiter $
Last Modified: $Date: 2003-05-23 18:41:17 $
Last Modified: $Date: 2003-05-28 14:56:45 $
*/
/*
@@ -449,7 +449,7 @@ STATIC RTN_STATUS send_mess(int card, char const *com, char inchar)
;
// gpibIOSend(cntrl->gpibInfo, local_buff, strlen(local_buff), GPIB_TIMEOUT);
else
serialIOSend(cntrl->serialInfo, local_buff, strlen(local_buff), SERIAL_TIMEOUT);
cntrl->serialInfo->serialIOSend(local_buff, strlen(local_buff), SERIAL_TIMEOUT);
return(OK);
}
@@ -520,14 +520,14 @@ STATIC int recv_mess(int card, char *com, int flag)
case RS232_PORT:
if (flag != FLUSH)
timeout = SERIAL_TIMEOUT;
len = serialIORecv(cntrl->serialInfo, com, BUFF_SIZE, (char *) "\n", timeout);
len = cntrl->serialInfo->serialIORecv(com, BUFF_SIZE, (char *) "\n", timeout);
if (len > 3 && com[0] == 'E')
{
long error;
error = strtol(&com[1], NULL, 0);
if (error >= 35 && error <= 42)
len = serialIORecv(cntrl->serialInfo, com, BUFF_SIZE, (char *) "\n", timeout);
len = cntrl->serialInfo->serialIORecv(com, BUFF_SIZE, (char *) "\n", timeout);
}
break;
}
@@ -643,7 +643,7 @@ STATIC int motor_init()
char *tok_save, *bufptr;
int total_axis = 0;
int status;
bool errind;
bool success_rtn;
initialized = true; /* Indicate that driver is initialized. */
@@ -664,7 +664,7 @@ STATIC int motor_init()
cntrl = (struct MMcontroller *) brdptr->DevicePrivate;
/* Initialize communications channel */
errind = false;
success_rtn = false;
switch (cntrl->port_type)
{
/*
@@ -672,18 +672,16 @@ STATIC int motor_init()
cntrl->gpibInfo = gpibIOInit(cntrl->gpib_link,
cntrl->gpib_address);
if (cntrl->gpibInfo == NULL)
errind = true;
success_rtn = true;
break;
*/
case RS232_PORT:
cntrl->serialInfo = serialIOInit(cntrl->serial_card,
cntrl->serial_task);
if (cntrl->serialInfo == NULL)
errind = true;
cntrl->serialInfo = new serialIO(cntrl->serial_card,
cntrl->serial_task, &success_rtn);
break;
}
if (errind == false)
if (success_rtn == true)
{
/* Send a message to the board, see if it exists */
/* flush any junk at input port - should not be any data available */
@@ -696,7 +694,7 @@ STATIC int motor_init()
/* Return value is length of response string */
}
if (errind == false && status > 0)
if (success_rtn == true && status > 0)
{
brdptr->localaddr = (char *) NULL;
brdptr->motor_in_motion = 0;
+11 -13
View File
@@ -2,9 +2,9 @@
FILENAME... drvMM4000.cc
USAGE... Motor record driver level support for Newport MM4000.
Version: $Revision: 1.2 $
Version: $Revision: 1.3 $
Modified By: $Author: sluiter $
Last Modified: $Date: 2003-05-23 18:44:33 $
Last Modified: $Date: 2003-05-28 14:57:08 $
*/
/*
@@ -491,7 +491,7 @@ STATIC RTN_STATUS send_mess(int card, char const *com, char inchar)
;
// gpibIOSend(cntrl->gpibInfo, local_buff, strlen(local_buff), GPIB_TIMEOUT);
else
serialIOSend(cntrl->serialInfo, local_buff, strlen(local_buff), SERIAL_TIMEOUT);
cntrl->serialInfo->serialIOSend(local_buff, strlen(local_buff), SERIAL_TIMEOUT);
return(OK);
}
@@ -535,7 +535,7 @@ STATIC int recv_mess(int card, char *com, int flag)
case RS232_PORT:
if (flag != FLUSH)
timeout = SERIAL_TIMEOUT;
len = serialIORecv(cntrl->serialInfo, com, BUFF_SIZE, (char *) "\r", timeout);
len = cntrl->serialInfo->serialIORecv(com, BUFF_SIZE, (char *) "\r", timeout);
break;
}
@@ -647,7 +647,7 @@ STATIC int motor_init()
char *tok_save, *pos_ptr;
int total_axis = 0;
int status, model_num, digits;
bool errind;
bool success_rtn;
initialized = true; /* Indicate that driver is initialized. */
@@ -666,7 +666,7 @@ STATIC int motor_init()
cntrl = (struct MMcontroller *) brdptr->DevicePrivate;
/* Initialize communications channel */
errind = false;
success_rtn = false;
switch (cntrl->port_type)
{
/*
@@ -674,18 +674,16 @@ STATIC int motor_init()
cntrl->gpibInfo = gpibIOInit(cntrl->gpib_link,
cntrl->gpib_address);
if (cntrl->gpibInfo == NULL)
errind = true;
success_rtn = true;
break;
*/
case RS232_PORT:
cntrl->serialInfo = serialIOInit(cntrl->serial_card,
cntrl->serial_task);
if (cntrl->serialInfo == NULL)
errind = true;
cntrl->serialInfo = new serialIO(cntrl->serial_card,
cntrl->serial_task, &success_rtn);
break;
}
if (errind == false)
if (success_rtn == true)
{
int retry = 0;
@@ -704,7 +702,7 @@ STATIC int motor_init()
} while(status == 0 && retry < 3);
}
if (errind == false && status > 0)
if (success_rtn == true && status > 0)
{
brdptr->localaddr = (char *) NULL;
brdptr->motor_in_motion = 0;
+11 -13
View File
@@ -2,9 +2,9 @@
FILENAME... drvPM500.cc
USAGE... Motor record driver level support for Newport PM500.
Version: $Revision: 1.2 $
Version: $Revision: 1.3 $
Modified By: $Author: sluiter $
Last Modified: $Date: 2003-05-23 18:45:43 $
Last Modified: $Date: 2003-05-28 14:57:30 $
*/
/* Device Driver Support routines for PM500 motor controller */
@@ -410,7 +410,7 @@ STATIC RTN_STATUS send_mess(int card, char const *com, char inchar)
;
// gpibIOSend(cntrl->gpibInfo, local_buff, strlen(local_buff), GPIB_TIMEOUT);
else
serialIOSend(cntrl->serialInfo, local_buff, strlen(local_buff), SERIAL_TIMEOUT);
cntrl->serialInfo->serialIOSend(local_buff, strlen(local_buff), SERIAL_TIMEOUT);
return(OK);
}
@@ -454,7 +454,7 @@ STATIC int recv_mess(int card, char *com, int flag)
case RS232_PORT:
if (flag != FLUSH)
timeout = SERIAL_TIMEOUT;
len = serialIORecv(cntrl->serialInfo, com, BUFF_SIZE, (char *) "\r", timeout);
len = cntrl->serialInfo->serialIORecv(com, BUFF_SIZE, (char *) "\r", timeout);
break;
}
@@ -569,7 +569,7 @@ STATIC int motor_init()
char buff[BUFF_SIZE];
int total_axis = 0;
int status, digits;
bool errind;
bool success_rtn;
initialized = true; /* Indicate that driver is initialized. */
@@ -588,7 +588,7 @@ STATIC int motor_init()
cntrl = (struct MMcontroller *) brdptr->DevicePrivate;
/* Initialize communications channel */
errind = false;
success_rtn = false;
switch (cntrl->port_type)
{
/*
@@ -596,18 +596,16 @@ STATIC int motor_init()
cntrl->gpibInfo = gpibIOInit(cntrl->gpib_link,
cntrl->gpib_address);
if (cntrl->gpibInfo == NULL)
errind = true;
success_rtn = true;
break;
*/
case RS232_PORT:
cntrl->serialInfo = serialIOInit(cntrl->serial_card,
cntrl->serial_task);
if (cntrl->serialInfo == NULL)
errind = true;
cntrl->serialInfo = new serialIO(cntrl->serial_card,
cntrl->serial_task, &success_rtn);
break;
}
if (errind == false)
if (success_rtn == true)
{
/* flush any junk at input port - should not be any data available */
do
@@ -646,7 +644,7 @@ STATIC int motor_init()
/* Return value is length of response string */
}
if (errind == false && status > 0)
if (success_rtn == true && status > 0)
{
brdptr->localaddr = (char *) NULL;
brdptr->motor_in_motion = 0;