- Adapted indenation to new agreed upon system
This commit is contained in:
@ -81,16 +81,18 @@
|
||||
**====================================================================
|
||||
** StrMatch - compare two strings.
|
||||
*/
|
||||
int StrMatch (
|
||||
int StrMatch(
|
||||
/* ========
|
||||
*/ char *str_a,
|
||||
char *str_b,
|
||||
int min_len) {
|
||||
*/ char *str_a,
|
||||
char *str_b, int min_len)
|
||||
{
|
||||
|
||||
int i = 0;
|
||||
int i = 0;
|
||||
|
||||
while ((tolower(str_a[i]) == tolower(str_b[i])) && (str_a[i] != '\0')) i++;
|
||||
while ((tolower(str_a[i]) == tolower(str_b[i])) && (str_a[i] != '\0'))
|
||||
i++;
|
||||
|
||||
return ((str_a[i] == '\0') && (i >= min_len));
|
||||
}
|
||||
|
||||
return ((str_a[i] == '\0') && (i >= min_len));
|
||||
}
|
||||
/*-------------------------------------------------- End of StrMatch.C =======*/
|
||||
|
@ -12,40 +12,40 @@
|
||||
#endif
|
||||
|
||||
#define AsynSrv_MAX_LINK 8
|
||||
/*
|
||||
** Structures needed by AsynSrv_Utility.
|
||||
*/
|
||||
struct AsynSrv__info {
|
||||
int skt; /* The socket number of the connection */
|
||||
char host[20]; /* The name of RS-232-C server */
|
||||
int port; /* The TCP/IP port number of server */
|
||||
int chan; /* The RS-232-C channel number on server */
|
||||
int msg_id;
|
||||
int protocol_code; /* Flag to identify the server's protocol level */
|
||||
char protocol_id[4]; /* ASCII version of server's protocol level */
|
||||
int cmnd_hdr_len; /* Header length for command strings */
|
||||
char cmnd_fmt[8]; /* "sprintf" format for cmnd header conversion */
|
||||
int rply_hdr_len; /* Header length for response strings */
|
||||
char rply_fmt[8]; /* "sscanf" format for rply header conversion */
|
||||
char chan_char[4]; /* ASCII encoded version of chan */
|
||||
char tmo[4]; /* ASCII encoded time-out (deci-secs) */
|
||||
char eot[4]; /* Expected terminators */
|
||||
int max_replies; /* Binary version of #replies in response */
|
||||
int n_replies; /* # of last response returned to caller */
|
||||
void (*idleHandler) (int, int); /* MZ. handler called when waiting ..
|
||||
** .. on a response */
|
||||
};
|
||||
/*
|
||||
** Structures needed by AsynSrv_Utility.
|
||||
*/
|
||||
struct AsynSrv__info {
|
||||
int skt; /* The socket number of the connection */
|
||||
char host[20]; /* The name of RS-232-C server */
|
||||
int port; /* The TCP/IP port number of server */
|
||||
int chan; /* The RS-232-C channel number on server */
|
||||
int msg_id;
|
||||
int protocol_code; /* Flag to identify the server's protocol level */
|
||||
char protocol_id[4]; /* ASCII version of server's protocol level */
|
||||
int cmnd_hdr_len; /* Header length for command strings */
|
||||
char cmnd_fmt[8]; /* "sprintf" format for cmnd header conversion */
|
||||
int rply_hdr_len; /* Header length for response strings */
|
||||
char rply_fmt[8]; /* "sscanf" format for rply header conversion */
|
||||
char chan_char[4]; /* ASCII encoded version of chan */
|
||||
char tmo[4]; /* ASCII encoded time-out (deci-secs) */
|
||||
char eot[4]; /* Expected terminators */
|
||||
int max_replies; /* Binary version of #replies in response */
|
||||
int n_replies; /* # of last response returned to caller */
|
||||
void (*idleHandler) (int, int); /* MZ. handler called when waiting ..
|
||||
** .. on a response */
|
||||
};
|
||||
|
||||
struct AsynSrv_HostPortSkt {
|
||||
char host[30];
|
||||
int port;
|
||||
int skt;
|
||||
int protocol_code;
|
||||
char protocol_id[4];
|
||||
int cmnd_hdr_len;
|
||||
int rply_hdr_len;
|
||||
int usage_cnt;
|
||||
int status;
|
||||
};
|
||||
struct AsynSrv_HostPortSkt {
|
||||
char host[30];
|
||||
int port;
|
||||
int skt;
|
||||
int protocol_code;
|
||||
char protocol_id[4];
|
||||
int cmnd_hdr_len;
|
||||
int rply_hdr_len;
|
||||
int usage_cnt;
|
||||
int status;
|
||||
};
|
||||
/*------------------------------------------------ End of AsynSrv_DEF.H --*/
|
||||
#endif /* _asynsrv_def_ */
|
||||
#endif /* _asynsrv_def_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -69,28 +69,31 @@
|
||||
/*--------------------------------------------------------------------------
|
||||
** Global Variables
|
||||
*/
|
||||
extern int C_gbl_status = 0;
|
||||
extern struct dsc$descriptor_s C_name_desc = {0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0};
|
||||
extern int C_gbl_status = 0;
|
||||
extern struct dsc$descriptor_s C_name_desc = { 0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
** Old-style prototypes of routines which we are
|
||||
** bridging to.
|
||||
*/
|
||||
int log_arr_get ();
|
||||
int log_int_get ();
|
||||
int log_flt_get ();
|
||||
int log_str_get ();
|
||||
int log_arr_get();
|
||||
int log_int_get();
|
||||
int log_flt_get();
|
||||
int log_str_get();
|
||||
|
||||
int str_edit ();
|
||||
int str_edit();
|
||||
|
||||
int tt_port_connect ();
|
||||
int tt_port_disconnect ();
|
||||
int tt_port_io ();
|
||||
int tt_port_config ();
|
||||
int tt_port_connect();
|
||||
int tt_port_disconnect();
|
||||
int tt_port_io();
|
||||
int tt_port_config();
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int C_log_arr_get (char *name, int arr_size, int *value, int indx) {
|
||||
int C_log_arr_get(char *name, int arr_size, int *value, int indx)
|
||||
{
|
||||
/* =============
|
||||
**
|
||||
** This routine is useful for calling LOG_ARR_GET from a C program.
|
||||
@ -110,15 +113,17 @@
|
||||
** C_name_desc - set up as a string descriptor for name. It can
|
||||
** be used to generate an error message if return status == 0.
|
||||
*/
|
||||
C_name_desc.dsc$w_length = strlen (name);
|
||||
C_name_desc.dsc$a_pointer = name;
|
||||
C_name_desc.dsc$w_length = strlen(name);
|
||||
C_name_desc.dsc$a_pointer = name;
|
||||
|
||||
C_gbl_status = log_arr_get (&C_name_desc, &arr_size, value, &indx);
|
||||
C_gbl_status = log_arr_get(&C_name_desc, &arr_size, value, &indx);
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int C_log_int_get (char *name, long int *value, int indx) {
|
||||
int C_log_int_get(char *name, long int *value, int indx)
|
||||
{
|
||||
/* =============
|
||||
**
|
||||
** This routine is useful for calling LOG_INT_GET from a C program.
|
||||
@ -136,15 +141,17 @@
|
||||
** C_name_desc - set up as a string descriptor for name. It can
|
||||
** be used to generate an error message if return status == 0.
|
||||
*/
|
||||
C_name_desc.dsc$w_length = strlen (name);
|
||||
C_name_desc.dsc$a_pointer = name;
|
||||
C_name_desc.dsc$w_length = strlen(name);
|
||||
C_name_desc.dsc$a_pointer = name;
|
||||
|
||||
C_gbl_status = log_int_get (&C_name_desc, value, &indx);
|
||||
C_gbl_status = log_int_get(&C_name_desc, value, &indx);
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int C_log_flt_get (char *name, float *value, int indx) {
|
||||
int C_log_flt_get(char *name, float *value, int indx)
|
||||
{
|
||||
/* =============
|
||||
**
|
||||
** This routine is useful for calling LOG_FLT_GET from a C program.
|
||||
@ -162,15 +169,17 @@
|
||||
** C_name_desc - set up as a string descriptor for name. It can
|
||||
** be used to generate an error message if return status == 0.
|
||||
*/
|
||||
C_name_desc.dsc$w_length = strlen (name);
|
||||
C_name_desc.dsc$a_pointer = name;
|
||||
C_name_desc.dsc$w_length = strlen(name);
|
||||
C_name_desc.dsc$a_pointer = name;
|
||||
|
||||
C_gbl_status = log_flt_get (&C_name_desc, value, &indx);
|
||||
C_gbl_status = log_flt_get(&C_name_desc, value, &indx);
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int C_log_str_get (char *name, char *value, int val_size, int indx) {
|
||||
int C_log_str_get(char *name, char *value, int val_size, int indx)
|
||||
{
|
||||
/* =============
|
||||
**
|
||||
** This routine is useful for calling LOG_STR_GET from a C program.
|
||||
@ -190,29 +199,32 @@
|
||||
** C_name_desc - set up as a string descriptor for name. It can
|
||||
** be used to generate an error message if return status == 0.
|
||||
*/
|
||||
struct dsc$descriptor_s my_val_desc = {0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0};
|
||||
struct dsc$descriptor_s my_val_desc = { 0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0
|
||||
};
|
||||
|
||||
C_name_desc.dsc$w_length = strlen (name);
|
||||
C_name_desc.dsc$a_pointer = name;
|
||||
C_name_desc.dsc$w_length = strlen(name);
|
||||
C_name_desc.dsc$a_pointer = name;
|
||||
|
||||
my_val_desc.dsc$w_length = val_size - 1;
|
||||
my_val_desc.dsc$a_pointer = value;
|
||||
my_val_desc.dsc$w_length = val_size - 1;
|
||||
my_val_desc.dsc$a_pointer = value;
|
||||
|
||||
C_gbl_status = log_str_get (&C_name_desc, &my_val_desc, &indx);
|
||||
value[val_size - 1] = 0; /* Zero-terminate the string */
|
||||
C_gbl_status = log_str_get(&C_name_desc, &my_val_desc, &indx);
|
||||
value[val_size - 1] = 0; /* Zero-terminate the string */
|
||||
|
||||
if (C_gbl_status & 1) { /* If success, strip trailing spaces */
|
||||
while ((strlen (value) > 0) && (value[strlen (value) - 1] == ' ')) {
|
||||
value[strlen (value) - 1] = 0;
|
||||
}
|
||||
if (C_gbl_status & 1) { /* If success, strip trailing spaces */
|
||||
while ((strlen(value) > 0) && (value[strlen(value) - 1] == ' ')) {
|
||||
value[strlen(value) - 1] = 0;
|
||||
}
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int C_str_edit (char *out, char *in, char *ctrl, int *length) {
|
||||
int C_str_edit(char *out, char *in, char *ctrl, int *length)
|
||||
{
|
||||
/* ==========
|
||||
**
|
||||
** This routine is useful for calling STR_EDIT from a C program.
|
||||
@ -235,39 +247,44 @@
|
||||
** Global variables:
|
||||
** C_gbl_status - set to the VAX/VMS return status of STR_EDIT.
|
||||
*/
|
||||
struct dsc$descriptor_s out_desc = {0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0};
|
||||
struct dsc$descriptor_s in_desc = {0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0};
|
||||
struct dsc$descriptor_s ctrl_desc = {0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0};
|
||||
struct dsc$descriptor_s out_desc = { 0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0
|
||||
};
|
||||
struct dsc$descriptor_s in_desc = { 0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0
|
||||
};
|
||||
struct dsc$descriptor_s ctrl_desc = { 0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0
|
||||
};
|
||||
|
||||
out_desc.dsc$w_length = *length - 1;
|
||||
out_desc.dsc$a_pointer = out;
|
||||
out_desc.dsc$w_length = *length - 1;
|
||||
out_desc.dsc$a_pointer = out;
|
||||
|
||||
in_desc.dsc$w_length = strlen (in);
|
||||
in_desc.dsc$a_pointer = in;
|
||||
in_desc.dsc$w_length = strlen(in);
|
||||
in_desc.dsc$a_pointer = in;
|
||||
|
||||
ctrl_desc.dsc$w_length = strlen (ctrl);
|
||||
ctrl_desc.dsc$a_pointer = ctrl;
|
||||
ctrl_desc.dsc$w_length = strlen(ctrl);
|
||||
ctrl_desc.dsc$a_pointer = ctrl;
|
||||
|
||||
C_gbl_status = str_edit (&out_desc, &in_desc, &ctrl_desc, length);
|
||||
if (*length >= 0) { /* zero-terminate the output string */
|
||||
out[*length] = '\0';
|
||||
}else {
|
||||
out[0] = '\0';
|
||||
}
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
C_gbl_status = str_edit(&out_desc, &in_desc, &ctrl_desc, length);
|
||||
if (*length >= 0) { /* zero-terminate the output string */
|
||||
out[*length] = '\0';
|
||||
} else {
|
||||
out[0] = '\0';
|
||||
}
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int C_tt_port_connect (int *hndl, int *chan, char *lognam, char *pwd) {
|
||||
int C_tt_port_connect(int *hndl, int *chan, char *lognam, char *pwd)
|
||||
{
|
||||
/* =================
|
||||
**
|
||||
** This routine is useful for calling TT_PORT_CONNECT from a C program.
|
||||
@ -292,30 +309,33 @@
|
||||
** Global variables:
|
||||
** C_gbl_status - set to the VAX/VMS return status of TT_PORT_CONNECT.
|
||||
*/
|
||||
struct dsc$descriptor_s lognam_desc = {0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0};
|
||||
struct dsc$descriptor_s pwd_desc = {0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0};
|
||||
lognam_desc.dsc$w_length = strlen (lognam);
|
||||
lognam_desc.dsc$a_pointer = lognam;
|
||||
struct dsc$descriptor_s lognam_desc = { 0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0
|
||||
};
|
||||
struct dsc$descriptor_s pwd_desc = { 0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0
|
||||
};
|
||||
lognam_desc.dsc$w_length = strlen(lognam);
|
||||
lognam_desc.dsc$a_pointer = lognam;
|
||||
|
||||
if (pwd != NULL) {
|
||||
pwd_desc.dsc$w_length = strlen (pwd);
|
||||
pwd_desc.dsc$a_pointer = pwd;
|
||||
C_gbl_status = tt_port_connect (
|
||||
hndl, chan, &lognam_desc, &pwd_desc);
|
||||
}else {
|
||||
C_gbl_status = tt_port_connect (hndl, chan, &lognam_desc, NULL);
|
||||
}
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
if (pwd != NULL) {
|
||||
pwd_desc.dsc$w_length = strlen(pwd);
|
||||
pwd_desc.dsc$a_pointer = pwd;
|
||||
C_gbl_status = tt_port_connect(hndl, chan, &lognam_desc, &pwd_desc);
|
||||
} else {
|
||||
C_gbl_status = tt_port_connect(hndl, chan, &lognam_desc, NULL);
|
||||
}
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int C_tt_port_disconnect (int *hndl) {
|
||||
int C_tt_port_disconnect(int *hndl)
|
||||
{
|
||||
/* ====================
|
||||
**
|
||||
** This routine is useful for calling TT_PORT_DISCONNECT from a C program.
|
||||
@ -331,20 +351,18 @@
|
||||
** Global variables:
|
||||
** C_gbl_status - set to the VAX/VMS return status of TT_PORT_DISCONNECT.
|
||||
*/
|
||||
C_gbl_status = tt_port_disconnect (hndl);
|
||||
C_gbl_status = tt_port_disconnect(hndl);
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int C_tt_port_io (
|
||||
int C_tt_port_io(
|
||||
/* ============
|
||||
*/ int *hndl,
|
||||
char *rqst,
|
||||
char *term,
|
||||
char *answ,
|
||||
int *answ_len, /* Attention -- Read/Write argument!! */
|
||||
int flush,
|
||||
int tmo) {
|
||||
*/ int *hndl,
|
||||
char *rqst, char *term, char *answ, int *answ_len, /* Attention -- Read/Write argument!! */
|
||||
int flush, int tmo)
|
||||
{
|
||||
/*
|
||||
** This routine is useful for calling TT_PORT_IO from a C program.
|
||||
** Refer to the DELTAT.OLB description of TT_PORT_IO to clarify any
|
||||
@ -386,66 +404,73 @@
|
||||
** Global variables:
|
||||
** C_gbl_status - set to the VAX/VMS return status of TT_PORT_IO.
|
||||
*/
|
||||
struct dsc$descriptor_s rqst_desc = {0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0};
|
||||
struct dsc$descriptor_s term_desc = {0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0};
|
||||
struct dsc$descriptor_s answ_desc = {0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0};
|
||||
char *my_rqst = NULL;
|
||||
char *my_term = NULL;
|
||||
char *my_answ = NULL;
|
||||
struct dsc$descriptor_s rqst_desc = { 0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0
|
||||
};
|
||||
struct dsc$descriptor_s term_desc = { 0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0
|
||||
};
|
||||
struct dsc$descriptor_s answ_desc = { 0,
|
||||
DSC$K_DTYPE_T,
|
||||
DSC$K_CLASS_S,
|
||||
0
|
||||
};
|
||||
char *my_rqst = NULL;
|
||||
char *my_term = NULL;
|
||||
char *my_answ = NULL;
|
||||
|
||||
int my_answ_len = 0;
|
||||
int my_flush = 1;
|
||||
int my_tmo = 2;
|
||||
int my_answ_len = 0;
|
||||
int my_flush = 1;
|
||||
int my_tmo = 2;
|
||||
|
||||
my_tmo = tmo;
|
||||
if (my_tmo < 0) my_tmo = 0;
|
||||
my_flush = flush;
|
||||
if (my_flush != 0) my_flush = 1;
|
||||
if (answ != NULL) {
|
||||
if (answ_len == 0) {
|
||||
printf ("C_tt_port_io -- argument error.\n");
|
||||
printf (" %s\n",
|
||||
"answ_len must be present if answ is present.");
|
||||
C_gbl_status = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
answ_desc.dsc$w_length = *answ_len - 1;
|
||||
answ_desc.dsc$a_pointer = answ;
|
||||
my_tmo = tmo;
|
||||
if (my_tmo < 0)
|
||||
my_tmo = 0;
|
||||
my_flush = flush;
|
||||
if (my_flush != 0)
|
||||
my_flush = 1;
|
||||
if (answ != NULL) {
|
||||
if (answ_len == 0) {
|
||||
printf("C_tt_port_io -- argument error.\n");
|
||||
printf(" %s\n",
|
||||
"answ_len must be present if answ is present.");
|
||||
C_gbl_status = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
if (term != NULL) {
|
||||
term_desc.dsc$w_length = strlen (term);
|
||||
term_desc.dsc$a_pointer = term;
|
||||
}
|
||||
if (rqst != NULL) {
|
||||
rqst_desc.dsc$w_length = strlen (rqst);
|
||||
rqst_desc.dsc$a_pointer = rqst;
|
||||
}
|
||||
C_gbl_status = tt_port_io (hndl, &rqst_desc, &term_desc,
|
||||
&answ_desc, &my_answ_len, &my_flush, &my_tmo);
|
||||
if (answ_desc.dsc$w_length > 0) { /* Process any input string */
|
||||
if (answ_desc.dsc$w_length > my_answ_len) { /* Room for terminator? */
|
||||
answ[my_answ_len+1] = answ[my_answ_len]; /* Yes, so move it. */
|
||||
}
|
||||
answ[my_answ_len] = '\0'; /* Put in null terminator */
|
||||
*answ_len = my_answ_len; /* Return value to caller */
|
||||
}
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
answ_desc.dsc$w_length = *answ_len - 1;
|
||||
answ_desc.dsc$a_pointer = answ;
|
||||
}
|
||||
if (term != NULL) {
|
||||
term_desc.dsc$w_length = strlen(term);
|
||||
term_desc.dsc$a_pointer = term;
|
||||
}
|
||||
if (rqst != NULL) {
|
||||
rqst_desc.dsc$w_length = strlen(rqst);
|
||||
rqst_desc.dsc$a_pointer = rqst;
|
||||
}
|
||||
C_gbl_status = tt_port_io(hndl, &rqst_desc, &term_desc,
|
||||
&answ_desc, &my_answ_len, &my_flush, &my_tmo);
|
||||
if (answ_desc.dsc$w_length > 0) { /* Process any input string */
|
||||
if (answ_desc.dsc$w_length > my_answ_len) { /* Room for terminator? */
|
||||
answ[my_answ_len + 1] = answ[my_answ_len]; /* Yes, so move it. */
|
||||
}
|
||||
answ[my_answ_len] = '\0'; /* Put in null terminator */
|
||||
*answ_len = my_answ_len; /* Return value to caller */
|
||||
}
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int C_tt_port_config (
|
||||
int C_tt_port_config(
|
||||
/* ================
|
||||
*/ int *hndl,
|
||||
int mask) {
|
||||
*/ int *hndl,
|
||||
int mask)
|
||||
{
|
||||
/*
|
||||
** This routine is useful for calling TT_PORT_CONFIG from a C program.
|
||||
** Refer to the DELTAT.OLB description of TT_PORT_CONFIG to clarify any
|
||||
@ -465,8 +490,9 @@
|
||||
** Global variables:
|
||||
** C_gbl_status - set to the VAX/VMS return status of TT_PORT_CONFIG.
|
||||
*/
|
||||
C_gbl_status = tt_port_config (hndl, &mask);
|
||||
C_gbl_status = tt_port_config(hndl, &mask);
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
|
||||
return (C_gbl_status & 1);
|
||||
}
|
||||
/*=========================================== End of C_INTERFACES.C ========*/
|
||||
|
@ -26,456 +26,416 @@
|
||||
*/
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
int DILLU_Open(pDILLU *pData, char *pHost, int iPort, int iChannel,
|
||||
int iMode, char *pTransFile)
|
||||
{
|
||||
int iRet;
|
||||
char pCommand[80];
|
||||
char pReply[132];
|
||||
pDILLU self = NULL;
|
||||
pSTable pTable = NULL;
|
||||
FILE *fd = NULL;
|
||||
|
||||
/* check translation file first */
|
||||
fd = fopen(pTransFile,"r");
|
||||
if(!fd)
|
||||
{
|
||||
return DILLU__FILENOTFOUND;
|
||||
}
|
||||
fgets(pReply, 131,fd);
|
||||
if(strstr(pReply,"DILLUTION") == NULL)
|
||||
{
|
||||
fclose(fd);
|
||||
return DILLU__NODILLFILE;
|
||||
}
|
||||
|
||||
pTable = CreateTable(fd);
|
||||
fclose(fd);
|
||||
if(!pTable)
|
||||
{
|
||||
return DILLU__ERRORTABLE;
|
||||
}
|
||||
|
||||
/* allocate a new data structure */
|
||||
self = (pDILLU)malloc(sizeof(DILLU));
|
||||
if(self == NULL)
|
||||
{
|
||||
return DILLU__BADMALLOC;
|
||||
}
|
||||
|
||||
*pData = self;
|
||||
self->pTranstable = pTable;
|
||||
|
||||
iRet = SerialOpen(&self->pData, pHost, iPort, iChannel);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
int DILLU_Open(pDILLU * pData, char *pHost, int iPort, int iChannel,
|
||||
int iMode, char *pTransFile)
|
||||
{
|
||||
int iRet;
|
||||
char pCommand[80];
|
||||
char pReply[132];
|
||||
pDILLU self = NULL;
|
||||
pSTable pTable = NULL;
|
||||
FILE *fd = NULL;
|
||||
|
||||
/* set an lengthy timeout for the configuration in order to
|
||||
prevent problems.
|
||||
*/
|
||||
iRet = SerialConfig(&self->pData, 100);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
self->iReadOnly = iMode;
|
||||
if(!self->iReadOnly)
|
||||
{
|
||||
/* switch to remote operation */
|
||||
/* check translation file first */
|
||||
fd = fopen(pTransFile, "r");
|
||||
if (!fd) {
|
||||
return DILLU__FILENOTFOUND;
|
||||
}
|
||||
fgets(pReply, 131, fd);
|
||||
if (strstr(pReply, "DILLUTION") == NULL) {
|
||||
fclose(fd);
|
||||
return DILLU__NODILLFILE;
|
||||
}
|
||||
|
||||
pTable = CreateTable(fd);
|
||||
fclose(fd);
|
||||
if (!pTable) {
|
||||
return DILLU__ERRORTABLE;
|
||||
}
|
||||
|
||||
/* allocate a new data structure */
|
||||
self = (pDILLU) malloc(sizeof(DILLU));
|
||||
if (self == NULL) {
|
||||
return DILLU__BADMALLOC;
|
||||
}
|
||||
|
||||
*pData = self;
|
||||
self->pTranstable = pTable;
|
||||
|
||||
iRet = SerialOpen(&self->pData, pHost, iPort, iChannel);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* set an lengthy timeout for the configuration in order to
|
||||
prevent problems.
|
||||
*/
|
||||
iRet = SerialConfig(&self->pData, 100);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
self->iReadOnly = iMode;
|
||||
if (!self->iReadOnly) {
|
||||
/* switch to remote operation */
|
||||
/* iRet = SerialWriteRead(&self->pData,"C1\r\n",pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
*/
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void DILLU_Close(pDILLU *pData)
|
||||
{
|
||||
char pReply[132];
|
||||
int iRet;
|
||||
pDILLU self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
/* switch to local operation */
|
||||
iRet = SerialWriteRead(&self->pData,"C0\r\n",pReply,131);
|
||||
/* ignore errors on this one, the thing may be down */
|
||||
|
||||
/* close connection */
|
||||
SerialClose(&self->pData);
|
||||
|
||||
/* free memory */
|
||||
free(self);
|
||||
*pData = NULL;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int DILLU_Config(pDILLU *pData, int iTmo)
|
||||
{
|
||||
int iRet;
|
||||
char pReply[132];
|
||||
char pCommand[10];
|
||||
pDILLU self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
/* first timeout */
|
||||
if(iTmo > 0)
|
||||
{
|
||||
iRet = SerialConfig(&self->pData, iTmo);
|
||||
if(iRet < 0)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int DILLU_Send(pDILLU *pData, char *pCommand, char *pReply, int iLen)
|
||||
{
|
||||
pDILLU self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
/* make sure, that there is a \r at the end of the command */
|
||||
if(strchr(pCommand,(int)'\r') == NULL)
|
||||
{
|
||||
strcat(pCommand,"\r\n");
|
||||
}
|
||||
return SerialWriteRead(&self->pData,pCommand,pReply,iLen);
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int DILLU_Read(pDILLU *pData, float *fVal)
|
||||
{
|
||||
char pCommand[10], pReply[132];
|
||||
int iRet;
|
||||
float fRead = -9999.;
|
||||
float fOhm;
|
||||
pDILLU self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
|
||||
/* send D command */
|
||||
sprintf(pCommand,"D\r\n");
|
||||
iRet = SerialWriteRead(&self->pData,pCommand,pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* read ohms */
|
||||
iRet = sscanf(pReply,"%f",&fOhm);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return DILLU__BADREAD;
|
||||
}
|
||||
if(fOhm > 9999890.)
|
||||
{
|
||||
return DILLU__SILLYANSWER;
|
||||
}
|
||||
|
||||
/* convert to K */
|
||||
iRet = InterpolateVal2(self->pTranstable,fOhm,&fRead);
|
||||
*fVal = fRead;
|
||||
return 1;
|
||||
*/
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void DILLU_Close(pDILLU * pData)
|
||||
{
|
||||
char pReply[132];
|
||||
int iRet;
|
||||
pDILLU self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
/* switch to local operation */
|
||||
iRet = SerialWriteRead(&self->pData, "C0\r\n", pReply, 131);
|
||||
/* ignore errors on this one, the thing may be down */
|
||||
|
||||
/* close connection */
|
||||
SerialClose(&self->pData);
|
||||
|
||||
/* free memory */
|
||||
free(self);
|
||||
*pData = NULL;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int DILLU_Config(pDILLU * pData, int iTmo)
|
||||
{
|
||||
int iRet;
|
||||
char pReply[132];
|
||||
char pCommand[10];
|
||||
pDILLU self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
/* first timeout */
|
||||
if (iTmo > 0) {
|
||||
iRet = SerialConfig(&self->pData, iTmo);
|
||||
if (iRet < 0) {
|
||||
return iRet;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int DILLU_Send(pDILLU * pData, char *pCommand, char *pReply, int iLen)
|
||||
{
|
||||
pDILLU self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
/* make sure, that there is a \r at the end of the command */
|
||||
if (strchr(pCommand, (int) '\r') == NULL) {
|
||||
strcat(pCommand, "\r\n");
|
||||
}
|
||||
return SerialWriteRead(&self->pData, pCommand, pReply, iLen);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int DILLU_Read(pDILLU * pData, float *fVal)
|
||||
{
|
||||
char pCommand[10], pReply[132];
|
||||
int iRet;
|
||||
float fRead = -9999.;
|
||||
float fOhm;
|
||||
pDILLU self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
|
||||
/* send D command */
|
||||
sprintf(pCommand, "D\r\n");
|
||||
iRet = SerialWriteRead(&self->pData, pCommand, pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* read ohms */
|
||||
iRet = sscanf(pReply, "%f", &fOhm);
|
||||
if (iRet != 1) {
|
||||
return DILLU__BADREAD;
|
||||
}
|
||||
if (fOhm > 9999890.) {
|
||||
return DILLU__SILLYANSWER;
|
||||
}
|
||||
|
||||
/* convert to K */
|
||||
iRet = InterpolateVal2(self->pTranstable, fOhm, &fRead);
|
||||
*fVal = fRead;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
int DILLU_Set(pDILLU *pData, float fVal)
|
||||
{
|
||||
char pCommand[50], pReply[132];
|
||||
int iRet, i,iRange, iExec;
|
||||
const float fPrecision = 0.0001;
|
||||
float fSet, fRead, fOhms, tmax, fTemp;
|
||||
pDILLU self;
|
||||
int DILLU_Set(pDILLU * pData, float fVal)
|
||||
{
|
||||
char pCommand[50], pReply[132];
|
||||
int iRet, i, iRange, iExec;
|
||||
const float fPrecision = 0.0001;
|
||||
float fSet, fRead, fOhms, tmax, fTemp;
|
||||
pDILLU self;
|
||||
|
||||
self = *pData;
|
||||
self = *pData;
|
||||
|
||||
if(self->iReadOnly)
|
||||
{
|
||||
return DILLU__READONLY;
|
||||
}
|
||||
|
||||
/* send D command to read current value*/
|
||||
sprintf(pCommand,"D\r\n");
|
||||
iRet = SerialWriteRead(&self->pData,pCommand,pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* read ohms */
|
||||
iRet = sscanf(pReply,"%f",&fRead);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return DILLU__BADREAD;
|
||||
}
|
||||
if(fRead > 9999890.)
|
||||
{
|
||||
return DILLU__SILLYANSWER;
|
||||
}
|
||||
|
||||
|
||||
/* convert new set value to ohms */
|
||||
iRet = InterpolateVal1(self->pTranstable,fVal,&fOhms);
|
||||
if(!iRet)
|
||||
{
|
||||
return DILLU__OUTOFRANGE;
|
||||
}
|
||||
|
||||
/* set to remote operation */
|
||||
#ifdef debug
|
||||
printf("C1\n");
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData,"C1\r\n",pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* set heater power */
|
||||
strcpy(pCommand,"G3\r");
|
||||
if(fOhms > 1125)
|
||||
{
|
||||
strcpy(pCommand,"G2\r");
|
||||
}
|
||||
if(fOhms > 4000)
|
||||
strcpy(pCommand,"G1\r");
|
||||
#ifdef debug
|
||||
printf("A9\n");
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData,"A9\r",pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
#ifdef debug
|
||||
printf("%s\n",pCommand);
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData,pCommand,pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* Integrator time constant */
|
||||
strcpy(pCommand,"G2\r");
|
||||
if(fOhms > 200)
|
||||
strcpy(pCommand,"G1\r");
|
||||
if(fOhms > 2000)
|
||||
strcpy(pCommand,"G0\r");
|
||||
strcpy(pCommand,"G7\r");
|
||||
if(fOhms > 400.)
|
||||
{
|
||||
strcpy(pCommand,"G6\r");
|
||||
}
|
||||
#ifdef debug
|
||||
printf("A4\n");
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData,"A4\r",pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
#ifdef debug
|
||||
printf("%s\n",pCommand);
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData,pCommand,pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* derivator time constant */
|
||||
if(fOhms > 1000.)
|
||||
{
|
||||
strcpy(pCommand,"G1\r");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(pCommand,"G2\r");
|
||||
}
|
||||
#ifdef debug
|
||||
printf("A5\n");
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData,"A5\r",pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
#ifdef debug
|
||||
printf("%s\n",pCommand);
|
||||
iRet = 1;
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData,pCommand,pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* proportional gain */
|
||||
if(fOhms > 500.)
|
||||
{
|
||||
strcpy(pCommand,"G3\r");
|
||||
}
|
||||
if(fOhms > 1000)
|
||||
{
|
||||
strcpy(pCommand,"G2\r");
|
||||
}
|
||||
if(fOhms > 2000)
|
||||
{
|
||||
strcpy(pCommand,"G1\r");
|
||||
}
|
||||
#ifdef debug
|
||||
printf("A6\n");
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData,"A6\r",pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
#ifdef debug
|
||||
printf("%s\n",pCommand);
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData,pCommand,pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* range calculation a la Elsenhans */
|
||||
iRange = 1;
|
||||
fTemp = fOhms*10000.;
|
||||
if( (fRead > 1.9) || (fOhms > 1.9) )
|
||||
{
|
||||
iRange = 2;
|
||||
fTemp = fOhms*1000.;
|
||||
}
|
||||
if( (fRead > 19) || (fOhms > 19) )
|
||||
{
|
||||
iRange = 3;
|
||||
fTemp = fOhms*100.;
|
||||
}
|
||||
if( (fRead > 190) || (fOhms > 190) )
|
||||
{
|
||||
iRange = 4;
|
||||
fTemp = fOhms*10.;
|
||||
}
|
||||
if( (fRead > 750) || (fOhms > 750) )
|
||||
{
|
||||
iRange = 5;
|
||||
fTemp = fOhms;
|
||||
}
|
||||
if( (fRead > 19000) || (fOhms > 19000) )
|
||||
{
|
||||
iRange = 6;
|
||||
fTemp = fOhms/10.;
|
||||
}
|
||||
if( (fRead > 190000) || (fOhms > 190000) )
|
||||
{
|
||||
iRange = 7;
|
||||
fTemp = fOhms/100.;
|
||||
}
|
||||
|
||||
sprintf(pCommand,"R%1.1d\r",iRange);
|
||||
#ifdef debug
|
||||
printf("%s\n",pCommand);
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData,pCommand,pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
|
||||
/* finally set temperature */
|
||||
#ifdef debug
|
||||
printf("Set Val befor hex: %d\n",(int)fTemp);
|
||||
#endif
|
||||
sprintf(pCommand,"G%4.4X\r",(int)fTemp);
|
||||
#ifdef debug
|
||||
printf("A3\n");
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData,"A3\r",pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
#ifdef debug
|
||||
printf("%s\n",pCommand);
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData,pCommand,pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* unset remote operation, so that users may mess everything up
|
||||
from the panel
|
||||
*/
|
||||
#ifdef debug
|
||||
printf("C1\n");
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData,"C0\r\n",pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
return 1;
|
||||
if (self->iReadOnly) {
|
||||
return DILLU__READONLY;
|
||||
}
|
||||
|
||||
/* send D command to read current value */
|
||||
sprintf(pCommand, "D\r\n");
|
||||
iRet = SerialWriteRead(&self->pData, pCommand, pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* read ohms */
|
||||
iRet = sscanf(pReply, "%f", &fRead);
|
||||
if (iRet != 1) {
|
||||
return DILLU__BADREAD;
|
||||
}
|
||||
if (fRead > 9999890.) {
|
||||
return DILLU__SILLYANSWER;
|
||||
}
|
||||
|
||||
|
||||
/* convert new set value to ohms */
|
||||
iRet = InterpolateVal1(self->pTranstable, fVal, &fOhms);
|
||||
if (!iRet) {
|
||||
return DILLU__OUTOFRANGE;
|
||||
}
|
||||
|
||||
/* set to remote operation */
|
||||
#ifdef debug
|
||||
printf("C1\n");
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData, "C1\r\n", pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* set heater power */
|
||||
strcpy(pCommand, "G3\r");
|
||||
if (fOhms > 1125) {
|
||||
strcpy(pCommand, "G2\r");
|
||||
}
|
||||
if (fOhms > 4000)
|
||||
strcpy(pCommand, "G1\r");
|
||||
#ifdef debug
|
||||
printf("A9\n");
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData, "A9\r", pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
#ifdef debug
|
||||
printf("%s\n", pCommand);
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData, pCommand, pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* Integrator time constant */
|
||||
strcpy(pCommand, "G2\r");
|
||||
if (fOhms > 200)
|
||||
strcpy(pCommand, "G1\r");
|
||||
if (fOhms > 2000)
|
||||
strcpy(pCommand, "G0\r");
|
||||
strcpy(pCommand, "G7\r");
|
||||
if (fOhms > 400.) {
|
||||
strcpy(pCommand, "G6\r");
|
||||
}
|
||||
#ifdef debug
|
||||
printf("A4\n");
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData, "A4\r", pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
#ifdef debug
|
||||
printf("%s\n", pCommand);
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData, pCommand, pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* derivator time constant */
|
||||
if (fOhms > 1000.) {
|
||||
strcpy(pCommand, "G1\r");
|
||||
} else {
|
||||
strcpy(pCommand, "G2\r");
|
||||
}
|
||||
#ifdef debug
|
||||
printf("A5\n");
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData, "A5\r", pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
#ifdef debug
|
||||
printf("%s\n", pCommand);
|
||||
iRet = 1;
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData, pCommand, pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* proportional gain */
|
||||
if (fOhms > 500.) {
|
||||
strcpy(pCommand, "G3\r");
|
||||
}
|
||||
if (fOhms > 1000) {
|
||||
strcpy(pCommand, "G2\r");
|
||||
}
|
||||
if (fOhms > 2000) {
|
||||
strcpy(pCommand, "G1\r");
|
||||
}
|
||||
#ifdef debug
|
||||
printf("A6\n");
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData, "A6\r", pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
#ifdef debug
|
||||
printf("%s\n", pCommand);
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData, pCommand, pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* range calculation a la Elsenhans */
|
||||
iRange = 1;
|
||||
fTemp = fOhms * 10000.;
|
||||
if ((fRead > 1.9) || (fOhms > 1.9)) {
|
||||
iRange = 2;
|
||||
fTemp = fOhms * 1000.;
|
||||
}
|
||||
if ((fRead > 19) || (fOhms > 19)) {
|
||||
iRange = 3;
|
||||
fTemp = fOhms * 100.;
|
||||
}
|
||||
if ((fRead > 190) || (fOhms > 190)) {
|
||||
iRange = 4;
|
||||
fTemp = fOhms * 10.;
|
||||
}
|
||||
if ((fRead > 750) || (fOhms > 750)) {
|
||||
iRange = 5;
|
||||
fTemp = fOhms;
|
||||
}
|
||||
if ((fRead > 19000) || (fOhms > 19000)) {
|
||||
iRange = 6;
|
||||
fTemp = fOhms / 10.;
|
||||
}
|
||||
if ((fRead > 190000) || (fOhms > 190000)) {
|
||||
iRange = 7;
|
||||
fTemp = fOhms / 100.;
|
||||
}
|
||||
|
||||
sprintf(pCommand, "R%1.1d\r", iRange);
|
||||
#ifdef debug
|
||||
printf("%s\n", pCommand);
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData, pCommand, pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
|
||||
/* finally set temperature */
|
||||
#ifdef debug
|
||||
printf("Set Val befor hex: %d\n", (int) fTemp);
|
||||
#endif
|
||||
sprintf(pCommand, "G%4.4X\r", (int) fTemp);
|
||||
#ifdef debug
|
||||
printf("A3\n");
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData, "A3\r", pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
#ifdef debug
|
||||
printf("%s\n", pCommand);
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData, pCommand, pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* unset remote operation, so that users may mess everything up
|
||||
from the panel
|
||||
*/
|
||||
#ifdef debug
|
||||
printf("C1\n");
|
||||
#endif
|
||||
iRet = SerialWriteRead(&self->pData, "C0\r\n", pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void DILLU_Error2Text(pDILLU *pData,int iCode, char *pError, int iLen)
|
||||
{
|
||||
char pBueffel[512];
|
||||
pDILLU self;
|
||||
void DILLU_Error2Text(pDILLU * pData, int iCode, char *pError, int iLen)
|
||||
{
|
||||
char pBueffel[512];
|
||||
pDILLU self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
switch(iCode)
|
||||
{
|
||||
case DILLU__FILENOTFOUND:
|
||||
strncpy(pError,"Translation Table file not found",iLen);
|
||||
return;
|
||||
break;
|
||||
case DILLU__NODILLFILE:
|
||||
strncpy(pError,"Translation Table file is not DILLU",iLen);
|
||||
return;
|
||||
break;
|
||||
case DILLU__ERRORTABLE:
|
||||
strncpy(pError,"Translation Table could not be created",iLen);
|
||||
return;
|
||||
break;
|
||||
case DILLU__BADREAD:
|
||||
strncpy(pError,"Message corrupted",iLen);
|
||||
return;
|
||||
break;
|
||||
case DILLU__SILLYANSWER:
|
||||
strncpy(pError,"Message corrupted",iLen);
|
||||
return;
|
||||
break;
|
||||
case DILLU__BADMALLOC:
|
||||
strncpy(pError,"Out of memory in Open_DILLU",iLen);
|
||||
return;
|
||||
break;
|
||||
case DILLU__READONLY:
|
||||
strncpy(pError,"DILLU is read-only",iLen);
|
||||
return;
|
||||
break;
|
||||
case DILLU__OUTOFRANGE:
|
||||
strncpy(pError,"Requested value is out of range",iLen);
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
SerialError(iCode,pError,iLen);
|
||||
break;
|
||||
}
|
||||
self = *pData;
|
||||
|
||||
switch (iCode) {
|
||||
case DILLU__FILENOTFOUND:
|
||||
strncpy(pError, "Translation Table file not found", iLen);
|
||||
return;
|
||||
break;
|
||||
case DILLU__NODILLFILE:
|
||||
strncpy(pError, "Translation Table file is not DILLU", iLen);
|
||||
return;
|
||||
break;
|
||||
case DILLU__ERRORTABLE:
|
||||
strncpy(pError, "Translation Table could not be created", iLen);
|
||||
return;
|
||||
break;
|
||||
case DILLU__BADREAD:
|
||||
strncpy(pError, "Message corrupted", iLen);
|
||||
return;
|
||||
break;
|
||||
case DILLU__SILLYANSWER:
|
||||
strncpy(pError, "Message corrupted", iLen);
|
||||
return;
|
||||
break;
|
||||
case DILLU__BADMALLOC:
|
||||
strncpy(pError, "Out of memory in Open_DILLU", iLen);
|
||||
return;
|
||||
break;
|
||||
case DILLU__READONLY:
|
||||
strncpy(pError, "DILLU is read-only", iLen);
|
||||
return;
|
||||
break;
|
||||
case DILLU__OUTOFRANGE:
|
||||
strncpy(pError, "Requested value is out of range", iLen);
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
SerialError(iCode, pError, iLen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -30,17 +30,17 @@
|
||||
#define DILLU__BADMALLOC -717
|
||||
#define DILLU__NODILLUFOUND -711
|
||||
/*------------------------------------------------------------------------*/
|
||||
typedef struct __DILLU {
|
||||
void *pData;
|
||||
pSTable pTranstable;
|
||||
int iReadOnly;
|
||||
} DILLU;
|
||||
typedef struct __DILLU {
|
||||
void *pData;
|
||||
pSTable pTranstable;
|
||||
int iReadOnly;
|
||||
} DILLU;
|
||||
|
||||
typedef struct __DILLU *pDILLU;
|
||||
typedef struct __DILLU *pDILLU;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
int DILLU_Open(pDILLU *pData,char *pHost, int iPort, int iChannel,
|
||||
int iMode, char *pTransFile);
|
||||
int DILLU_Open(pDILLU * pData, char *pHost, int iPort, int iChannel,
|
||||
int iMode, char *pTransFile);
|
||||
/***** creates an DILLU datastructure and opens a connection to the ITCL4
|
||||
controller. Input Parameters are:
|
||||
the hostname
|
||||
@ -53,16 +53,16 @@
|
||||
Return values are 1 for success, a negative error code on
|
||||
failure.
|
||||
|
||||
*/
|
||||
|
||||
void DILLU_Close(pDILLU *pData);
|
||||
*/
|
||||
|
||||
void DILLU_Close(pDILLU * pData);
|
||||
/****** close a connection to an DILLU controller and frees its
|
||||
data structure. The only parameter is a pointer to the data
|
||||
structure for this controller. This pointer will be invalid after
|
||||
this call.
|
||||
*/
|
||||
*/
|
||||
|
||||
int DILLU_Config(pDILLU *pData, int iTmo);
|
||||
int DILLU_Config(pDILLU * pData, int iTmo);
|
||||
/***** configure some aspects of a DILLU temperature controller.
|
||||
The parameter are:
|
||||
- a pointer to the data structure for the controller as
|
||||
@ -71,8 +71,8 @@
|
||||
The function returns 1 on success, a negative error code on
|
||||
failure.
|
||||
*/
|
||||
|
||||
int DILLU_Send(pDILLU *pData, char *pCommand, char *pReply, int iLen);
|
||||
|
||||
int DILLU_Send(pDILLU * pData, char *pCommand, char *pReply, int iLen);
|
||||
/******* send a the command in pCommand to the DILLU controller.
|
||||
A possible reply is returned in the buffer pReply.
|
||||
Maximum iLen characters are copied to pReply.
|
||||
@ -82,8 +82,8 @@
|
||||
Return values are 1 for success, a negative error code on
|
||||
failure.
|
||||
*/
|
||||
|
||||
int DILLU_Read(pDILLU *pData, float *fVal);
|
||||
|
||||
int DILLU_Read(pDILLU * pData, float *fVal);
|
||||
/******
|
||||
Reads the current temperature at the controller
|
||||
|
||||
@ -91,7 +91,7 @@
|
||||
failure.
|
||||
*/
|
||||
|
||||
int DILLU_Set(pDILLU *pData, float fVal);
|
||||
int DILLU_Set(pDILLU * pData, float fVal);
|
||||
/****** sets a new preset temperature in the DILL temperature
|
||||
controller. Parameters are:
|
||||
- a pointer to a DILLU data structure as returned by Open_DILLU.
|
||||
@ -101,8 +101,6 @@
|
||||
failure.
|
||||
*/
|
||||
|
||||
void DILLU_Error2Text(pDILLU *pData, int iCode, char *pError, int iLen);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void DILLU_Error2Text(pDILLU * pData, int iCode, char *pError, int iLen);
|
||||
|
||||
#endif
|
||||
|
@ -17,57 +17,58 @@
|
||||
|
||||
#define MAX_MOT 12
|
||||
|
||||
enum EL734_Requests {FULL__STATUS,
|
||||
SHORT__STATUS};
|
||||
enum EL734_Requests { FULL__STATUS,
|
||||
SHORT__STATUS
|
||||
};
|
||||
/*
|
||||
** Structure to which the EL734_Open handle points.
|
||||
*/
|
||||
struct EL734info {
|
||||
struct AsynSrv__info asyn_info; /* Contains skt, host, port & chan */
|
||||
int motor;
|
||||
int ored_msr, fp_cntr, fr_cntr;
|
||||
struct RS__MsgStruct to_host;
|
||||
struct RS__RespStruct from_host;
|
||||
};
|
||||
struct EL734info {
|
||||
struct AsynSrv__info asyn_info; /* Contains skt, host, port & chan */
|
||||
int motor;
|
||||
int ored_msr, fp_cntr, fr_cntr;
|
||||
struct RS__MsgStruct to_host;
|
||||
struct RS__RespStruct from_host;
|
||||
};
|
||||
/*
|
||||
** Structure holding everything that is known about a VME Motor Controller.
|
||||
** It is also the structure of replies from the Server.
|
||||
*/
|
||||
struct Motor_State {
|
||||
int motor; /* Motor number */
|
||||
int exists; /* True if Motor exists */
|
||||
int msr; /* MSR - Motor Status Register */
|
||||
int ored_msr; /* Cumulated MSR */
|
||||
int fp_cntr; /* Counter for *FP reports */
|
||||
int fr_cntr; /* Counter for *FR reports */
|
||||
int ss; /* SS - Status Flags Register */
|
||||
char pos_real[16]; /* U - Position as read (degrees) */
|
||||
char name[16]; /* MN */
|
||||
int dec_pt; /* A - # of decimal places */
|
||||
int enc_factor[2]; /* FD - Encoder scaling factors (numer/denom) */
|
||||
int mot_factor[2]; /* FM - Motor scaling factors (numer/denom) */
|
||||
char inertia_tol[16];/* D - Inertia tol'nce (sec) (Schleppfehler) */
|
||||
int ramp; /* E - Start/stop ramp (kHz/sec) */
|
||||
int loop_mode; /* F - Open loop/Closed loop (0/1) */
|
||||
int slow_hz; /* G - Start/stop frequency (Mot-S/sec) */
|
||||
char lims[2][16]; /* H - Lower/Upper limits */
|
||||
int fast_hz; /* J - Top speed (Mot-S/sec) */
|
||||
int ref_mode; /* K - Reference mode */
|
||||
int backlash; /* L - Backlash par (Mot-S) (Spielausgleich) */
|
||||
int pos_tol; /* M - Position tolerance (Enc-Steps) */
|
||||
char ref_param[16]; /* Q - Parameter for "Goto Reference" */
|
||||
int is_sided; /* T - One-sided operation flag (0 = no) */
|
||||
char null_pt[16]; /* V - Null point */
|
||||
int ac_par; /* W - Air-cushion dependency */
|
||||
int enc_circ; /* Z - circumference of encoder (Enc-Steps) */
|
||||
int stat_pos; /* SP - # of positionings */
|
||||
int stat_pos_flt; /* ST - # of positioning faults (recovered) */
|
||||
int stat_pos_fail; /* SR - # of positioning fails (abandoned) */
|
||||
int stat_cush_fail; /* SA - # of air-cushion fails */
|
||||
char set_real[16]; /* P - Position as set (degrees) */
|
||||
int ac_state; /* AC - Air-cushion state (0 = down) */
|
||||
int out; /* SO - State of Output Signal */
|
||||
int in; /* RI - State of Input Signal */
|
||||
};
|
||||
struct Motor_State {
|
||||
int motor; /* Motor number */
|
||||
int exists; /* True if Motor exists */
|
||||
int msr; /* MSR - Motor Status Register */
|
||||
int ored_msr; /* Cumulated MSR */
|
||||
int fp_cntr; /* Counter for *FP reports */
|
||||
int fr_cntr; /* Counter for *FR reports */
|
||||
int ss; /* SS - Status Flags Register */
|
||||
char pos_real[16]; /* U - Position as read (degrees) */
|
||||
char name[16]; /* MN */
|
||||
int dec_pt; /* A - # of decimal places */
|
||||
int enc_factor[2]; /* FD - Encoder scaling factors (numer/denom) */
|
||||
int mot_factor[2]; /* FM - Motor scaling factors (numer/denom) */
|
||||
char inertia_tol[16]; /* D - Inertia tol'nce (sec) (Schleppfehler) */
|
||||
int ramp; /* E - Start/stop ramp (kHz/sec) */
|
||||
int loop_mode; /* F - Open loop/Closed loop (0/1) */
|
||||
int slow_hz; /* G - Start/stop frequency (Mot-S/sec) */
|
||||
char lims[2][16]; /* H - Lower/Upper limits */
|
||||
int fast_hz; /* J - Top speed (Mot-S/sec) */
|
||||
int ref_mode; /* K - Reference mode */
|
||||
int backlash; /* L - Backlash par (Mot-S) (Spielausgleich) */
|
||||
int pos_tol; /* M - Position tolerance (Enc-Steps) */
|
||||
char ref_param[16]; /* Q - Parameter for "Goto Reference" */
|
||||
int is_sided; /* T - One-sided operation flag (0 = no) */
|
||||
char null_pt[16]; /* V - Null point */
|
||||
int ac_par; /* W - Air-cushion dependency */
|
||||
int enc_circ; /* Z - circumference of encoder (Enc-Steps) */
|
||||
int stat_pos; /* SP - # of positionings */
|
||||
int stat_pos_flt; /* ST - # of positioning faults (recovered) */
|
||||
int stat_pos_fail; /* SR - # of positioning fails (abandoned) */
|
||||
int stat_cush_fail; /* SA - # of air-cushion fails */
|
||||
char set_real[16]; /* P - Position as set (degrees) */
|
||||
int ac_state; /* AC - Air-cushion state (0 = down) */
|
||||
int out; /* SO - State of Output Signal */
|
||||
int in; /* RI - State of Input Signal */
|
||||
};
|
||||
/*------------------------------------------------ End of EL734_DEF.H --*/
|
||||
#endif /* _el734_def_ */
|
||||
#endif /* _el734_def_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@
|
||||
|
||||
#define EL734__BAD_HOST ASYNSRV__BAD_HOST
|
||||
#define EL734__BAD_BIND ASYNSRV__BAD_BIND
|
||||
#define EL734__BAD_SENDLEN ASYNSRV__BAD_SEND_LEN
|
||||
#define EL734__BAD_SENDLEN ASYNSRV__BAD_SEND_LEN
|
||||
#define EL734__BAD_SEND ASYNSRV__BAD_SEND
|
||||
#define EL734__BAD_SEND_PIPE ASYNSRV__BAD_SEND_PIPE
|
||||
#define EL734__BAD_SEND_UNKN ASYNSRV__BAD_SEND_UNKN
|
||||
@ -26,4 +26,4 @@
|
||||
#define EL734__BAD_RECV1_NET ASYNSRV__BAD_RECV1_NET
|
||||
#define EL734__BAD_CONNECT ASYNSRV__BAD_CONNECT
|
||||
#define EL734__BAD_ID EL734__BAD_DEV
|
||||
#endif /* el734fix */
|
||||
#endif /* el734fix */
|
||||
|
1045
hardsup/el734tcl.c
1045
hardsup/el734tcl.c
File diff suppressed because it is too large
Load Diff
@ -18,50 +18,52 @@
|
||||
#include <el737_errcodes.h>
|
||||
#endif
|
||||
|
||||
enum EL737_States {
|
||||
UNKNOWN = -2,
|
||||
OFFLINE = -1,
|
||||
MS = 0x0,
|
||||
PTS = 0x1,
|
||||
PCS = 0x2,
|
||||
LRTS = 0x5,
|
||||
LRCS = 0x6,
|
||||
PTSP = 0x9,
|
||||
PCSP = 0xA,
|
||||
LRTSP = 0xD,
|
||||
LRCSP = 0xE};
|
||||
enum EL737_States {
|
||||
UNKNOWN = -2,
|
||||
OFFLINE = -1,
|
||||
MS = 0x0,
|
||||
PTS = 0x1,
|
||||
PCS = 0x2,
|
||||
LRTS = 0x5,
|
||||
LRCS = 0x6,
|
||||
PTSP = 0x9,
|
||||
PCSP = 0xA,
|
||||
LRTSP = 0xD,
|
||||
LRCSP = 0xE
|
||||
};
|
||||
|
||||
enum EL737_Consts {
|
||||
VMECNT__PRESET_COUNT,
|
||||
VMECNT__PRESET_TIME,
|
||||
enum EL737_Consts {
|
||||
VMECNT__PRESET_COUNT,
|
||||
VMECNT__PRESET_TIME,
|
||||
|
||||
VMECNT__FULL,
|
||||
VMECNT__SHORT,
|
||||
VMECNT__INCR};
|
||||
VMECNT__FULL,
|
||||
VMECNT__SHORT,
|
||||
VMECNT__INCR
|
||||
};
|
||||
/*
|
||||
** Structure to which the EL737_Open handle points.
|
||||
*/
|
||||
struct EL737info {
|
||||
struct AsynSrv__info asyn_info; /* Contains skt, host, port & chan */
|
||||
int c5, c6, c7, c8;
|
||||
struct RS__MsgStruct to_host;
|
||||
struct RS__RespStruct from_host;
|
||||
};
|
||||
struct EL737info {
|
||||
struct AsynSrv__info asyn_info; /* Contains skt, host, port & chan */
|
||||
int c5, c6, c7, c8;
|
||||
struct RS__MsgStruct to_host;
|
||||
struct RS__RespStruct from_host;
|
||||
};
|
||||
/*
|
||||
** Structure holding everything that is known about a VME Neutron Counter.
|
||||
*/
|
||||
struct Counter_State {
|
||||
int state; /* RS */
|
||||
char timer[16]; /* RT \ RA */
|
||||
int cntrs[8]; /* RC 1 ... RC 8 / */
|
||||
char rates[8][16]; /* RR 1 ... RR 8 */
|
||||
char thresh_integ_time[8][16]; /* DI 1 ... DI 8 */
|
||||
char rate_integ_time[16]; /* DT */
|
||||
int analog_indx; /* DA */
|
||||
int thresh_indx; /* DR */
|
||||
char threshes[8][16]; /* DL 1 ... DL 8 */
|
||||
int mon_preset; /* MP */
|
||||
char timer_preset[16]; /* TP */
|
||||
};
|
||||
struct Counter_State {
|
||||
int state; /* RS */
|
||||
char timer[16]; /* RT \ RA */
|
||||
int cntrs[8]; /* RC 1 ... RC 8 / */
|
||||
char rates[8][16]; /* RR 1 ... RR 8 */
|
||||
char thresh_integ_time[8][16]; /* DI 1 ... DI 8 */
|
||||
char rate_integ_time[16]; /* DT */
|
||||
int analog_indx; /* DA */
|
||||
int thresh_indx; /* DR */
|
||||
char threshes[8][16]; /* DL 1 ... DL 8 */
|
||||
int mon_preset; /* MP */
|
||||
char timer_preset[16]; /* TP */
|
||||
};
|
||||
/*----------------------------------------------------- End of EL737_DEF.H --*/
|
||||
#endif /* _el737_def_ */
|
||||
#endif /* _el737_def_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@
|
||||
|
||||
#define EL737__BAD_HOST ASYNSRV__BAD_HOST
|
||||
#define EL737__BAD_BIND ASYNSRV__BAD_BIND
|
||||
#define EL737__BAD_SENDLEN ASYNSRV__BAD_SEND_LEN
|
||||
#define EL737__BAD_SENDLEN ASYNSRV__BAD_SEND_LEN
|
||||
#define EL737__BAD_SEND ASYNSRV__BAD_SEND
|
||||
#define EL737__BAD_SEND_PIPE ASYNSRV__BAD_SEND_PIPE
|
||||
#define EL737__BAD_SEND_UNKN ASYNSRV__BAD_SEND_UNKN
|
||||
@ -25,9 +25,9 @@
|
||||
#define EL737__BAD_RECV1_PIPE ASYNSRV__BAD_RECV1_PIPE
|
||||
#define EL737__BAD_RECV1_NET ASYNSRV__BAD_RECV1_NET
|
||||
#define EL737__BAD_CONNECT ASYNSRV__BAD_CONNECT
|
||||
#define EL737__BAD_ID -99995
|
||||
#define EL737__BAD_ID -99995
|
||||
#define EL737__BAD_SNTX -99991
|
||||
#define EL737__BAD_REPLY -99992
|
||||
#define EL737__BAD_ADR -99993
|
||||
#define EL737__BAD_RNG -99994
|
||||
#endif /* el734fix */
|
||||
#endif /* el734fix */
|
||||
|
@ -23,13 +23,13 @@
|
||||
#define True 1
|
||||
#define False 0
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *pData; /* EL737 open struct */
|
||||
} EL737st;
|
||||
typedef struct {
|
||||
void *pData; /* EL737 open struct */
|
||||
} EL737st;
|
||||
|
||||
EXTERN int EL737Action(ClientData pDat, Tcl_Interp *i, int a, char *argv[]);
|
||||
static void EL737Error2Text(char *pBuffer, int errcode);
|
||||
EXTERN int EL737Action(ClientData pDat, Tcl_Interp * i, int a,
|
||||
char *argv[]);
|
||||
static void EL737Error2Text(char *pBuffer, int errcode);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Tcl has a high niceness level. It deletes a command properly when
|
||||
@ -38,79 +38,73 @@
|
||||
---------------------------------------------------------------------------*/
|
||||
EXTERN void EL737Murder(ClientData pData)
|
||||
{
|
||||
EL737st *pTa = (EL737st *)pData;
|
||||
EL737_Close(&(pTa->pData));
|
||||
free(pData);
|
||||
EL737st *pTa = (EL737st *) pData;
|
||||
EL737_Close(&(pTa->pData));
|
||||
free(pData);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
CterEL737 is the main entry point for this stuff. It connects to a counter
|
||||
and, on success, creates a new command with the name of the counter.
|
||||
Syntax:
|
||||
EL737 name host port channel
|
||||
---------------------------------------------------------------------------*/
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
int CterEL737(ClientData clientData, Tcl_Interp *interp,
|
||||
int argc, char *argv[])
|
||||
int CterEL737(ClientData clientData, Tcl_Interp * interp,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
int iRet;
|
||||
EL737st *pEL737 = NULL;
|
||||
int iPort, iChannel, iMotor;
|
||||
char *pErr = NULL;
|
||||
char pBueffel[80];
|
||||
|
||||
/* check arguments */
|
||||
if(argc < 5)
|
||||
{
|
||||
Tcl_AppendResult(interp,
|
||||
" Insufficient arguments: CterEL737 name host port channel"
|
||||
, (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* convert arguments */
|
||||
iRet = Tcl_GetInt(interp,argv[3],&iPort);
|
||||
if(iRet == TCL_ERROR)
|
||||
{
|
||||
Tcl_AppendResult(interp,"Need integer value for port",
|
||||
(char *)NULL);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
iRet = Tcl_GetInt(interp,argv[4],&iChannel);
|
||||
if(iRet == TCL_ERROR)
|
||||
{
|
||||
Tcl_AppendResult(interp,"Need integer value for channel",
|
||||
(char *)NULL);
|
||||
return iRet;
|
||||
}
|
||||
int iRet;
|
||||
EL737st *pEL737 = NULL;
|
||||
int iPort, iChannel, iMotor;
|
||||
char *pErr = NULL;
|
||||
char pBueffel[80];
|
||||
|
||||
/* make a new pointer, initialise EL737st */
|
||||
pEL737 = (EL737st *)malloc(sizeof(EL737st));
|
||||
if(pEL737 ==NULL)
|
||||
{
|
||||
Tcl_AppendResult(interp,"No memory in EL734",NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
/* check arguments */
|
||||
if (argc < 5) {
|
||||
Tcl_AppendResult(interp,
|
||||
" Insufficient arguments: CterEL737 name host port channel",
|
||||
(char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* open the rotten Counter, finally */
|
||||
iRet = EL737_Open(&(pEL737->pData), argv[2],iPort,iChannel);
|
||||
if(iRet) /* success */
|
||||
{
|
||||
/* handle TCL, create new command: the Counter */
|
||||
Tcl_CreateCommand(interp,strdup(argv[1]),EL737Action,
|
||||
(ClientData)pEL737,EL737Murder);
|
||||
Tcl_AppendResult(interp,strdup(argv[1]),(char *)NULL);
|
||||
return TCL_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
EL737_ErrInfo(&pErr,&iPort,&iChannel, &iMotor);
|
||||
EL737Error2Text(pBueffel,iPort);
|
||||
Tcl_AppendResult(interp,pBueffel,(char *) NULL);
|
||||
free(pEL737);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
/* convert arguments */
|
||||
iRet = Tcl_GetInt(interp, argv[3], &iPort);
|
||||
if (iRet == TCL_ERROR) {
|
||||
Tcl_AppendResult(interp, "Need integer value for port", (char *) NULL);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
iRet = Tcl_GetInt(interp, argv[4], &iChannel);
|
||||
if (iRet == TCL_ERROR) {
|
||||
Tcl_AppendResult(interp, "Need integer value for channel",
|
||||
(char *) NULL);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* make a new pointer, initialise EL737st */
|
||||
pEL737 = (EL737st *) malloc(sizeof(EL737st));
|
||||
if (pEL737 == NULL) {
|
||||
Tcl_AppendResult(interp, "No memory in EL734", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* open the rotten Counter, finally */
|
||||
iRet = EL737_Open(&(pEL737->pData), argv[2], iPort, iChannel);
|
||||
if (iRet) { /* success */
|
||||
/* handle TCL, create new command: the Counter */
|
||||
Tcl_CreateCommand(interp, strdup(argv[1]), EL737Action,
|
||||
(ClientData) pEL737, EL737Murder);
|
||||
Tcl_AppendResult(interp, strdup(argv[1]), (char *) NULL);
|
||||
return TCL_OK;
|
||||
} else {
|
||||
EL737_ErrInfo(&pErr, &iPort, &iChannel, &iMotor);
|
||||
EL737Error2Text(pBueffel, iPort);
|
||||
Tcl_AppendResult(interp, pBueffel, (char *) NULL);
|
||||
free(pEL737);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
EL737 Action is the routine where commands send to the conter will
|
||||
@ -130,271 +124,241 @@ int CterEL737(ClientData clientData, Tcl_Interp *interp,
|
||||
{ counts monitor time }
|
||||
counter Stop forces counter to stop
|
||||
----------------------------------------------------------------------------*/
|
||||
EXTERN int EL737Action(ClientData clientData, Tcl_Interp *interp,
|
||||
int argc, char *argv[])
|
||||
EXTERN int EL737Action(ClientData clientData, Tcl_Interp * interp,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
EL737st *pData = (EL737st *)clientData;
|
||||
char pBueffel[132];
|
||||
char pNumBuf[20];
|
||||
char *pErr = NULL;
|
||||
int iC1, iC2, iC3, iC4, iRS, iRet;
|
||||
float fTime;
|
||||
int iFlag = 0;
|
||||
int iMode;
|
||||
double dVal;
|
||||
EL737st *pData = (EL737st *) clientData;
|
||||
char pBueffel[132];
|
||||
char pNumBuf[20];
|
||||
char *pErr = NULL;
|
||||
int iC1, iC2, iC3, iC4, iRS, iRet;
|
||||
float fTime;
|
||||
int iFlag = 0;
|
||||
int iMode;
|
||||
double dVal;
|
||||
|
||||
/* obviously we need at least a keyword! */
|
||||
if(argc < 2)
|
||||
{
|
||||
Tcl_AppendResult(interp,"No keyword given",NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* get values out */
|
||||
if(strcmp(argv[1],"value") == 0)
|
||||
{
|
||||
iRet = EL737_GetStatus(&(pData->pData),&iC1, &iC2, &iC3,
|
||||
&iC4,&fTime,&iRS);
|
||||
if(!iRet)
|
||||
{
|
||||
EL737_ErrInfo(&pErr,&iC1,&iC2, &iC3);
|
||||
EL737Error2Text(pBueffel,iC1);
|
||||
Tcl_AppendResult(interp,pBueffel,(char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
sprintf(pNumBuf,"%d",iC2);
|
||||
Tcl_AppendElement(interp,pNumBuf);
|
||||
sprintf(pNumBuf,"%d",iC1);
|
||||
Tcl_AppendElement(interp,pNumBuf);
|
||||
sprintf(pNumBuf,"%f",fTime);
|
||||
Tcl_AppendElement(interp,pNumBuf);
|
||||
return TCL_OK;
|
||||
}
|
||||
/* obviously we need at least a keyword! */
|
||||
if (argc < 2) {
|
||||
Tcl_AppendResult(interp, "No keyword given", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* isDone ? */
|
||||
if(strcmp(argv[1],"isDone") == 0)
|
||||
{
|
||||
iRet = EL737_GetStatus(&(pData->pData),&iC1, &iC2, &iC3,
|
||||
&iC4,&fTime,&iRS);
|
||||
if(!iRet)
|
||||
{
|
||||
EL737_ErrInfo(&pErr,&iC1,&iC2, &iC3);
|
||||
EL737Error2Text(pBueffel,iC1);
|
||||
Tcl_AppendResult(interp,pBueffel,(char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if(iRS == 0) /* done is true */
|
||||
{
|
||||
sprintf(pNumBuf,"%d",True);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(pNumBuf,"%d",False);
|
||||
}
|
||||
Tcl_AppendResult(interp,pNumBuf,(char *) NULL);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/* actual counting neutrons in two different modes */
|
||||
if(strcmp(argv[1],"wait") == 0)
|
||||
{
|
||||
iFlag = 2;
|
||||
}
|
||||
if(strcmp(argv[1],"start") == 0)
|
||||
{
|
||||
iFlag = 1;
|
||||
}
|
||||
if(iFlag > 0) /* we need to count */
|
||||
{
|
||||
if(argc < 4) /* not enough arguments */
|
||||
{
|
||||
Tcl_AppendResult(interp,"Usage: ",argv[0],argv[1],
|
||||
" timer or monitor val",NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* timer or monitor preset ? */
|
||||
if(strcmp(argv[2],"timer") == 0)
|
||||
{
|
||||
iMode = 1;
|
||||
}
|
||||
else if (strcmp(argv[2],"monitor") == 0)
|
||||
{
|
||||
iMode = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
Tcl_AppendResult(interp,"Usage: ",argv[0],argv[1],
|
||||
" timer or monitor val",NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* get the preset value */
|
||||
iRet = Tcl_GetDouble(interp,argv[3],&dVal);
|
||||
if(iRet == TCL_ERROR)
|
||||
{
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* actual start collecting neutrons */
|
||||
if(iMode == 1)
|
||||
{
|
||||
iRet = EL737_StartTime(&(pData->pData),(float)dVal,
|
||||
&iRS);
|
||||
}
|
||||
else
|
||||
{
|
||||
iRet = EL737_StartCnt(&(pData->pData),(int)dVal,
|
||||
&iRS);
|
||||
}
|
||||
if(!iRet)
|
||||
{
|
||||
EL737_ErrInfo(&pErr,&iC1,&iC2, &iC3);
|
||||
EL737Error2Text(pBueffel,iC1);
|
||||
Tcl_AppendResult(interp,pBueffel,(char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
} /* end of count startup code */
|
||||
|
||||
/* if apropriate: wait */
|
||||
if(iFlag == 2)
|
||||
{
|
||||
iRet = EL737_WaitIdle(&(pData->pData),&iC1, &iC2, &iC3,
|
||||
&iC4,&fTime);
|
||||
if(!iRet)
|
||||
{
|
||||
EL737_ErrInfo(&pErr,&iC1,&iC2, &iC3);
|
||||
EL737Error2Text(pBueffel,iC1);
|
||||
Tcl_AppendResult(interp,pBueffel,(char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
else if(iFlag == 1)
|
||||
{
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/* the stop command */
|
||||
if(strcmp(argv[1],"stop") == 0)
|
||||
{
|
||||
iRet = EL737_Stop(&(pData->pData),&iC1, &iC2, &iC3,
|
||||
&iC4,&fTime,&iRS);
|
||||
if(!iRet)
|
||||
{
|
||||
EL737_ErrInfo(&pErr,&iC1,&iC2, &iC3);
|
||||
EL737Error2Text(pBueffel,iC1);
|
||||
Tcl_AppendResult(interp,pBueffel,(char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
/* get values out */
|
||||
if (strcmp(argv[1], "value") == 0) {
|
||||
iRet = EL737_GetStatus(&(pData->pData), &iC1, &iC2, &iC3,
|
||||
&iC4, &fTime, &iRS);
|
||||
if (!iRet) {
|
||||
EL737_ErrInfo(&pErr, &iC1, &iC2, &iC3);
|
||||
EL737Error2Text(pBueffel, iC1);
|
||||
Tcl_AppendResult(interp, pBueffel, (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
sprintf(pNumBuf, "%d", iC2);
|
||||
Tcl_AppendElement(interp, pNumBuf);
|
||||
sprintf(pNumBuf, "%d", iC1);
|
||||
Tcl_AppendElement(interp, pNumBuf);
|
||||
sprintf(pNumBuf, "%f", fTime);
|
||||
Tcl_AppendElement(interp, pNumBuf);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
Tcl_AppendResult(interp," obscure command: ",argv[1],
|
||||
" not understood by EL737 counter", NULL);
|
||||
return TCL_ERROR;
|
||||
/* isDone ? */
|
||||
if (strcmp(argv[1], "isDone") == 0) {
|
||||
iRet = EL737_GetStatus(&(pData->pData), &iC1, &iC2, &iC3,
|
||||
&iC4, &fTime, &iRS);
|
||||
if (!iRet) {
|
||||
EL737_ErrInfo(&pErr, &iC1, &iC2, &iC3);
|
||||
EL737Error2Text(pBueffel, iC1);
|
||||
Tcl_AppendResult(interp, pBueffel, (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (iRS == 0) { /* done is true */
|
||||
sprintf(pNumBuf, "%d", True);
|
||||
} else {
|
||||
sprintf(pNumBuf, "%d", False);
|
||||
}
|
||||
Tcl_AppendResult(interp, pNumBuf, (char *) NULL);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/* actual counting neutrons in two different modes */
|
||||
if (strcmp(argv[1], "wait") == 0) {
|
||||
iFlag = 2;
|
||||
}
|
||||
if (strcmp(argv[1], "start") == 0) {
|
||||
iFlag = 1;
|
||||
}
|
||||
if (iFlag > 0) { /* we need to count */
|
||||
if (argc < 4) { /* not enough arguments */
|
||||
Tcl_AppendResult(interp, "Usage: ", argv[0], argv[1],
|
||||
" timer or monitor val", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* timer or monitor preset ? */
|
||||
if (strcmp(argv[2], "timer") == 0) {
|
||||
iMode = 1;
|
||||
} else if (strcmp(argv[2], "monitor") == 0) {
|
||||
iMode = 2;
|
||||
} else {
|
||||
Tcl_AppendResult(interp, "Usage: ", argv[0], argv[1],
|
||||
" timer or monitor val", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* get the preset value */
|
||||
iRet = Tcl_GetDouble(interp, argv[3], &dVal);
|
||||
if (iRet == TCL_ERROR) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* actual start collecting neutrons */
|
||||
if (iMode == 1) {
|
||||
iRet = EL737_StartTime(&(pData->pData), (float) dVal, &iRS);
|
||||
} else {
|
||||
iRet = EL737_StartCnt(&(pData->pData), (int) dVal, &iRS);
|
||||
}
|
||||
if (!iRet) {
|
||||
EL737_ErrInfo(&pErr, &iC1, &iC2, &iC3);
|
||||
EL737Error2Text(pBueffel, iC1);
|
||||
Tcl_AppendResult(interp, pBueffel, (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* end of count startup code */
|
||||
/* if apropriate: wait */
|
||||
if (iFlag == 2) {
|
||||
iRet = EL737_WaitIdle(&(pData->pData), &iC1, &iC2, &iC3, &iC4, &fTime);
|
||||
if (!iRet) {
|
||||
EL737_ErrInfo(&pErr, &iC1, &iC2, &iC3);
|
||||
EL737Error2Text(pBueffel, iC1);
|
||||
Tcl_AppendResult(interp, pBueffel, (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
} else if (iFlag == 1) {
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/* the stop command */
|
||||
if (strcmp(argv[1], "stop") == 0) {
|
||||
iRet = EL737_Stop(&(pData->pData), &iC1, &iC2, &iC3,
|
||||
&iC4, &fTime, &iRS);
|
||||
if (!iRet) {
|
||||
EL737_ErrInfo(&pErr, &iC1, &iC2, &iC3);
|
||||
EL737Error2Text(pBueffel, iC1);
|
||||
Tcl_AppendResult(interp, pBueffel, (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
Tcl_AppendResult(interp, " obscure command: ", argv[1],
|
||||
" not understood by EL737 counter", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
EL737Error2Text converts between an EL734 error code to text
|
||||
-----------------------------------------------------------------------------*/
|
||||
void EL737Error2Text(char *pBuffer, int iErr)
|
||||
{
|
||||
switch(iErr)
|
||||
{
|
||||
case -28:
|
||||
strcpy(pBuffer,"EL737__BAD_ADR");
|
||||
break;
|
||||
case -8:
|
||||
strcpy(pBuffer,"EL737__BAD_OVFL");
|
||||
break;
|
||||
case -30:
|
||||
strcpy(pBuffer,"EL737__BAD_BSY");
|
||||
break;
|
||||
case -3:
|
||||
strcpy(pBuffer,"EL737__BAD_SNTX");
|
||||
break;
|
||||
case -9:
|
||||
strcpy(pBuffer,"EL737__BAD_CONNECT");
|
||||
break;
|
||||
case -23:
|
||||
strcpy(pBuffer,"EL737__BAD_FLUSH");
|
||||
break;
|
||||
case -6:
|
||||
strcpy(pBuffer,"EL734__BAD_DEV");
|
||||
break;
|
||||
case -10:
|
||||
strcpy(pBuffer,"EL737__BAD_ID");
|
||||
break;
|
||||
case -5:
|
||||
strcpy(pBuffer,"EL737__BAD_ILLG");
|
||||
break;
|
||||
case -2:
|
||||
strcpy(pBuffer,"EL737__BAD_LOC");
|
||||
break;
|
||||
case -11:
|
||||
strcpy(pBuffer,"EL737__BAD_MALLOC");
|
||||
break;
|
||||
case -21:
|
||||
strcpy(pBuffer,"EL737__BAD_NOT_BCD");
|
||||
break;
|
||||
case -4:
|
||||
strcpy(pBuffer,"EL737__BAD_OFL");
|
||||
break;
|
||||
case -29:
|
||||
strcpy(pBuffer,"EL737__BAD_PAR");
|
||||
break;
|
||||
|
||||
case -17:
|
||||
strcpy(pBuffer,"EL737__BAD_RECV");
|
||||
break;
|
||||
case -19:
|
||||
strcpy(pBuffer,"EL737__BAD_RECV_NET");
|
||||
break;
|
||||
case -18:
|
||||
strcpy(pBuffer,"EL737__BAD_RECV_PIPE");
|
||||
break;
|
||||
case -20:
|
||||
strcpy(pBuffer,"EL737__BAD_RECV_UNKN");
|
||||
break;
|
||||
case -22:
|
||||
strcpy(pBuffer,"EL737__BAD_RECVLEN");
|
||||
break;
|
||||
case -24:
|
||||
strcpy(pBuffer,"EL737__BAD_RECV1");
|
||||
break;
|
||||
case -26:
|
||||
strcpy(pBuffer,"EL737__BAD_RECV1_NET");
|
||||
break;
|
||||
case -25:
|
||||
strcpy(pBuffer,"EL737__BAD_RECV1_PIPE");
|
||||
break;
|
||||
case -27:
|
||||
strcpy(pBuffer,"EL737__BAD_RNG");
|
||||
break;
|
||||
case -13:
|
||||
strcpy(pBuffer,"EL737__BAD_SEND");
|
||||
break;
|
||||
case -14:
|
||||
strcpy(pBuffer,"EL737__BAD_SEND_PIPE");
|
||||
break;
|
||||
case -15:
|
||||
strcpy(pBuffer,"EL737__BAD_SEND_NET");
|
||||
break;
|
||||
case -16:
|
||||
strcpy(pBuffer,"EL737__BAD_SEND_UNKN");
|
||||
break;
|
||||
case -12:
|
||||
strcpy(pBuffer,"EL737__BAD_SENDLEN");
|
||||
break;
|
||||
case -7:
|
||||
strcpy(pBuffer,"EL737__BAD_SOCKET");
|
||||
break;
|
||||
case -1:
|
||||
strcpy(pBuffer,"EL737__BAD_TMO");
|
||||
break;
|
||||
default:
|
||||
strcpy(pBuffer,"Unknown EL737 error");
|
||||
break;
|
||||
}
|
||||
}
|
||||
void EL737Error2Text(char *pBuffer, int iErr)
|
||||
{
|
||||
switch (iErr) {
|
||||
case -28:
|
||||
strcpy(pBuffer, "EL737__BAD_ADR");
|
||||
break;
|
||||
case -8:
|
||||
strcpy(pBuffer, "EL737__BAD_OVFL");
|
||||
break;
|
||||
case -30:
|
||||
strcpy(pBuffer, "EL737__BAD_BSY");
|
||||
break;
|
||||
case -3:
|
||||
strcpy(pBuffer, "EL737__BAD_SNTX");
|
||||
break;
|
||||
case -9:
|
||||
strcpy(pBuffer, "EL737__BAD_CONNECT");
|
||||
break;
|
||||
case -23:
|
||||
strcpy(pBuffer, "EL737__BAD_FLUSH");
|
||||
break;
|
||||
case -6:
|
||||
strcpy(pBuffer, "EL734__BAD_DEV");
|
||||
break;
|
||||
case -10:
|
||||
strcpy(pBuffer, "EL737__BAD_ID");
|
||||
break;
|
||||
case -5:
|
||||
strcpy(pBuffer, "EL737__BAD_ILLG");
|
||||
break;
|
||||
case -2:
|
||||
strcpy(pBuffer, "EL737__BAD_LOC");
|
||||
break;
|
||||
case -11:
|
||||
strcpy(pBuffer, "EL737__BAD_MALLOC");
|
||||
break;
|
||||
case -21:
|
||||
strcpy(pBuffer, "EL737__BAD_NOT_BCD");
|
||||
break;
|
||||
case -4:
|
||||
strcpy(pBuffer, "EL737__BAD_OFL");
|
||||
break;
|
||||
case -29:
|
||||
strcpy(pBuffer, "EL737__BAD_PAR");
|
||||
break;
|
||||
|
||||
case -17:
|
||||
strcpy(pBuffer, "EL737__BAD_RECV");
|
||||
break;
|
||||
case -19:
|
||||
strcpy(pBuffer, "EL737__BAD_RECV_NET");
|
||||
break;
|
||||
case -18:
|
||||
strcpy(pBuffer, "EL737__BAD_RECV_PIPE");
|
||||
break;
|
||||
case -20:
|
||||
strcpy(pBuffer, "EL737__BAD_RECV_UNKN");
|
||||
break;
|
||||
case -22:
|
||||
strcpy(pBuffer, "EL737__BAD_RECVLEN");
|
||||
break;
|
||||
case -24:
|
||||
strcpy(pBuffer, "EL737__BAD_RECV1");
|
||||
break;
|
||||
case -26:
|
||||
strcpy(pBuffer, "EL737__BAD_RECV1_NET");
|
||||
break;
|
||||
case -25:
|
||||
strcpy(pBuffer, "EL737__BAD_RECV1_PIPE");
|
||||
break;
|
||||
case -27:
|
||||
strcpy(pBuffer, "EL737__BAD_RNG");
|
||||
break;
|
||||
case -13:
|
||||
strcpy(pBuffer, "EL737__BAD_SEND");
|
||||
break;
|
||||
case -14:
|
||||
strcpy(pBuffer, "EL737__BAD_SEND_PIPE");
|
||||
break;
|
||||
case -15:
|
||||
strcpy(pBuffer, "EL737__BAD_SEND_NET");
|
||||
break;
|
||||
case -16:
|
||||
strcpy(pBuffer, "EL737__BAD_SEND_UNKN");
|
||||
break;
|
||||
case -12:
|
||||
strcpy(pBuffer, "EL737__BAD_SENDLEN");
|
||||
break;
|
||||
case -7:
|
||||
strcpy(pBuffer, "EL737__BAD_SOCKET");
|
||||
break;
|
||||
case -1:
|
||||
strcpy(pBuffer, "EL737__BAD_TMO");
|
||||
break;
|
||||
default:
|
||||
strcpy(pBuffer, "Unknown EL737 error");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -21,11 +21,11 @@
|
||||
/*
|
||||
** Structure to which the EL755_Open handle points.
|
||||
*/
|
||||
struct EL755info {
|
||||
struct AsynSrv__info asyn_info; /* Contains skt, host, port & chan */
|
||||
int index;
|
||||
struct RS__MsgStruct to_host;
|
||||
struct RS__RespStruct from_host;
|
||||
};
|
||||
struct EL755info {
|
||||
struct AsynSrv__info asyn_info; /* Contains skt, host, port & chan */
|
||||
int index;
|
||||
struct RS__MsgStruct to_host;
|
||||
struct RS__RespStruct from_host;
|
||||
};
|
||||
/*------------------------------------------------ End of EL755_DEF.H --*/
|
||||
#endif /* _el755_def_ */
|
||||
#endif /* _el755_def_ */
|
||||
|
@ -16,11 +16,13 @@
|
||||
** routine if he wishes to log these errors in
|
||||
** some other way.
|
||||
*/
|
||||
void EL755_ErrorLog (
|
||||
void EL755_ErrorLog(
|
||||
/* ==============
|
||||
*/ char *routine_name,
|
||||
char *text) {
|
||||
*/ char *routine_name,
|
||||
char *text)
|
||||
{
|
||||
|
||||
fprintf(stderr, "%s: %s\n", routine_name, text);
|
||||
}
|
||||
|
||||
fprintf (stderr, "%s: %s\n", routine_name, text);
|
||||
}
|
||||
/*-------------------------------------------- End of EL755_ErrorLog.C =======*/
|
||||
|
File diff suppressed because it is too large
Load Diff
199
hardsup/err.c
199
hardsup/err.c
@ -3,103 +3,102 @@
|
||||
|
||||
EL734Error2Text converts between an EL734 error code to text
|
||||
-----------------------------------------------------------------------------*/
|
||||
void EL734Error2Text(char *pBuffer, int iErr)
|
||||
{
|
||||
switch(iErr)
|
||||
{
|
||||
case -28:
|
||||
strcpy(pBuffer,"EL734__BAD_ADR");
|
||||
break;
|
||||
case -8:
|
||||
strcpy(pBuffer,"EL734__BAD_BIND");
|
||||
break;
|
||||
case -30:
|
||||
strcpy(pBuffer,"EL734__BAD_BSY");
|
||||
break;
|
||||
case -3:
|
||||
strcpy(pBuffer,"EL734__BAD_CMD");
|
||||
break;
|
||||
case -9:
|
||||
strcpy(pBuffer,"EL734__BAD_CONNECT");
|
||||
break;
|
||||
case -23:
|
||||
strcpy(pBuffer,"EL734__BAD_FLUSH");
|
||||
break;
|
||||
case -6:
|
||||
strcpy(pBuffer,"EL734__BAD_HOST");
|
||||
break;
|
||||
case -10:
|
||||
strcpy(pBuffer,"EL734__BAD_ID");
|
||||
break;
|
||||
case -5:
|
||||
strcpy(pBuffer,"EL734__BAD_ILLG");
|
||||
break;
|
||||
case -2:
|
||||
strcpy(pBuffer,"EL734__BAD_LOC");
|
||||
break;
|
||||
case -11:
|
||||
strcpy(pBuffer,"EL734__BAD_MALLOC");
|
||||
break;
|
||||
case -21:
|
||||
strcpy(pBuffer,"EL734__BAD_NOT_BCD");
|
||||
break;
|
||||
case -4:
|
||||
strcpy(pBuffer,"EL734__BAD_OFL");
|
||||
break;
|
||||
case -29:
|
||||
strcpy(pBuffer,"EL734__BAD_PAR");
|
||||
break;
|
||||
|
||||
case -17:
|
||||
strcpy(pBuffer,"EL734__BAD_RECV");
|
||||
break;
|
||||
case -19:
|
||||
strcpy(pBuffer,"EL734__BAD_RECV_NET");
|
||||
break;
|
||||
case -18:
|
||||
strcpy(pBuffer,"EL734__BAD_RECV_PIPE");
|
||||
break;
|
||||
case -20:
|
||||
strcpy(pBuffer,"EL734__BAD_RECV_UNKN");
|
||||
break;
|
||||
case -22:
|
||||
strcpy(pBuffer,"EL734__BAD_RECVLEN");
|
||||
break;
|
||||
case -24:
|
||||
strcpy(pBuffer,"EL734__BAD_RECV1");
|
||||
break;
|
||||
case -26:
|
||||
strcpy(pBuffer,"EL734__BAD_RECV1_NET");
|
||||
break;
|
||||
case -25:
|
||||
strcpy(pBuffer,"EL734__BAD_RECV1_PIPE");
|
||||
break;
|
||||
case -27:
|
||||
strcpy(pBuffer,"EL734__BAD_RNG");
|
||||
break;
|
||||
case -13:
|
||||
strcpy(pBuffer,"EL734__BAD_SEND");
|
||||
break;
|
||||
case -14:
|
||||
strcpy(pBuffer,"EL734__BAD_SEND_PIPE");
|
||||
break;
|
||||
case -15:
|
||||
strcpy(pBuffer,"EL734__BAD_SEND_NET");
|
||||
break;
|
||||
case -16:
|
||||
strcpy(pBuffer,"EL734__BAD_SEND_UNKN");
|
||||
break;
|
||||
case -12:
|
||||
strcpy(pBuffer,"EL734__BAD_SENDLEN");
|
||||
break;
|
||||
case -7:
|
||||
strcpy(pBuffer,"EL734__BAD_SOCKET");
|
||||
break;
|
||||
case -1:
|
||||
strcpy(pBuffer,"EL734__BAD_TMO");
|
||||
break;
|
||||
default:
|
||||
strcpy(pBuffer,"Unknown EL734 error");
|
||||
break;
|
||||
}
|
||||
}
|
||||
void EL734Error2Text(char *pBuffer, int iErr)
|
||||
{
|
||||
switch (iErr) {
|
||||
case -28:
|
||||
strcpy(pBuffer, "EL734__BAD_ADR");
|
||||
break;
|
||||
case -8:
|
||||
strcpy(pBuffer, "EL734__BAD_BIND");
|
||||
break;
|
||||
case -30:
|
||||
strcpy(pBuffer, "EL734__BAD_BSY");
|
||||
break;
|
||||
case -3:
|
||||
strcpy(pBuffer, "EL734__BAD_CMD");
|
||||
break;
|
||||
case -9:
|
||||
strcpy(pBuffer, "EL734__BAD_CONNECT");
|
||||
break;
|
||||
case -23:
|
||||
strcpy(pBuffer, "EL734__BAD_FLUSH");
|
||||
break;
|
||||
case -6:
|
||||
strcpy(pBuffer, "EL734__BAD_HOST");
|
||||
break;
|
||||
case -10:
|
||||
strcpy(pBuffer, "EL734__BAD_ID");
|
||||
break;
|
||||
case -5:
|
||||
strcpy(pBuffer, "EL734__BAD_ILLG");
|
||||
break;
|
||||
case -2:
|
||||
strcpy(pBuffer, "EL734__BAD_LOC");
|
||||
break;
|
||||
case -11:
|
||||
strcpy(pBuffer, "EL734__BAD_MALLOC");
|
||||
break;
|
||||
case -21:
|
||||
strcpy(pBuffer, "EL734__BAD_NOT_BCD");
|
||||
break;
|
||||
case -4:
|
||||
strcpy(pBuffer, "EL734__BAD_OFL");
|
||||
break;
|
||||
case -29:
|
||||
strcpy(pBuffer, "EL734__BAD_PAR");
|
||||
break;
|
||||
|
||||
case -17:
|
||||
strcpy(pBuffer, "EL734__BAD_RECV");
|
||||
break;
|
||||
case -19:
|
||||
strcpy(pBuffer, "EL734__BAD_RECV_NET");
|
||||
break;
|
||||
case -18:
|
||||
strcpy(pBuffer, "EL734__BAD_RECV_PIPE");
|
||||
break;
|
||||
case -20:
|
||||
strcpy(pBuffer, "EL734__BAD_RECV_UNKN");
|
||||
break;
|
||||
case -22:
|
||||
strcpy(pBuffer, "EL734__BAD_RECVLEN");
|
||||
break;
|
||||
case -24:
|
||||
strcpy(pBuffer, "EL734__BAD_RECV1");
|
||||
break;
|
||||
case -26:
|
||||
strcpy(pBuffer, "EL734__BAD_RECV1_NET");
|
||||
break;
|
||||
case -25:
|
||||
strcpy(pBuffer, "EL734__BAD_RECV1_PIPE");
|
||||
break;
|
||||
case -27:
|
||||
strcpy(pBuffer, "EL734__BAD_RNG");
|
||||
break;
|
||||
case -13:
|
||||
strcpy(pBuffer, "EL734__BAD_SEND");
|
||||
break;
|
||||
case -14:
|
||||
strcpy(pBuffer, "EL734__BAD_SEND_PIPE");
|
||||
break;
|
||||
case -15:
|
||||
strcpy(pBuffer, "EL734__BAD_SEND_NET");
|
||||
break;
|
||||
case -16:
|
||||
strcpy(pBuffer, "EL734__BAD_SEND_UNKN");
|
||||
break;
|
||||
case -12:
|
||||
strcpy(pBuffer, "EL734__BAD_SENDLEN");
|
||||
break;
|
||||
case -7:
|
||||
strcpy(pBuffer, "EL734__BAD_SOCKET");
|
||||
break;
|
||||
case -1:
|
||||
strcpy(pBuffer, "EL734__BAD_TMO");
|
||||
break;
|
||||
default:
|
||||
strcpy(pBuffer, "Unknown EL734 error");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -89,21 +89,23 @@
|
||||
/*
|
||||
** FailInet: Some network failure has occurred.
|
||||
*/
|
||||
void FailInet (char *text) {
|
||||
void FailInet(char *text)
|
||||
{
|
||||
/* ========
|
||||
** Output the given text and exit the process.
|
||||
*/
|
||||
int my_errno, my_vaxc_errno;
|
||||
int my_errno, my_vaxc_errno;
|
||||
|
||||
GetErrno (&my_errno, &my_vaxc_errno);
|
||||
printf ("### Internet Error ###\n");
|
||||
GetErrno(&my_errno, &my_vaxc_errno);
|
||||
printf("### Internet Error ###\n");
|
||||
#ifdef __VMS
|
||||
printf (" ### errno = %d.\n", my_errno);
|
||||
printf (" ### vaxc$errno = %d.\n", my_vaxc_errno);
|
||||
printf(" ### errno = %d.\n", my_errno);
|
||||
printf(" ### vaxc$errno = %d.\n", my_vaxc_errno);
|
||||
#else
|
||||
printf (" ### errno = %d.\n", my_errno);
|
||||
printf(" ### errno = %d.\n", my_errno);
|
||||
#endif
|
||||
perror (text);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
perror(text);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/*------------------------------------------------- End of FAILINET.C =======*/
|
||||
|
@ -82,15 +82,17 @@
|
||||
/*--------------------------------------------------------------------------
|
||||
** GetErrno: Make copies of errno and vaxc$errno for debug.
|
||||
*/
|
||||
void GetErrno (int *his_errno, int *his_vaxc_errno) {
|
||||
void GetErrno(int *his_errno, int *his_vaxc_errno)
|
||||
{
|
||||
/* ========
|
||||
*/
|
||||
*his_errno = errno; /* Make copy of errno */
|
||||
*his_errno = errno; /* Make copy of errno */
|
||||
#ifdef __VMS
|
||||
*his_vaxc_errno = vaxc$errno; /* Make copy of vaxc$errno */
|
||||
*his_vaxc_errno = vaxc$errno; /* Make copy of vaxc$errno */
|
||||
#else
|
||||
*his_vaxc_errno = 1;
|
||||
*his_vaxc_errno = 1;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*------------------------------------------------- End of GETERRNO.C =======*/
|
||||
|
@ -45,377 +45,340 @@
|
||||
#include "itc4util.h"
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
int ITC4_Open(pITC4 *pData, char *pHost, int iPort, int iChannel, int iMode)
|
||||
{
|
||||
int iRet;
|
||||
char pCommand[80];
|
||||
char pReply[132];
|
||||
pITC4 self = NULL;
|
||||
|
||||
self = (pITC4)malloc(sizeof(ITC4));
|
||||
if(self == NULL)
|
||||
{
|
||||
return ITC4__BADMALLOC;
|
||||
}
|
||||
*pData = self;
|
||||
self->iControl = 1;
|
||||
self->iRead = 1;
|
||||
self->iReadOnly = iMode;
|
||||
self->fDiv = 10.;
|
||||
self->fMult = 10.;
|
||||
|
||||
iRet = SerialOpen(&self->pData, pHost, iPort, iChannel);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
int ITC4_Open(pITC4 * pData, char *pHost, int iPort, int iChannel,
|
||||
int iMode)
|
||||
{
|
||||
int iRet;
|
||||
char pCommand[80];
|
||||
char pReply[132];
|
||||
pITC4 self = NULL;
|
||||
|
||||
/* set an lengthy timeout for the configuration in order to
|
||||
prevent problems.
|
||||
*/
|
||||
iRet = SerialConfig(&self->pData, 100);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* an identification test has been here, but I had to removed as not all
|
||||
ITC4 controllers at SINQ answer the V command. Some versions of the
|
||||
controller do not recognize it. Sighhhhhhh. I had to put it in again
|
||||
in order to check for ITC-503, but I handle the thing by default as
|
||||
an ITC4 if I do not get a proper response.
|
||||
*/
|
||||
self->i503 = 0;
|
||||
iRet = SerialWriteRead(&self->pData,"V\r\n",pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
if(strstr(pReply,"ITC503") != NULL)
|
||||
{
|
||||
self->i503 = 1;
|
||||
}
|
||||
|
||||
if(!self->iReadOnly)
|
||||
{
|
||||
/* switch to remote and locked operation */
|
||||
iRet = SerialWriteRead(&self->pData,"C3\r\n",pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
if(pReply[0] == '?')
|
||||
{
|
||||
strcpy(self->pAns,pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
|
||||
/* set the control sensor, for this we need to switch A0 first,
|
||||
the do it and switch back
|
||||
*/
|
||||
iRet = SerialWriteRead(&self->pData,"A0\r\n",pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
if(pReply[0] == '?')
|
||||
{
|
||||
strcpy(self->pAns,pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
|
||||
sprintf(pCommand,"H%1.1d\r\n",self->iControl);
|
||||
iRet = SerialWriteRead(&self->pData,pCommand,pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
if(pReply[0] == '?')
|
||||
{
|
||||
strcpy(self->pAns,pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
|
||||
/* controls to automatic */
|
||||
iRet = SerialWriteRead(&self->pData,"A3\r\n",pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
if(pReply[0] == '?')
|
||||
{
|
||||
strcpy(self->pAns,pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
/* reset timeout */
|
||||
iRet = SerialConfig(&self->pData, 10);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void ITC4_Close(pITC4 *pData)
|
||||
{
|
||||
char pReply[132];
|
||||
int iRet;
|
||||
pITC4 self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
/* switch to local operation */
|
||||
iRet = SerialWriteRead(&self->pData,"C0\r\n",pReply,131);
|
||||
/* ignore errors on this one, the thing may be down */
|
||||
|
||||
/* close connection */
|
||||
SerialClose(&self->pData);
|
||||
|
||||
/* free memory */
|
||||
free(self);
|
||||
*pData = NULL;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int ITC4_Config(pITC4 *pData, int iTmo, int iRead, int iControl,
|
||||
float fDiv,float fMult)
|
||||
{
|
||||
int iRet;
|
||||
char pReply[132];
|
||||
char pCommand[10];
|
||||
pITC4 self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
/* first timeout */
|
||||
if(iTmo > 0)
|
||||
{
|
||||
iRet = SerialConfig(&self->pData, iTmo);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
}
|
||||
|
||||
/* Read Sensor */
|
||||
if( (iRead > 0) && (iRead < 5) && (self->iRead != iRead) )
|
||||
{
|
||||
self->iRead = iRead;
|
||||
}
|
||||
|
||||
/* Control Sensor */
|
||||
if( (iControl > 0) && (iControl < 5) )
|
||||
{
|
||||
/* set the control sensor, for this we need to switch A0 first,
|
||||
the do it and switch back
|
||||
*/
|
||||
iRet = SerialWriteRead(&self->pData,"A0\r\n",pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
if(pReply[0] == '?')
|
||||
{
|
||||
strcpy(self->pAns,pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
|
||||
/* set sensor */
|
||||
sprintf(pCommand,"H%1.1d\r\n",iControl);
|
||||
iRet = SerialWriteRead(&self->pData,pCommand,pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
if(pReply[0] == '?')
|
||||
{
|
||||
strcpy(self->pAns,pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
|
||||
/* controls to automatic */
|
||||
iRet = SerialWriteRead(&self->pData,"A3\r\n",pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
if(pReply[0] == '?')
|
||||
{
|
||||
strcpy(self->pAns,pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
}
|
||||
self->fDiv = fDiv;
|
||||
self->fMult = fMult;
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int ITC4_Send(pITC4 *pData, char *pCommand, char *pReply, int iLen)
|
||||
{
|
||||
pITC4 self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
/* make sure, that there is a \r at the end of the command */
|
||||
if(strchr(pCommand,(int)'\r') == NULL)
|
||||
{
|
||||
strcat(pCommand,"\r");
|
||||
}
|
||||
return SerialWriteRead(&self->pData,pCommand,pReply,iLen);
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int ITC4_Read(pITC4 *pData, float *fVal)
|
||||
{
|
||||
char pCommand[10], pReply[132];
|
||||
int iRet;
|
||||
float fRead = -9999999.;
|
||||
pITC4 self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
|
||||
/* format and send R command */
|
||||
sprintf(pCommand,"R%1.1d\r\n",self->iRead);
|
||||
iRet = SerialWriteRead(&self->pData,pCommand,pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
if(pReply[0] == '?')
|
||||
{
|
||||
strcpy(self->pAns,pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
|
||||
/* analyse reply */
|
||||
if(pReply[0] != 'R')
|
||||
{
|
||||
strcpy(self->pAns,pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
|
||||
iRet = sscanf(&pReply[1],"%f",&fRead);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return ITC4__BADREAD;
|
||||
}
|
||||
if(self->i503)
|
||||
{
|
||||
*fVal = fRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
*fVal = fRead/self->fDiv;
|
||||
}
|
||||
return 1;
|
||||
self = (pITC4) malloc(sizeof(ITC4));
|
||||
if (self == NULL) {
|
||||
return ITC4__BADMALLOC;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
int ITC4_Set(pITC4 *pData, float fVal)
|
||||
{
|
||||
char pCommand[10], pReply[132];
|
||||
int iRet, i, iRead;
|
||||
const float fPrecision = 0.0001;
|
||||
float fSet, fDelta, fRead, fDum;
|
||||
pITC4 self;
|
||||
int iSet;
|
||||
*pData = self;
|
||||
self->iControl = 1;
|
||||
self->iRead = 1;
|
||||
self->iReadOnly = iMode;
|
||||
self->fDiv = 10.;
|
||||
self->fMult = 10.;
|
||||
|
||||
self = *pData;
|
||||
iRet = SerialOpen(&self->pData, pHost, iPort, iChannel);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
if(self->iReadOnly)
|
||||
{
|
||||
return ITC4__READONLY;
|
||||
}
|
||||
|
||||
/* format command */
|
||||
if(self->i503)
|
||||
{
|
||||
sprintf(pCommand,"T%-7.3f\r\n",fVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
fSet = fVal;
|
||||
iSet = (int)(fSet*self->fMult);
|
||||
sprintf(pCommand,"T%5.5d\r\n",iSet);
|
||||
}
|
||||
|
||||
/* try three times: send, read, test, if OK return, else
|
||||
resend. This must be done because the ITC4 tends to loose
|
||||
characters
|
||||
/* set an lengthy timeout for the configuration in order to
|
||||
prevent problems.
|
||||
*/
|
||||
iRet = SerialConfig(&self->pData, 100);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* an identification test has been here, but I had to removed as not all
|
||||
ITC4 controllers at SINQ answer the V command. Some versions of the
|
||||
controller do not recognize it. Sighhhhhhh. I had to put it in again
|
||||
in order to check for ITC-503, but I handle the thing by default as
|
||||
an ITC4 if I do not get a proper response.
|
||||
*/
|
||||
self->i503 = 0;
|
||||
iRet = SerialWriteRead(&self->pData, "V\r\n", pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
if (strstr(pReply, "ITC503") != NULL) {
|
||||
self->i503 = 1;
|
||||
}
|
||||
|
||||
if (!self->iReadOnly) {
|
||||
/* switch to remote and locked operation */
|
||||
iRet = SerialWriteRead(&self->pData, "C3\r\n", pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
if (pReply[0] == '?') {
|
||||
strcpy(self->pAns, pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
|
||||
/* set the control sensor, for this we need to switch A0 first,
|
||||
the do it and switch back
|
||||
*/
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
/* send command */
|
||||
iRet = SerialWriteRead(&self->pData,pCommand,pReply,131);
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
if(pReply[0] == '?')
|
||||
{
|
||||
strcpy(self->pAns,pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
/* read the set value again */
|
||||
iRead = self->iRead;
|
||||
self->iRead = 0; /* make a R0 */
|
||||
fDum = self->fDiv;
|
||||
self->fDiv = self->fMult;
|
||||
iRet = ITC4_Read(pData,&fRead);
|
||||
self->iRead = iRead;
|
||||
self->fDiv = fDum;
|
||||
if(iRet != 1)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
/* check the value read back */
|
||||
if(self->i503)
|
||||
{
|
||||
fDelta = fRead - fVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
fDelta = fRead - fSet;
|
||||
}
|
||||
if(fDelta < 0)
|
||||
fDelta = -fDelta;
|
||||
if(fDelta < fPrecision)
|
||||
{
|
||||
/* Success, go home */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return ITC4__BADSET;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void ITC4_ErrorTxt(pITC4 *pData,int iCode, char *pError, int iLen)
|
||||
{
|
||||
char pBueffel[512];
|
||||
pITC4 self;
|
||||
iRet = SerialWriteRead(&self->pData, "A0\r\n", pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
if (pReply[0] == '?') {
|
||||
strcpy(self->pAns, pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
|
||||
self = *pData;
|
||||
|
||||
switch(iCode)
|
||||
{
|
||||
case ITC4__BADCOM:
|
||||
sprintf(pBueffel,"ITC4: Invalid command or offline, got %s",
|
||||
self->pAns);
|
||||
strncpy(pError,pBueffel,iLen);
|
||||
break;
|
||||
case ITC4__BADPAR:
|
||||
strncpy(pError,"ITC4: Invalid parameter specified",iLen);
|
||||
break;
|
||||
case ITC4__BADMALLOC:
|
||||
strncpy(pError,"ITC4: Error allocating memory in ITC4",iLen);
|
||||
break;
|
||||
case ITC4__BADREAD:
|
||||
strncpy(pError,"ITC4: Badly formatted answer",iLen);
|
||||
break;
|
||||
case ITC4__BADSET:
|
||||
strncpy(pError,"ITC4: Failed three times to write new set value to ITC4",iLen);
|
||||
break;
|
||||
default:
|
||||
SerialError(iCode, pError,iLen);
|
||||
break;
|
||||
}
|
||||
sprintf(pCommand, "H%1.1d\r\n", self->iControl);
|
||||
iRet = SerialWriteRead(&self->pData, pCommand, pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
if (pReply[0] == '?') {
|
||||
strcpy(self->pAns, pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
|
||||
/* controls to automatic */
|
||||
iRet = SerialWriteRead(&self->pData, "A3\r\n", pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
if (pReply[0] == '?') {
|
||||
strcpy(self->pAns, pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
/* reset timeout */
|
||||
iRet = SerialConfig(&self->pData, 10);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void ITC4_Close(pITC4 * pData)
|
||||
{
|
||||
char pReply[132];
|
||||
int iRet;
|
||||
pITC4 self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
/* switch to local operation */
|
||||
iRet = SerialWriteRead(&self->pData, "C0\r\n", pReply, 131);
|
||||
/* ignore errors on this one, the thing may be down */
|
||||
|
||||
/* close connection */
|
||||
SerialClose(&self->pData);
|
||||
|
||||
/* free memory */
|
||||
free(self);
|
||||
*pData = NULL;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int ITC4_Config(pITC4 * pData, int iTmo, int iRead, int iControl,
|
||||
float fDiv, float fMult)
|
||||
{
|
||||
int iRet;
|
||||
char pReply[132];
|
||||
char pCommand[10];
|
||||
pITC4 self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
/* first timeout */
|
||||
if (iTmo > 0) {
|
||||
iRet = SerialConfig(&self->pData, iTmo);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
}
|
||||
|
||||
/* Read Sensor */
|
||||
if ((iRead > 0) && (iRead < 5) && (self->iRead != iRead)) {
|
||||
self->iRead = iRead;
|
||||
}
|
||||
|
||||
/* Control Sensor */
|
||||
if ((iControl > 0) && (iControl < 5)) {
|
||||
/* set the control sensor, for this we need to switch A0 first,
|
||||
the do it and switch back
|
||||
*/
|
||||
iRet = SerialWriteRead(&self->pData, "A0\r\n", pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
if (pReply[0] == '?') {
|
||||
strcpy(self->pAns, pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
|
||||
/* set sensor */
|
||||
sprintf(pCommand, "H%1.1d\r\n", iControl);
|
||||
iRet = SerialWriteRead(&self->pData, pCommand, pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
if (pReply[0] == '?') {
|
||||
strcpy(self->pAns, pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
|
||||
/* controls to automatic */
|
||||
iRet = SerialWriteRead(&self->pData, "A3\r\n", pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
if (pReply[0] == '?') {
|
||||
strcpy(self->pAns, pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
}
|
||||
self->fDiv = fDiv;
|
||||
self->fMult = fMult;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int ITC4_Send(pITC4 * pData, char *pCommand, char *pReply, int iLen)
|
||||
{
|
||||
pITC4 self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
/* make sure, that there is a \r at the end of the command */
|
||||
if (strchr(pCommand, (int) '\r') == NULL) {
|
||||
strcat(pCommand, "\r");
|
||||
}
|
||||
return SerialWriteRead(&self->pData, pCommand, pReply, iLen);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int ITC4_Read(pITC4 * pData, float *fVal)
|
||||
{
|
||||
char pCommand[10], pReply[132];
|
||||
int iRet;
|
||||
float fRead = -9999999.;
|
||||
pITC4 self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
|
||||
/* format and send R command */
|
||||
sprintf(pCommand, "R%1.1d\r\n", self->iRead);
|
||||
iRet = SerialWriteRead(&self->pData, pCommand, pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
if (pReply[0] == '?') {
|
||||
strcpy(self->pAns, pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
|
||||
/* analyse reply */
|
||||
if (pReply[0] != 'R') {
|
||||
strcpy(self->pAns, pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
|
||||
iRet = sscanf(&pReply[1], "%f", &fRead);
|
||||
if (iRet != 1) {
|
||||
return ITC4__BADREAD;
|
||||
}
|
||||
if (self->i503) {
|
||||
*fVal = fRead;
|
||||
} else {
|
||||
*fVal = fRead / self->fDiv;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
int ITC4_Set(pITC4 * pData, float fVal)
|
||||
{
|
||||
char pCommand[10], pReply[132];
|
||||
int iRet, i, iRead;
|
||||
const float fPrecision = 0.0001;
|
||||
float fSet, fDelta, fRead, fDum;
|
||||
pITC4 self;
|
||||
int iSet;
|
||||
|
||||
self = *pData;
|
||||
|
||||
if (self->iReadOnly) {
|
||||
return ITC4__READONLY;
|
||||
}
|
||||
|
||||
/* format command */
|
||||
if (self->i503) {
|
||||
sprintf(pCommand, "T%-7.3f\r\n", fVal);
|
||||
} else {
|
||||
fSet = fVal;
|
||||
iSet = (int) (fSet * self->fMult);
|
||||
sprintf(pCommand, "T%5.5d\r\n", iSet);
|
||||
}
|
||||
|
||||
/* try three times: send, read, test, if OK return, else
|
||||
resend. This must be done because the ITC4 tends to loose
|
||||
characters
|
||||
*/
|
||||
for (i = 0; i < 3; i++) {
|
||||
/* send command */
|
||||
iRet = SerialWriteRead(&self->pData, pCommand, pReply, 131);
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
if (pReply[0] == '?') {
|
||||
strcpy(self->pAns, pReply);
|
||||
return ITC4__BADCOM;
|
||||
}
|
||||
/* read the set value again */
|
||||
iRead = self->iRead;
|
||||
self->iRead = 0; /* make a R0 */
|
||||
fDum = self->fDiv;
|
||||
self->fDiv = self->fMult;
|
||||
iRet = ITC4_Read(pData, &fRead);
|
||||
self->iRead = iRead;
|
||||
self->fDiv = fDum;
|
||||
if (iRet != 1) {
|
||||
return iRet;
|
||||
}
|
||||
/* check the value read back */
|
||||
if (self->i503) {
|
||||
fDelta = fRead - fVal;
|
||||
} else {
|
||||
fDelta = fRead - fSet;
|
||||
}
|
||||
if (fDelta < 0)
|
||||
fDelta = -fDelta;
|
||||
if (fDelta < fPrecision) {
|
||||
/* Success, go home */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return ITC4__BADSET;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void ITC4_ErrorTxt(pITC4 * pData, int iCode, char *pError, int iLen)
|
||||
{
|
||||
char pBueffel[512];
|
||||
pITC4 self;
|
||||
|
||||
self = *pData;
|
||||
|
||||
switch (iCode) {
|
||||
case ITC4__BADCOM:
|
||||
sprintf(pBueffel, "ITC4: Invalid command or offline, got %s",
|
||||
self->pAns);
|
||||
strncpy(pError, pBueffel, iLen);
|
||||
break;
|
||||
case ITC4__BADPAR:
|
||||
strncpy(pError, "ITC4: Invalid parameter specified", iLen);
|
||||
break;
|
||||
case ITC4__BADMALLOC:
|
||||
strncpy(pError, "ITC4: Error allocating memory in ITC4", iLen);
|
||||
break;
|
||||
case ITC4__BADREAD:
|
||||
strncpy(pError, "ITC4: Badly formatted answer", iLen);
|
||||
break;
|
||||
case ITC4__BADSET:
|
||||
strncpy(pError,
|
||||
"ITC4: Failed three times to write new set value to ITC4",
|
||||
iLen);
|
||||
break;
|
||||
default:
|
||||
SerialError(iCode, pError, iLen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -16,11 +16,11 @@
|
||||
defined are those defined for serialsinq plus a few additional ones:
|
||||
*/
|
||||
|
||||
#define ITC4__BADCOM -501
|
||||
#define ITC4__BADCOM -501
|
||||
/* command not recognized */
|
||||
#define ITC4__BADPAR -502
|
||||
#define ITC4__BADPAR -502
|
||||
/* bad parameter to command */
|
||||
#define ITC4__BADMALLOC -503
|
||||
#define ITC4__BADMALLOC -503
|
||||
/* error allocating memory */
|
||||
#define ITC4__BADREAD -504
|
||||
/* error analysing command string on Read */
|
||||
@ -30,21 +30,22 @@
|
||||
/* failed three times to set temperature */
|
||||
#define ITC4__READONLY -531
|
||||
/*------------------------------------------------------------------------*/
|
||||
typedef struct __ITC4 {
|
||||
int iRead;
|
||||
int iControl;
|
||||
void *pData;
|
||||
char pAns[80];
|
||||
float fDiv;
|
||||
float fMult;
|
||||
int iReadOnly;
|
||||
int i503; /* flag for model 503, understanding float*/
|
||||
} ITC4;
|
||||
typedef struct __ITC4 {
|
||||
int iRead;
|
||||
int iControl;
|
||||
void *pData;
|
||||
char pAns[80];
|
||||
float fDiv;
|
||||
float fMult;
|
||||
int iReadOnly;
|
||||
int i503; /* flag for model 503, understanding float */
|
||||
} ITC4;
|
||||
|
||||
typedef struct __ITC4 *pITC4;
|
||||
typedef struct __ITC4 *pITC4;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
int ITC4_Open(pITC4 *pData,char *pHost, int iPort, int iChannel, int iMode);
|
||||
int ITC4_Open(pITC4 * pData, char *pHost, int iPort, int iChannel,
|
||||
int iMode);
|
||||
/***** creates an ITC4 datastructure and opens a connection to the ITCL4
|
||||
controller. Input Parameters are:
|
||||
the hostname
|
||||
@ -55,17 +56,17 @@
|
||||
Return values are 1 for success, a negative error code on
|
||||
failure.
|
||||
|
||||
*/
|
||||
|
||||
void ITC4_Close(pITC4 *pData);
|
||||
*/
|
||||
|
||||
void ITC4_Close(pITC4 * pData);
|
||||
/****** close a connection to an ITC4controller and frees its
|
||||
data structure. The only parameter is a pointer to the data
|
||||
structure for this controller. This pointer will be invalid after
|
||||
this call.
|
||||
*/
|
||||
*/
|
||||
|
||||
int ITC4_Config(pITC4 *pData, int iTmo, int iRead,
|
||||
int iControl, float fDiv, float fMult);
|
||||
int ITC4_Config(pITC4 * pData, int iTmo, int iRead,
|
||||
int iControl, float fDiv, float fMult);
|
||||
/***** configure some aspects of a ITC4temperature controller.
|
||||
The parameter are:
|
||||
- a pointer to the data structure for the controller as
|
||||
@ -80,8 +81,8 @@
|
||||
The function returns 1 on success, a negative error code on
|
||||
failure.
|
||||
*/
|
||||
|
||||
int ITC4_Send(pITC4 *pData, char *pCommand, char *pReply, int iLen);
|
||||
|
||||
int ITC4_Send(pITC4 * pData, char *pCommand, char *pReply, int iLen);
|
||||
/******* send a the command in pCommand to the ITC4controller.
|
||||
A possible reply is returned in the buffer pReply.
|
||||
Maximum iLen characters are copied to pReply.
|
||||
@ -91,8 +92,8 @@
|
||||
Return values are 1 for success, a negative error code on
|
||||
failure.
|
||||
*/
|
||||
|
||||
int ITC4_Read(pITC4 *pData, float *fVal);
|
||||
|
||||
int ITC4_Read(pITC4 * pData, float *fVal);
|
||||
/******* reads the current actual temperature of the sensor
|
||||
configured by ConfigITC4for reading. The value is returned
|
||||
in fVal. The first parameter is a pointer to a ITCL4
|
||||
@ -102,7 +103,7 @@
|
||||
failure.
|
||||
*/
|
||||
|
||||
int ITC4_Set(pITC4 *pData, float fVal);
|
||||
int ITC4_Set(pITC4 * pData, float fVal);
|
||||
/****** sets a new preset temperature in the ITC4temperature
|
||||
controller. Parameters are:
|
||||
- a pointer to a ITC4data structure as returned by OpenITCL4.
|
||||
@ -111,14 +112,12 @@
|
||||
Return values are 1 for success, a negative error code on
|
||||
failure.
|
||||
*/
|
||||
|
||||
void ITC4_ErrorTxt(pITC4 *pData, int iCode, char *pError, int iLen);
|
||||
|
||||
void ITC4_ErrorTxt(pITC4 * pData, int iCode, char *pError, int iLen);
|
||||
/******* translates one of the negative error ITC4error codes
|
||||
into text. Maximum iLen bytes will be copied to the
|
||||
buffer pError;
|
||||
*/
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -154,7 +154,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef FORTIFY
|
||||
#include <fortify.h>
|
||||
#include <fortify.h>
|
||||
#endif
|
||||
|
||||
#include <sinq_prototypes.h>
|
||||
@ -167,110 +167,157 @@
|
||||
**--------------------------------------------------------------------------
|
||||
** MakeCharPrintable: makes a single character printable.
|
||||
*/
|
||||
int MakeCharPrintable (char *out, int out_size, char in) {
|
||||
int MakeCharPrintable(char *out, int out_size, char in)
|
||||
{
|
||||
/* =================
|
||||
**
|
||||
** Return value is number of chars put into *out.
|
||||
*/
|
||||
char buff[8], *pntr;
|
||||
char buff[8], *pntr;
|
||||
|
||||
pntr = buff;
|
||||
pntr = buff;
|
||||
|
||||
if ((in & 0x80) != 0) { /* Parity bit set? */
|
||||
*pntr++ = '^'; /* Yes. Put a '^' in the buffer .. */
|
||||
in = in & 0x7f; /* .. and remove the parity bit. */
|
||||
}
|
||||
|
||||
switch (in) {
|
||||
case '^': *pntr++ = '\\'; *pntr++ = '^'; break;
|
||||
case '\\': *pntr++ = '\\'; *pntr++ = '\\'; break;
|
||||
case '\000': *pntr++ = '\\'; *pntr++ = '0'; break;
|
||||
case '\007': *pntr++ = '\\'; *pntr++ = 'a'; break;
|
||||
case '\010': *pntr++ = '\\'; *pntr++ = 'b'; break;
|
||||
case '\011': *pntr++ = '\\'; *pntr++ = 't'; break;
|
||||
case '\012': *pntr++ = '\\'; *pntr++ = 'n'; break;
|
||||
case '\013': *pntr++ = '\\'; *pntr++ = 'v'; break;
|
||||
case '\014': *pntr++ = '\\'; *pntr++ = 'f'; break;
|
||||
case '\015': *pntr++ = '\\'; *pntr++ = 'r'; break;
|
||||
default:
|
||||
if ((in < ' ') || (in > '~')) {
|
||||
pntr += sprintf (pntr, "\\%3.3o", in);
|
||||
}else {
|
||||
*pntr++ = in;
|
||||
}
|
||||
}
|
||||
out_size = (out_size > (pntr - buff)) ? (pntr - buff) : out_size;
|
||||
memcpy (out, buff, out_size);
|
||||
return out_size;
|
||||
if ((in & 0x80) != 0) { /* Parity bit set? */
|
||||
*pntr++ = '^'; /* Yes. Put a '^' in the buffer .. */
|
||||
in = in & 0x7f; /* .. and remove the parity bit. */
|
||||
}
|
||||
|
||||
switch (in) {
|
||||
case '^':
|
||||
*pntr++ = '\\';
|
||||
*pntr++ = '^';
|
||||
break;
|
||||
case '\\':
|
||||
*pntr++ = '\\';
|
||||
*pntr++ = '\\';
|
||||
break;
|
||||
case '\000':
|
||||
*pntr++ = '\\';
|
||||
*pntr++ = '0';
|
||||
break;
|
||||
case '\007':
|
||||
*pntr++ = '\\';
|
||||
*pntr++ = 'a';
|
||||
break;
|
||||
case '\010':
|
||||
*pntr++ = '\\';
|
||||
*pntr++ = 'b';
|
||||
break;
|
||||
case '\011':
|
||||
*pntr++ = '\\';
|
||||
*pntr++ = 't';
|
||||
break;
|
||||
case '\012':
|
||||
*pntr++ = '\\';
|
||||
*pntr++ = 'n';
|
||||
break;
|
||||
case '\013':
|
||||
*pntr++ = '\\';
|
||||
*pntr++ = 'v';
|
||||
break;
|
||||
case '\014':
|
||||
*pntr++ = '\\';
|
||||
*pntr++ = 'f';
|
||||
break;
|
||||
case '\015':
|
||||
*pntr++ = '\\';
|
||||
*pntr++ = 'r';
|
||||
break;
|
||||
default:
|
||||
if ((in < ' ') || (in > '~')) {
|
||||
pntr += sprintf(pntr, "\\%3.3o", in);
|
||||
} else {
|
||||
*pntr++ = in;
|
||||
}
|
||||
}
|
||||
out_size = (out_size > (pntr - buff)) ? (pntr - buff) : out_size;
|
||||
memcpy(out, buff, out_size);
|
||||
return out_size;
|
||||
}
|
||||
|
||||
/*
|
||||
**--------------------------------------------------------------------------
|
||||
** MakeMemPrintable: alternative version of MakePrintable.
|
||||
*/
|
||||
char *MakeMemPrintable (
|
||||
char *MakeMemPrintable(
|
||||
/* ================
|
||||
*/ char *out,
|
||||
int out_size,
|
||||
char *in,
|
||||
int in_len) {
|
||||
*/ char *out,
|
||||
int out_size, char *in, int in_len)
|
||||
{
|
||||
|
||||
int i;
|
||||
char *pntr;
|
||||
int i;
|
||||
char *pntr;
|
||||
|
||||
if (out_size <= 0) return out;
|
||||
|
||||
while ((out_size > 1) && (in_len > 0)) {
|
||||
i = MakeCharPrintable (out, (out_size - 1), *in);
|
||||
out += i; out_size -= i;
|
||||
in++; in_len--;
|
||||
}
|
||||
*out = NIL;
|
||||
if (out_size <= 0)
|
||||
return out;
|
||||
|
||||
while ((out_size > 1) && (in_len > 0)) {
|
||||
i = MakeCharPrintable(out, (out_size - 1), *in);
|
||||
out += i;
|
||||
out_size -= i;
|
||||
in++;
|
||||
in_len--;
|
||||
}
|
||||
*out = NIL;
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
**--------------------------------------------------------------------------
|
||||
** MakePrint: Make all characters in a buffer printable.
|
||||
*/
|
||||
char *MakePrint (char *chr) {
|
||||
char *MakePrint(char *chr)
|
||||
{
|
||||
/* =========
|
||||
*/
|
||||
int len, i;
|
||||
|
||||
for (i = 0; chr[i] != NIL; i++) chr[i] &= 0x7F;
|
||||
int len, i;
|
||||
|
||||
len = strlen (chr);
|
||||
if (len <= 0) return chr;
|
||||
|
||||
if (chr[len-1] == '\r') chr[len-1] = NIL;
|
||||
if (chr[len-1] == '\n') chr[len-1] = NIL;
|
||||
|
||||
for (i = 0; chr[i] != NIL; i++) {
|
||||
if (chr[i] < ' ') chr[i] = '.';
|
||||
if (chr[i] == 0x7F) chr[i] = '.';
|
||||
}
|
||||
for (i = 0; chr[i] != NIL; i++)
|
||||
chr[i] &= 0x7F;
|
||||
|
||||
len = strlen(chr);
|
||||
if (len <= 0)
|
||||
return chr;
|
||||
|
||||
if (chr[len - 1] == '\r')
|
||||
chr[len - 1] = NIL;
|
||||
if (chr[len - 1] == '\n')
|
||||
chr[len - 1] = NIL;
|
||||
|
||||
for (i = 0; chr[i] != NIL; i++) {
|
||||
if (chr[i] < ' ')
|
||||
chr[i] = '.';
|
||||
if (chr[i] == 0x7F)
|
||||
chr[i] = '.';
|
||||
}
|
||||
|
||||
return chr;
|
||||
}
|
||||
|
||||
/*
|
||||
**--------------------------------------------------------------------------
|
||||
** MakePrintable: improved version of MakePrint.
|
||||
*/
|
||||
char *MakePrintable (
|
||||
char *MakePrintable(
|
||||
/* =============
|
||||
*/ char *out,
|
||||
int out_size,
|
||||
char *in) {
|
||||
*/ char *out,
|
||||
int out_size, char *in)
|
||||
{
|
||||
|
||||
int i;
|
||||
char *pntr;
|
||||
int i;
|
||||
char *pntr;
|
||||
|
||||
if (out_size <= 0) return out;
|
||||
|
||||
while ((out_size > 1) && (*in != NIL)) {
|
||||
i = MakeCharPrintable (out, (out_size - 1), *in);
|
||||
in++; out += i; out_size -= i;
|
||||
}
|
||||
*out = NIL;
|
||||
if (out_size <= 0)
|
||||
return out;
|
||||
|
||||
while ((out_size > 1) && (*in != NIL)) {
|
||||
i = MakeCharPrintable(out, (out_size - 1), *in);
|
||||
in++;
|
||||
out += i;
|
||||
out_size -= i;
|
||||
}
|
||||
*out = NIL;
|
||||
return out;
|
||||
}
|
||||
|
||||
/*-------------------------------------------- End of MakePrint.C =======*/
|
||||
|
@ -9,8 +9,8 @@
|
||||
#define RS__PROTOCOL_ID "V01A"
|
||||
#define RS__PROTOCOL_ID_V01B "V01B"
|
||||
|
||||
#define RS__PROTOCOL_CODE 1 /* Code corresponding to RS__PROTOCOL_ID */
|
||||
#define RS__PROTOCOL_CODE_V01B 2 /* Code corresponding to RS__PROTOCOL_ID_0 */
|
||||
#define RS__PROTOCOL_CODE 1 /* Code corresponding to RS__PROTOCOL_ID */
|
||||
#define RS__PROTOCOL_CODE_V01B 2 /* Code corresponding to RS__PROTOCOL_ID_0 */
|
||||
|
||||
#ifndef OffsetOf
|
||||
#define OffsetOf(type, identifier) ((size_t)(&((type*) NULL)->identifier))
|
||||
@ -76,28 +76,28 @@
|
||||
**
|
||||
** An example of a command item might be: "0006RMT 1\r"
|
||||
**--------------------------------------------------------------------------*/
|
||||
struct RS__MsgStruct {
|
||||
char msg_size[4]; /* 4 ASCII decimal chars!! */
|
||||
char msg_id[4];
|
||||
char c_pcol_lvl[4]; /* Client protocol level */
|
||||
char serial_port[4];
|
||||
char tmo[4]; /* Units are 0.1 secs */
|
||||
char terms[4];
|
||||
char n_cmnds[4];
|
||||
char cmnds[356];
|
||||
};
|
||||
/*
|
||||
** The "cmnds" buffer in RS__MsgStruct is a concatenated
|
||||
** list of the following structures.
|
||||
*/
|
||||
struct RS__CmndStruct {
|
||||
char cmnd_len[2];
|
||||
char cmnd[1];
|
||||
};
|
||||
struct RS__CmndStruct_V01B {
|
||||
char cmnd_len[4];
|
||||
char cmnd[1];
|
||||
};
|
||||
struct RS__MsgStruct {
|
||||
char msg_size[4]; /* 4 ASCII decimal chars!! */
|
||||
char msg_id[4];
|
||||
char c_pcol_lvl[4]; /* Client protocol level */
|
||||
char serial_port[4];
|
||||
char tmo[4]; /* Units are 0.1 secs */
|
||||
char terms[4];
|
||||
char n_cmnds[4];
|
||||
char cmnds[356];
|
||||
};
|
||||
/*
|
||||
** The "cmnds" buffer in RS__MsgStruct is a concatenated
|
||||
** list of the following structures.
|
||||
*/
|
||||
struct RS__CmndStruct {
|
||||
char cmnd_len[2];
|
||||
char cmnd[1];
|
||||
};
|
||||
struct RS__CmndStruct_V01B {
|
||||
char cmnd_len[4];
|
||||
char cmnd[1];
|
||||
};
|
||||
/*----------------------------------------------------------------------------
|
||||
** Structure of Reply from Server to Client - everything is sent in ASCII
|
||||
** for LabView's benefit.
|
||||
@ -150,37 +150,37 @@
|
||||
**
|
||||
** An example of a reply item might be: "0009\r12.3456\0"
|
||||
**--------------------------------------------------------------------------*/
|
||||
struct RS__RespStruct {
|
||||
char msg_size[4];
|
||||
char msg_id[4];
|
||||
char s_pcol_lvl[4]; /* Server protocol level */
|
||||
char n_rply[4]; /* Error if < 0 */
|
||||
union {
|
||||
char rplys[496];
|
||||
char sub_status[12];
|
||||
} u;
|
||||
};
|
||||
/*
|
||||
** The "rplys" buffer in RS__RespStruct is a
|
||||
** concatenated list of the following structures.
|
||||
*/
|
||||
struct RS__RplyStruct {
|
||||
char rply_len[2]; /* 2 ASCII decimal chars!!
|
||||
** The length includes the
|
||||
** terminator, term, and the
|
||||
** zero terminator of rply.
|
||||
*/
|
||||
char term; /* The terminating character */
|
||||
char rply[1]; /* Zero terminated string */
|
||||
};
|
||||
struct RS__RplyStruct_V01B {
|
||||
char rply_len[4]; /* 4 ASCII decimal chars!!
|
||||
** The length includes the
|
||||
** terminator, term, and the
|
||||
** zero terminator of rply.
|
||||
*/
|
||||
char term; /* The terminating character */
|
||||
char rply[1]; /* Zero terminated string */
|
||||
};
|
||||
struct RS__RespStruct {
|
||||
char msg_size[4];
|
||||
char msg_id[4];
|
||||
char s_pcol_lvl[4]; /* Server protocol level */
|
||||
char n_rply[4]; /* Error if < 0 */
|
||||
union {
|
||||
char rplys[496];
|
||||
char sub_status[12];
|
||||
} u;
|
||||
};
|
||||
/*
|
||||
** The "rplys" buffer in RS__RespStruct is a
|
||||
** concatenated list of the following structures.
|
||||
*/
|
||||
struct RS__RplyStruct {
|
||||
char rply_len[2]; /* 2 ASCII decimal chars!!
|
||||
** The length includes the
|
||||
** terminator, term, and the
|
||||
** zero terminator of rply.
|
||||
*/
|
||||
char term; /* The terminating character */
|
||||
char rply[1]; /* Zero terminated string */
|
||||
};
|
||||
struct RS__RplyStruct_V01B {
|
||||
char rply_len[4]; /* 4 ASCII decimal chars!!
|
||||
** The length includes the
|
||||
** terminator, term, and the
|
||||
** zero terminator of rply.
|
||||
*/
|
||||
char term; /* The terminating character */
|
||||
char rply[1]; /* Zero terminated string */
|
||||
};
|
||||
/*------------------------------------------------ End of RS232C_DEF.H --*/
|
||||
#endif /* _rs232c_def_ */
|
||||
#endif /* _rs232c_def_ */
|
||||
|
1498
hardsup/serialsinq.c
1498
hardsup/serialsinq.c
File diff suppressed because it is too large
Load Diff
@ -22,25 +22,25 @@
|
||||
|
||||
#line 30 "velodorn.w"
|
||||
|
||||
int SerialOpen(void **pData, char *pHost, int iPort, int iChannel);
|
||||
int SerialForceOpen(void **pData, char *pHost, int iPort, int iChannel);
|
||||
int SerialConfig(void **pData, int iTmo);
|
||||
int SerialGetTmo(void **pData);
|
||||
int SerialATerm(void **pData, char *pTerm);
|
||||
int SerialAGetTerm(void **pData, char *pTerm, int iTermLen);
|
||||
int SerialSendTerm(void **pData, char *pTerm);
|
||||
int SerialGetSocket(void **pData);
|
||||
int SerialClose(void **pData);
|
||||
int SerialForceClose(void **pData);
|
||||
int SerialOpen(void **pData, char *pHost, int iPort, int iChannel);
|
||||
int SerialForceOpen(void **pData, char *pHost, int iPort, int iChannel);
|
||||
int SerialConfig(void **pData, int iTmo);
|
||||
int SerialGetTmo(void **pData);
|
||||
int SerialATerm(void **pData, char *pTerm);
|
||||
int SerialAGetTerm(void **pData, char *pTerm, int iTermLen);
|
||||
int SerialSendTerm(void **pData, char *pTerm);
|
||||
int SerialGetSocket(void **pData);
|
||||
int SerialClose(void **pData);
|
||||
int SerialForceClose(void **pData);
|
||||
|
||||
int SerialSend(void **pData, char *pCommand);
|
||||
int SerialReceive(void **pData, char *pBuffer, int iBufLen);
|
||||
int SerialReceiveWithTerm(void **pData, char *pBuffer,
|
||||
int iBufLen,char *cTerm);
|
||||
int SerialError(int iError, char *pError, int iErrLen);
|
||||
int SerialWriteRead(void **pData, char *pCommand,
|
||||
char *pBuffer, int iBufLen);
|
||||
int SerialNoReply(void **pData, char *pCommand);
|
||||
int SerialSend(void **pData, char *pCommand);
|
||||
int SerialReceive(void **pData, char *pBuffer, int iBufLen);
|
||||
int SerialReceiveWithTerm(void **pData, char *pBuffer,
|
||||
int iBufLen, char *cTerm);
|
||||
int SerialError(int iError, char *pError, int iErrLen);
|
||||
int SerialWriteRead(void **pData, char *pCommand,
|
||||
char *pBuffer, int iBufLen);
|
||||
int SerialNoReply(void **pData, char *pCommand);
|
||||
|
||||
#line 175 "velodorn.w"
|
||||
|
||||
@ -48,8 +48,8 @@
|
||||
|
||||
#line 116 "velodorn.w"
|
||||
|
||||
typedef int (*SerialSleep)(void *pData, int iTime);
|
||||
void SetSerialSleep(void **pData, SerialSleep pFunc, void *pUserData);
|
||||
typedef int (*SerialSleep) (void *pData, int iTime);
|
||||
void SetSerialSleep(void **pData, SerialSleep pFunc, void *pUserData);
|
||||
|
||||
#line 177 "velodorn.w"
|
||||
|
||||
|
@ -19,656 +19,242 @@
|
||||
#include <el737_def.h>
|
||||
#endif
|
||||
/*---------------------------------------------------------------------*/
|
||||
int AsynSrv_ChanClose (
|
||||
struct AsynSrv__info *asyn_info);
|
||||
int AsynSrv_Close (
|
||||
struct AsynSrv__info *asyn_info,
|
||||
int force_flag);
|
||||
int AsynSrv_Config (
|
||||
struct AsynSrv__info *asyn_info,
|
||||
...);
|
||||
int AsynSrv_ConfigDflt (
|
||||
char *par_id,
|
||||
...);
|
||||
void AsynSrv_ErrInfo (
|
||||
char **entry_txt,
|
||||
int *errcode,
|
||||
int *my_errno,
|
||||
int *vaxc_errno);
|
||||
int AsynSrv_Flush (
|
||||
struct AsynSrv__info *asyn_info);
|
||||
int AsynSrv_GetLenTerm (
|
||||
struct AsynSrv__info *asyn_info,
|
||||
struct RS__RespStruct *rcve_buff,
|
||||
char *rply,
|
||||
int *len,
|
||||
char *term);
|
||||
char *AsynSrv_GetReply (
|
||||
struct AsynSrv__info *asyn_info,
|
||||
struct RS__RespStruct *rcve_buff,
|
||||
char *last_rply);
|
||||
int AsynSrv_Open (
|
||||
struct AsynSrv__info *asyn_info);
|
||||
int AsynSrv_OpenNew (
|
||||
struct AsynSrv__info *asyn_info);
|
||||
int AsynSrv_SendCmnds (
|
||||
struct AsynSrv__info *asyn_info,
|
||||
struct RS__MsgStruct *send_buff,
|
||||
struct RS__RespStruct *rcve_buff,
|
||||
...);
|
||||
int AsynSrv_SendCmndsBig (
|
||||
struct AsynSrv__info *asyn_info,
|
||||
struct RS__MsgStruct *send_buff,
|
||||
int send_buff_size,
|
||||
struct RS__RespStruct *rcve_buff,
|
||||
int rcve_buff_size,
|
||||
...);
|
||||
int AsynSrv_Trace (
|
||||
struct AsynSrv__info *asyn_info,
|
||||
int state);
|
||||
int AsynSrv_Trace_Write (
|
||||
struct AsynSrv__info *asyn_info);
|
||||
int AsynSrv_ChanClose(struct AsynSrv__info *asyn_info);
|
||||
int AsynSrv_Close(struct AsynSrv__info *asyn_info, int force_flag);
|
||||
int AsynSrv_Config(struct AsynSrv__info *asyn_info, ...);
|
||||
int AsynSrv_ConfigDflt(char *par_id, ...);
|
||||
void AsynSrv_ErrInfo(char **entry_txt,
|
||||
int *errcode, int *my_errno, int *vaxc_errno);
|
||||
int AsynSrv_Flush(struct AsynSrv__info *asyn_info);
|
||||
int AsynSrv_GetLenTerm(struct AsynSrv__info *asyn_info,
|
||||
struct RS__RespStruct *rcve_buff,
|
||||
char *rply, int *len, char *term);
|
||||
char *AsynSrv_GetReply(struct AsynSrv__info *asyn_info,
|
||||
struct RS__RespStruct *rcve_buff, char *last_rply);
|
||||
int AsynSrv_Open(struct AsynSrv__info *asyn_info);
|
||||
int AsynSrv_OpenNew(struct AsynSrv__info *asyn_info);
|
||||
int AsynSrv_SendCmnds(struct AsynSrv__info *asyn_info,
|
||||
struct RS__MsgStruct *send_buff,
|
||||
struct RS__RespStruct *rcve_buff, ...);
|
||||
int AsynSrv_SendCmndsBig(struct AsynSrv__info *asyn_info,
|
||||
struct RS__MsgStruct *send_buff,
|
||||
int send_buff_size,
|
||||
struct RS__RespStruct *rcve_buff,
|
||||
int rcve_buff_size, ...);
|
||||
int AsynSrv_Trace(struct AsynSrv__info *asyn_info, int state);
|
||||
int AsynSrv_Trace_Write(struct AsynSrv__info *asyn_info);
|
||||
/*---------------------------------------------------------------------*/
|
||||
int C_log_arr_get (
|
||||
char *name,
|
||||
int arr_size,
|
||||
int *value,
|
||||
int indx);
|
||||
int C_log_flt_get (
|
||||
char *name,
|
||||
float *value,
|
||||
int indx);
|
||||
int C_log_int_get (
|
||||
char *name,
|
||||
long int *value,
|
||||
int indx);
|
||||
int C_log_str_get (
|
||||
char *name,
|
||||
char *value,
|
||||
int val_size,
|
||||
int indx);
|
||||
int C_log_arr_get(char *name, int arr_size, int *value, int indx);
|
||||
int C_log_flt_get(char *name, float *value, int indx);
|
||||
int C_log_int_get(char *name, long int *value, int indx);
|
||||
int C_log_str_get(char *name, char *value, int val_size, int indx);
|
||||
/*---------------------------------------------------------------------*/
|
||||
int C_str_edit (
|
||||
char *out,
|
||||
char *in,
|
||||
char *ctrl,
|
||||
int *length);
|
||||
int C_str_edit(char *out, char *in, char *ctrl, int *length);
|
||||
/*---------------------------------------------------------------------*/
|
||||
int C_tt_port_config (
|
||||
int *hndl,
|
||||
int mask);
|
||||
int C_tt_port_connect (
|
||||
int *hndl,
|
||||
int *chan,
|
||||
char *lognam,
|
||||
char *pwd);
|
||||
int C_tt_port_disconnect (
|
||||
int *hndl);
|
||||
int C_tt_port_io (
|
||||
int *hndl,
|
||||
char *rqst,
|
||||
char *term,
|
||||
char *answ,
|
||||
int *answ_len,
|
||||
int flush,
|
||||
int tmo);
|
||||
int C_tt_port_config(int *hndl, int mask);
|
||||
int C_tt_port_connect(int *hndl, int *chan, char *lognam, char *pwd);
|
||||
int C_tt_port_disconnect(int *hndl);
|
||||
int C_tt_port_io(int *hndl,
|
||||
char *rqst,
|
||||
char *term,
|
||||
char *answ, int *answ_len, int flush, int tmo);
|
||||
/*---------------------------------------------------------------------*/
|
||||
int EL734_Close (
|
||||
void **handle,
|
||||
int force_flag);
|
||||
int EL734_Config (
|
||||
void **handle,
|
||||
...);
|
||||
char *EL734_EncodeMSR (
|
||||
char *text,
|
||||
int text_len,
|
||||
int msr,
|
||||
int ored_msr,
|
||||
int fp_cntr,
|
||||
int fr_cntr);
|
||||
char *EL734_EncodeSS (
|
||||
char *text,
|
||||
int text_len,
|
||||
int ss);
|
||||
void EL734_ErrInfo (
|
||||
char **entry_txt,
|
||||
int *errcode,
|
||||
int *my_errno,
|
||||
int *vaxc_errno);
|
||||
int EL734_GetAirCush (
|
||||
void **handle,
|
||||
int *present,
|
||||
int *state);
|
||||
int EL734_GetEncGearing (
|
||||
void **handle,
|
||||
int *nominator,
|
||||
int *denominator);
|
||||
int EL734_GetId (
|
||||
void **handle,
|
||||
char *id_txt,
|
||||
int id_len);
|
||||
int EL734_GetLimits (
|
||||
void **handle,
|
||||
float *lo,
|
||||
float *hi);
|
||||
int EL734_GetMotorGearing (
|
||||
void **handle,
|
||||
int *nominator,
|
||||
int *denominator);
|
||||
int EL734_GetNullPoint (
|
||||
void **handle,
|
||||
int *null_pt);
|
||||
int EL734_GetPosition (
|
||||
void **handle,
|
||||
float *ist_posit);
|
||||
int EL734_GetPrecision (
|
||||
void **handle,
|
||||
int *n_dec);
|
||||
int EL734_GetRefMode (
|
||||
void **handle,
|
||||
int *mode);
|
||||
int EL734_GetRefParam (
|
||||
void **handle,
|
||||
float *param);
|
||||
int EL734_GetSpeeds (
|
||||
void **handle,
|
||||
int *lo,
|
||||
int *hi,
|
||||
int *ramp);
|
||||
int EL734_GetStatus (
|
||||
void **handle,
|
||||
int *msr,
|
||||
int *ored_msr,
|
||||
int *fp_cntr,
|
||||
int *fr_cntr,
|
||||
int *ss,
|
||||
float *ist_posit);
|
||||
int EL734_GetZeroPoint (
|
||||
void **handle,
|
||||
float *zero_pt);
|
||||
int EL734_MoveNoWait (
|
||||
void **handle,
|
||||
float soll_posit);
|
||||
int EL734_MoveWait (
|
||||
void **handle,
|
||||
float soll_posit,
|
||||
int *ored_msr,
|
||||
int *fp_cntr,
|
||||
int *fr_cntr,
|
||||
float *ist_posit);
|
||||
int EL734_Open (
|
||||
void **handle,
|
||||
char *host,
|
||||
int port,
|
||||
int chan,
|
||||
int motor,
|
||||
char *id);
|
||||
int EL734_PutOffline (
|
||||
void **handle);
|
||||
int EL734_PutOnline (
|
||||
void **handle,
|
||||
int echo);
|
||||
int EL734_SendCmnd (
|
||||
void **handle,
|
||||
char *cmnd,
|
||||
char *rply,
|
||||
int rply_size);
|
||||
int EL734_SetAirCush (
|
||||
void **handle,
|
||||
int state);
|
||||
int EL734_SetErrcode (
|
||||
struct EL734info *info_ptr,
|
||||
char *response,
|
||||
char *cmnd);
|
||||
int EL734_SetHighSpeed (
|
||||
void **handle,
|
||||
int hi);
|
||||
int EL734_SetLowSpeed (
|
||||
void **handle,
|
||||
int lo);
|
||||
int EL734_SetRamp (
|
||||
void **handle,
|
||||
int ramp);
|
||||
int EL734_Stop (
|
||||
void **handle);
|
||||
int EL734_WaitIdle (
|
||||
void **handle,
|
||||
int *ored_msr,
|
||||
int *fp_cntr,
|
||||
int *fr_cntr,
|
||||
float *ist_posit);
|
||||
void EL734_ZeroStatus (
|
||||
void **handle);
|
||||
int EL734_Close(void **handle, int force_flag);
|
||||
int EL734_Config(void **handle, ...);
|
||||
char *EL734_EncodeMSR(char *text,
|
||||
int text_len,
|
||||
int msr, int ored_msr, int fp_cntr, int fr_cntr);
|
||||
char *EL734_EncodeSS(char *text, int text_len, int ss);
|
||||
void EL734_ErrInfo(char **entry_txt,
|
||||
int *errcode, int *my_errno, int *vaxc_errno);
|
||||
int EL734_GetAirCush(void **handle, int *present, int *state);
|
||||
int EL734_GetEncGearing(void **handle, int *nominator, int *denominator);
|
||||
int EL734_GetId(void **handle, char *id_txt, int id_len);
|
||||
int EL734_GetLimits(void **handle, float *lo, float *hi);
|
||||
int EL734_GetMotorGearing(void **handle, int *nominator, int *denominator);
|
||||
int EL734_GetNullPoint(void **handle, int *null_pt);
|
||||
int EL734_GetPosition(void **handle, float *ist_posit);
|
||||
int EL734_GetPrecision(void **handle, int *n_dec);
|
||||
int EL734_GetRefMode(void **handle, int *mode);
|
||||
int EL734_GetRefParam(void **handle, float *param);
|
||||
int EL734_GetSpeeds(void **handle, int *lo, int *hi, int *ramp);
|
||||
int EL734_GetStatus(void **handle,
|
||||
int *msr,
|
||||
int *ored_msr,
|
||||
int *fp_cntr, int *fr_cntr, int *ss, float *ist_posit);
|
||||
int EL734_GetZeroPoint(void **handle, float *zero_pt);
|
||||
int EL734_MoveNoWait(void **handle, float soll_posit);
|
||||
int EL734_MoveWait(void **handle,
|
||||
float soll_posit,
|
||||
int *ored_msr,
|
||||
int *fp_cntr, int *fr_cntr, float *ist_posit);
|
||||
int EL734_Open(void **handle,
|
||||
char *host, int port, int chan, int motor, char *id);
|
||||
int EL734_PutOffline(void **handle);
|
||||
int EL734_PutOnline(void **handle, int echo);
|
||||
int EL734_SendCmnd(void **handle, char *cmnd, char *rply, int rply_size);
|
||||
int EL734_SetAirCush(void **handle, int state);
|
||||
int EL734_SetErrcode(struct EL734info *info_ptr,
|
||||
char *response, char *cmnd);
|
||||
int EL734_SetHighSpeed(void **handle, int hi);
|
||||
int EL734_SetLowSpeed(void **handle, int lo);
|
||||
int EL734_SetRamp(void **handle, int ramp);
|
||||
int EL734_Stop(void **handle);
|
||||
int EL734_WaitIdle(void **handle,
|
||||
int *ored_msr,
|
||||
int *fp_cntr, int *fr_cntr, float *ist_posit);
|
||||
void EL734_ZeroStatus(void **handle);
|
||||
/*---------------------------------------------------------------------*/
|
||||
int EL737_Close (
|
||||
void **handle,
|
||||
int force_flag);
|
||||
int EL737_Config (
|
||||
void **handle,
|
||||
...);
|
||||
int EL737_Continue (
|
||||
void **handle,
|
||||
int *status);
|
||||
int EL737_EnableThresh (
|
||||
void **handle,
|
||||
int indx);
|
||||
void EL737_ErrInfo (
|
||||
char **entry_txt,
|
||||
int *errcode,
|
||||
int *my_errno,
|
||||
int *vaxc_errno);
|
||||
int EL737_GetMonIntegTime (
|
||||
void **handle,
|
||||
int indx,
|
||||
float *mon_integ_time);
|
||||
int EL737_GetRateIntegTime (
|
||||
void **handle,
|
||||
float *rate_integ_time);
|
||||
void *EL737_GetReply (
|
||||
void **handle,
|
||||
void *last_rply);
|
||||
int EL737_GetStatus (
|
||||
void **handle,
|
||||
int *c1,
|
||||
int *c2,
|
||||
int *c3,
|
||||
int *c4,
|
||||
float *timer,
|
||||
int *rs);
|
||||
int EL737_GetStatusExtra (
|
||||
void **handle,
|
||||
int *c5,
|
||||
int *c6,
|
||||
int *c7,
|
||||
int *c8);
|
||||
int EL737_GetThresh (
|
||||
void **handle,
|
||||
int *indx,
|
||||
float *val);
|
||||
int EL737_Open (
|
||||
void **handle,
|
||||
char *host,
|
||||
int port,
|
||||
int chan);
|
||||
int EL737_Pause (
|
||||
void **handle,
|
||||
int *status);
|
||||
int EL737_SendCmnd (
|
||||
void **handle,
|
||||
char *cmnd,
|
||||
char *rply,
|
||||
int rply_size);
|
||||
int EL737_SetErrcode (
|
||||
struct EL737info *info_ptr,
|
||||
char *response,
|
||||
char *cmnd);
|
||||
int EL737_SetThresh (
|
||||
void **handle,
|
||||
int indx,
|
||||
float val);
|
||||
int EL737_StartCnt (
|
||||
void **handle,
|
||||
int preset_count,
|
||||
int *status);
|
||||
int EL737_StartTime (
|
||||
void **handle,
|
||||
float preset_time,
|
||||
int *status);
|
||||
int EL737_Stop (
|
||||
void **handle,
|
||||
int *c1,
|
||||
int *c2,
|
||||
int *c3,
|
||||
int *c4,
|
||||
float *timer,
|
||||
int *status);
|
||||
int EL737_StopFast (
|
||||
void **handle);
|
||||
int EL737_WaitIdle (
|
||||
void **handle,
|
||||
int *c1,
|
||||
int *c2,
|
||||
int *c3,
|
||||
int *c4,
|
||||
float *timer);
|
||||
int EL737_Close(void **handle, int force_flag);
|
||||
int EL737_Config(void **handle, ...);
|
||||
int EL737_Continue(void **handle, int *status);
|
||||
int EL737_EnableThresh(void **handle, int indx);
|
||||
void EL737_ErrInfo(char **entry_txt,
|
||||
int *errcode, int *my_errno, int *vaxc_errno);
|
||||
int EL737_GetMonIntegTime(void **handle, int indx, float *mon_integ_time);
|
||||
int EL737_GetRateIntegTime(void **handle, float *rate_integ_time);
|
||||
void *EL737_GetReply(void **handle, void *last_rply);
|
||||
int EL737_GetStatus(void **handle,
|
||||
int *c1,
|
||||
int *c2, int *c3, int *c4, float *timer, int *rs);
|
||||
int EL737_GetStatusExtra(void **handle,
|
||||
int *c5, int *c6, int *c7, int *c8);
|
||||
int EL737_GetThresh(void **handle, int *indx, float *val);
|
||||
int EL737_Open(void **handle, char *host, int port, int chan);
|
||||
int EL737_Pause(void **handle, int *status);
|
||||
int EL737_SendCmnd(void **handle, char *cmnd, char *rply, int rply_size);
|
||||
int EL737_SetErrcode(struct EL737info *info_ptr,
|
||||
char *response, char *cmnd);
|
||||
int EL737_SetThresh(void **handle, int indx, float val);
|
||||
int EL737_StartCnt(void **handle, int preset_count, int *status);
|
||||
int EL737_StartTime(void **handle, float preset_time, int *status);
|
||||
int EL737_Stop(void **handle,
|
||||
int *c1,
|
||||
int *c2, int *c3, int *c4, float *timer, int *status);
|
||||
int EL737_StopFast(void **handle);
|
||||
int EL737_WaitIdle(void **handle,
|
||||
int *c1, int *c2, int *c3, int *c4, float *timer);
|
||||
/*---------------------------------------------------------------------*/
|
||||
int EL755_Close (
|
||||
void **handle,
|
||||
int force_flag);
|
||||
int EL755_Config (
|
||||
void **handle,
|
||||
...);
|
||||
void EL755_ErrInfo (
|
||||
char **entry_txt,
|
||||
int *errcode,
|
||||
int *my_errno,
|
||||
int *vaxc_errno);
|
||||
int EL755_ErrorLog (
|
||||
char *routine_name,
|
||||
char *text);
|
||||
int EL755_GetConstant (
|
||||
void **handle,
|
||||
float *value);
|
||||
int EL755_GetCurrents (
|
||||
void **handle,
|
||||
float *soll,
|
||||
float *ist);
|
||||
int EL755_GetId (
|
||||
void **handle,
|
||||
char *id_txt,
|
||||
int id_len);
|
||||
int EL755_GetLimit (
|
||||
void **handle,
|
||||
float *value);
|
||||
int EL755_GetRamp (
|
||||
void **handle,
|
||||
float *value);
|
||||
int EL755_GetTimeConstant (
|
||||
void **handle,
|
||||
float *value);
|
||||
int EL755_GetVoltageRange (
|
||||
void **handle,
|
||||
float *value);
|
||||
int EL755_Open (
|
||||
void **handle,
|
||||
char *host,
|
||||
int port,
|
||||
int chan,
|
||||
int indx);
|
||||
int EL755_PutOffline (
|
||||
void **handle);
|
||||
int EL755_PutOnline (
|
||||
void **handle,
|
||||
int echo);
|
||||
int EL755_SendTillSameStr (
|
||||
void **handle,
|
||||
char *cmnd,
|
||||
char *rply,
|
||||
int rply_len);
|
||||
int EL755_SendTillSameVal (
|
||||
void **handle,
|
||||
char *cmnd,
|
||||
float *val);
|
||||
int EL755_SendTillTwoVals (
|
||||
void **handle,
|
||||
char *cmnd,
|
||||
float *val0,
|
||||
float *val1);
|
||||
int EL755_SetConstant (
|
||||
void **handle,
|
||||
float value);
|
||||
int EL755_SetCurrent (
|
||||
void **handle,
|
||||
float soll);
|
||||
int EL755_SetLimit (
|
||||
void **handle,
|
||||
float value);
|
||||
int EL755_SetRamp (
|
||||
void **handle,
|
||||
float value);
|
||||
int EL755_SetTimeConstant (
|
||||
void **handle,
|
||||
float value);
|
||||
int EL755_SetVoltageRange (
|
||||
void **handle,
|
||||
float value);
|
||||
int EL755_Close(void **handle, int force_flag);
|
||||
int EL755_Config(void **handle, ...);
|
||||
void EL755_ErrInfo(char **entry_txt,
|
||||
int *errcode, int *my_errno, int *vaxc_errno);
|
||||
int EL755_ErrorLog(char *routine_name, char *text);
|
||||
int EL755_GetConstant(void **handle, float *value);
|
||||
int EL755_GetCurrents(void **handle, float *soll, float *ist);
|
||||
int EL755_GetId(void **handle, char *id_txt, int id_len);
|
||||
int EL755_GetLimit(void **handle, float *value);
|
||||
int EL755_GetRamp(void **handle, float *value);
|
||||
int EL755_GetTimeConstant(void **handle, float *value);
|
||||
int EL755_GetVoltageRange(void **handle, float *value);
|
||||
int EL755_Open(void **handle, char *host, int port, int chan, int indx);
|
||||
int EL755_PutOffline(void **handle);
|
||||
int EL755_PutOnline(void **handle, int echo);
|
||||
int EL755_SendTillSameStr(void **handle,
|
||||
char *cmnd, char *rply, int rply_len);
|
||||
int EL755_SendTillSameVal(void **handle, char *cmnd, float *val);
|
||||
int EL755_SendTillTwoVals(void **handle,
|
||||
char *cmnd, float *val0, float *val1);
|
||||
int EL755_SetConstant(void **handle, float value);
|
||||
int EL755_SetCurrent(void **handle, float soll);
|
||||
int EL755_SetLimit(void **handle, float value);
|
||||
int EL755_SetRamp(void **handle, float value);
|
||||
int EL755_SetTimeConstant(void **handle, float value);
|
||||
int EL755_SetVoltageRange(void **handle, float value);
|
||||
/*---------------------------------------------------------------------*/
|
||||
int Fluke_Close (
|
||||
void **handle,
|
||||
int force_flag);
|
||||
int Fluke_Config (
|
||||
void **handle,
|
||||
...);
|
||||
void Fluke_ErrInfo (
|
||||
char **entry_txt,
|
||||
int *errcode,
|
||||
int *my_errno,
|
||||
int *vaxc_errno);
|
||||
int Fluke_ErrorLog (
|
||||
char *routine_name,
|
||||
char *text);
|
||||
int Fluke_Open (
|
||||
void **handle,
|
||||
char *host,
|
||||
int port,
|
||||
int chan);
|
||||
int Fluke_Read (
|
||||
void **handle,
|
||||
float *ist);
|
||||
int Fluke_SendTillSame (
|
||||
void **handle,
|
||||
char *cmnd,
|
||||
char *rply,
|
||||
int rply_len);
|
||||
int Fluke_SendTillSameVal (
|
||||
void **handle,
|
||||
char *cmnd,
|
||||
float *val);
|
||||
int Fluke_Close(void **handle, int force_flag);
|
||||
int Fluke_Config(void **handle, ...);
|
||||
void Fluke_ErrInfo(char **entry_txt,
|
||||
int *errcode, int *my_errno, int *vaxc_errno);
|
||||
int Fluke_ErrorLog(char *routine_name, char *text);
|
||||
int Fluke_Open(void **handle, char *host, int port, int chan);
|
||||
int Fluke_Read(void **handle, float *ist);
|
||||
int Fluke_SendTillSame(void **handle,
|
||||
char *cmnd, char *rply, int rply_len);
|
||||
int Fluke_SendTillSameVal(void **handle, char *cmnd, float *val);
|
||||
/*---------------------------------------------------------------------*/
|
||||
int ITC_Close (
|
||||
void **handle,
|
||||
int force_flag);
|
||||
int ITC_Config (
|
||||
void **handle,
|
||||
...);
|
||||
int ITC_Dump_RAM (
|
||||
void **handle,
|
||||
int buff_size,
|
||||
char *buff,
|
||||
int *dump_len,
|
||||
int *n_diffs);
|
||||
void ITC_ErrInfo (
|
||||
char **entry_txt,
|
||||
int *errcode,
|
||||
int *my_errno,
|
||||
int *vaxc_errno);
|
||||
int ITC_GetConfig (
|
||||
void **handle,
|
||||
...);
|
||||
int ITC_Load_RAM (
|
||||
void **handle,
|
||||
int load_len,
|
||||
char *buff);
|
||||
int ITC_Load_Table (
|
||||
void **handle,
|
||||
char *buff);
|
||||
int ITC_Open (
|
||||
void **handle,
|
||||
char *host,
|
||||
int port,
|
||||
int chan);
|
||||
int ITC_Read_ITC_Sensor (
|
||||
void **handle,
|
||||
int sensor,
|
||||
float factor,
|
||||
float *value);
|
||||
int ITC_Read_LTC11_Sensor (
|
||||
void **handle,
|
||||
int sensor,
|
||||
float *value);
|
||||
int ITC_Read_LTC11_SetPt (
|
||||
void **handle,
|
||||
float *value);
|
||||
int ITC_ReadAuxTemp (
|
||||
void **handle,
|
||||
float *value);
|
||||
int ITC_ReadControlTemp (
|
||||
void **handle,
|
||||
float *value);
|
||||
int ITC_ReadHeaterOp (
|
||||
void **handle,
|
||||
float *op_level,
|
||||
float *op_percent);
|
||||
int ITC_ReadId (
|
||||
void **handle,
|
||||
char *id_txt,
|
||||
int id_txt_len,
|
||||
int *id_len);
|
||||
int ITC_ReadPID (
|
||||
void **handle,
|
||||
float *p,
|
||||
float *i,
|
||||
float *d);
|
||||
int ITC_ReadSampleTemp (
|
||||
void **handle,
|
||||
float *s_temp);
|
||||
int ITC_ReadSetPoint (
|
||||
void **handle,
|
||||
float *sp_temp);
|
||||
int ITC_ReadStatus (
|
||||
void **handle,
|
||||
char *status_txt,
|
||||
int status_txt_len,
|
||||
int *status_len,
|
||||
int *auto_state,
|
||||
int *remote_state);
|
||||
int ITC_SendTillAckOk (
|
||||
void **handle,
|
||||
struct RS__MsgStruct *to_host,
|
||||
struct RS__RespStruct *from_host,
|
||||
char *cmnd);
|
||||
int ITC_SendTillSame (
|
||||
void **handle,
|
||||
struct RS__MsgStruct *to_host,
|
||||
struct RS__RespStruct *from_host,
|
||||
char *cmnd,
|
||||
char *rply,
|
||||
int rply_len);
|
||||
int ITC_SendTillSameLen (
|
||||
void **handle,
|
||||
struct RS__MsgStruct *to_host,
|
||||
struct RS__RespStruct *from_host,
|
||||
char *cmnd,
|
||||
char *rply,
|
||||
int rply_len);
|
||||
int ITC_SendTillSameLenAckOK (
|
||||
void **handle,
|
||||
struct RS__MsgStruct *to_host,
|
||||
struct RS__RespStruct *from_host,
|
||||
char *cmnd,
|
||||
char *rply,
|
||||
int rply_len);
|
||||
int ITC_SetControlTemp (
|
||||
void **handle,
|
||||
float s_temp);
|
||||
int ITC_SetHeatLevel (
|
||||
void **handle,
|
||||
float heat_percent);
|
||||
int ITC_ErrorLog (
|
||||
char *routine_name,
|
||||
char *text);
|
||||
int ITC_Close(void **handle, int force_flag);
|
||||
int ITC_Config(void **handle, ...);
|
||||
int ITC_Dump_RAM(void **handle,
|
||||
int buff_size, char *buff, int *dump_len, int *n_diffs);
|
||||
void ITC_ErrInfo(char **entry_txt,
|
||||
int *errcode, int *my_errno, int *vaxc_errno);
|
||||
int ITC_GetConfig(void **handle, ...);
|
||||
int ITC_Load_RAM(void **handle, int load_len, char *buff);
|
||||
int ITC_Load_Table(void **handle, char *buff);
|
||||
int ITC_Open(void **handle, char *host, int port, int chan);
|
||||
int ITC_Read_ITC_Sensor(void **handle,
|
||||
int sensor, float factor, float *value);
|
||||
int ITC_Read_LTC11_Sensor(void **handle, int sensor, float *value);
|
||||
int ITC_Read_LTC11_SetPt(void **handle, float *value);
|
||||
int ITC_ReadAuxTemp(void **handle, float *value);
|
||||
int ITC_ReadControlTemp(void **handle, float *value);
|
||||
int ITC_ReadHeaterOp(void **handle, float *op_level, float *op_percent);
|
||||
int ITC_ReadId(void **handle, char *id_txt, int id_txt_len, int *id_len);
|
||||
int ITC_ReadPID(void **handle, float *p, float *i, float *d);
|
||||
int ITC_ReadSampleTemp(void **handle, float *s_temp);
|
||||
int ITC_ReadSetPoint(void **handle, float *sp_temp);
|
||||
int ITC_ReadStatus(void **handle,
|
||||
char *status_txt,
|
||||
int status_txt_len,
|
||||
int *status_len, int *auto_state, int *remote_state);
|
||||
int ITC_SendTillAckOk(void **handle,
|
||||
struct RS__MsgStruct *to_host,
|
||||
struct RS__RespStruct *from_host, char *cmnd);
|
||||
int ITC_SendTillSame(void **handle,
|
||||
struct RS__MsgStruct *to_host,
|
||||
struct RS__RespStruct *from_host,
|
||||
char *cmnd, char *rply, int rply_len);
|
||||
int ITC_SendTillSameLen(void **handle,
|
||||
struct RS__MsgStruct *to_host,
|
||||
struct RS__RespStruct *from_host,
|
||||
char *cmnd, char *rply, int rply_len);
|
||||
int ITC_SendTillSameLenAckOK(void **handle,
|
||||
struct RS__MsgStruct *to_host,
|
||||
struct RS__RespStruct *from_host,
|
||||
char *cmnd, char *rply, int rply_len);
|
||||
int ITC_SetControlTemp(void **handle, float s_temp);
|
||||
int ITC_SetHeatLevel(void **handle, float heat_percent);
|
||||
int ITC_ErrorLog(char *routine_name, char *text);
|
||||
/*---------------------------------------------------------------------*/
|
||||
int SPS_Close (
|
||||
void **handle,
|
||||
int force_flag);
|
||||
int SPS_Config (
|
||||
void **handle,
|
||||
...);
|
||||
void SPS_ErrInfo (
|
||||
char **entry_txt,
|
||||
int *errcode,
|
||||
int *my_errno,
|
||||
int *vaxc_errno);
|
||||
int SPS_ErrorLog (
|
||||
char *routine_name,
|
||||
char *text);
|
||||
int SPS_GetStatus (
|
||||
void **handle,
|
||||
unsigned char *status_vals,
|
||||
int n_status_vals,
|
||||
int *adc_vals,
|
||||
int n_adc_vals);
|
||||
int SPS_Open (
|
||||
void **handle,
|
||||
char *host,
|
||||
int port,
|
||||
int chan);
|
||||
int SPS_SendTillSame (
|
||||
void **handle,
|
||||
struct RS__MsgStruct *to_host,
|
||||
struct RS__RespStruct *from_host,
|
||||
char *cmnd,
|
||||
char *rply,
|
||||
int rply_len);
|
||||
int SPS_SendTillSameLen (
|
||||
void **handle,
|
||||
struct RS__MsgStruct *to_host,
|
||||
struct RS__RespStruct *from_host,
|
||||
char *cmnd,
|
||||
char *rply,
|
||||
int rply_len);
|
||||
int SPS_Close(void **handle, int force_flag);
|
||||
int SPS_Config(void **handle, ...);
|
||||
void SPS_ErrInfo(char **entry_txt,
|
||||
int *errcode, int *my_errno, int *vaxc_errno);
|
||||
int SPS_ErrorLog(char *routine_name, char *text);
|
||||
int SPS_GetStatus(void **handle,
|
||||
unsigned char *status_vals,
|
||||
int n_status_vals, int *adc_vals, int n_adc_vals);
|
||||
int SPS_Open(void **handle, char *host, int port, int chan);
|
||||
int SPS_SendTillSame(void **handle,
|
||||
struct RS__MsgStruct *to_host,
|
||||
struct RS__RespStruct *from_host,
|
||||
char *cmnd, char *rply, int rply_len);
|
||||
int SPS_SendTillSameLen(void **handle,
|
||||
struct RS__MsgStruct *to_host,
|
||||
struct RS__RespStruct *from_host,
|
||||
char *cmnd, char *rply, int rply_len);
|
||||
/*---------------------------------------------------------------------*/
|
||||
int VelSel_Close (
|
||||
void **handle,
|
||||
int force_flag);
|
||||
void VelSel_Config (
|
||||
void **handle,
|
||||
int msec_tmo,
|
||||
char *eot_str);
|
||||
void VelSel_ErrInfo (
|
||||
char **entry_txt,
|
||||
int *errcode,
|
||||
int *my_errno,
|
||||
int *vaxc_errno);
|
||||
void *VelSel_GetReply (
|
||||
void **handle,
|
||||
void *last_rply);
|
||||
int VelSel_GetStatus (
|
||||
void **handle,
|
||||
char *status_str,
|
||||
int status_str_len);
|
||||
int VelSel_Open (
|
||||
void **handle,
|
||||
char *host,
|
||||
int port,
|
||||
int chan);
|
||||
int VelSel_SendCmnd (
|
||||
void **handle,
|
||||
char *cmnd,
|
||||
char *rply,
|
||||
int rply_size);
|
||||
int VelSel_Close(void **handle, int force_flag);
|
||||
void VelSel_Config(void **handle, int msec_tmo, char *eot_str);
|
||||
void VelSel_ErrInfo(char **entry_txt,
|
||||
int *errcode, int *my_errno, int *vaxc_errno);
|
||||
void *VelSel_GetReply(void **handle, void *last_rply);
|
||||
int VelSel_GetStatus(void **handle, char *status_str, int status_str_len);
|
||||
int VelSel_Open(void **handle, char *host, int port, int chan);
|
||||
int VelSel_SendCmnd(void **handle, char *cmnd, char *rply, int rply_size);
|
||||
/*---------------------------------------------------------------------*/
|
||||
void FailInet (
|
||||
char *text);
|
||||
void GetErrno (
|
||||
int *his_errno,
|
||||
int *his_vaxc_errno);
|
||||
int MakeCharPrintable (
|
||||
char *out,
|
||||
int out_size,
|
||||
char in);
|
||||
char *MakePrint (
|
||||
char *text);
|
||||
char *MakePrintable (
|
||||
char *out,
|
||||
int out_size,
|
||||
char *in);
|
||||
void *Map_to_ACS ();
|
||||
char *StrEdit (
|
||||
char *out,
|
||||
char *in,
|
||||
char *ctrl,
|
||||
int *ln);
|
||||
char *StrJoin (
|
||||
char *result,
|
||||
int result_size,
|
||||
char *str_a,
|
||||
char *str_b);
|
||||
int StrMatch (
|
||||
char *str_a,
|
||||
char *str_b,
|
||||
int min_len);
|
||||
int Get_TASMAD_Info (
|
||||
char *file_name,
|
||||
int *nItems,
|
||||
...);
|
||||
int Get_TASMAD_Info_Filename (
|
||||
char *file_name,
|
||||
char *buf,
|
||||
int *bufSize);
|
||||
int Update_TASMAD_Info (
|
||||
char *file_name,
|
||||
int *nItems,
|
||||
...);
|
||||
void FailInet(char *text);
|
||||
void GetErrno(int *his_errno, int *his_vaxc_errno);
|
||||
int MakeCharPrintable(char *out, int out_size, char in);
|
||||
char *MakePrint(char *text);
|
||||
char *MakePrintable(char *out, int out_size, char *in);
|
||||
void *Map_to_ACS();
|
||||
char *StrEdit(char *out, char *in, char *ctrl, int *ln);
|
||||
char *StrJoin(char *result, int result_size, char *str_a, char *str_b);
|
||||
int StrMatch(char *str_a, char *str_b, int min_len);
|
||||
int Get_TASMAD_Info(char *file_name, int *nItems, ...);
|
||||
int Get_TASMAD_Info_Filename(char *file_name, char *buf, int *bufSize);
|
||||
int Update_TASMAD_Info(char *file_name, int *nItems, ...);
|
||||
/*--------------------------------------------- End of SINQ_PROTOTYPES.H --*/
|
||||
#endif /* _sinq_prototypes_loaded_ */
|
||||
#endif /* _sinq_prototypes_loaded_ */
|
||||
|
3111
hardsup/sinqhm.c
3111
hardsup/sinqhm.c
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,7 @@
|
||||
#define SINQHMUTILITY
|
||||
#include "sinqhm_def.h"
|
||||
|
||||
typedef struct __SINQHM *pSINQHM;
|
||||
typedef struct __SINQHM *pSINQHM;
|
||||
/*------------------------------ Error codes -----------------------------*/
|
||||
|
||||
#line 341 "sinqhm.w"
|
||||
@ -46,61 +46,59 @@
|
||||
|
||||
#line 118 "sinqhm.w"
|
||||
|
||||
pSINQHM CreateSINQHM(char *pHMComputer, int iMasterPort);
|
||||
pSINQHM CopySINQHM(pSINQHM self);
|
||||
void DeleteSINQHM(pSINQHM self);
|
||||
void SINQHMSetPar(pSINQHM self, int iRank, int iLength, int iBinWidth);
|
||||
void SINQHMSetPSD(pSINQHM self, int xSize, int xOff, int xFac,
|
||||
int ySize, int yOff, int yFac);
|
||||
pSINQHM CreateSINQHM(char *pHMComputer, int iMasterPort);
|
||||
pSINQHM CopySINQHM(pSINQHM self);
|
||||
void DeleteSINQHM(pSINQHM self);
|
||||
void SINQHMSetPar(pSINQHM self, int iRank, int iLength, int iBinWidth);
|
||||
void SINQHMSetPSD(pSINQHM self, int xSize, int xOff, int xFac,
|
||||
int ySize, int yOff, int yFac);
|
||||
|
||||
#line 142 "sinqhm.w"
|
||||
|
||||
int SINQHMError2Text(int iErr, char *pBuffer, int iBufLen);
|
||||
int SINQHMError2Text(int iErr, char *pBuffer, int iBufLen);
|
||||
|
||||
#line 155 "sinqhm.w"
|
||||
|
||||
int SINQHMConfigure(pSINQHM self, int iMode, int iRank, int iLength,
|
||||
int iBinWidth, int iLowBin, int iCompress);
|
||||
int SINQHMConfigurePSD(pSINQHM self, int iMode,
|
||||
int xSize, int xOff, int xFac,
|
||||
int ySize, int yOff, int yFac,
|
||||
int iBinWidth,
|
||||
float *iEdges, int iEdgeLength);
|
||||
int SINQHMConfigure(pSINQHM self, int iMode, int iRank, int iLength,
|
||||
int iBinWidth, int iLowBin, int iCompress);
|
||||
int SINQHMConfigurePSD(pSINQHM self, int iMode,
|
||||
int xSize, int xOff, int xFac,
|
||||
int ySize, int yOff, int yFac,
|
||||
int iBinWidth, float *iEdges, int iEdgeLength);
|
||||
|
||||
int SINQHMDeconfigure(pSINQHM self, int iHarsh);
|
||||
int SINQHMGetStatus(pSINQHM self, int *iMode, int *iDaq,
|
||||
int *iRank, int *iBinWidth,
|
||||
int *iLength, int *iClients);
|
||||
int SINQHMDebug(pSINQHM self, int iLevel);
|
||||
int SINQHMKill(pSINQHM self);
|
||||
|
||||
int SINQHMDeconfigure(pSINQHM self, int iHarsh);
|
||||
int SINQHMGetStatus(pSINQHM self,int *iMode, int *iDaq,
|
||||
int *iRank, int *iBinWidth,
|
||||
int *iLength, int *iClients);
|
||||
int SINQHMDebug(pSINQHM self, int iLevel);
|
||||
int SINQHMKill(pSINQHM self);
|
||||
|
||||
|
||||
#line 261 "sinqhm.w"
|
||||
|
||||
int SINQHMOpenDAQ(pSINQHM self);
|
||||
int SINQHMCloseDAQ(pSINQHM self);
|
||||
int SINQHMOpenDAQ(pSINQHM self);
|
||||
int SINQHMCloseDAQ(pSINQHM self);
|
||||
|
||||
int SINQHMStartDAQ(pSINQHM self);
|
||||
int SINQHMStopDAQ(pSINQHM self);
|
||||
int SINQHMInhibitDAQ(pSINQHM self);
|
||||
int SINQHMContinueDAQ(pSINQHM self);
|
||||
|
||||
int SINQHMWrite(pSINQHM self, int iNum, int iStart, int iEnd,
|
||||
void *pData);
|
||||
long SINQHMSize(pSINQHM self, int iNum, int iStart, int iEnd);
|
||||
int SINQHMRead(pSINQHM self, int iNum, int iStart, int iEnd,
|
||||
void *pData, int iDataLen);
|
||||
int SINQHMProject(pSINQHM self, int code, int xStart, int nx,
|
||||
int yStart, int ny, void *pData, int iDataLen);
|
||||
int SINQHMZero(pSINQHM self, int iNum, int iStart, int iEnd);
|
||||
int SINQHMStartDAQ(pSINQHM self);
|
||||
int SINQHMStopDAQ(pSINQHM self);
|
||||
int SINQHMInhibitDAQ(pSINQHM self);
|
||||
int SINQHMContinueDAQ(pSINQHM self);
|
||||
|
||||
int SINQHMWrite(pSINQHM self, int iNum, int iStart, int iEnd, void *pData);
|
||||
long SINQHMSize(pSINQHM self, int iNum, int iStart, int iEnd);
|
||||
int SINQHMRead(pSINQHM self, int iNum, int iStart, int iEnd,
|
||||
void *pData, int iDataLen);
|
||||
int SINQHMProject(pSINQHM self, int code, int xStart, int nx,
|
||||
int yStart, int ny, void *pData, int iDataLen);
|
||||
int SINQHMZero(pSINQHM self, int iNum, int iStart, int iEnd);
|
||||
|
||||
#line 382 "sinqhm.w"
|
||||
|
||||
|
||||
#line 232 "sinqhm.w"
|
||||
|
||||
int SINQHMDefineBank(pSINQHM self, int iBankNumber, int iStart, int iEnd,
|
||||
float *iEdges, int iEdgeLength);
|
||||
int SINQHMDefineBank(pSINQHM self, int iBankNumber, int iStart, int iEnd,
|
||||
float *iEdges, int iEdgeLength);
|
||||
|
||||
#line 383 "sinqhm.w"
|
||||
|
||||
|
@ -19,15 +19,15 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
** Define some defaults.
|
||||
*/
|
||||
#define PORT_BASE 2400 /* The Internet Port for Server Requests */
|
||||
#define MAX_CLIENTS 8 /* The maximum number of active clients */
|
||||
#define MAX_TOF_CNTR 1024 /* The maximum number of individual counters ..
|
||||
** which can be handled in TOF mode */
|
||||
#define PORT_BASE 2400 /* The Internet Port for Server Requests */
|
||||
#define MAX_CLIENTS 8 /* The maximum number of active clients */
|
||||
#define MAX_TOF_CNTR 1024 /* The maximum number of individual counters ..
|
||||
** which can be handled in TOF mode */
|
||||
#define MAX_PSD_CNTR 1048576 /* maximum number of PSD elements */
|
||||
#define MAX_TOF_NBINS 32768 /* The maximum number of bins in a TOF histog */
|
||||
#define MAX_TOF_EDGE 16 /* The maximum number of TOF edge arrays */
|
||||
#define VMIO_BASE_ADDR 0x1900 /* VME address of a (possible) VMIO10 module */
|
||||
#define IDENT_MSGE_LEN 256 /* Length of Ident info for SQHM_IDENT */
|
||||
#define MAX_TOF_NBINS 32768 /* The maximum number of bins in a TOF histog */
|
||||
#define MAX_TOF_EDGE 16 /* The maximum number of TOF edge arrays */
|
||||
#define VMIO_BASE_ADDR 0x1900 /* VME address of a (possible) VMIO10 module */
|
||||
#define IDENT_MSGE_LEN 256 /* Length of Ident info for SQHM_IDENT */
|
||||
|
||||
#define uchar unsigned char
|
||||
#define usint unsigned short int
|
||||
@ -71,76 +71,76 @@
|
||||
#define SQHM_STATUS 0x0a
|
||||
#define SQHM_WRITE 0x0b
|
||||
#define SQHM_ZERO 0x0c
|
||||
/*
|
||||
** Define the various operation modes
|
||||
*/
|
||||
#define SQHM__TRANS 0x1000 /* Transparent mode */
|
||||
#define SQHM__HM_DIG 0x2000 /* Hist mode (with digitised read-out) */
|
||||
#define SQHM__TOF 0x3000 /* Time-of-Flight mode */
|
||||
#define SQHM__HM_PSD 0x4000 /* Hist mode (with Pos-sens-detect read-out) */
|
||||
#define SQHM__HRPT 0x5000 /* Hist mode for HRPT */
|
||||
/*
|
||||
** Define the various sub-mode bits of the operation modes
|
||||
*/
|
||||
#define SQHM__SUB_MODE_MSK 0xff /* Mask for extracting "sub-mode" bits */
|
||||
#define SQHM__DEBUG 0x01 /* Debug flag - FILLER will suspend itself ..
|
||||
** .. after starting to allow debugging */
|
||||
#define SQHM__UD 0x02 /* Use Up/Down bit information */
|
||||
/*
|
||||
** Define the various operation modes
|
||||
*/
|
||||
#define SQHM__TRANS 0x1000 /* Transparent mode */
|
||||
#define SQHM__HM_DIG 0x2000 /* Hist mode (with digitised read-out) */
|
||||
#define SQHM__TOF 0x3000 /* Time-of-Flight mode */
|
||||
#define SQHM__HM_PSD 0x4000 /* Hist mode (with Pos-sens-detect read-out) */
|
||||
#define SQHM__HRPT 0x5000 /* Hist mode for HRPT */
|
||||
/*
|
||||
** Define the various sub-mode bits of the operation modes
|
||||
*/
|
||||
#define SQHM__SUB_MODE_MSK 0xff /* Mask for extracting "sub-mode" bits */
|
||||
#define SQHM__DEBUG 0x01 /* Debug flag - FILLER will suspend itself ..
|
||||
** .. after starting to allow debugging */
|
||||
#define SQHM__UD 0x02 /* Use Up/Down bit information */
|
||||
|
||||
#define SQHM__BO_MSK 0x18 /* Mask for extracting "bin-overflow" bits */
|
||||
#define SQHM__BO_IGN 0x00 /* Ignore bin-overflows (bin-contents wrap) */
|
||||
#define SQHM__BO_SMAX 0x08 /* On bin-overflow, stop at maximum */
|
||||
#define SQHM__BO_CNT 0x10 /* Keep counts of overflow bins */
|
||||
#define SQHM__BO_MSK 0x18 /* Mask for extracting "bin-overflow" bits */
|
||||
#define SQHM__BO_IGN 0x00 /* Ignore bin-overflows (bin-contents wrap) */
|
||||
#define SQHM__BO_SMAX 0x08 /* On bin-overflow, stop at maximum */
|
||||
#define SQHM__BO_CNT 0x10 /* Keep counts of overflow bins */
|
||||
|
||||
#define SQHM__STROBO 0x20 /* Use strobo-bit information */
|
||||
#define SQHM__REFLECT 0x40 /* Reflect histograms */
|
||||
#define SQHM__NO_STAT 0x80 /* Suppress status info from "Filler" */
|
||||
/*
|
||||
** ----------------------------------------------------------
|
||||
** SQHM_DAQ sub-function codes
|
||||
*/
|
||||
#define SQHM__STROBO 0x20 /* Use strobo-bit information */
|
||||
#define SQHM__REFLECT 0x40 /* Reflect histograms */
|
||||
#define SQHM__NO_STAT 0x80 /* Suppress status info from "Filler" */
|
||||
/*
|
||||
** ----------------------------------------------------------
|
||||
** SQHM_DAQ sub-function codes
|
||||
*/
|
||||
#define DAQ__EXIT 0xffffffff
|
||||
#define DAQ__CLR 0x01
|
||||
#define DAQ__GO 0x02
|
||||
#define DAQ__INH 0x03
|
||||
#define DAQ__STOP 0x04
|
||||
#define DAQ__TST 0x05
|
||||
/*
|
||||
** ----------------------------------------------------------
|
||||
** SQHM_PROJECT sub-codes
|
||||
*/
|
||||
#define PROJECT__ON_Y 0x0001 /* Project onto y-axis */
|
||||
#define PROJECT__1_DIM 0x0002 /* Make projection of a 1-dim histogram */
|
||||
/*
|
||||
** ----------------------------------------------------------
|
||||
** SQHM_PROJECT sub-codes
|
||||
*/
|
||||
#define PROJECT__ON_Y 0x0001 /* Project onto y-axis */
|
||||
#define PROJECT__1_DIM 0x0002 /* Make projection of a 1-dim histogram */
|
||||
#define PROJECT__COLL 0x0003 /* collapse PSD on one time channel */
|
||||
#define PROJECT__SAMPLE 0x0004 /* sum a rectangular part of the PSD
|
||||
detector in time
|
||||
*/
|
||||
/*
|
||||
** ----------------------------------------------------------
|
||||
** Definition of bits in <flag> of TOF edge-array
|
||||
*/
|
||||
#define FLAG__VAR_BIN 0x01 /* Bin span of histogram is variable */
|
||||
/*
|
||||
** ----------------------------------------------------------
|
||||
** Definition of bits in <flags> of SQHM_STATUS response
|
||||
*/
|
||||
#define STATUS_FLAGS__PF 0x8000 /* PF - Power Fail */
|
||||
#define STATUS_FLAGS__SWC 0x4000 /* SWC - Status Word Changed */
|
||||
#define STATUS_FLAGS__NRL 0x2000 /* NRL - Neutron Rate Low */
|
||||
#define STATUS_FLAGS__DAQ 0x1000 /* DAQ on -- set if Hdr Mask Bits are
|
||||
** correct so that data acq is active */
|
||||
#define STATUS_FLAGS__SYNC3 0x0800 /* Ext Synch Bit #3 */
|
||||
#define STATUS_FLAGS__SYNC2 0x0400 /* Ext Synch Bit #2 */
|
||||
#define STATUS_FLAGS__SYNC1 0x0200 /* Ext Synch Bit #1 */
|
||||
#define STATUS_FLAGS__SYNC0 0x0100 /* Ext Synch Bit #0 */
|
||||
#define STATUS_FLAGS__UD 0x0080 /* UD - Up/Down */
|
||||
#define STATUS_FLAGS__GU 0x0040 /* GU - Gummi (i.e. Strobo) */
|
||||
/*
|
||||
** ----------------------------------------------------------
|
||||
*/
|
||||
#define N_HISTS_MAX 64 /* Maximum number of histograms supported */
|
||||
#define N_BINS_MAX 0x00ffff /* Maximum histogram bin number permitted */
|
||||
#define N_TOTAL_BYTES 0x400000 /* Maximum total bytes of histogram */
|
||||
*/
|
||||
/*
|
||||
** ----------------------------------------------------------
|
||||
** Definition of bits in <flag> of TOF edge-array
|
||||
*/
|
||||
#define FLAG__VAR_BIN 0x01 /* Bin span of histogram is variable */
|
||||
/*
|
||||
** ----------------------------------------------------------
|
||||
** Definition of bits in <flags> of SQHM_STATUS response
|
||||
*/
|
||||
#define STATUS_FLAGS__PF 0x8000 /* PF - Power Fail */
|
||||
#define STATUS_FLAGS__SWC 0x4000 /* SWC - Status Word Changed */
|
||||
#define STATUS_FLAGS__NRL 0x2000 /* NRL - Neutron Rate Low */
|
||||
#define STATUS_FLAGS__DAQ 0x1000 /* DAQ on -- set if Hdr Mask Bits are
|
||||
** correct so that data acq is active */
|
||||
#define STATUS_FLAGS__SYNC3 0x0800 /* Ext Synch Bit #3 */
|
||||
#define STATUS_FLAGS__SYNC2 0x0400 /* Ext Synch Bit #2 */
|
||||
#define STATUS_FLAGS__SYNC1 0x0200 /* Ext Synch Bit #1 */
|
||||
#define STATUS_FLAGS__SYNC0 0x0100 /* Ext Synch Bit #0 */
|
||||
#define STATUS_FLAGS__UD 0x0080 /* UD - Up/Down */
|
||||
#define STATUS_FLAGS__GU 0x0040 /* GU - Gummi (i.e. Strobo) */
|
||||
/*
|
||||
** ----------------------------------------------------------
|
||||
*/
|
||||
#define N_HISTS_MAX 64 /* Maximum number of histograms supported */
|
||||
#define N_BINS_MAX 0x00ffff /* Maximum histogram bin number permitted */
|
||||
#define N_TOTAL_BYTES 0x400000 /* Maximum total bytes of histogram */
|
||||
/*
|
||||
**------------------------------------------------------------------------------
|
||||
** Definitions of Filler states in HRPT mode
|
||||
@ -151,74 +151,74 @@
|
||||
**------------------------------------------------------------------------------
|
||||
** Definitions for the LWL Datagrams
|
||||
*/
|
||||
#define LWL_HDR_TYPE_MASK (0x1f000000) /* Mask for extracting main dgrm ..
|
||||
** .. hdr command-type bits */
|
||||
#define LWL_HDR_PF_MASK (0x80000000) /* Mask for extr Power Fail bit */
|
||||
#define LWL_HDR_SWC_MASK (0x40000000) /* Mask for extr Status Word Chng bit */
|
||||
#define LWL_HDR_NRL_MASK (0x20000000) /* Mask for extr Neutron Rate Low bit */
|
||||
#define LWL_HDR_SYNC3_MASK (0x00800000) /* Mask for one of ext synch bits */
|
||||
#define LWL_HDR_SYNC2_MASK (0x00400000) /* Mask for one of ext synch bits */
|
||||
#define LWL_HDR_SYNC1_MASK (0x00200000) /* Mask for one of ext synch bits */
|
||||
#define LWL_HDR_SYNC0_MASK (0x00100000) /* Mask for one of ext synch bits */
|
||||
#define LWL_HDR_UD_MASK LWL_HDR_SYNC1_MASK /* Mask for Up/Down bit */
|
||||
#define LWL_HDR_GU_MASK LWL_HDR_SYNC0_MASK /* Mask for GU bit */
|
||||
#define LWL_HDR_BA_MASK (0x00f00000) /* Mask for TSI Binning Addr */
|
||||
#define LWL_HDR_TS_MASK (0x000fffff) /* Mask for TSI Time Stamp */
|
||||
#define LWL_HDR_TYPE_MASK (0x1f000000) /* Mask for extracting main dgrm ..
|
||||
** .. hdr command-type bits */
|
||||
#define LWL_HDR_PF_MASK (0x80000000) /* Mask for extr Power Fail bit */
|
||||
#define LWL_HDR_SWC_MASK (0x40000000) /* Mask for extr Status Word Chng bit */
|
||||
#define LWL_HDR_NRL_MASK (0x20000000) /* Mask for extr Neutron Rate Low bit */
|
||||
#define LWL_HDR_SYNC3_MASK (0x00800000) /* Mask for one of ext synch bits */
|
||||
#define LWL_HDR_SYNC2_MASK (0x00400000) /* Mask for one of ext synch bits */
|
||||
#define LWL_HDR_SYNC1_MASK (0x00200000) /* Mask for one of ext synch bits */
|
||||
#define LWL_HDR_SYNC0_MASK (0x00100000) /* Mask for one of ext synch bits */
|
||||
#define LWL_HDR_UD_MASK LWL_HDR_SYNC1_MASK /* Mask for Up/Down bit */
|
||||
#define LWL_HDR_GU_MASK LWL_HDR_SYNC0_MASK /* Mask for GU bit */
|
||||
#define LWL_HDR_BA_MASK (0x00f00000) /* Mask for TSI Binning Addr */
|
||||
#define LWL_HDR_TS_MASK (0x000fffff) /* Mask for TSI Time Stamp */
|
||||
|
||||
#define LWL_FIFO_EMPTY (0x1e000000) /* FIFO Empty */
|
||||
#define LWL_FIFO_EMPTY (0x1e000000) /* FIFO Empty */
|
||||
|
||||
#define LWL_TSI_TR (0x1f000000) /* Time-Status-Info Transp-Mode */
|
||||
#define LWL_TSI_HM_NC (0x1f000000) /* Time-Status-Info Hist-Mode+No-Coinc */
|
||||
#define LWL_TSI_HM_C (0x0e000000) /* Time-Status-Info Hist-Mode+Coinc */
|
||||
#define LWL_TSI_TOF (0x1f000000) /* Time-Status-Info TOF-Mode */
|
||||
#define LWL_TSI_SM_NC (0x1f000000) /* Time-Status-Info Strobo-Mode+No-Coin */
|
||||
#define LWL_TSI_SM_C (0x0e000000) /* Time-Status-Info Strobo-Mode+Coinc */
|
||||
#define LWL_TSI_DT_MSK (0x000fffff) /* Mask for Dead-Time in TSI */
|
||||
#define LWL_TSI_DTS_MSK (0x000fffff) /* Mask for Delay-Time-to-Start in TSI */
|
||||
#define LWL_TSI_TR (0x1f000000) /* Time-Status-Info Transp-Mode */
|
||||
#define LWL_TSI_HM_NC (0x1f000000) /* Time-Status-Info Hist-Mode+No-Coinc */
|
||||
#define LWL_TSI_HM_C (0x0e000000) /* Time-Status-Info Hist-Mode+Coinc */
|
||||
#define LWL_TSI_TOF (0x1f000000) /* Time-Status-Info TOF-Mode */
|
||||
#define LWL_TSI_SM_NC (0x1f000000) /* Time-Status-Info Strobo-Mode+No-Coin */
|
||||
#define LWL_TSI_SM_C (0x0e000000) /* Time-Status-Info Strobo-Mode+Coinc */
|
||||
#define LWL_TSI_DT_MSK (0x000fffff) /* Mask for Dead-Time in TSI */
|
||||
#define LWL_TSI_DTS_MSK (0x000fffff) /* Mask for Delay-Time-to-Start in TSI */
|
||||
|
||||
#define LWL_TR_C1 (0x00000001) /* Transp. Mode Chan 1 */
|
||||
#define LWL_TR_C2 (0x00000002) /* Transp. Mode Chan 2 */
|
||||
#define LWL_TR_C3 (0x00000003) /* Transp. Mode Chan 3 */
|
||||
#define LWL_TR_C4 (0x00000004) /* Transp. Mode Chan 4 */
|
||||
#define LWL_TR_C5 (0x00000005) /* Transp. Mode Chan 5 */
|
||||
#define LWL_TR_C6 (0x00000006) /* Transp. Mode Chan 6 */
|
||||
#define LWL_TR_C7 (0x00000007) /* Transp. Mode Chan 7 */
|
||||
#define LWL_TR_C8 (0x00000008) /* Transp. Mode Chan 8 */
|
||||
#define LWL_TR_C9 (0x00000009) /* Transp. Mode Chan 9 */
|
||||
#define LWL_TR_C1 (0x00000001) /* Transp. Mode Chan 1 */
|
||||
#define LWL_TR_C2 (0x00000002) /* Transp. Mode Chan 2 */
|
||||
#define LWL_TR_C3 (0x00000003) /* Transp. Mode Chan 3 */
|
||||
#define LWL_TR_C4 (0x00000004) /* Transp. Mode Chan 4 */
|
||||
#define LWL_TR_C5 (0x00000005) /* Transp. Mode Chan 5 */
|
||||
#define LWL_TR_C6 (0x00000006) /* Transp. Mode Chan 6 */
|
||||
#define LWL_TR_C7 (0x00000007) /* Transp. Mode Chan 7 */
|
||||
#define LWL_TR_C8 (0x00000008) /* Transp. Mode Chan 8 */
|
||||
#define LWL_TR_C9 (0x00000009) /* Transp. Mode Chan 9 */
|
||||
|
||||
#define LWL_HM_NC (0x10000000) /* Hist-Mode/No-Coinc 0 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C1 (0x11000000) /* Hist-Mode/No-Coinc 1 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C2 (0x12000000) /* Hist-Mode/No-Coinc 2 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C3 (0x13000000) /* Hist-Mode/No-Coinc 3 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C4 (0x14000000) /* Hist-Mode/No-Coinc 4 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C5 (0x15000000) /* Hist-Mode/No-Coinc 5 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C6 (0x16000000) /* Hist-Mode/No-Coinc 6 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C7 (0x17000000) /* Hist-Mode/No-Coinc 7 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C8 (0x18000000) /* Hist-Mode/No-Coinc 8 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C9 (0x19000000) /* Hist-Mode/No-Coinc 9 chan dgrm hdr */
|
||||
#define LWL_HM_NC (0x10000000) /* Hist-Mode/No-Coinc 0 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C1 (0x11000000) /* Hist-Mode/No-Coinc 1 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C2 (0x12000000) /* Hist-Mode/No-Coinc 2 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C3 (0x13000000) /* Hist-Mode/No-Coinc 3 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C4 (0x14000000) /* Hist-Mode/No-Coinc 4 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C5 (0x15000000) /* Hist-Mode/No-Coinc 5 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C6 (0x16000000) /* Hist-Mode/No-Coinc 6 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C7 (0x17000000) /* Hist-Mode/No-Coinc 7 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C8 (0x18000000) /* Hist-Mode/No-Coinc 8 chan dgrm hdr */
|
||||
#define LWL_HM_NC_C9 (0x19000000) /* Hist-Mode/No-Coinc 9 chan dgrm hdr */
|
||||
|
||||
#define LWL_HM_CO (0x10000000) /* Hist-Mode+Coinc 0 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C2 (0x12000000) /* Hist-Mode+Coinc 2 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C3 (0x13000000) /* Hist-Mode+Coinc 3 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C4 (0x14000000) /* Hist-Mode+Coinc 4 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C5 (0x15000000) /* Hist-Mode+Coinc 5 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C6 (0x16000000) /* Hist-Mode+Coinc 6 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C7 (0x17000000) /* Hist-Mode+Coinc 7 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C8 (0x18000000) /* Hist-Mode+Coinc 8 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C9 (0x19000000) /* Hist-Mode+Coinc 9 chan dgrm hdr */
|
||||
#define LWL_HM_CO (0x10000000) /* Hist-Mode+Coinc 0 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C2 (0x12000000) /* Hist-Mode+Coinc 2 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C3 (0x13000000) /* Hist-Mode+Coinc 3 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C4 (0x14000000) /* Hist-Mode+Coinc 4 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C5 (0x15000000) /* Hist-Mode+Coinc 5 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C6 (0x16000000) /* Hist-Mode+Coinc 6 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C7 (0x17000000) /* Hist-Mode+Coinc 7 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C8 (0x18000000) /* Hist-Mode+Coinc 8 chan dgrm hdr */
|
||||
#define LWL_HM_CO_C9 (0x19000000) /* Hist-Mode+Coinc 9 chan dgrm hdr */
|
||||
|
||||
#define LWL_TOF_C1 (0x01000000) /* TOF-Mode 1 chan dgrm hdr */
|
||||
#define LWL_TOF_C2 (0x02000000) /* TOF-Mode 2 chan dgrm hdr */
|
||||
#define LWL_TOF_C3 (0x03000000) /* TOF-Mode 3 chan dgrm hdr */
|
||||
#define LWL_TOF_C4 (0x04000000) /* TOF-Mode 4 chan dgrm hdr */
|
||||
#define LWL_TOF_C5 (0x05000000) /* TOF-Mode 5 chan dgrm hdr */
|
||||
#define LWL_TOF_C6 (0x06000000) /* TOF-Mode 6 chan dgrm hdr */
|
||||
#define LWL_TOF_C7 (0x07000000) /* TOF-Mode 7 chan dgrm hdr */
|
||||
#define LWL_TOF_C8 (0x08000000) /* TOF-Mode 8 chan dgrm hdr */
|
||||
#define LWL_TOF_C9 (0x09000000) /* TOF-Mode 9 chan dgrm hdr */
|
||||
#define LWL_TOF_C1 (0x01000000) /* TOF-Mode 1 chan dgrm hdr */
|
||||
#define LWL_TOF_C2 (0x02000000) /* TOF-Mode 2 chan dgrm hdr */
|
||||
#define LWL_TOF_C3 (0x03000000) /* TOF-Mode 3 chan dgrm hdr */
|
||||
#define LWL_TOF_C4 (0x04000000) /* TOF-Mode 4 chan dgrm hdr */
|
||||
#define LWL_TOF_C5 (0x05000000) /* TOF-Mode 5 chan dgrm hdr */
|
||||
#define LWL_TOF_C6 (0x06000000) /* TOF-Mode 6 chan dgrm hdr */
|
||||
#define LWL_TOF_C7 (0x07000000) /* TOF-Mode 7 chan dgrm hdr */
|
||||
#define LWL_TOF_C8 (0x08000000) /* TOF-Mode 8 chan dgrm hdr */
|
||||
#define LWL_TOF_C9 (0x09000000) /* TOF-Mode 9 chan dgrm hdr */
|
||||
|
||||
#define LWL_PSD_TSI 0x0E000000 /* PSD-Mode TSI datagram */
|
||||
#define LWL_PSD_DATA 0x12000000 /* PSD-mode data datagram */
|
||||
#define LWL_PSD_DATA 0x12000000 /* PSD-mode data datagram */
|
||||
#define LWL_PSD_PWF 0x20000000 /* PSD-mode Power Fail bit */
|
||||
#define LWL_PSD_TIME 0x000fffff /* PSD-mode time stamp extraction
|
||||
mask */
|
||||
@ -226,258 +226,276 @@
|
||||
#define LWL_PSD_XORF 0x2000 /* mask for TDC-XORF bit */
|
||||
#define LWL_PSD_CONF 0x0100 /* mask for TDC-CONF flag */
|
||||
|
||||
#define LWL_SM_NC (0x10000000) /* Strobo-Mode/No-Coinc 0 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C1 (0x11000000) /* Strobo-Mode/No-Coinc 1 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C2 (0x12000000) /* Strobo-Mode/No-Coinc 2 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C3 (0x13000000) /* Strobo-Mode/No-Coinc 3 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C4 (0x14000000) /* Strobo-Mode/No-Coinc 4 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C5 (0x15000000) /* Strobo-Mode/No-Coinc 5 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C6 (0x16000000) /* Strobo-Mode/No-Coinc 6 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C7 (0x17000000) /* Strobo-Mode/No-Coinc 7 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C8 (0x18000000) /* Strobo-Mode/No-Coinc 8 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C9 (0x19000000) /* Strobo-Mode/No-Coinc 9 chan dgrm hdr */
|
||||
#define LWL_SM_NC (0x10000000) /* Strobo-Mode/No-Coinc 0 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C1 (0x11000000) /* Strobo-Mode/No-Coinc 1 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C2 (0x12000000) /* Strobo-Mode/No-Coinc 2 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C3 (0x13000000) /* Strobo-Mode/No-Coinc 3 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C4 (0x14000000) /* Strobo-Mode/No-Coinc 4 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C5 (0x15000000) /* Strobo-Mode/No-Coinc 5 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C6 (0x16000000) /* Strobo-Mode/No-Coinc 6 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C7 (0x17000000) /* Strobo-Mode/No-Coinc 7 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C8 (0x18000000) /* Strobo-Mode/No-Coinc 8 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C9 (0x19000000) /* Strobo-Mode/No-Coinc 9 chan dgrm hdr */
|
||||
|
||||
#define LWL_SM_CO (0x10000000) /* Strobo-Mode + Coinc 0 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C1 (0x11000000) /* Strobo-Mode + Coinc 1 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C2 (0x12000000) /* Strobo-Mode + Coinc 2 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C3 (0x13000000) /* Strobo-Mode + Coinc 3 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C4 (0x14000000) /* Strobo-Mode + Coinc 4 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C5 (0x15000000) /* Strobo-Mode + Coinc 5 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C6 (0x16000000) /* Strobo-Mode + Coinc 6 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C7 (0x17000000) /* Strobo-Mode + Coinc 7 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C8 (0x18000000) /* Strobo-Mode + Coinc 8 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C9 (0x19000000) /* Strobo-Mode + Coinc 9 chan dgrm hdr */
|
||||
#define LWL_SM_CO (0x10000000) /* Strobo-Mode + Coinc 0 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C1 (0x11000000) /* Strobo-Mode + Coinc 1 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C2 (0x12000000) /* Strobo-Mode + Coinc 2 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C3 (0x13000000) /* Strobo-Mode + Coinc 3 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C4 (0x14000000) /* Strobo-Mode + Coinc 4 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C5 (0x15000000) /* Strobo-Mode + Coinc 5 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C6 (0x16000000) /* Strobo-Mode + Coinc 6 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C7 (0x17000000) /* Strobo-Mode + Coinc 7 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C8 (0x18000000) /* Strobo-Mode + Coinc 8 chan dgrm hdr */
|
||||
#define LWL_SM_CO_C9 (0x19000000) /* Strobo-Mode + Coinc 9 chan dgrm hdr */
|
||||
|
||||
#define LWL_TSI_MODE_MASK (0x000e) /* Mask for mode in Time Status Info */
|
||||
#define LWL_TSI_MODE_TR (0x0000) /* TSI Transparent-Mode */
|
||||
#define LWL_TSI_MODE_HM (0x0002) /* TSI Hist-Mode */
|
||||
#define LWL_TSI_MODE_TOF (0x0004) /* TSI TOF-Mode */
|
||||
#define LWL_TSI_MODE_SM1 (0x0006) /* TSI Strobo-Mode 1 - time-stamp coded */
|
||||
#define LWL_TSI_MODE_TR_UD (0x0008) /* TSI Transparent-Mode Up-Down */
|
||||
#define LWL_TSI_MODE_HM_UD (0x000a) /* TSI Hist-Mode Up-Down */
|
||||
#define LWL_TSI_MODE_TOF_UD (0x000c) /* TSI TOF-Mode Up-Down */
|
||||
#define LWL_TSI_MODE_SM2 (0x000e) /* TSI Strobo-Mode 2 - h/w coded */
|
||||
#define LWL_TSI_MODE_MASK (0x000e) /* Mask for mode in Time Status Info */
|
||||
#define LWL_TSI_MODE_TR (0x0000) /* TSI Transparent-Mode */
|
||||
#define LWL_TSI_MODE_HM (0x0002) /* TSI Hist-Mode */
|
||||
#define LWL_TSI_MODE_TOF (0x0004) /* TSI TOF-Mode */
|
||||
#define LWL_TSI_MODE_SM1 (0x0006) /* TSI Strobo-Mode 1 - time-stamp coded */
|
||||
#define LWL_TSI_MODE_TR_UD (0x0008) /* TSI Transparent-Mode Up-Down */
|
||||
#define LWL_TSI_MODE_HM_UD (0x000a) /* TSI Hist-Mode Up-Down */
|
||||
#define LWL_TSI_MODE_TOF_UD (0x000c) /* TSI TOF-Mode Up-Down */
|
||||
#define LWL_TSI_MODE_SM2 (0x000e) /* TSI Strobo-Mode 2 - h/w coded */
|
||||
/*
|
||||
**------------------------------------------------------------------------------
|
||||
** Define structure of a TOF histogram data item.
|
||||
*/
|
||||
struct tof_histog {
|
||||
int cntr_nmbr; /* Counter number */
|
||||
uint lo_edge; /* Low edge of first bin (20-bit value) */
|
||||
uint hi_edge; /* Top edge of last bin (20-bit value) */
|
||||
usint flag; /* Bit mask giving info on histog -- may be
|
||||
** used to help optimise the code */
|
||||
usint bytes_per_bin; /* Number of bytes in each histogram bin */
|
||||
uint n_bins; /* Number of bins in histogram */
|
||||
uint cnt_early_up; /* Count of early events (pol'n up) */
|
||||
uint cnt_late_up; /* Count of late events (pol'n up) */
|
||||
uint cnt_early_down; /* Count of early events (pol'n down) */
|
||||
uint cnt_late_down; /* Count of late events (pol'n down) */
|
||||
uint *bin_edge; /* Pointer to array of bin edges */
|
||||
union { /* Pointer to histogram array */
|
||||
uchar *b_bin_data; /* .. pointer if it's 8-bit bins */
|
||||
usint *w_bin_data; /* .. pointer if it's 16-bit bins */
|
||||
uint *l_bin_data; /* .. pointer if it's 32-bit bins */
|
||||
} u;
|
||||
};
|
||||
struct tof_histog {
|
||||
int cntr_nmbr; /* Counter number */
|
||||
uint lo_edge; /* Low edge of first bin (20-bit value) */
|
||||
uint hi_edge; /* Top edge of last bin (20-bit value) */
|
||||
usint flag; /* Bit mask giving info on histog -- may be
|
||||
** used to help optimise the code */
|
||||
usint bytes_per_bin; /* Number of bytes in each histogram bin */
|
||||
uint n_bins; /* Number of bins in histogram */
|
||||
uint cnt_early_up; /* Count of early events (pol'n up) */
|
||||
uint cnt_late_up; /* Count of late events (pol'n up) */
|
||||
uint cnt_early_down; /* Count of early events (pol'n down) */
|
||||
uint cnt_late_down; /* Count of late events (pol'n down) */
|
||||
uint *bin_edge; /* Pointer to array of bin edges */
|
||||
union { /* Pointer to histogram array */
|
||||
uchar *b_bin_data; /* .. pointer if it's 8-bit bins */
|
||||
usint *w_bin_data; /* .. pointer if it's 16-bit bins */
|
||||
uint *l_bin_data; /* .. pointer if it's 32-bit bins */
|
||||
} u;
|
||||
};
|
||||
|
||||
/* Define a TOF 'edge-info' structure. This structure is created
|
||||
** as a result of a TOF 'edge-array' in a SQHM__TOF config cmnd.
|
||||
*/
|
||||
struct tof_edge_info {
|
||||
uint n_bins; /* Number of bins in histogram */
|
||||
uint flag; /* Flag bits defining type of histo */
|
||||
uint bin_span; /* Time spanned by a histogram bin (20-bit
|
||||
** value) if bin width is constant. Otherwise
|
||||
** it is zero. */
|
||||
uint hi_edge; /* Top edge of last bin (20-bit value) */
|
||||
uint edges[2]; /* Array of edge data (20-bit values). There
|
||||
** are actually (n_bins+1) items in the array
|
||||
** and give the bottom edges of the bin */
|
||||
};
|
||||
struct tof_edge_info {
|
||||
uint n_bins; /* Number of bins in histogram */
|
||||
uint flag; /* Flag bits defining type of histo */
|
||||
uint bin_span; /* Time spanned by a histogram bin (20-bit
|
||||
** value) if bin width is constant. Otherwise
|
||||
** it is zero. */
|
||||
uint hi_edge; /* Top edge of last bin (20-bit value) */
|
||||
uint edges[2]; /* Array of edge data (20-bit values). There
|
||||
** are actually (n_bins+1) items in the array
|
||||
** and give the bottom edges of the bin */
|
||||
};
|
||||
|
||||
/* Define structure of a TOF 'edge-array' in SQHM__TOF config cmnd
|
||||
*/
|
||||
struct tof_edge_arr {
|
||||
uint n_bins; /* Number of bins in histogram */
|
||||
uint flag; /* Flag (0/1) for fixed/variable bin size */
|
||||
uint *edges; /* Array of bottom edges (20-bit values) */
|
||||
};
|
||||
struct tof_edge_arr {
|
||||
uint n_bins; /* Number of bins in histogram */
|
||||
uint flag; /* Flag (0/1) for fixed/variable bin size */
|
||||
uint *edges; /* Array of bottom edges (20-bit values) */
|
||||
};
|
||||
|
||||
/* Define structure of a TOF 'bank' in SQHM__TOF config command
|
||||
*/
|
||||
struct tof_bank {
|
||||
usint first; /* Number of first counter in bank */
|
||||
usint n_cntrs; /* Number of counters in bank */
|
||||
usint edge_indx; /* Index of edge array */
|
||||
usint bytes_per_bin; /* Number of bytes per bin */
|
||||
};
|
||||
struct tof_bank {
|
||||
usint first; /* Number of first counter in bank */
|
||||
usint n_cntrs; /* Number of counters in bank */
|
||||
usint edge_indx; /* Index of edge array */
|
||||
usint bytes_per_bin; /* Number of bytes per bin */
|
||||
};
|
||||
/*
|
||||
**------------------------------------------------------------------------------
|
||||
** Define command structure.
|
||||
*/
|
||||
struct req_buff_struct { /* For messages to SinqHM */
|
||||
uint bigend;
|
||||
uint cmnd;
|
||||
struct req_buff_struct { /* For messages to SinqHM */
|
||||
uint bigend;
|
||||
uint cmnd;
|
||||
union {
|
||||
char filler[56];
|
||||
|
||||
struct {
|
||||
uint max_pkt, strt_mode;
|
||||
} cnct;
|
||||
|
||||
struct {
|
||||
uint mode;
|
||||
union {
|
||||
char filler[56];
|
||||
|
||||
struct {uint max_pkt,
|
||||
strt_mode;} cnct;
|
||||
|
||||
struct {uint mode;
|
||||
union {
|
||||
struct {
|
||||
uint n_buffs;
|
||||
uint n_bytes;
|
||||
} trans;
|
||||
struct {
|
||||
uint n_hists;
|
||||
uint lo_bin;
|
||||
uint num_bins;
|
||||
uint bytes_per_bin;
|
||||
uint compress;
|
||||
} hm_dig;
|
||||
struct {
|
||||
uint n_extra_bytes;
|
||||
usint n_edges;
|
||||
usint n_banks;
|
||||
uint preset_delay;
|
||||
struct tof_edge_arr edge_0;
|
||||
struct tof_bank bank_0;
|
||||
} tof;
|
||||
struct {
|
||||
uint n_extra_bytes;
|
||||
usint n_edges;
|
||||
usint n_banks;
|
||||
uint preset_delay;
|
||||
usint xFactor;
|
||||
usint yFactor;
|
||||
usint xOffset;
|
||||
usint yOffset;
|
||||
usint xSize;
|
||||
usint ySize;
|
||||
struct tof_edge_arr edge_0;
|
||||
struct tof_bank bank_0;
|
||||
} psd;
|
||||
} u;
|
||||
} cnfg;
|
||||
|
||||
struct {uint mask;} dbg;
|
||||
|
||||
struct {uint sub_code;} decnfg;
|
||||
|
||||
struct {uint sub_cmnd;} daq;
|
||||
|
||||
struct {uint sub_code,
|
||||
x_lo,
|
||||
nx,
|
||||
y_lo,
|
||||
ny,
|
||||
xdim,
|
||||
nhist;} project;
|
||||
|
||||
struct {uint hist_no,
|
||||
first_bin,
|
||||
n_bins;} read;
|
||||
|
||||
struct {uint hist_no;} select;
|
||||
|
||||
struct {uint hist_no,
|
||||
first_bin,
|
||||
n_bins,
|
||||
bytes_per_bin;} write;
|
||||
|
||||
struct {uint hist_no,
|
||||
first_bin,
|
||||
n_bins;} zero;
|
||||
struct {
|
||||
uint n_buffs;
|
||||
uint n_bytes;
|
||||
} trans;
|
||||
struct {
|
||||
uint n_hists;
|
||||
uint lo_bin;
|
||||
uint num_bins;
|
||||
uint bytes_per_bin;
|
||||
uint compress;
|
||||
} hm_dig;
|
||||
struct {
|
||||
uint n_extra_bytes;
|
||||
usint n_edges;
|
||||
usint n_banks;
|
||||
uint preset_delay;
|
||||
struct tof_edge_arr edge_0;
|
||||
struct tof_bank bank_0;
|
||||
} tof;
|
||||
struct {
|
||||
uint n_extra_bytes;
|
||||
usint n_edges;
|
||||
usint n_banks;
|
||||
uint preset_delay;
|
||||
usint xFactor;
|
||||
usint yFactor;
|
||||
usint xOffset;
|
||||
usint yOffset;
|
||||
usint xSize;
|
||||
usint ySize;
|
||||
struct tof_edge_arr edge_0;
|
||||
struct tof_bank bank_0;
|
||||
} psd;
|
||||
} u;
|
||||
};
|
||||
} cnfg;
|
||||
|
||||
struct {
|
||||
uint mask;
|
||||
} dbg;
|
||||
|
||||
struct {
|
||||
uint sub_code;
|
||||
} decnfg;
|
||||
|
||||
struct {
|
||||
uint sub_cmnd;
|
||||
} daq;
|
||||
|
||||
struct {
|
||||
uint sub_code, x_lo, nx, y_lo, ny, xdim, nhist;
|
||||
} project;
|
||||
|
||||
struct {
|
||||
uint hist_no, first_bin, n_bins;
|
||||
} read;
|
||||
|
||||
struct {
|
||||
uint hist_no;
|
||||
} select;
|
||||
|
||||
struct {
|
||||
uint hist_no, first_bin, n_bins, bytes_per_bin;
|
||||
} write;
|
||||
|
||||
struct {
|
||||
uint hist_no, first_bin, n_bins;
|
||||
} zero;
|
||||
} u;
|
||||
};
|
||||
/*
|
||||
**------------------------------------------------------------------------------
|
||||
** Define status response structure.
|
||||
*/
|
||||
struct rply_buff_struct { /* For messages from SinqHM */
|
||||
uint bigend;
|
||||
uint status;
|
||||
uint sub_status;
|
||||
struct rply_buff_struct { /* For messages from SinqHM */
|
||||
uint bigend;
|
||||
uint status;
|
||||
uint sub_status;
|
||||
union {
|
||||
char message[52];
|
||||
|
||||
struct {
|
||||
uint port;
|
||||
uint pkt_size;
|
||||
uint hm_mode;
|
||||
uint n_hists;
|
||||
uint num_bins;
|
||||
uint bytes_per_bin;
|
||||
uint curr_hist;
|
||||
uint max_block;
|
||||
uint total_bytes;
|
||||
uint lo_cntr;
|
||||
uint lo_bin;
|
||||
uint compress;
|
||||
uint up_time;
|
||||
} cnct;
|
||||
|
||||
struct {
|
||||
usint daq_now;
|
||||
usint daq_was;
|
||||
usint filler_mask;
|
||||
usint server_mask;
|
||||
} daq;
|
||||
|
||||
struct {
|
||||
uint n_extra_bytes;
|
||||
uint up_time;
|
||||
usint offset_vxWorks_ident;
|
||||
usint offset_vxWorks_date;
|
||||
usint offset_instr;
|
||||
usint offset_def_ident;
|
||||
usint offset_sinqhm_main_ident;
|
||||
usint offset_sinqhm_main_date;
|
||||
usint offset_sinqhm_server_ident;
|
||||
usint offset_sinqhm_server_date;
|
||||
usint offset_sinqhm_filler_ident;
|
||||
usint offset_sinqhm_filler_date;
|
||||
usint offset_sinqhm_routines_ident;
|
||||
usint offset_sinqhm_routines_date;
|
||||
} ident;
|
||||
|
||||
struct {
|
||||
uint n_bins;
|
||||
uint bytes_per_bin;
|
||||
uint cnts_lo;
|
||||
uint cnts_hi;
|
||||
} project;
|
||||
|
||||
struct {
|
||||
uint first_bin;
|
||||
uint n_bins;
|
||||
uint bytes_per_bin;
|
||||
uint cnts_lo;
|
||||
uint cnts_hi;
|
||||
} read;
|
||||
|
||||
struct {
|
||||
uint cfg_state;
|
||||
usint n_hists, curr_hist;
|
||||
uint num_bins;
|
||||
uint max_n_hists;
|
||||
uint max_num_bins;
|
||||
uchar max_srvrs, act_srvrs, bytes_per_bin, compress;
|
||||
usint daq_now, filler_mask;
|
||||
uint max_block;
|
||||
usint tsi_status, flags;
|
||||
union {
|
||||
char message[52];
|
||||
|
||||
struct {uint port;
|
||||
uint pkt_size;
|
||||
uint hm_mode;
|
||||
uint n_hists;
|
||||
uint num_bins;
|
||||
uint bytes_per_bin;
|
||||
uint curr_hist;
|
||||
uint max_block;
|
||||
uint total_bytes;
|
||||
uint lo_cntr;
|
||||
uint lo_bin;
|
||||
uint compress;
|
||||
uint up_time;} cnct;
|
||||
|
||||
struct {usint daq_now;
|
||||
usint daq_was;
|
||||
usint filler_mask;
|
||||
usint server_mask;} daq;
|
||||
|
||||
struct {uint n_extra_bytes;
|
||||
uint up_time;
|
||||
usint offset_vxWorks_ident;
|
||||
usint offset_vxWorks_date;
|
||||
usint offset_instr;
|
||||
usint offset_def_ident;
|
||||
usint offset_sinqhm_main_ident;
|
||||
usint offset_sinqhm_main_date;
|
||||
usint offset_sinqhm_server_ident;
|
||||
usint offset_sinqhm_server_date;
|
||||
usint offset_sinqhm_filler_ident;
|
||||
usint offset_sinqhm_filler_date;
|
||||
usint offset_sinqhm_routines_ident;
|
||||
usint offset_sinqhm_routines_date;} ident;
|
||||
|
||||
struct {uint n_bins;
|
||||
uint bytes_per_bin;
|
||||
uint cnts_lo;
|
||||
uint cnts_hi;} project;
|
||||
|
||||
struct {uint first_bin;
|
||||
uint n_bins;
|
||||
uint bytes_per_bin;
|
||||
uint cnts_lo;
|
||||
uint cnts_hi;} read;
|
||||
|
||||
struct {uint cfg_state;
|
||||
usint n_hists, curr_hist;
|
||||
uint num_bins;
|
||||
uint max_n_hists;
|
||||
uint max_num_bins;
|
||||
uchar max_srvrs, act_srvrs, bytes_per_bin, compress;
|
||||
usint daq_now, filler_mask;
|
||||
uint max_block;
|
||||
usint tsi_status, flags;
|
||||
union {
|
||||
uint dead_time;
|
||||
uint dts;
|
||||
uint both;
|
||||
} dt_or_dts;
|
||||
uint num_bad_events;
|
||||
uint up_time;} status;
|
||||
} u;
|
||||
};
|
||||
uint dead_time;
|
||||
uint dts;
|
||||
uint both;
|
||||
} dt_or_dts;
|
||||
uint num_bad_events;
|
||||
uint up_time;
|
||||
} status;
|
||||
} u;
|
||||
};
|
||||
/*
|
||||
**------------------------------------------------------------------------------
|
||||
** Define structure of message to SinqHM-filler.
|
||||
*/
|
||||
struct msg_to_filler_struct { /* For messages to SinqHM-filler */
|
||||
union {
|
||||
char message[32]; /* Ensure buffer is 32 bytes total */
|
||||
struct {
|
||||
uint cmnd;
|
||||
uint index;
|
||||
usint new_mask;} uu;
|
||||
} u;
|
||||
};
|
||||
struct msg_to_filler_struct { /* For messages to SinqHM-filler */
|
||||
union {
|
||||
char message[32]; /* Ensure buffer is 32 bytes total */
|
||||
struct {
|
||||
uint cmnd;
|
||||
uint index;
|
||||
usint new_mask;
|
||||
} uu;
|
||||
} u;
|
||||
};
|
||||
/*======================================================= End of SinqHM_def.h */
|
||||
|
@ -163,253 +163,324 @@
|
||||
** strncpy to be sure result is always
|
||||
** null terminated.
|
||||
*/
|
||||
char *StrEdit (
|
||||
char *StrEdit(
|
||||
/* =======
|
||||
*/ char *out,
|
||||
char *in,
|
||||
char *ctrl,
|
||||
int *ln) {
|
||||
*/ char *out,
|
||||
char *in, char *ctrl, int *ln)
|
||||
{
|
||||
|
||||
int i, j, k, l, m, len, inxt, out_size;
|
||||
char my_ctrl[80];
|
||||
char *tok_nxt, *my_in, *my_out, *my_tmp, *nxt;
|
||||
int do_collapse, do_compress, do_lowercase, do_trim;
|
||||
int do_uncomment, do_upcase;
|
||||
int i, j, k, l, m, len, inxt, out_size;
|
||||
char my_ctrl[80];
|
||||
char *tok_nxt, *my_in, *my_out, *my_tmp, *nxt;
|
||||
int do_collapse, do_compress, do_lowercase, do_trim;
|
||||
int do_uncomment, do_upcase;
|
||||
|
||||
out_size = *ln;
|
||||
if (out_size < 1) {*ln = 0; return NULL;} /* Can't do anything!! */
|
||||
|
||||
if (strlen (in) <= 0) {
|
||||
*out = NIL; *ln = 0; return out; /* Nothing to do!! */
|
||||
}
|
||||
/*
|
||||
** Scan ctrl looking to see what has to be done. Do this by first
|
||||
** taking a copy of it (in case it is declared "const" in the calling
|
||||
** routine, convert to lowercase and split into tokens at any space,
|
||||
** tab or comma.
|
||||
*/
|
||||
len = strlen (ctrl);
|
||||
if (len >= sizeof (my_ctrl)) {
|
||||
*out = NIL; *ln = 0; return NULL;
|
||||
}
|
||||
for (i = 0; i <= len; i++) my_ctrl[i] = tolower (ctrl[i]);
|
||||
|
||||
do_collapse = do_compress = do_lowercase = do_trim = do_uncomment =
|
||||
do_upcase = False;
|
||||
tok_nxt = strtok (my_ctrl, ", \t\f\v\n");
|
||||
while (tok_nxt != NULL) {
|
||||
if (strcmp (tok_nxt, "collapse") == 0) {
|
||||
do_collapse = True;
|
||||
}else if (strcmp (tok_nxt, "compress") == 0) {
|
||||
do_compress = True;
|
||||
}else if (strcmp (tok_nxt, "lowercase") == 0) {
|
||||
do_lowercase = True;
|
||||
}else if (strcmp (tok_nxt, "trim") == 0) {
|
||||
do_trim = True;
|
||||
}else if (strcmp (tok_nxt, "uncomment") == 0) {
|
||||
do_uncomment = True;
|
||||
}else if (strcmp (tok_nxt, "upcase") == 0) {
|
||||
do_upcase = True;
|
||||
}else {
|
||||
*out = NIL; *ln = 0; return NULL; /* Illegal ctrl verb */
|
||||
}
|
||||
tok_nxt = strtok (NULL, ", \t\f\v\n");
|
||||
}
|
||||
|
||||
len = strlen (in) + 1;
|
||||
my_in = malloc (len); /* Get some working space */
|
||||
if (my_in == NULL) {
|
||||
*out = NIL; *ln = 0; return NULL;
|
||||
}
|
||||
/*
|
||||
** Copy "in" to the "my_in" working space, processing any '\' escape
|
||||
** sequences as we go. Note that, since "my_in" is big enough to hold
|
||||
** "in" and the escape sequence processing can only shorten the length
|
||||
** of "in", there's no need to check for an overflow of "my_in". Any
|
||||
** non-escaped double quotes are converted to something special so
|
||||
** that they can be recognised at the editing stage.
|
||||
*/
|
||||
nxt = my_in;
|
||||
while (*in != '\0') {
|
||||
if (*in == '\\') { /* Look for escape sequence */
|
||||
in++;
|
||||
switch (*in) {
|
||||
case 'a': case 'A': *nxt++ = '\007'; in++; break;
|
||||
case 'b': case 'B': *nxt++ = '\010'; in++; break;
|
||||
case 'f': case 'F': *nxt++ = '\014'; in++; break;
|
||||
case 'n': case 'N': *nxt++ = '\012'; in++; break;
|
||||
case 'r': case 'R': *nxt++ = '\015'; in++; break;
|
||||
case 't': case 'T': *nxt++ = '\011'; in++; break;
|
||||
case 'v': case 'V': *nxt++ = '\013'; in++; break;
|
||||
case '\\': *nxt++ = '\\'; in++; break;
|
||||
case '\'': *nxt++ = '\''; in++; break;
|
||||
case '\"': *nxt++ = '\"'; in++; break;
|
||||
case '\?': *nxt++ = '\?'; in++; break;
|
||||
case 'x': case 'X':
|
||||
in++;
|
||||
i = strspn (in, "0123456789abcdefABCDEF");
|
||||
if (i > 0) {
|
||||
*nxt++ = strtol (in, &in, 16); break;
|
||||
}else {
|
||||
*nxt++ = '\\'; break;
|
||||
}
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
i = strspn (in, "01234567");
|
||||
if (i > 3) {
|
||||
sscanf (in, "%3o", &j);
|
||||
*nxt++ = j;
|
||||
in += 3;
|
||||
break;
|
||||
}else if (i > 0) {
|
||||
sscanf (in, "%o", &j);
|
||||
*nxt++ = j;
|
||||
in += i;
|
||||
break;
|
||||
}else {
|
||||
*nxt++ = '\\';
|
||||
break;
|
||||
}
|
||||
default:
|
||||
*nxt++ = '\\'; /* Invalid esc sequ - just copy it */
|
||||
}
|
||||
}else if (*in == '\"') { /* Look for non-escaped double quotes */
|
||||
*nxt++ = QUOTE; *in++; /* Make it something unlikely */
|
||||
}else {
|
||||
*nxt++ = *in++;
|
||||
}
|
||||
}
|
||||
*nxt = '\0';
|
||||
|
||||
my_out = malloc (len); /* Get some working space */
|
||||
if (my_out == NULL) {
|
||||
free (my_in); *out = NIL; *ln = 0; return NULL;
|
||||
}
|
||||
*my_out = NIL;
|
||||
|
||||
my_tmp = malloc (len); /* Get some working space */
|
||||
if (my_tmp == NULL) {
|
||||
free (my_out); free (my_in);
|
||||
*out = NIL; *ln = 0; return NULL;
|
||||
}
|
||||
*my_tmp = NIL;
|
||||
*out = NIL;
|
||||
/*
|
||||
** Ensure "in" has an even number of non-escaped quotes. Return if not.
|
||||
*/
|
||||
i = 0;
|
||||
for (j = 0; my_in[j] != NIL; j++) if (my_in[j] == QUOTE) i++;
|
||||
if ((i & 1) == 1) {
|
||||
free (my_tmp);
|
||||
free (my_out);
|
||||
free (my_in);
|
||||
*ln = strlen (out);
|
||||
return NULL;
|
||||
}
|
||||
/*
|
||||
** Scan through "in", substring by substring, to
|
||||
** handle quotation marks correctly.
|
||||
*/
|
||||
inxt = 0;
|
||||
while (my_in[inxt] != NIL) {
|
||||
if (my_in[inxt] == QUOTE) { /* Is there a quoted string next? */
|
||||
nxt = strchr (&my_in[inxt+1], QUOTE); /* Yes, find matching quote. */
|
||||
j = nxt - &my_in[inxt+1];
|
||||
memcpy (my_tmp, &my_in[inxt+1], j); /* Make copy of it */
|
||||
my_tmp[j] = NIL;
|
||||
inxt = inxt + j + 2;
|
||||
}else {
|
||||
nxt = strchr (&my_in[inxt], QUOTE); /* Not a quoted string; ..
|
||||
** .. find next non-escaped ..
|
||||
** .. quote.
|
||||
*/
|
||||
if (nxt != NULL) {
|
||||
j = nxt - my_in - inxt;
|
||||
}else {
|
||||
j = strlen (&my_in[inxt]);
|
||||
}
|
||||
memcpy (my_tmp, &my_in[inxt], j); /* Make copy for us to work on */
|
||||
my_tmp[j] = NIL;
|
||||
inxt = inxt + j;
|
||||
/*
|
||||
** For collapse and compress, start by turning all white space
|
||||
** chars to spaces.
|
||||
*/
|
||||
if (do_collapse || do_compress) {
|
||||
for (k = 0; my_tmp[k] != NIL; k++) {
|
||||
if (my_tmp[k] == '\t') my_tmp[k] = ' ';
|
||||
if (my_tmp[k] == '\f') my_tmp[k] = ' ';
|
||||
if (my_tmp[k] == '\v') my_tmp[k] = ' ';
|
||||
if (my_tmp[k] == '\n') my_tmp[k] = ' ';
|
||||
}
|
||||
if (do_collapse) {
|
||||
l = 0;
|
||||
for (k = 0; my_tmp[k] != NIL; k++) {
|
||||
if (my_tmp[k] != ' ') {
|
||||
my_tmp[l] = my_tmp[k];
|
||||
l++;
|
||||
}
|
||||
}
|
||||
my_tmp[l] = NIL;
|
||||
}else if (do_compress) {
|
||||
for (k = 0; my_tmp[k] != NIL; k++) {
|
||||
if (my_tmp[k] == ' ') {
|
||||
l = strspn (&my_tmp[k], " ");
|
||||
if (l > 1) {
|
||||
for (m = 0; my_tmp[k+l+m] != NIL; m++) {
|
||||
my_tmp[k+m+1] = my_tmp[k+l+m];
|
||||
}
|
||||
my_tmp[k+m+1] = NIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (do_lowercase) {
|
||||
for (k = 0; my_tmp[k] != NIL; k++) my_tmp[k] = _tolower (my_tmp[k]);
|
||||
}
|
||||
if (do_upcase) {
|
||||
for (k = 0; my_tmp[k] != NIL; k++) my_tmp[k] = _toupper (my_tmp[k]);
|
||||
}
|
||||
if (do_uncomment) {
|
||||
nxt = strchr (my_tmp, '!');
|
||||
if (nxt != NULL) {
|
||||
*nxt = NIL; /* Truncate the string at the "!" */
|
||||
my_in[inxt] = NIL; /* Stop processing loop too */
|
||||
}
|
||||
}
|
||||
}
|
||||
StrJoin (out, out_size, my_out, my_tmp);
|
||||
strcpy (my_out, out);
|
||||
}
|
||||
|
||||
if (do_trim) {
|
||||
i = strspn (my_out, " ");
|
||||
if (i == strlen (my_out)) { /* If all spaces, result is a null string */
|
||||
*out = NIL;
|
||||
}else {
|
||||
for (j = strlen (my_out); my_out[j-1] == ' '; j--);
|
||||
my_out[j] = NIL;
|
||||
}
|
||||
strcpy (out, &my_out[i]);
|
||||
}
|
||||
free (my_tmp);
|
||||
free (my_out);
|
||||
free (my_in);
|
||||
*ln = strlen (out);
|
||||
/*
|
||||
** Undo any encoded escape characters.
|
||||
*/
|
||||
for (i = 0; out[i] != NIL; i++) {
|
||||
if (out[i] == ~'\"') out[i] = '\"';
|
||||
}
|
||||
|
||||
return out;
|
||||
out_size = *ln;
|
||||
if (out_size < 1) {
|
||||
*ln = 0;
|
||||
return NULL;
|
||||
}
|
||||
/* Can't do anything!! */
|
||||
if (strlen(in) <= 0) {
|
||||
*out = NIL;
|
||||
*ln = 0;
|
||||
return out; /* Nothing to do!! */
|
||||
}
|
||||
/*
|
||||
** Scan ctrl looking to see what has to be done. Do this by first
|
||||
** taking a copy of it (in case it is declared "const" in the calling
|
||||
** routine, convert to lowercase and split into tokens at any space,
|
||||
** tab or comma.
|
||||
*/
|
||||
len = strlen(ctrl);
|
||||
if (len >= sizeof(my_ctrl)) {
|
||||
*out = NIL;
|
||||
*ln = 0;
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i <= len; i++)
|
||||
my_ctrl[i] = tolower(ctrl[i]);
|
||||
|
||||
do_collapse = do_compress = do_lowercase = do_trim = do_uncomment =
|
||||
do_upcase = False;
|
||||
tok_nxt = strtok(my_ctrl, ", \t\f\v\n");
|
||||
while (tok_nxt != NULL) {
|
||||
if (strcmp(tok_nxt, "collapse") == 0) {
|
||||
do_collapse = True;
|
||||
} else if (strcmp(tok_nxt, "compress") == 0) {
|
||||
do_compress = True;
|
||||
} else if (strcmp(tok_nxt, "lowercase") == 0) {
|
||||
do_lowercase = True;
|
||||
} else if (strcmp(tok_nxt, "trim") == 0) {
|
||||
do_trim = True;
|
||||
} else if (strcmp(tok_nxt, "uncomment") == 0) {
|
||||
do_uncomment = True;
|
||||
} else if (strcmp(tok_nxt, "upcase") == 0) {
|
||||
do_upcase = True;
|
||||
} else {
|
||||
*out = NIL;
|
||||
*ln = 0;
|
||||
return NULL; /* Illegal ctrl verb */
|
||||
}
|
||||
tok_nxt = strtok(NULL, ", \t\f\v\n");
|
||||
}
|
||||
|
||||
len = strlen(in) + 1;
|
||||
my_in = malloc(len); /* Get some working space */
|
||||
if (my_in == NULL) {
|
||||
*out = NIL;
|
||||
*ln = 0;
|
||||
return NULL;
|
||||
}
|
||||
/*
|
||||
** Copy "in" to the "my_in" working space, processing any '\' escape
|
||||
** sequences as we go. Note that, since "my_in" is big enough to hold
|
||||
** "in" and the escape sequence processing can only shorten the length
|
||||
** of "in", there's no need to check for an overflow of "my_in". Any
|
||||
** non-escaped double quotes are converted to something special so
|
||||
** that they can be recognised at the editing stage.
|
||||
*/
|
||||
nxt = my_in;
|
||||
while (*in != '\0') {
|
||||
if (*in == '\\') { /* Look for escape sequence */
|
||||
in++;
|
||||
switch (*in) {
|
||||
case 'a':
|
||||
case 'A':
|
||||
*nxt++ = '\007';
|
||||
in++;
|
||||
break;
|
||||
case 'b':
|
||||
case 'B':
|
||||
*nxt++ = '\010';
|
||||
in++;
|
||||
break;
|
||||
case 'f':
|
||||
case 'F':
|
||||
*nxt++ = '\014';
|
||||
in++;
|
||||
break;
|
||||
case 'n':
|
||||
case 'N':
|
||||
*nxt++ = '\012';
|
||||
in++;
|
||||
break;
|
||||
case 'r':
|
||||
case 'R':
|
||||
*nxt++ = '\015';
|
||||
in++;
|
||||
break;
|
||||
case 't':
|
||||
case 'T':
|
||||
*nxt++ = '\011';
|
||||
in++;
|
||||
break;
|
||||
case 'v':
|
||||
case 'V':
|
||||
*nxt++ = '\013';
|
||||
in++;
|
||||
break;
|
||||
case '\\':
|
||||
*nxt++ = '\\';
|
||||
in++;
|
||||
break;
|
||||
case '\'':
|
||||
*nxt++ = '\'';
|
||||
in++;
|
||||
break;
|
||||
case '\"':
|
||||
*nxt++ = '\"';
|
||||
in++;
|
||||
break;
|
||||
case '\?':
|
||||
*nxt++ = '\?';
|
||||
in++;
|
||||
break;
|
||||
case 'x':
|
||||
case 'X':
|
||||
in++;
|
||||
i = strspn(in, "0123456789abcdefABCDEF");
|
||||
if (i > 0) {
|
||||
*nxt++ = strtol(in, &in, 16);
|
||||
break;
|
||||
} else {
|
||||
*nxt++ = '\\';
|
||||
break;
|
||||
}
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
i = strspn(in, "01234567");
|
||||
if (i > 3) {
|
||||
sscanf(in, "%3o", &j);
|
||||
*nxt++ = j;
|
||||
in += 3;
|
||||
break;
|
||||
} else if (i > 0) {
|
||||
sscanf(in, "%o", &j);
|
||||
*nxt++ = j;
|
||||
in += i;
|
||||
break;
|
||||
} else {
|
||||
*nxt++ = '\\';
|
||||
break;
|
||||
}
|
||||
default:
|
||||
*nxt++ = '\\'; /* Invalid esc sequ - just copy it */
|
||||
}
|
||||
} else if (*in == '\"') { /* Look for non-escaped double quotes */
|
||||
*nxt++ = QUOTE;
|
||||
*in++; /* Make it something unlikely */
|
||||
} else {
|
||||
*nxt++ = *in++;
|
||||
}
|
||||
}
|
||||
*nxt = '\0';
|
||||
|
||||
my_out = malloc(len); /* Get some working space */
|
||||
if (my_out == NULL) {
|
||||
free(my_in);
|
||||
*out = NIL;
|
||||
*ln = 0;
|
||||
return NULL;
|
||||
}
|
||||
*my_out = NIL;
|
||||
|
||||
my_tmp = malloc(len); /* Get some working space */
|
||||
if (my_tmp == NULL) {
|
||||
free(my_out);
|
||||
free(my_in);
|
||||
*out = NIL;
|
||||
*ln = 0;
|
||||
return NULL;
|
||||
}
|
||||
*my_tmp = NIL;
|
||||
*out = NIL;
|
||||
/*
|
||||
** Ensure "in" has an even number of non-escaped quotes. Return if not.
|
||||
*/
|
||||
i = 0;
|
||||
for (j = 0; my_in[j] != NIL; j++)
|
||||
if (my_in[j] == QUOTE)
|
||||
i++;
|
||||
if ((i & 1) == 1) {
|
||||
free(my_tmp);
|
||||
free(my_out);
|
||||
free(my_in);
|
||||
*ln = strlen(out);
|
||||
return NULL;
|
||||
}
|
||||
/*
|
||||
** Scan through "in", substring by substring, to
|
||||
** handle quotation marks correctly.
|
||||
*/
|
||||
inxt = 0;
|
||||
while (my_in[inxt] != NIL) {
|
||||
if (my_in[inxt] == QUOTE) { /* Is there a quoted string next? */
|
||||
nxt = strchr(&my_in[inxt + 1], QUOTE); /* Yes, find matching quote. */
|
||||
j = nxt - &my_in[inxt + 1];
|
||||
memcpy(my_tmp, &my_in[inxt + 1], j); /* Make copy of it */
|
||||
my_tmp[j] = NIL;
|
||||
inxt = inxt + j + 2;
|
||||
} else {
|
||||
nxt = strchr(&my_in[inxt], QUOTE); /* Not a quoted string; ..
|
||||
** .. find next non-escaped ..
|
||||
** .. quote.
|
||||
*/
|
||||
if (nxt != NULL) {
|
||||
j = nxt - my_in - inxt;
|
||||
} else {
|
||||
j = strlen(&my_in[inxt]);
|
||||
}
|
||||
memcpy(my_tmp, &my_in[inxt], j); /* Make copy for us to work on */
|
||||
my_tmp[j] = NIL;
|
||||
inxt = inxt + j;
|
||||
/*
|
||||
** For collapse and compress, start by turning all white space
|
||||
** chars to spaces.
|
||||
*/
|
||||
if (do_collapse || do_compress) {
|
||||
for (k = 0; my_tmp[k] != NIL; k++) {
|
||||
if (my_tmp[k] == '\t')
|
||||
my_tmp[k] = ' ';
|
||||
if (my_tmp[k] == '\f')
|
||||
my_tmp[k] = ' ';
|
||||
if (my_tmp[k] == '\v')
|
||||
my_tmp[k] = ' ';
|
||||
if (my_tmp[k] == '\n')
|
||||
my_tmp[k] = ' ';
|
||||
}
|
||||
if (do_collapse) {
|
||||
l = 0;
|
||||
for (k = 0; my_tmp[k] != NIL; k++) {
|
||||
if (my_tmp[k] != ' ') {
|
||||
my_tmp[l] = my_tmp[k];
|
||||
l++;
|
||||
}
|
||||
}
|
||||
my_tmp[l] = NIL;
|
||||
} else if (do_compress) {
|
||||
for (k = 0; my_tmp[k] != NIL; k++) {
|
||||
if (my_tmp[k] == ' ') {
|
||||
l = strspn(&my_tmp[k], " ");
|
||||
if (l > 1) {
|
||||
for (m = 0; my_tmp[k + l + m] != NIL; m++) {
|
||||
my_tmp[k + m + 1] = my_tmp[k + l + m];
|
||||
}
|
||||
my_tmp[k + m + 1] = NIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (do_lowercase) {
|
||||
for (k = 0; my_tmp[k] != NIL; k++)
|
||||
my_tmp[k] = _tolower(my_tmp[k]);
|
||||
}
|
||||
if (do_upcase) {
|
||||
for (k = 0; my_tmp[k] != NIL; k++)
|
||||
my_tmp[k] = _toupper(my_tmp[k]);
|
||||
}
|
||||
if (do_uncomment) {
|
||||
nxt = strchr(my_tmp, '!');
|
||||
if (nxt != NULL) {
|
||||
*nxt = NIL; /* Truncate the string at the "!" */
|
||||
my_in[inxt] = NIL; /* Stop processing loop too */
|
||||
}
|
||||
}
|
||||
}
|
||||
StrJoin(out, out_size, my_out, my_tmp);
|
||||
strcpy(my_out, out);
|
||||
}
|
||||
|
||||
if (do_trim) {
|
||||
i = strspn(my_out, " ");
|
||||
if (i == strlen(my_out)) { /* If all spaces, result is a null string */
|
||||
*out = NIL;
|
||||
} else {
|
||||
for (j = strlen(my_out); my_out[j - 1] == ' '; j--);
|
||||
my_out[j] = NIL;
|
||||
}
|
||||
strcpy(out, &my_out[i]);
|
||||
}
|
||||
free(my_tmp);
|
||||
free(my_out);
|
||||
free(my_in);
|
||||
*ln = strlen(out);
|
||||
/*
|
||||
** Undo any encoded escape characters.
|
||||
*/
|
||||
for (i = 0; out[i] != NIL; i++) {
|
||||
if (out[i] == ~'\"')
|
||||
out[i] = '\"';
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------- End of StrEdit.C -------*/
|
||||
|
@ -89,54 +89,57 @@
|
||||
** strncpy to be sure result is always
|
||||
** null terminated.
|
||||
*/
|
||||
char *StrJoin (
|
||||
char *StrJoin(
|
||||
/* =======
|
||||
*/ char *result,
|
||||
int result_size,
|
||||
char *str_a,
|
||||
char *str_b) {
|
||||
*/ char *result,
|
||||
int result_size, char *str_a, char *str_b)
|
||||
{
|
||||
|
||||
int i, size, size_a, size_b;
|
||||
int i, size, size_a, size_b;
|
||||
|
||||
size = result_size - 1;
|
||||
size = result_size - 1;
|
||||
|
||||
if (size < 0) return result;
|
||||
|
||||
if (result == str_a) { /* Are the result and str_a the same? */
|
||||
size_a = strlen (str_a); /* Yes */
|
||||
if (size_a > size) { /* Check sizes anyway. */
|
||||
result[size] = NIL; /* Truncate str_a. No room for str_b! */
|
||||
}else {
|
||||
size = size - strlen (result); /* And append str_b */
|
||||
if (size > 0) {
|
||||
strncat (result, str_b, size);
|
||||
}
|
||||
}
|
||||
}else if (result == str_b) { /* Are the result and str_b the same? */
|
||||
size_a = strlen (str_a); /* Yes, this is a bit complicated! */
|
||||
size_b = strlen (str_b);
|
||||
if (size_a >= size) { /* If str_a completely fills result, .. */
|
||||
result[0] = NIL; /* .. then just copy in str_a */
|
||||
strncat (result, str_a, size);
|
||||
}else {
|
||||
/*
|
||||
** Otherwise, str_b must first be moved to
|
||||
** make room for str_a and then str_a must
|
||||
** be put at the front of the result.
|
||||
*/
|
||||
if ((size_a + size_b) > size) size_b = size - size_a;
|
||||
result[size_a+size_b] = NIL;
|
||||
for (i = (size_b-1); i >= 0; i--) {
|
||||
result[size_a+i] = str_b[i];
|
||||
}
|
||||
memcpy (result, str_a, size_a);
|
||||
}
|
||||
}else { /* Result is neither str_a nor str_b so .. */
|
||||
result[0] = NIL; /* .. str_a needs to be copied */
|
||||
strncat (result, str_a, size);
|
||||
size = size - strlen (result); /* And str_a appended */
|
||||
if (size > 0) strncat (result, str_b, size);
|
||||
}
|
||||
if (size < 0)
|
||||
return result;
|
||||
|
||||
if (result == str_a) { /* Are the result and str_a the same? */
|
||||
size_a = strlen(str_a); /* Yes */
|
||||
if (size_a > size) { /* Check sizes anyway. */
|
||||
result[size] = NIL; /* Truncate str_a. No room for str_b! */
|
||||
} else {
|
||||
size = size - strlen(result); /* And append str_b */
|
||||
if (size > 0) {
|
||||
strncat(result, str_b, size);
|
||||
}
|
||||
}
|
||||
} else if (result == str_b) { /* Are the result and str_b the same? */
|
||||
size_a = strlen(str_a); /* Yes, this is a bit complicated! */
|
||||
size_b = strlen(str_b);
|
||||
if (size_a >= size) { /* If str_a completely fills result, .. */
|
||||
result[0] = NIL; /* .. then just copy in str_a */
|
||||
strncat(result, str_a, size);
|
||||
} else {
|
||||
/*
|
||||
** Otherwise, str_b must first be moved to
|
||||
** make room for str_a and then str_a must
|
||||
** be put at the front of the result.
|
||||
*/
|
||||
if ((size_a + size_b) > size)
|
||||
size_b = size - size_a;
|
||||
result[size_a + size_b] = NIL;
|
||||
for (i = (size_b - 1); i >= 0; i--) {
|
||||
result[size_a + i] = str_b[i];
|
||||
}
|
||||
memcpy(result, str_a, size_a);
|
||||
}
|
||||
} else { /* Result is neither str_a nor str_b so .. */
|
||||
result[0] = NIL; /* .. str_a needs to be copied */
|
||||
strncat(result, str_a, size);
|
||||
size = size - strlen(result); /* And str_a appended */
|
||||
if (size > 0)
|
||||
strncat(result, str_b, size);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------- End of STRJOIN.C =======*/
|
||||
|
300
hardsup/table.c
300
hardsup/table.c
@ -12,165 +12,149 @@
|
||||
#include "table.h"
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
typedef struct __SicsTable {
|
||||
float *fVal1;
|
||||
float *fVal2;
|
||||
int iLength;
|
||||
} STable;
|
||||
/*-------------------------------------------------------------------------*/
|
||||
pSTable CreateTable(FILE *fd)
|
||||
{
|
||||
pSTable pNew = NULL;
|
||||
long lStart, lEnd, lData, i;
|
||||
char *pBuffer = NULL, *pEnd = NULL, *pEndLine, *pPtr;
|
||||
int iLength, iRet;
|
||||
float fVal1, fVal2;
|
||||
|
||||
assert(fd);
|
||||
|
||||
/* find length of file, create a buffer and read it in */
|
||||
lStart = ftell(fd);
|
||||
fseek(fd,0L,SEEK_END);
|
||||
lEnd = ftell(fd);
|
||||
lData = lEnd - lStart;
|
||||
pBuffer = (char *)malloc(lData*sizeof(char));
|
||||
if(!pBuffer)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
fseek(fd,lStart,SEEK_SET);
|
||||
fread(pBuffer,sizeof(char),lData,fd);
|
||||
|
||||
/* find number of lines */
|
||||
for(i = 0, iLength = 0; i < lData; i++)
|
||||
{
|
||||
if(pBuffer[i] == '\n')
|
||||
{
|
||||
iLength++;
|
||||
}
|
||||
}
|
||||
|
||||
/* allocate the table structure */
|
||||
pNew = (pSTable)malloc(sizeof(STable));
|
||||
if(!pNew)
|
||||
{
|
||||
free(pBuffer);
|
||||
return NULL;
|
||||
}
|
||||
pNew->iLength = iLength;
|
||||
pNew->fVal1 = (float *)malloc(sizeof(float)*iLength);
|
||||
pNew->fVal2 = (float *)malloc(sizeof(float)*iLength);
|
||||
if( (!pNew->fVal1) || (!pNew->fVal2))
|
||||
{
|
||||
free(pBuffer);
|
||||
free(pNew);
|
||||
return NULL;
|
||||
}
|
||||
memset(pNew->fVal1,0,iLength*sizeof(float));
|
||||
memset(pNew->fVal2,0,iLength*sizeof(float));
|
||||
|
||||
/* dodge through the file reading pairs until end */
|
||||
pPtr = pBuffer;
|
||||
pEnd = pBuffer + lData;
|
||||
pEndLine = pBuffer;
|
||||
i = 0;
|
||||
while(pEndLine < pEnd)
|
||||
{
|
||||
if(*pEndLine == '\n')
|
||||
{
|
||||
*pEndLine = '\0';
|
||||
iRet = sscanf(pPtr,"%f %f",&fVal1, &fVal2);
|
||||
if(iRet == 2)
|
||||
{
|
||||
pNew->fVal1[i] = fVal1;
|
||||
pNew->fVal2[i] = fVal2;
|
||||
i++;
|
||||
}
|
||||
pEndLine++;
|
||||
pPtr = pEndLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
pEndLine++;
|
||||
}
|
||||
}
|
||||
|
||||
free(pBuffer);
|
||||
return pNew;
|
||||
typedef struct __SicsTable {
|
||||
float *fVal1;
|
||||
float *fVal2;
|
||||
int iLength;
|
||||
} STable;
|
||||
/*-------------------------------------------------------------------------*/
|
||||
pSTable CreateTable(FILE * fd)
|
||||
{
|
||||
pSTable pNew = NULL;
|
||||
long lStart, lEnd, lData, i;
|
||||
char *pBuffer = NULL, *pEnd = NULL, *pEndLine, *pPtr;
|
||||
int iLength, iRet;
|
||||
float fVal1, fVal2;
|
||||
|
||||
assert(fd);
|
||||
|
||||
/* find length of file, create a buffer and read it in */
|
||||
lStart = ftell(fd);
|
||||
fseek(fd, 0L, SEEK_END);
|
||||
lEnd = ftell(fd);
|
||||
lData = lEnd - lStart;
|
||||
pBuffer = (char *) malloc(lData * sizeof(char));
|
||||
if (!pBuffer) {
|
||||
return NULL;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void DeleteTable(pSTable self)
|
||||
{
|
||||
if(self->fVal1)
|
||||
{
|
||||
free(self->fVal1);
|
||||
}
|
||||
if(self->fVal2)
|
||||
{
|
||||
free(self->fVal2);
|
||||
}
|
||||
free(self);
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int InterpolateVal1(pSTable self, float fKey, float *fResult)
|
||||
{
|
||||
float fFrac;
|
||||
int i1,i;
|
||||
|
||||
assert(self);
|
||||
assert(self->fVal1);
|
||||
assert(self->fVal2);
|
||||
|
||||
/* search the entry point */
|
||||
for(i = 0; i < self->iLength; i++)
|
||||
{
|
||||
if(self->fVal1[i] >= fKey)
|
||||
{
|
||||
i1 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i1 >= self->iLength)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
fseek(fd, lStart, SEEK_SET);
|
||||
fread(pBuffer, sizeof(char), lData, fd);
|
||||
|
||||
/* find number of lines */
|
||||
for (i = 0, iLength = 0; i < lData; i++) {
|
||||
if (pBuffer[i] == '\n') {
|
||||
iLength++;
|
||||
}
|
||||
}
|
||||
|
||||
/* allocate the table structure */
|
||||
pNew = (pSTable) malloc(sizeof(STable));
|
||||
if (!pNew) {
|
||||
free(pBuffer);
|
||||
return NULL;
|
||||
}
|
||||
pNew->iLength = iLength;
|
||||
pNew->fVal1 = (float *) malloc(sizeof(float) * iLength);
|
||||
pNew->fVal2 = (float *) malloc(sizeof(float) * iLength);
|
||||
if ((!pNew->fVal1) || (!pNew->fVal2)) {
|
||||
free(pBuffer);
|
||||
free(pNew);
|
||||
return NULL;
|
||||
}
|
||||
memset(pNew->fVal1, 0, iLength * sizeof(float));
|
||||
memset(pNew->fVal2, 0, iLength * sizeof(float));
|
||||
|
||||
/* dodge through the file reading pairs until end */
|
||||
pPtr = pBuffer;
|
||||
pEnd = pBuffer + lData;
|
||||
pEndLine = pBuffer;
|
||||
i = 0;
|
||||
while (pEndLine < pEnd) {
|
||||
if (*pEndLine == '\n') {
|
||||
*pEndLine = '\0';
|
||||
iRet = sscanf(pPtr, "%f %f", &fVal1, &fVal2);
|
||||
if (iRet == 2) {
|
||||
pNew->fVal1[i] = fVal1;
|
||||
pNew->fVal2[i] = fVal2;
|
||||
i++;
|
||||
}
|
||||
pEndLine++;
|
||||
pPtr = pEndLine;
|
||||
} else {
|
||||
pEndLine++;
|
||||
}
|
||||
}
|
||||
|
||||
free(pBuffer);
|
||||
return pNew;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void DeleteTable(pSTable self)
|
||||
{
|
||||
if (self->fVal1) {
|
||||
free(self->fVal1);
|
||||
}
|
||||
if (self->fVal2) {
|
||||
free(self->fVal2);
|
||||
}
|
||||
free(self);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int InterpolateVal1(pSTable self, float fKey, float *fResult)
|
||||
{
|
||||
float fFrac;
|
||||
int i1, i;
|
||||
|
||||
assert(self);
|
||||
assert(self->fVal1);
|
||||
assert(self->fVal2);
|
||||
|
||||
/* search the entry point */
|
||||
for (i = 0; i < self->iLength; i++) {
|
||||
if (self->fVal1[i] >= fKey) {
|
||||
i1 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i1 >= self->iLength) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* interpolate */
|
||||
fFrac = (fKey - self->fVal1[i1 - 1])
|
||||
/ (self->fVal1[i1] - self->fVal1[i1 - 1]);
|
||||
*fResult = self->fVal2[i1 - 1]
|
||||
+ fFrac * (self->fVal2[i1] - self->fVal2[i1 - 1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* interpolate */
|
||||
fFrac = (fKey - self->fVal1[i1 -1])
|
||||
/ (self->fVal1[i1] - self->fVal1[i1 - 1]);
|
||||
*fResult = self->fVal2[i1-1]
|
||||
+ fFrac*(self->fVal2[i1] - self->fVal2[i1 -1]);
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int InterpolateVal2(pSTable self, float fKey, float *fResult)
|
||||
{
|
||||
float fFrac;
|
||||
int i1,i;
|
||||
|
||||
assert(self);
|
||||
assert(self->fVal1);
|
||||
assert(self->fVal2);
|
||||
|
||||
/* search the entry point */
|
||||
for(i = 0; i < self->iLength; i++)
|
||||
{
|
||||
if(self->fVal2[i] <= fKey)
|
||||
{
|
||||
i1 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i1 >= self->iLength)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int InterpolateVal2(pSTable self, float fKey, float *fResult)
|
||||
{
|
||||
float fFrac;
|
||||
int i1, i;
|
||||
|
||||
/* interpolate */
|
||||
fFrac = (fKey - self->fVal2[i1 -1])
|
||||
/ (self->fVal2[i1] - self->fVal2[i1 - 1]);
|
||||
*fResult = self->fVal1[i1-1]
|
||||
+ fFrac*(self->fVal1[i1] - self->fVal1[i1 -1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
assert(self);
|
||||
assert(self->fVal1);
|
||||
assert(self->fVal2);
|
||||
|
||||
/* search the entry point */
|
||||
for (i = 0; i < self->iLength; i++) {
|
||||
if (self->fVal2[i] <= fKey) {
|
||||
i1 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i1 >= self->iLength) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* interpolate */
|
||||
fFrac = (fKey - self->fVal2[i1 - 1])
|
||||
/ (self->fVal2[i1] - self->fVal2[i1 - 1]);
|
||||
*fResult = self->fVal1[i1 - 1]
|
||||
+ fFrac * (self->fVal1[i1] - self->fVal1[i1 - 1]);
|
||||
return 1;
|
||||
}
|
||||
|
@ -8,28 +8,28 @@
|
||||
|
||||
copyright: see copyright.h
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
-----------------------------------------------------------------------------*/
|
||||
#ifndef SICSTABLE
|
||||
#define SICSTABLE
|
||||
typedef struct __SicsTable *pSTable;
|
||||
|
||||
typedef struct __SicsTable *pSTable;
|
||||
|
||||
/*------------------------- live & death ----------------------------------*/
|
||||
pSTable CreateTable(FILE *fd);
|
||||
pSTable CreateTable(FILE * fd);
|
||||
/*
|
||||
creates a new table from a given file. The file is meant to have
|
||||
been positioned to the first entry for the table in the file.
|
||||
This leaves the caller free to examine a header, if any.
|
||||
*/
|
||||
void DeleteTable(pSTable self);
|
||||
*/
|
||||
void DeleteTable(pSTable self);
|
||||
/*------------------------- Interpolation --------------------------------*/
|
||||
int InterpolateVal1(pSTable pTable, float fKey, float *fResult);
|
||||
int InterpolateVal1(pSTable pTable, float fKey, float *fResult);
|
||||
/*
|
||||
Returns a result from the second column for a key from the
|
||||
first column.
|
||||
*/
|
||||
int InterpolateVal2(pSTable pTable, float fKey, float *fResult);
|
||||
*/
|
||||
int InterpolateVal2(pSTable pTable, float fKey, float *fResult);
|
||||
/*
|
||||
Returns a result from the first column for a key from the
|
||||
second column.
|
||||
*/
|
||||
#endif
|
||||
*/
|
||||
#endif
|
||||
|
@ -9,50 +9,51 @@
|
||||
#define OffsetOf(type, identifier) ((size_t)(&((type*) NULL)->identifier))
|
||||
#endif
|
||||
|
||||
enum VelSel_Errors {VELSEL__BAD_TMO = -1,
|
||||
VELSEL__BAD_CMD = -3,
|
||||
VELSEL__BAD_OFL = -4,
|
||||
VELSEL__BAD_ILLG = -5,
|
||||
VELSEL__BAD_HOST = -6,
|
||||
VELSEL__BAD_SOCKET = -7,
|
||||
VELSEL__BAD_BIND = -8,
|
||||
VELSEL__BAD_CONNECT = -9,
|
||||
VELSEL__BAD_DEV = -10,
|
||||
VELSEL__BAD_MALLOC = -11,
|
||||
VELSEL__BAD_SENDLEN = -12,
|
||||
VELSEL__BAD_SEND = -13,
|
||||
VELSEL__BAD_SEND_PIPE = -14,
|
||||
VELSEL__BAD_SEND_NET = -15,
|
||||
VELSEL__BAD_SEND_UNKN = -16,
|
||||
VELSEL__BAD_RECV = -17,
|
||||
VELSEL__BAD_RECV_PIPE = -18,
|
||||
VELSEL__BAD_RECV_NET = -19,
|
||||
VELSEL__BAD_RECV_UNKN = -20,
|
||||
VELSEL__BAD_NOT_BCD = -21,
|
||||
VELSEL__BAD_RECVLEN = -22,
|
||||
VELSEL__BAD_FLUSH = -23,
|
||||
VELSEL__BAD_RECV1 = -24,
|
||||
VELSEL__BAD_RECV1_PIPE = -25,
|
||||
VELSEL__BAD_RECV1_NET = -26,
|
||||
VELSEL__BAD_PAR = -29,
|
||||
VELSEL__BAD_BSY = -30,
|
||||
VELSEL__BAD_OPEN = -31,
|
||||
VELSEL__FORCED_CLOSED = -32,
|
||||
VELSEL__BAD_STP = -33,
|
||||
VELSEL__NOT_OPEN = -35,
|
||||
VELSEL__BAD_ASYNSRV = -36,
|
||||
VELSEL__BAD_REPLY = -34};
|
||||
enum VelSel_Errors { VELSEL__BAD_TMO = -1,
|
||||
VELSEL__BAD_CMD = -3,
|
||||
VELSEL__BAD_OFL = -4,
|
||||
VELSEL__BAD_ILLG = -5,
|
||||
VELSEL__BAD_HOST = -6,
|
||||
VELSEL__BAD_SOCKET = -7,
|
||||
VELSEL__BAD_BIND = -8,
|
||||
VELSEL__BAD_CONNECT = -9,
|
||||
VELSEL__BAD_DEV = -10,
|
||||
VELSEL__BAD_MALLOC = -11,
|
||||
VELSEL__BAD_SENDLEN = -12,
|
||||
VELSEL__BAD_SEND = -13,
|
||||
VELSEL__BAD_SEND_PIPE = -14,
|
||||
VELSEL__BAD_SEND_NET = -15,
|
||||
VELSEL__BAD_SEND_UNKN = -16,
|
||||
VELSEL__BAD_RECV = -17,
|
||||
VELSEL__BAD_RECV_PIPE = -18,
|
||||
VELSEL__BAD_RECV_NET = -19,
|
||||
VELSEL__BAD_RECV_UNKN = -20,
|
||||
VELSEL__BAD_NOT_BCD = -21,
|
||||
VELSEL__BAD_RECVLEN = -22,
|
||||
VELSEL__BAD_FLUSH = -23,
|
||||
VELSEL__BAD_RECV1 = -24,
|
||||
VELSEL__BAD_RECV1_PIPE = -25,
|
||||
VELSEL__BAD_RECV1_NET = -26,
|
||||
VELSEL__BAD_PAR = -29,
|
||||
VELSEL__BAD_BSY = -30,
|
||||
VELSEL__BAD_OPEN = -31,
|
||||
VELSEL__FORCED_CLOSED = -32,
|
||||
VELSEL__BAD_STP = -33,
|
||||
VELSEL__NOT_OPEN = -35,
|
||||
VELSEL__BAD_ASYNSRV = -36,
|
||||
VELSEL__BAD_REPLY = -34
|
||||
};
|
||||
/*
|
||||
** Structure to which the VelSel_Open handle points.
|
||||
*/
|
||||
struct VelSel_info {
|
||||
struct AsynSrv__info asyn_info; /* Contains skt, host, port & chan */
|
||||
int tmo;
|
||||
char eot[4];
|
||||
int msg_id;
|
||||
int n_replies, max_replies;
|
||||
struct RS__MsgStruct to_host;
|
||||
struct RS__RespStruct from_host;
|
||||
};
|
||||
struct VelSel_info {
|
||||
struct AsynSrv__info asyn_info; /* Contains skt, host, port & chan */
|
||||
int tmo;
|
||||
char eot[4];
|
||||
int msg_id;
|
||||
int n_replies, max_replies;
|
||||
struct RS__MsgStruct to_host;
|
||||
struct RS__RespStruct from_host;
|
||||
};
|
||||
/*------------------------------------------------ End of VelSel_DEF.H --*/
|
||||
#endif /* _velsel_def_ */
|
||||
#endif /* _velsel_def_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user