ANL/LANL integration
This commit is contained in:
1538
src/ca/access.c
1538
src/ca/access.c
File diff suppressed because it is too large
Load Diff
144
src/ca/acctst.c
144
src/ca/acctst.c
@@ -11,15 +11,18 @@
|
||||
#endif
|
||||
|
||||
#include <cadef.h>
|
||||
#include <caerr.h>
|
||||
#include <db_access.h>
|
||||
|
||||
/*
|
||||
#define CA_TEST_CHNL "AI_T2000"
|
||||
*/
|
||||
#define CA_TEST_CHNL "AI_T2000.DESC"
|
||||
#define CA_TEST_CHNL4 "AI_DOGGY"
|
||||
#define CA_TEST_CHNL "ca:ai_2000"
|
||||
#define CA_TEST_CHNL4 "ca:ai_2000"
|
||||
|
||||
#define EVENT_ROUTINE null_event
|
||||
/*
|
||||
#define EVENT_ROUTINE ca_test_event
|
||||
*/
|
||||
|
||||
#define NUM 1
|
||||
|
||||
@@ -60,6 +63,7 @@ main()
|
||||
struct dbr_ctrl_float *pctrl;
|
||||
char pstring[NUM][MAX_STRING_SIZE];
|
||||
void write_event();
|
||||
void conn();
|
||||
|
||||
|
||||
SEVCHK(ca_task_initialize(),"Unable to initialize");
|
||||
@@ -71,7 +75,9 @@ main()
|
||||
|
||||
ptr = (struct dbr_gr_float *)
|
||||
malloc(dbr_size[DBR_GR_FLOAT] + dbr_value_size[DBR_GR_FLOAT]*(NUM-1));
|
||||
for(i=0;i<2;i++){
|
||||
|
||||
for(i=0; i<0; i++){
|
||||
|
||||
status = ca_array_build( CA_TEST_CHNL, /* channel ASCII name */
|
||||
DBR_GR_FLOAT, /* fetch external type */
|
||||
NUM, /* array element cnt */
|
||||
@@ -79,16 +85,79 @@ main()
|
||||
ptr /* pointer to recv buf */
|
||||
);
|
||||
SEVCHK(status, NULL);
|
||||
|
||||
SEVCHK(ca_build_and_connect(
|
||||
CA_TEST_CHNL4,
|
||||
TYPENOTCONN,
|
||||
0,
|
||||
&chix4,
|
||||
NULL,
|
||||
conn,
|
||||
NULL),NULL);
|
||||
SEVCHK(ca_build_and_connect(
|
||||
CA_TEST_CHNL,
|
||||
TYPENOTCONN,
|
||||
0,
|
||||
&chix2,
|
||||
NULL,
|
||||
conn,
|
||||
NULL),NULL);
|
||||
SEVCHK(ca_build_and_connect(
|
||||
CA_TEST_CHNL,
|
||||
TYPENOTCONN,
|
||||
0,
|
||||
&chix1,
|
||||
NULL,
|
||||
conn,
|
||||
NULL),NULL);
|
||||
status = ca_pend_io(10.0);
|
||||
SEVCHK(status,NULL);
|
||||
|
||||
SEVCHK(ca_clear_channel(chix4),NULL);
|
||||
SEVCHK(ca_clear_channel(chix2),NULL);
|
||||
SEVCHK(ca_clear_channel(chix3),NULL);
|
||||
SEVCHK(ca_clear_channel(chix1),NULL);
|
||||
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
|
||||
SEVCHK(ca_search(CA_TEST_CHNL4,&chix4),NULL);
|
||||
SEVCHK(ca_search(CA_TEST_CHNL,&chix2),NULL);
|
||||
status = ca_array_build(
|
||||
CA_TEST_CHNL, /* channel ASCII name */
|
||||
DBR_GR_FLOAT, /* fetch external type */
|
||||
NUM, /* array element cnt */
|
||||
&chix3, /* ptr to chid */
|
||||
ptr /* pointer to recv buf */
|
||||
);
|
||||
SEVCHK(status, NULL);
|
||||
|
||||
for(i=0;i<1;i++)
|
||||
SEVCHK(ca_search(CA_TEST_CHNL,&chix1),NULL);
|
||||
SEVCHK(ca_build_and_connect(
|
||||
CA_TEST_CHNL4,
|
||||
TYPENOTCONN,
|
||||
0,
|
||||
&chix4,
|
||||
NULL,
|
||||
conn,
|
||||
NULL),NULL);
|
||||
SEVCHK(ca_build_and_connect(
|
||||
CA_TEST_CHNL,
|
||||
TYPENOTCONN,
|
||||
0,
|
||||
&chix2,
|
||||
NULL,
|
||||
conn,
|
||||
NULL),NULL);
|
||||
SEVCHK(ca_build_and_connect(
|
||||
CA_TEST_CHNL,
|
||||
TYPENOTCONN,
|
||||
0,
|
||||
&chix1,
|
||||
NULL,
|
||||
conn,
|
||||
NULL),NULL);
|
||||
|
||||
status = ca_pend_io(1.0);
|
||||
SEVCHK(status,NULL);
|
||||
|
||||
if(INVALID_DB_REQ(chix1->type))
|
||||
printf("Failed to locate %s\n",CA_TEST_CHNL);
|
||||
@@ -116,20 +185,26 @@ main()
|
||||
lib$init_timer();
|
||||
# endif
|
||||
|
||||
|
||||
if(VALID_DB_REQ(chix4->type)){
|
||||
ca_add_event(DBR_FLOAT, chix4, ca_test_event, 0xaaaaaaaa, &monix);
|
||||
ca_clear_event(monix);
|
||||
status = ca_add_event(DBR_FLOAT, chix4, EVENT_ROUTINE, 0xaaaaaaaa, &monix);
|
||||
SEVCHK(status,NULL);
|
||||
SEVCHK(ca_clear_event(monix),NULL);
|
||||
}
|
||||
if(VALID_DB_REQ(chix4->type)){
|
||||
ca_add_event(DBR_FLOAT, chix4, ca_test_event, 0xaaaaaaaa, &monix);
|
||||
ca_clear_event(monix);
|
||||
status = ca_add_event(DBR_FLOAT, chix4, EVENT_ROUTINE, 0xaaaaaaaa, &monix);
|
||||
SEVCHK(status,NULL);
|
||||
SEVCHK(ca_clear_event(monix),NULL);
|
||||
}
|
||||
|
||||
if(VALID_DB_REQ(chix3->type)){
|
||||
ca_add_event(DBR_FLOAT, chix3, ca_test_event, 0xaaaaaaaa, &monix);
|
||||
ca_add_event(DBR_FLOAT, chix3, write_event, 0xaaaaaaaa, &monix);
|
||||
status = ca_add_event(DBR_FLOAT, chix3, EVENT_ROUTINE, 0xaaaaaaaa, &monix);
|
||||
SEVCHK(status,NULL);
|
||||
status = ca_add_event(DBR_FLOAT, chix3, write_event, 0xaaaaaaaa, &monix);
|
||||
SEVCHK(status,NULL);
|
||||
}
|
||||
|
||||
|
||||
pfloat = (float *) malloc(sizeof(float)*NUM);
|
||||
|
||||
|
||||
@@ -144,7 +219,7 @@ main()
|
||||
else
|
||||
abort();
|
||||
|
||||
ca_pend_io(4.0);
|
||||
SEVCHK(ca_pend_io(4.0),NULL);
|
||||
|
||||
# ifdef VMS
|
||||
lib$show_timer();
|
||||
@@ -152,14 +227,20 @@ main()
|
||||
for(i=0;i<NUM;i++)
|
||||
printf("Value Returned from put/get %f\n",pfloat[i]);
|
||||
|
||||
for(i=0;i<10;i++)
|
||||
ca_get_callback(DBR_FLOAT, chix1, ca_test_event, NULL);
|
||||
|
||||
printf("-- Put/Gets done- waiting for Events --\n");
|
||||
ca_pend_event(30.0);
|
||||
status = ca_pend_event(500.0);
|
||||
if(status == ECA_TIMEOUT){
|
||||
|
||||
free(ptr);
|
||||
free(pfloat);
|
||||
free(ptr);
|
||||
free(pfloat);
|
||||
|
||||
exit();
|
||||
}else
|
||||
SEVCHK(status,NULL);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +249,12 @@ main()
|
||||
|
||||
void null_event()
|
||||
{
|
||||
printf("-");
|
||||
static int i;
|
||||
|
||||
if(i++>100){
|
||||
printf("100 occured\n");
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -181,5 +267,23 @@ struct event_handler_args args;
|
||||
|
||||
SEVCHK(ca_rput(args.chid, &a),"write fail in event");
|
||||
SEVCHK(ca_flush_io(),NULL);
|
||||
/*
|
||||
#ifdef vxWorks
|
||||
taskDelay(20);
|
||||
#endif
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
void conn(args)
|
||||
struct connection_handler_args args;
|
||||
{
|
||||
|
||||
if(args.op == CA_OP_CONN_UP)
|
||||
printf("Channel On Line [%s]\n", ca_name(args.chid));
|
||||
else if(args.op == CA_OP_CONN_DOWN)
|
||||
printf("Channel Off Line [%s]\n", ca_name(args.chid));
|
||||
else
|
||||
printf("Ukn conn ev\n");
|
||||
}
|
||||
|
||||
|
||||
154
src/ca/conn.c
154
src/ca/conn.c
@@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* L O S A L A M O S */
|
||||
/* Los Alamos National Laboratory */
|
||||
/* Los Alamos, New Mexico 87545 */
|
||||
/* Los Alamos, New Mexico 87545 */
|
||||
/* */
|
||||
/* Copyright, 1986, The Regents of the University of California. */
|
||||
/* */
|
||||
@@ -18,7 +18,7 @@
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Title: IOC connection automation */
|
||||
/* File: atcs:[ca]access.c */
|
||||
/* File: atcs:[ca]conn.c */
|
||||
/* Environment: VMS, UNIX, VRTX */
|
||||
/* Equipment: VAX, SUN, VME */
|
||||
/* */
|
||||
@@ -26,6 +26,9 @@
|
||||
/* */
|
||||
/************************************************************************/
|
||||
/*_end */
|
||||
#ifdef UNIX
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <cadef.h>
|
||||
@@ -34,54 +37,127 @@
|
||||
#include <iocinf.h>
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* CHID_RETRY
|
||||
*
|
||||
* retry disconnected channels
|
||||
*
|
||||
*
|
||||
* NOTES:
|
||||
* Lock must be applied while in this routine
|
||||
*/
|
||||
chid_retry(silent)
|
||||
char silent;
|
||||
{
|
||||
register chid chix;
|
||||
register unsigned int retry_cnt = 0;
|
||||
char string[100];
|
||||
void send_msg();
|
||||
register chid chix;
|
||||
register unsigned int retry_cnt = 0;
|
||||
unsigned int retry_cnt_no_handler = 0;
|
||||
char string[100];
|
||||
int i;
|
||||
int search_type;
|
||||
|
||||
if(!chidlist_pend.count)
|
||||
return ECA_NORMAL;
|
||||
/*
|
||||
* CASTTMO+pndrecvcnt*LKUPTMO)/DELAYVAL + 1
|
||||
*/
|
||||
#define CASTTMO 0.150 /* 150 mS */
|
||||
#define LKUPTMO 0.015 /* 15 mS */
|
||||
|
||||
LOCK;
|
||||
chix = (chid) &chidlist_pend;
|
||||
while(chix = (chid) chix->node.next){
|
||||
build_msg(chix,TRUE);
|
||||
retry_cnt++;
|
||||
if(!silent)
|
||||
ca_signal(ECA_CHIDNOTFND, chix+1);
|
||||
}
|
||||
send_msg();
|
||||
printf("Sent ");
|
||||
UNLOCK;
|
||||
for(i=0; i< nxtiiu; i++){
|
||||
if(i != BROADCAST_IIU && iiu[i].conn_up)
|
||||
continue;
|
||||
|
||||
if(retry_cnt && !silent){
|
||||
sprintf(string, "%d channels outstanding", retry_cnt);
|
||||
ca_signal(ECA_CHIDRETRY, string);
|
||||
}
|
||||
if(iiu[i].nconn_tries++ > MAXCONNTRIES)
|
||||
continue;
|
||||
|
||||
return ECA_NORMAL;
|
||||
search_type = (i==BROADCAST_IIU? DONTREPLY: DOREPLY);
|
||||
|
||||
chix = (chid) &iiu[i].chidlist;
|
||||
while(chix = (chid) chix->node.next){
|
||||
if(chix->type != TYPENOTCONN)
|
||||
continue;
|
||||
build_msg(chix,search_type);
|
||||
retry_cnt++;
|
||||
|
||||
if(!(silent || chix->connection_func)){
|
||||
ca_signal(ECA_CHIDNOTFND, chix+1);
|
||||
retry_cnt_no_handler++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(retry_cnt){
|
||||
send_msg();
|
||||
printf("<Trying> ");
|
||||
#ifdef UNIX
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
if(!silent && retry_cnt_no_handler){
|
||||
sprintf(string, "%d channels outstanding", retry_cnt);
|
||||
ca_signal(ECA_CHIDRETRY, string);
|
||||
}
|
||||
}
|
||||
|
||||
return ECA_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Locks must be applied while in this routine
|
||||
*/
|
||||
mark_chids_disconnected(iocix)
|
||||
register unsigned iocix;
|
||||
*
|
||||
*
|
||||
* MARK_SERVER_AVAILABLE
|
||||
*
|
||||
*
|
||||
* NOTES:
|
||||
* Lock must be applied while in this routine
|
||||
*
|
||||
*/
|
||||
void
|
||||
mark_server_available(net_addr)
|
||||
struct in_addr net_addr;
|
||||
{
|
||||
register chid chix;
|
||||
register chid nextchix;
|
||||
int i;
|
||||
void noop_msg();
|
||||
|
||||
nextchix = (chid) &chidlist_conn.node;
|
||||
while(chix = nextchix){
|
||||
nextchix = (chid) chix->node.next;
|
||||
if(chix->iocix == iocix){
|
||||
lstDelete(&chidlist_conn, chix);
|
||||
lstAdd(&chidlist_pend, chix);
|
||||
chix->type = TYPENOTCONN;
|
||||
}
|
||||
}
|
||||
for(i=0;i<nxtiiu;i++)
|
||||
if( (net_addr.s_addr ==
|
||||
iiu[i].sock_addr.sin_addr.s_addr)){
|
||||
|
||||
/*
|
||||
* reset the retry count out
|
||||
*
|
||||
*/
|
||||
iiu[i].nconn_tries = 0;
|
||||
|
||||
/*
|
||||
* Check if the conn is down but TCP
|
||||
* has not informed me by sending a NULL msg
|
||||
*/
|
||||
if(iiu[i].conn_up){
|
||||
noop_msg(&iiu[i]);
|
||||
send_msg();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Not on a known IOC so try a directed UDP
|
||||
*
|
||||
*/
|
||||
/*
|
||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
This connects when the client starts before the server
|
||||
1) uses a broadcast- should use a directed UDP messaage
|
||||
2) many clients with nonexsistent channels could
|
||||
cause a flood here
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
iiu[BROADCAST_IIU].nconn_tries = MAXCONNTRIES-1;
|
||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
*/
|
||||
}
|
||||
|
||||
257
src/ca/convert.c
257
src/ca/convert.c
@@ -1,3 +1,33 @@
|
||||
/*
|
||||
* C O N V E R T . C
|
||||
*
|
||||
* Author: D. Kersteins
|
||||
*
|
||||
*
|
||||
* NOTES:
|
||||
* 1) converts arrays without subroutine call
|
||||
* for improved efficiency -joh
|
||||
*
|
||||
* 2) These routines only do VAX conversions for now - joh
|
||||
*
|
||||
* 3) All routines in this file have an encode argument which
|
||||
* determines if we are converting from the standard format to
|
||||
* the local format or vise versa. To date only float and double data
|
||||
* types must be converted differently depending on the encode
|
||||
* argument - joh
|
||||
*
|
||||
* History
|
||||
* joh 10-21-90 Moved atomic types here to avoid
|
||||
* maintenance problems in service.c
|
||||
* This also provides for a cleaner seperation
|
||||
* of function.
|
||||
* joh 10-21-90 Added new DBR_XXXX types for release two
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <db_access.h>
|
||||
#include <net_convert.h>
|
||||
|
||||
@@ -7,6 +37,219 @@
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Routine we will do later
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
no_cvrt()
|
||||
{
|
||||
printf("Sorry, conversion for that type currently not implemented\n");
|
||||
exit();
|
||||
}
|
||||
cvrt_sts_char() {no_cvrt();}
|
||||
cvrt_sts_long() {no_cvrt();}
|
||||
cvrt_sts_double() {no_cvrt();}
|
||||
|
||||
cvrt_time_string() {no_cvrt();}
|
||||
cvrt_time_short() {no_cvrt();}
|
||||
cvrt_time_float() {no_cvrt();}
|
||||
cvrt_time_enum() {no_cvrt();}
|
||||
cvrt_time_char() {no_cvrt();}
|
||||
cvrt_time_long() {no_cvrt();}
|
||||
cvrt_time_double() {no_cvrt();}
|
||||
|
||||
cvrt_gr_char() {no_cvrt();}
|
||||
cvrt_gr_double() {no_cvrt();}
|
||||
cvrt_gr_long() {no_cvrt();}
|
||||
cvrt_gr_string() {no_cvrt();}
|
||||
cvrt_gr_enum() {no_cvrt();}
|
||||
|
||||
cvrt_ctrl_char() {no_cvrt();}
|
||||
cvrt_ctrl_long() {no_cvrt();}
|
||||
cvrt_ctrl_string() {no_cvrt();}
|
||||
cvrt_ctrl_double() {no_cvrt();}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* CVRT_SHORT()
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
cvrt_short(s,d,encode,num)
|
||||
short *s; /* source */
|
||||
short *d; /* destination */
|
||||
int encode; /* cvrt VAX to IEEE if T */
|
||||
int num; /* number of values */
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for(i=0; i<num; i++){
|
||||
*d++ = ntohs( *s++ );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CVRT_CHAR()
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
cvrt_char(s,d,encode,num)
|
||||
char *s; /* source */
|
||||
char *d; /* destination */
|
||||
int encode; /* cvrt VAX to IEEE if T */
|
||||
int num; /* number of values */
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for(i=0; i<num; i++){
|
||||
*d++ = *s++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CVRT_LONG()
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
cvrt_long(s,d,encode,num)
|
||||
long *s; /* source */
|
||||
long *d; /* destination */
|
||||
int encode; /* cvrt VAX to IEEE if T */
|
||||
int num; /* number of values */
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for(i=0; i<num; i++){
|
||||
*d++ = ntohl( *s++ );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CVRT_ENUM()
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
cvrt_enum(s,d,encode,num)
|
||||
short *s; /* source */
|
||||
short *d; /* destination */
|
||||
int encode; /* cvrt VAX to IEEE if T */
|
||||
int num; /* number of values */
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for(i=0; i<num; i++){
|
||||
*d++ = ntohs(*s++);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CVRT_FLOAT()
|
||||
*
|
||||
*
|
||||
* NOTES:
|
||||
* placing encode outside the loop results in more
|
||||
* code but better performance.
|
||||
*
|
||||
*/
|
||||
cvrt_float(s,d,encode,num)
|
||||
float *s; /* source */
|
||||
float *d; /* destination */
|
||||
int encode; /* cvrt VAX to IEEE if T*/
|
||||
int num; /* number of values */
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for(i=0; i<num; i++){
|
||||
if(encode){
|
||||
htonf(s, d);
|
||||
}
|
||||
else{
|
||||
ntohf(s, d);
|
||||
}
|
||||
/*
|
||||
* incrementing these inside the MACRO could be unhealthy
|
||||
*/
|
||||
s++;
|
||||
d++;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CVRT_DOUBLE()
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
cvrt_double(s,d,encode,num)
|
||||
double *s; /* source */
|
||||
double *d; /* destination */
|
||||
int encode; /* cvrt VAX to IEEE if T */
|
||||
int num; /* number of values */
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
printf("CA: sorry no code for conversions of doubles\n");
|
||||
printf("CA: setting your variable to nill\n");
|
||||
for(i=0; i<num; i++){
|
||||
*d++ = 0.0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CVRT_STRING()
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
cvrt_string(s,d,encode,num)
|
||||
char *s; /* source */
|
||||
char *d; /* destination */
|
||||
int encode; /* cvrt VAX to IEEE if T */
|
||||
int num; /* number of values */
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if(num == 1)
|
||||
strcpy(d, s);
|
||||
else
|
||||
memcpy(d, s, (MAX_STRING_SIZE * num));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
** cvrt_sts_string(s,d)
|
||||
** struct dbr_sts_string *s pointer to source struct
|
||||
@@ -39,10 +282,8 @@ int num; /* number of values */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
** cvrt_sts_int(s,d)
|
||||
** cvrt_sts_short(s,d)
|
||||
** struct dbr_sts_int *s pointer to source struct
|
||||
** struct dbr_sts_int *d pointer to destination struct
|
||||
** int encode; boolean, if true vax to ieee
|
||||
@@ -54,7 +295,7 @@ int num; /* number of values */
|
||||
** format
|
||||
****************************************************************************/
|
||||
|
||||
cvrt_sts_int(s,d,encode,num)
|
||||
cvrt_sts_short(s,d,encode,num)
|
||||
struct dbr_sts_int *s; /* source */
|
||||
struct dbr_sts_int *d; /* destination */
|
||||
int encode; /* if true, vax to ieee */
|
||||
@@ -192,7 +433,7 @@ int num; /* number of values */
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
** cvrt_gr_int(s,d)
|
||||
** cvrt_gr_short(s,d)
|
||||
** struct dbr_gr_int *s pointer to source struct
|
||||
** struct dbr_gr_int *d pointer to destination struct
|
||||
** int encode; boolean, if true vax to ieee
|
||||
@@ -204,7 +445,7 @@ int num; /* number of values */
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
cvrt_gr_int(s,d,encode,num)
|
||||
cvrt_gr_short(s,d,encode,num)
|
||||
struct dbr_gr_int *s; /* source */
|
||||
struct dbr_gr_int *d; /* destination */
|
||||
int encode; /* if true, vax to ieee */
|
||||
@@ -323,7 +564,7 @@ int num; /* number of values */
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
** cvrt_ctrl_int(s,d)
|
||||
** cvrt_ctrl_short(s,d)
|
||||
** struct dbr_gr_int *s pointer to source struct
|
||||
** struct dbr_gr_int *d pointer to destination struct
|
||||
** int encode; boolean, if true vax to ieee
|
||||
@@ -335,7 +576,7 @@ int num; /* number of values */
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
cvrt_ctrl_int(s,d,encode,num)
|
||||
cvrt_ctrl_short(s,d,encode,num)
|
||||
struct dbr_ctrl_int *s; /* source */
|
||||
struct dbr_ctrl_int *d; /* destination */
|
||||
int encode; /* if true, vax to ieee */
|
||||
|
||||
1006
src/ca/iocinf.c
1006
src/ca/iocinf.c
File diff suppressed because it is too large
Load Diff
176
src/ca/iocinf.h
176
src/ca/iocinf.h
@@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* L O S A L A M O S */
|
||||
/* Los Alamos National Laboratory */
|
||||
/* Los Alamos, New Mexico 87545 */
|
||||
/* Los Alamos, New Mexico 87545 */
|
||||
/* */
|
||||
/* Copyright, 1986, The Regents of the University of California. */
|
||||
/* */
|
||||
@@ -29,13 +29,16 @@
|
||||
/* ioc interface include */
|
||||
/* */
|
||||
/* */
|
||||
/* Special comments */
|
||||
/* Special comments */
|
||||
/* ------- -------- */
|
||||
/* Use GLBLTYPE to define externals so we can change the all at */
|
||||
/* once from VAX globals to generic externals */
|
||||
/* */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
/*_end */
|
||||
#ifndef INCiocinfh
|
||||
#define INCiocinfh
|
||||
|
||||
|
||||
#ifndef INClstLibh
|
||||
#include <lstLib.h>
|
||||
@@ -49,39 +52,24 @@
|
||||
#include <in.h>
|
||||
#endif
|
||||
|
||||
#ifdef vxWorks
|
||||
#include <fast_lock.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VMS
|
||||
# include <ssdef>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VMS
|
||||
/************************************************************************/
|
||||
/* Provided to enforce one thread at a time code sections */
|
||||
/* independent of a particular operating system */
|
||||
/************************************************************************/
|
||||
/* note: the following must allways be used together */
|
||||
/* provided for data structure mutal exclusive lock out */
|
||||
/* in the VMS AST environment. */
|
||||
# define LOCK\
|
||||
{register long astenblwas;\
|
||||
astenblwas = sys$setast(FALSE);
|
||||
# define UNLOCK\
|
||||
if(astenblwas == SS$_WASSET)sys$setast(TRUE);}
|
||||
#else
|
||||
# ifdef vxWorks
|
||||
# define LOCK FASTLOCK(&client_lock);
|
||||
# define UNLOCK FASTUNLOCK(&client_lock);
|
||||
# else
|
||||
# define LOCK
|
||||
# define UNLOCK
|
||||
# endif
|
||||
#ifndef INCos_depenh
|
||||
# include <os_depen.h>
|
||||
#endif
|
||||
|
||||
void send_msg();
|
||||
|
||||
/* throw out requests prior to last ECA_TIMEOUT from ca_pend */
|
||||
#define VALID_MSG(PIIU) (piiu->read_seq == piiu->cur_read_seq)
|
||||
|
||||
/* perform a build to reconnect this channel ? */
|
||||
#define VALID_BUILD(CHID)\
|
||||
(CHID->build_count && CHID->build_type != TYPENOTCONN && CHID->build_value)
|
||||
|
||||
|
||||
#define IODONESUB\
|
||||
{\
|
||||
register struct pending_io_event *pioe;\
|
||||
@@ -94,37 +82,10 @@
|
||||
UNLOCK;\
|
||||
}
|
||||
|
||||
#define VALID_MSG(PIIU) (piiu->read_seq == piiu->cur_read_seq)
|
||||
enum channel_state{cs_never_conn, cs_prev_conn, cs_conn, closed};
|
||||
|
||||
#ifdef vxWorks
|
||||
# define SETPENDRECV {pndrecvcnt++;}
|
||||
# define CLRPENDRECV\
|
||||
{if(--pndrecvcnt<1){IODONESUB; vrtxPost(&io_done_flag, TRUE);}}
|
||||
#else
|
||||
#ifdef VMS
|
||||
# define SETPENDRECV {pndrecvcnt++;}
|
||||
# define CLRPENDRECV\
|
||||
{if(--pndrecvcnt<1){IODONESUB; sys$setef(io_done_flag);}}
|
||||
#else
|
||||
# define SETPENDRECV {pndrecvcnt++;}
|
||||
# define CLRPENDRECV\
|
||||
{if(--pndrecvcnt<1){IODONESUB;}}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WINTCP /* Wallangong */
|
||||
/* (the VAXC runtime lib has its own close */
|
||||
# define socket_close(S) netclose(S)
|
||||
# define socket_ioctl(A,B,C) ioctl(A,B,C)
|
||||
#endif
|
||||
#ifdef UNIX
|
||||
# define socket_close(S) close(S)
|
||||
# define socket_ioctl(A,B,C) ioctl(A,B,C)
|
||||
#endif
|
||||
#ifdef vxWorks
|
||||
# define socket_close(S) close(S)
|
||||
# define socket_ioctl(A,B,C) ioctl(A,B,C)
|
||||
#endif
|
||||
#define SETPENDRECV {pndrecvcnt++;}
|
||||
#define CLRPENDRECV {if(--pndrecvcnt<1){IODONESUB; POST_IO_EV;}}
|
||||
|
||||
/* size of object in bytes rounded up to nearest long word */
|
||||
#define QUAD_ROUND(A) (((A)+3)>>2)
|
||||
@@ -133,39 +94,10 @@
|
||||
/* size of object in bytes rounded up to nearest short word */
|
||||
#define BI_ROUND(A) (((A)+1)>>1)
|
||||
#define BI_SIZEOF(A) (QUAD_ROUND(sizeof(A)))
|
||||
|
||||
/*
|
||||
#define MAX(A,B) (((A)>(B))?(A):(B))
|
||||
#define MIN(A,B) (((A)>(B))?(B):(A))
|
||||
|
||||
#ifdef vxWorks
|
||||
#define VXTHISTASKID taskIdCurrent
|
||||
extern int taskIdCurrent;
|
||||
#define abort() taskSuspend(taskIdCurrent);
|
||||
#endif
|
||||
|
||||
#ifdef vxWorks
|
||||
# define memcpy(D,S,N) bcopy(S,D,N)
|
||||
# define memset(D,V,N) bfill(D,N,V)
|
||||
#endif
|
||||
|
||||
#ifdef VMS
|
||||
#ifdef WINTCP
|
||||
extern int uerrno; /* Wallongong errno is uerrno */
|
||||
# define MYERRNO uerrno
|
||||
#else
|
||||
extern volatile int noshare socket_errno;
|
||||
# define MYERRNO socket_errno
|
||||
#endif
|
||||
#else
|
||||
# ifdef vxWorks
|
||||
# define MYERRNO (errnoGet()&0xffff)
|
||||
# else
|
||||
extern int errno;
|
||||
# define MYERRNO errno
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
*/
|
||||
/************************************************************************/
|
||||
/* Structures */
|
||||
/************************************************************************/
|
||||
@@ -176,21 +108,10 @@ struct buffer{
|
||||
char buf[MAX_MSG_SIZE]; /* from iocmsg.h */
|
||||
};
|
||||
|
||||
#ifdef VMS
|
||||
struct iosb{
|
||||
short status;
|
||||
unsigned short count;
|
||||
void *device;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct timeval{
|
||||
unsigned long tv_sec;
|
||||
unsigned long tv_usec;
|
||||
};
|
||||
|
||||
/* Moved in an allocated structure for vxWorks Compatibility */
|
||||
/* indexs into the ioc in use table */
|
||||
#define MAXIIU 25
|
||||
#define INVALID_IIU (MAXIIU+1)
|
||||
#define LOCAL_IIU (MAXIIU+100)
|
||||
#define BROADCAST_IIU 0
|
||||
|
||||
@@ -210,9 +131,13 @@ struct pending_io_event{
|
||||
#define chidlist_conn (ca_static->ca_chidlist_conn)
|
||||
#define chidlist_noreply\
|
||||
(ca_static->ca_chidlist_noreply)
|
||||
#define eventlist (ca_static->ca_eventlist)
|
||||
#define ioeventlist (ca_static->ca_ioeventlist)
|
||||
#define nxtiiu (ca_static->ca_nxtiiu)
|
||||
#define free_event_list (ca_static->ca_free_event_list)
|
||||
#define pend_read_list (ca_static->ca_pend_read_list)
|
||||
#define fd_register_func\
|
||||
(ca_static->ca_fd_register_func)
|
||||
#define fd_register_arg (ca_static->ca_fd_register_arg)
|
||||
#ifdef UNIX
|
||||
#define readch (ca_static->ca_readch)
|
||||
#define writech (ca_static->ca_writech)
|
||||
@@ -225,6 +150,8 @@ struct pending_io_event{
|
||||
#define client_lock (ca_static->ca_client_lock)
|
||||
#define event_buf (ca_static->ca_event_buf)
|
||||
#define event_buf_size (ca_static->ca_event_buf_size)
|
||||
#define local_chidlist (ca_static->ca_local_chidlist)
|
||||
#define dbfree_ev_list (ca_static->ca_dbfree_ev_list)
|
||||
#endif
|
||||
#ifdef VMS
|
||||
#define io_done_flag (ca_static->ca_io_done_flag)
|
||||
@@ -233,18 +160,21 @@ struct pending_io_event{
|
||||
struct ca_static{
|
||||
unsigned short ca_nxtiiu;
|
||||
long ca_pndrecvcnt;
|
||||
LIST ca_chidlist_conn;
|
||||
LIST ca_chidlist_pend;
|
||||
LIST ca_chidlist_noreply;
|
||||
LIST ca_eventlist;
|
||||
LIST ca_ioeventlist;
|
||||
void (*ca_exception_func)();
|
||||
void *ca_exception_arg;
|
||||
void (*ca_connection_func)();
|
||||
void *ca_connection_arg;
|
||||
void (*ca_fd_register_func)();
|
||||
void (*ca_fd_register_arg)();
|
||||
short ca_exit_in_progress;
|
||||
unsigned short ca_post_msg_active;
|
||||
LIST ca_free_event_list;
|
||||
LIST ca_pend_read_list;
|
||||
short ca_repeater_contacted;
|
||||
#ifdef UNIX
|
||||
fd_set ca_readch;
|
||||
fd_set ca_writech;
|
||||
fd_set ca_execch;
|
||||
#endif
|
||||
short ca_exit_in_progress;
|
||||
unsigned short ca_post_msg_active;
|
||||
#ifdef VMS
|
||||
int ca_io_done_flag;
|
||||
#endif
|
||||
@@ -255,6 +185,8 @@ struct ca_static{
|
||||
void *ca_event_buf;
|
||||
unsigned ca_event_buf_size;
|
||||
int ca_tid;
|
||||
LIST ca_local_chidlist;
|
||||
LIST ca_dbfree_ev_list;
|
||||
#endif
|
||||
struct ioc_in_use{
|
||||
unsigned contiguous_msg_count;
|
||||
@@ -267,6 +199,12 @@ struct ca_static{
|
||||
struct buffer *recv;
|
||||
unsigned read_seq;
|
||||
unsigned cur_read_seq;
|
||||
LIST chidlist; /* chans on this connection */
|
||||
unsigned nconn_wait; /* number delays before try */
|
||||
unsigned nconn_tries; /* number of times conn was tried */
|
||||
int conn_up; /* boolean: T-conn /F-disconn */
|
||||
unsigned count_to_refresh; /* ndelays to conn retry */
|
||||
#define MAXCONNTRIES 3
|
||||
#ifdef VMS /* for qio ASTs */
|
||||
struct sockaddr_in recvfrom;
|
||||
struct iosb iosb;
|
||||
@@ -281,7 +219,7 @@ struct ca_static{
|
||||
GLOBAL VARIABLES
|
||||
There should only be one - add others to ca_static above -joh
|
||||
*/
|
||||
#ifdef GLBLSOURCE
|
||||
#ifdef CA_GLBLSOURCE
|
||||
# ifdef VAXC
|
||||
# define GLBLTYPE globaldef
|
||||
# else
|
||||
@@ -305,13 +243,5 @@ char ca_unique_address;
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Error handlers needed
|
||||
|
||||
remote_error(user_arg,chid,type,count)
|
||||
diconnect(user_arg,chid)
|
||||
connect(user_arg,chid)
|
||||
io_done(user_arg)
|
||||
|
||||
*/
|
||||
#endif
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
#ifndef __IOCMSG__
|
||||
/*
|
||||
History
|
||||
1/90 Jeff Hill removed status field in favor of a
|
||||
seperate command- saves space on every
|
||||
successful operation
|
||||
09/24/90 Marty Kraimer Temporily changed def for SERVER_NUM
|
||||
1/90 joh removed status field in favor of a seperate command-
|
||||
saves space on every successful operation
|
||||
|
||||
4-13-90 joh moved server ports to above IPPORT_USERRESERVED
|
||||
see in.h
|
||||
|
||||
*/
|
||||
|
||||
#define __IOCMSG__
|
||||
|
||||
/* TCP/UDP port number (bumped each protocol change) */
|
||||
#define CA_PROTOCOL_VERSION 2
|
||||
/*
|
||||
#define SERVER_NUM (IPPORT_USERRESERVED+12+CA_PROTOCOL_VERSION)
|
||||
*/
|
||||
#define SERVER_NUM (1102+CA_PROTOCOL_VERSION)
|
||||
#define CA_PROTOCOL_VERSION 3
|
||||
#define CA_PORT_BASE IPPORT_USERRESERVED + 56
|
||||
#define CA_SERVER_PORT (CA_PORT_BASE+CA_PROTOCOL_VERSION*2)
|
||||
#define CA_CLIENT_PORT (CA_PORT_BASE+CA_PROTOCOL_VERSION*2+1)
|
||||
|
||||
#define RSERVERQ 1 /* qid for response server queue */
|
||||
#define MAX_UDP 1024
|
||||
#define MAX_TCP (MAX_UDP*16) /* so waveforms fit */
|
||||
#define MAX_MSG_SIZE (MAX_TCP) /* the larger of tcp and udp max */
|
||||
@@ -25,22 +24,34 @@
|
||||
|
||||
/* values for m_cmmd */
|
||||
|
||||
#define IOC_EVENT_ADD 2 /* add an event */
|
||||
#define IOC_NOCMD 4 /* NOOP */
|
||||
#define IOC_EVENT_CANCEL 5 /* cancel an event */
|
||||
#define IOC_READ 7 /* read and return a channel value*/
|
||||
#define IOC_WRITE 9 /* write a channel value */
|
||||
#define IOC_SNAPSHOT 11 /* snapshot of the system */
|
||||
#define IOC_SEARCH 31 /* IOC channel search */
|
||||
#define IOC_BUILD 33 /* Conglomerate of IOC_SEARCH */
|
||||
#define IOC_NOOP 0 /* do nothing, but verify TCP */
|
||||
#define IOC_EVENT_ADD 1 /* add an event */
|
||||
#define IOC_EVENT_CANCEL 2 /* cancel an event */
|
||||
#define IOC_READ 3 /* read and return a channel value*/
|
||||
#define IOC_WRITE 4 /* write a channel value */
|
||||
#define IOC_SNAPSHOT 5 /* snapshot of the system */
|
||||
#define IOC_SEARCH 6 /* IOC channel search */
|
||||
#define IOC_BUILD 7 /* Conglomerate of IOC_SEARCH */
|
||||
/* IOC_READ */
|
||||
/* (optimizes OPI network use) */
|
||||
#define IOC_EVENTS_OFF 13 /* flow control */
|
||||
#define IOC_EVENTS_ON 14 /* flow control */
|
||||
#define IOC_READ_SYNC 16 /* purge old reads */
|
||||
#define IOC_ERROR 18 /* an operation failed */
|
||||
|
||||
#define IOC_EVENTS_OFF 8 /* flow control */
|
||||
#define IOC_EVENTS_ON 9 /* flow control */
|
||||
#define IOC_READ_SYNC 10 /* purge old reads */
|
||||
#define IOC_ERROR 11 /* an operation failed */
|
||||
#define IOC_CLEAR_CHANNEL 12 /* free chan resources */
|
||||
#define IOC_RSRV_IS_UP 13 /* CA server has joined the net */
|
||||
#define IOC_NOT_FOUND 14 /* channel not found */
|
||||
#define IOC_READ_NOTIFY 15 /* add a one shot event */
|
||||
#define IOC_READ_BUILD 16 /* read accompanying a build */
|
||||
#define REPEATER_CONFIRM 17 /* registration confirmation */
|
||||
|
||||
/*
|
||||
for use with build and search and not_found
|
||||
(if search fails and its not a broadcast tell
|
||||
the client to look elesewhere)
|
||||
*/
|
||||
#define DOREPLY 10
|
||||
#define DONTREPLY 5
|
||||
|
||||
|
||||
/* extmsg - the nonvariant part of each message sent/recv
|
||||
@@ -53,20 +64,19 @@ struct extmsg {
|
||||
unsigned short m_postsize; /* size of message extension */
|
||||
unsigned short m_type; /* operation data type */
|
||||
unsigned short m_count; /* operation data count */
|
||||
void *m_paddr; /* ptr to struct db_addr */
|
||||
/* IOC db field addr info */
|
||||
void *m_pciu; /* ptr to server channel in use */
|
||||
unsigned long m_available; /* undefined message location for use
|
||||
* by client processes */
|
||||
};
|
||||
|
||||
|
||||
/* for monitor message extension */
|
||||
/* for monitor (event) message extension */
|
||||
struct mon_info{
|
||||
float m_lval; /* low value to look for (deviation low
|
||||
* for continuous monitors) */
|
||||
float m_hval; /* high value (high deviation
|
||||
* for continuous monitors) */
|
||||
float m_toval; /* timeout limit for returning cval */
|
||||
float m_lval; /* low delta */
|
||||
float m_hval; /* high delta */
|
||||
float m_toval; /* period btween samples */
|
||||
unsigned short m_mask; /* event select mask */
|
||||
unsigned short m_pad; /* extend to 32 bits */
|
||||
};
|
||||
|
||||
struct monops { /* monitor req opi to ioc */
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* N E T _ C O N V E R T . H
|
||||
* MACROS for rapid conversion between VAX data formats and those used
|
||||
* by the IOCs
|
||||
*
|
||||
*
|
||||
* joh 09-13-90 force MIT sign to zero if exponent is zero
|
||||
* to prevent a reseved operand fault.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* So byte swapping can be performed in line for efficiency */
|
||||
/* (WINTCP has library routines with the same same functionality */
|
||||
@@ -95,25 +110,31 @@ struct ieeeflt{
|
||||
*(long *)(IEEE) = ntohl(*(long*)(IEEE));\
|
||||
}
|
||||
|
||||
/*
|
||||
* sign must be forced to zero if the exponent is zero to prevent a reserved
|
||||
* operand fault- joh 9-13-90
|
||||
*/
|
||||
# define ntohf(IEEE,MIT)\
|
||||
{\
|
||||
long exp,mant2,mant1,sign;\
|
||||
*(long *)(IEEE) = htonl(*(long*)(IEEE));\
|
||||
sign = ((struct ieeeflt *) (IEEE))->sign;\
|
||||
if( (short)((struct ieeeflt *) (IEEE))->exp > EXPMAXMIT + IEEE_SB){\
|
||||
sign = ((struct ieeeflt *) (IEEE))->sign;\
|
||||
exp = EXPMAXMIT + MIT_SB;\
|
||||
mant2 = ~0;\
|
||||
mant1 = ~0;\
|
||||
}\
|
||||
else if( ((struct ieeeflt *) (IEEE))->exp == 0){\
|
||||
sign = 0;\
|
||||
exp = 0;\
|
||||
mant2 = 0;\
|
||||
mant1 = 0;\
|
||||
}\
|
||||
else{\
|
||||
exp = ((struct ieeeflt *) (IEEE))->exp+MIT_SB-IEEE_SB;\
|
||||
mant2 = ((struct ieeeflt *) (IEEE))->mant;\
|
||||
mant1 = (((struct ieeeflt *) (IEEE))->mant>>(unsigned)16);\
|
||||
sign = ((struct ieeeflt *) (IEEE))->sign;\
|
||||
exp = ((struct ieeeflt *) (IEEE))->exp+MIT_SB-IEEE_SB;\
|
||||
mant2 = ((struct ieeeflt *) (IEEE))->mant;\
|
||||
mant1 = ((struct ieeeflt *) (IEEE))->mant>>(unsigned)16;\
|
||||
}\
|
||||
((struct mitflt *) (MIT))->exp = exp;\
|
||||
((struct mitflt *) (MIT))->mant2 = mant2;\
|
||||
@@ -128,33 +149,90 @@ struct ieeeflt{
|
||||
#endif
|
||||
|
||||
#ifdef VAX
|
||||
/* cvrt is (array of) (pointer to) (function returning) int */
|
||||
int cvrt_sts_string ();
|
||||
int cvrt_sts_int ();
|
||||
int cvrt_sts_float ();
|
||||
int cvrt_sts_enum ();
|
||||
int cvrt_gr_int ();
|
||||
int cvrt_gr_float ();
|
||||
int cvrt_ctrl_int ();
|
||||
int cvrt_ctrl_float ();
|
||||
int cvrt_ctrl_enum ();
|
||||
int cvrt_string();
|
||||
int cvrt_short();
|
||||
int cvrt_float();
|
||||
int cvrt_enum();
|
||||
int cvrt_char();
|
||||
int cvrt_long();
|
||||
int cvrt_double();
|
||||
|
||||
int cvrt_sts_string();
|
||||
int cvrt_sts_short();
|
||||
int cvrt_sts_float();
|
||||
int cvrt_sts_enum();
|
||||
int cvrt_sts_char();
|
||||
int cvrt_sts_long();
|
||||
int cvrt_sts_double();
|
||||
|
||||
int cvrt_time_string();
|
||||
int cvrt_time_short();
|
||||
int cvrt_time_float();
|
||||
int cvrt_time_enum();
|
||||
int cvrt_time_char();
|
||||
int cvrt_time_long();
|
||||
int cvrt_time_double();
|
||||
|
||||
int cvrt_gr_string();
|
||||
int cvrt_gr_short();
|
||||
int cvrt_gr_float();
|
||||
int cvrt_gr_enum();
|
||||
int cvrt_gr_char();
|
||||
int cvrt_gr_long();
|
||||
int cvrt_gr_double();
|
||||
int cvrt_gr_string();
|
||||
|
||||
int cvrt_ctrl_string();
|
||||
int cvrt_ctrl_short();
|
||||
int cvrt_ctrl_float();
|
||||
int cvrt_ctrl_enum();
|
||||
int cvrt_ctrl_char();
|
||||
int cvrt_ctrl_long();
|
||||
int cvrt_ctrl_double();
|
||||
|
||||
/* cvrt is (array of) (pointer to) (function returning) int */
|
||||
static
|
||||
int (*cvrt[])()
|
||||
=
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
cvrt_string,
|
||||
cvrt_short,
|
||||
cvrt_float,
|
||||
cvrt_enum,
|
||||
cvrt_char,
|
||||
cvrt_long,
|
||||
cvrt_double,
|
||||
|
||||
cvrt_sts_string,
|
||||
cvrt_sts_int,
|
||||
cvrt_sts_short,
|
||||
cvrt_sts_float,
|
||||
cvrt_sts_enum,
|
||||
cvrt_gr_int,
|
||||
cvrt_sts_char,
|
||||
cvrt_sts_long,
|
||||
cvrt_sts_double,
|
||||
|
||||
cvrt_time_string,
|
||||
cvrt_time_short,
|
||||
cvrt_time_float,
|
||||
cvrt_time_enum,
|
||||
cvrt_time_char,
|
||||
cvrt_time_long,
|
||||
cvrt_time_double,
|
||||
|
||||
cvrt_gr_string,
|
||||
cvrt_gr_short,
|
||||
cvrt_gr_float,
|
||||
cvrt_ctrl_int,
|
||||
cvrt_gr_enum,
|
||||
cvrt_gr_char,
|
||||
cvrt_gr_long,
|
||||
cvrt_gr_double,
|
||||
|
||||
cvrt_ctrl_string,
|
||||
cvrt_ctrl_short,
|
||||
cvrt_ctrl_float,
|
||||
cvrt_ctrl_enum
|
||||
cvrt_ctrl_enum,
|
||||
cvrt_ctrl_char,
|
||||
cvrt_ctrl_long,
|
||||
cvrt_ctrl_double
|
||||
};
|
||||
#endif
|
||||
|
||||
598
src/ca/service.c
598
src/ca/service.c
@@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* L O S A L A M O S */
|
||||
/* Los Alamos National Laboratory */
|
||||
/* Los Alamos, New Mexico 87545 */
|
||||
/* Los Alamos, New Mexico 87545 */
|
||||
/* */
|
||||
/* Copyright, 1986, The Regents of the University of California. */
|
||||
/* */
|
||||
@@ -20,7 +20,7 @@
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Title: channel access service routines */
|
||||
/* File: atcs:[ca]servuice.c */
|
||||
/* File: atcs:[ca]service.c */
|
||||
/* Environment: VMS, UNIX, VRTX */
|
||||
/* Equipment: VAX, SUN, VME */
|
||||
/* */
|
||||
@@ -31,9 +31,9 @@
|
||||
/* channel access service routines */
|
||||
/* */
|
||||
/* */
|
||||
/* Special comments */
|
||||
/* Special comments */
|
||||
/* ------- -------- */
|
||||
/* */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
/*_end */
|
||||
|
||||
@@ -41,6 +41,10 @@
|
||||
#include <stsdef.h>
|
||||
#endif
|
||||
|
||||
#ifdef UNIX
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <vxWorks.h>
|
||||
|
||||
#include <types.h>
|
||||
@@ -50,8 +54,9 @@
|
||||
#include <iocmsg.h>
|
||||
#include <iocinf.h>
|
||||
|
||||
void reconnect_channel();
|
||||
|
||||
void post_msg(hdrptr,bufcnt,net_addr,piiu)
|
||||
void post_msg(hdrptr,bufcnt,net_addr,piiu)
|
||||
register struct extmsg *hdrptr;
|
||||
register long bufcnt;
|
||||
struct in_addr net_addr;
|
||||
@@ -60,7 +65,6 @@ struct ioc_in_use *piiu;
|
||||
evid monix;
|
||||
long msgcnt;
|
||||
long tmp;
|
||||
char *name;
|
||||
|
||||
register void * t_available;
|
||||
register unsigned short t_postsize;
|
||||
@@ -70,15 +74,13 @@ struct ioc_in_use *piiu;
|
||||
register unsigned short t_size;
|
||||
int status;
|
||||
|
||||
# define BUFCHK(SIZE)\
|
||||
msgcnt = (SIZE); if(bufcnt-msgcnt < 0)\
|
||||
{printf("post_msg(): expected msg size larger than actual msg\n");return;}
|
||||
|
||||
# define BUFSTAT\
|
||||
printf("expected %d left %d\n",msgcnt,bufcnt);
|
||||
|
||||
post_msg_active++;
|
||||
|
||||
|
||||
while(bufcnt>0){
|
||||
# ifdef DEBUG
|
||||
printf( "processing message- bytes left %d, pending msgcnt %d\n",
|
||||
@@ -94,223 +96,368 @@ struct ioc_in_use *piiu;
|
||||
t_count = ntohs(hdrptr->m_count);
|
||||
t_size = dbr_size[t_type];
|
||||
|
||||
# ifdef DEBUG
|
||||
printf( "MSG: cmd:%d type:%d cnt:%d size:%d npost:%d avail:%x\n",
|
||||
t_cmmd,
|
||||
t_type,
|
||||
t_count,
|
||||
t_size,
|
||||
t_postsize,
|
||||
t_available
|
||||
);
|
||||
# endif
|
||||
|
||||
msgcnt = sizeof(*hdrptr) + t_postsize;
|
||||
if(bufcnt-msgcnt < 0){
|
||||
printf(
|
||||
"post_msg(): expected msg size larger than actual msg %d %d\n",
|
||||
bufcnt,
|
||||
msgcnt);
|
||||
post_msg_active--;
|
||||
return;
|
||||
}
|
||||
|
||||
switch(t_cmmd){
|
||||
|
||||
case IOC_EVENT_ADD:
|
||||
/* run the user's event handler */
|
||||
/* m_available points to event descriptor */
|
||||
|
||||
monix = (evid) t_available;
|
||||
|
||||
/* m_postsize = 0 is a confirmation of a monitor cancel */
|
||||
if( !t_postsize ){
|
||||
LOCK;
|
||||
lstDelete(&eventlist, monix);
|
||||
UNLOCK;
|
||||
if(free(monix)<0)
|
||||
printf("Unable to dealloc VM on IOC monitor cancel confirmation\n");
|
||||
|
||||
BUFCHK(sizeof(*hdrptr));
|
||||
break;
|
||||
}
|
||||
|
||||
/* BREAK LEFT OUT HERE BY DESIGN -JH */
|
||||
|
||||
case IOC_READ:
|
||||
case IOC_READ_NOTIFY:
|
||||
{
|
||||
/* update and convert the user's argument if read */
|
||||
/* (m_available points to argument descriptor) */
|
||||
/* else update in buffer if a monitor */
|
||||
register void *objptr = (void *) (hdrptr+1);
|
||||
register void *dstptr;
|
||||
unsigned int i;
|
||||
/* run the user's event handler */
|
||||
/* m_available points to event descriptor */
|
||||
struct event_handler_args args;
|
||||
|
||||
if(t_cmmd == IOC_READ){
|
||||
/* only count get returns if from the current read seq */
|
||||
if(!VALID_MSG(piiu))
|
||||
break;
|
||||
dstptr = (void *) t_available;
|
||||
}
|
||||
else
|
||||
dstptr = objptr;
|
||||
monix = (evid) t_available;
|
||||
|
||||
BUFCHK(sizeof(*hdrptr) + t_postsize);
|
||||
|
||||
# ifdef DEBUG
|
||||
BUFSTAT
|
||||
if(t_cmmd==IOC_READ)
|
||||
{static short i; printf("global reccnt %d\n",++i);}
|
||||
else
|
||||
{static short i; printf("global moncnt %d\n",++i);}
|
||||
# endif
|
||||
/*
|
||||
* Currently only the VAXs need data conversion
|
||||
*/
|
||||
# ifdef VAX
|
||||
(*cvrt[t_type])( hdrptr+1, hdrptr+1, FALSE, t_count);
|
||||
# endif
|
||||
|
||||
for(i=0; i<t_count; i++){
|
||||
/*
|
||||
* Orig version of CA didnt use this strucure.
|
||||
* This would run faster if I had decided to
|
||||
* pass a pointer to this structure rather
|
||||
* than the structure itself early on.
|
||||
*
|
||||
* Pumping the arguments on the stack explicitly
|
||||
* could cause problems if a small item is in
|
||||
* the structure and we are on a SPARC processor.
|
||||
*
|
||||
* call handler, only if they did not clear the chid
|
||||
* in the interim
|
||||
*/
|
||||
if(*monix->usr_func){
|
||||
args.usr = monix->usr_arg;
|
||||
args.chid = monix->chan;
|
||||
args.type = t_type;
|
||||
args.count = t_count;
|
||||
args.dbr = (void *) (hdrptr+1);
|
||||
|
||||
/* perform 2 and 4 byte transfer in line */
|
||||
/* NOTE that if we are on a machine that does not require */
|
||||
/* conversions these will be NULL macros */
|
||||
switch(t_type){
|
||||
(*monix->usr_func)(args);
|
||||
}
|
||||
|
||||
/* long word convert/transfer */
|
||||
case DBR_INT:
|
||||
case DBR_ENUM:
|
||||
*(short *)dstptr = ntohs(*(short *)objptr);
|
||||
break;
|
||||
LOCK;
|
||||
lstDelete(&pend_read_list, monix);
|
||||
lstAdd(&free_event_list, monix);
|
||||
UNLOCK;
|
||||
|
||||
case DBR_FLOAT:
|
||||
tmp = *(long *)objptr;
|
||||
ntohf(&tmp, dstptr);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case IOC_EVENT_ADD:
|
||||
{
|
||||
/* run the user's event handler */
|
||||
/* m_available points to event descriptor */
|
||||
struct event_handler_args args;
|
||||
|
||||
case DBR_STRING:
|
||||
if(dstptr != objptr)
|
||||
strcpy( dstptr,
|
||||
objptr);
|
||||
break;
|
||||
monix = (evid) t_available;
|
||||
|
||||
/* record transfer and convert */
|
||||
case DBR_STS_STRING:
|
||||
case DBR_STS_INT:
|
||||
case DBR_STS_FLOAT:
|
||||
case DBR_STS_ENUM:
|
||||
case DBR_GR_INT:
|
||||
case DBR_GR_FLOAT:
|
||||
case DBR_CTRL_INT:
|
||||
case DBR_CTRL_FLOAT:
|
||||
case DBR_CTRL_ENUM:
|
||||
# ifdef VAX
|
||||
(*cvrt[t_type])(objptr,dstptr,(int)FALSE,(int)t_count);
|
||||
# else
|
||||
if(dstptr != objptr)
|
||||
memcpy( dstptr,
|
||||
objptr,
|
||||
t_size);
|
||||
# endif
|
||||
|
||||
/*
|
||||
Conversion Routines handle all elements of an array in one call
|
||||
for efficiency.
|
||||
*/
|
||||
goto array_loop_exit;
|
||||
/* m_postsize = 0 is a confirmation of a monitor cancel */
|
||||
if( !t_postsize ){
|
||||
LOCK;
|
||||
lstDelete(&monix->chan->eventq, monix);
|
||||
lstAdd(&free_event_list, monix);
|
||||
UNLOCK;
|
||||
|
||||
break;
|
||||
default:
|
||||
printf("post_msg(): unsupported db fld type in msg ?%d\n",t_type);
|
||||
abort();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
(char *) objptr += t_size;
|
||||
(char *) dstptr += t_size;
|
||||
/* only call if not disabled */
|
||||
if(!monix->usr_func)
|
||||
break;
|
||||
|
||||
}
|
||||
/*
|
||||
* Currently only the VAXs need data conversion
|
||||
*/
|
||||
# ifdef VAX
|
||||
(*cvrt[t_type])( hdrptr+1, hdrptr+1, FALSE, t_count);
|
||||
# endif
|
||||
|
||||
array_loop_exit:
|
||||
|
||||
if(t_cmmd == IOC_READ)
|
||||
/* decrement the outstanding IO count */
|
||||
CLRPENDRECV
|
||||
else
|
||||
/* call handler */
|
||||
(*monix->usr_func)(
|
||||
monix->usr_arg, /* usr supplied */
|
||||
monix->chan, /* channel id */
|
||||
t_type, /* type of returned val */
|
||||
t_count, /* the element count */
|
||||
hdrptr+1 /* ptr to returned val */
|
||||
);
|
||||
|
||||
/*
|
||||
* Orig version of CA didnt use this strucure.
|
||||
* This would run faster if I had decided to
|
||||
* pass a pointer to this structure rather
|
||||
* than the structure itself early on.
|
||||
*
|
||||
* Pumping the arguments on the stack explicitly
|
||||
* could cause problems if a small item is in
|
||||
* the structure and we are on a SPARC processor.
|
||||
*
|
||||
*/
|
||||
args.usr = monix->usr_arg;
|
||||
args.chid = monix->chan;
|
||||
args.type = t_type;
|
||||
args.count = t_count;
|
||||
args.dbr = (void *) (hdrptr+1);
|
||||
|
||||
/* call their handler */
|
||||
(*monix->usr_func)(args);
|
||||
|
||||
break;
|
||||
}
|
||||
case IOC_READ:
|
||||
case IOC_READ_BUILD:
|
||||
{
|
||||
chid chan = (chid) hdrptr->m_pciu;
|
||||
|
||||
/* only count get returns if from the current read seq */
|
||||
if(!VALID_MSG(piiu))
|
||||
break;
|
||||
|
||||
if(t_postsize > (t_count-1) * dbr_value_size[t_type] + dbr_size[t_type])
|
||||
SEVCHK(ECA_INTERNAL,"about to violate user's buffer");
|
||||
|
||||
/*
|
||||
* Currently only the VAXs need data conversion
|
||||
*/
|
||||
# ifdef VAX
|
||||
(*cvrt[t_type])( hdrptr+1, t_available, FALSE, t_count);
|
||||
# else
|
||||
/* in line is a little faster */
|
||||
if(t_postsize<=sizeof(int)){
|
||||
if(t_postsize==sizeof(long))
|
||||
*(long *)t_available = *(long *)(hdrptr+1);
|
||||
else if(t_postsize==sizeof(short))
|
||||
*(short *)t_available = *(short *)(hdrptr+1);
|
||||
else if(t_postsize==sizeof(char))
|
||||
*(char *)t_available = *(char *)(hdrptr+1);
|
||||
}else
|
||||
memcpy(
|
||||
t_available,
|
||||
hdrptr+1,
|
||||
t_postsize);
|
||||
# endif
|
||||
|
||||
/*
|
||||
* decrement the outstanding IO count
|
||||
*
|
||||
* This relies on the IOC_READ_BUILD msg returning prior to the
|
||||
* IOC_BUILD msg.
|
||||
*/
|
||||
if( t_cmmd != IOC_READ_BUILD ||
|
||||
(chan->connection_func == NULL && chan->state==cs_never_conn))
|
||||
CLRPENDRECV;
|
||||
|
||||
break;
|
||||
}
|
||||
case IOC_SEARCH:
|
||||
case IOC_BUILD:
|
||||
BUFCHK(sizeof(*hdrptr));
|
||||
if( ((chid)t_available)->paddr ){
|
||||
int iocix = ((chid)t_available)->iocix;
|
||||
{
|
||||
chid chan = (chid) t_available;
|
||||
struct ioc_in_use *chpiiu = &iiu[chan->iocix];
|
||||
|
||||
if(iiu[iocix].sock_addr.sin_addr.s_addr==net_addr.s_addr)
|
||||
printf("burp ");
|
||||
else{
|
||||
char msg[256];
|
||||
char acc[64];
|
||||
char rej[64];
|
||||
sprintf(acc,"%s",host_from_addr(iiu[iocix].sock_addr.sin_addr));
|
||||
sprintf(rej,"%s",host_from_addr(net_addr));
|
||||
sprintf( msg,
|
||||
"Channel: %s Accepted: %s Rejected: %s ",
|
||||
((chid)t_available)+1,
|
||||
acc,
|
||||
rej);
|
||||
ca_signal(ECA_DBLCHNL, msg);
|
||||
if( chan->paddr ){
|
||||
|
||||
if(chpiiu->sock_addr.sin_addr.s_addr==net_addr.s_addr){
|
||||
printf("burp ");
|
||||
#ifdef UNIX
|
||||
fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
else{
|
||||
char msg[256];
|
||||
char acc[64];
|
||||
char rej[64];
|
||||
|
||||
sprintf(acc,"%s",
|
||||
host_from_addr(chpiiu->sock_addr.sin_addr));
|
||||
sprintf(rej,"%s",host_from_addr(net_addr));
|
||||
sprintf(
|
||||
msg,
|
||||
"Channel: %s Accepted: %s Rejected: %s ",
|
||||
chan+1,
|
||||
acc,
|
||||
rej);
|
||||
ca_signal(ECA_DBLCHNL, msg);
|
||||
}
|
||||
|
||||
/*
|
||||
* IOC_BUILD messages allways have a IOC_READ msg following.
|
||||
* (IOC_BUILD messages are sometimes followed by error
|
||||
* messages which are ignored on double replies)
|
||||
*/
|
||||
if(t_cmmd == IOC_BUILD)
|
||||
msgcnt += sizeof(struct extmsg) +
|
||||
(hdrptr+1)->m_postsize;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if(!chan->connection_func && chan->state==cs_never_conn){
|
||||
/* decrement the outstanding IO count */
|
||||
CLRPENDRECV;
|
||||
}
|
||||
|
||||
/* IOC_BUILD messages allways have a IOC_READ msg following */
|
||||
/* (IOC_BUILD messages are sometimes followed by error messages */
|
||||
/* which are also ignored on double replies) */
|
||||
/* the following cause this message to be ignored for double replies */
|
||||
if(t_cmmd == IOC_BUILD)
|
||||
msgcnt += sizeof(struct extmsg) + (hdrptr+1)->m_postsize;
|
||||
|
||||
break;
|
||||
}
|
||||
LOCK;
|
||||
status = alloc_ioc (
|
||||
net_addr,
|
||||
IPPROTO_TCP,
|
||||
&((chid)t_available)->iocix
|
||||
);
|
||||
SEVCHK(status, host_from_addr(net_addr));
|
||||
SEVCHK(status, ((chid)t_available)+1);
|
||||
LOCK;
|
||||
reconnect_channel(hdrptr,net_addr,piiu);
|
||||
UNLOCK;
|
||||
|
||||
/* Update rmt chid fields from extmsg fields */
|
||||
((chid)t_available)->type = t_type;
|
||||
((chid)t_available)->count = t_count;
|
||||
((chid)t_available)->paddr = hdrptr->m_paddr;
|
||||
lstDelete(&chidlist_pend, t_available);
|
||||
lstAdd(&chidlist_conn, t_available);
|
||||
UNLOCK;
|
||||
if(chan->connection_func){
|
||||
struct connection_handler_args args;
|
||||
|
||||
/* decrement the outstanding IO count */
|
||||
CLRPENDRECV;
|
||||
|
||||
break;
|
||||
args.chid = chan;
|
||||
args.op = CA_OP_CONN_UP;
|
||||
(*chan->connection_func)(args);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case IOC_READ_SYNC:
|
||||
BUFCHK(sizeof(struct extmsg));
|
||||
piiu->read_seq++;
|
||||
break;
|
||||
piiu->read_seq++;
|
||||
break;
|
||||
|
||||
case IOC_ERROR:
|
||||
case IOC_RSRV_IS_UP:
|
||||
# ifdef DEBUG
|
||||
printf( "IOC on line ->[%s]\n",
|
||||
host_from_addr(t_available));
|
||||
# endif
|
||||
LOCK;
|
||||
mark_server_available(t_available);
|
||||
chid_retry(TRUE);
|
||||
UNLOCK;
|
||||
break;
|
||||
|
||||
case REPEATER_CONFIRM:
|
||||
ca_static->ca_repeater_contacted = TRUE;
|
||||
# ifdef DEBUG
|
||||
printf("repeater confirmation\n");
|
||||
# endif
|
||||
break;
|
||||
|
||||
case IOC_NOT_FOUND:
|
||||
{
|
||||
char context[255];
|
||||
chid chix = (chid) t_available;
|
||||
struct ioc_in_use *piiu = &iiu[chix->iocix];
|
||||
|
||||
BUFCHK(sizeof(struct extmsg) + t_postsize);
|
||||
LOCK;
|
||||
lstDelete(&piiu->chidlist, chix);
|
||||
lstAdd(&iiu[BROADCAST_IIU].chidlist, chix);
|
||||
chix->iocix = BROADCAST_IIU;
|
||||
if(!piiu->chidlist.count)
|
||||
close_ioc(piiu);
|
||||
iiu[BROADCAST_IIU].nconn_tries = 0;
|
||||
chid_retry(TRUE);
|
||||
UNLOCK;
|
||||
|
||||
name = (char *) host_from_addr(net_addr);
|
||||
if(!name)
|
||||
name = "an unregistered IOC";
|
||||
|
||||
if(t_postsize>sizeof(struct extmsg))
|
||||
sprintf(context, "detected by: %s for: %s", name, hdrptr+2);
|
||||
else
|
||||
sprintf(context, "detected by: %s", name);
|
||||
|
||||
/*
|
||||
NOTE:
|
||||
The orig request is stored as an extmsg structure at
|
||||
hdrptr+1
|
||||
I should print additional diagnostic info using this
|
||||
info when time permits......
|
||||
*/
|
||||
|
||||
SEVCHK(ntohl((int)t_available), context);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
case IOC_CLEAR_CHANNEL:
|
||||
{
|
||||
chid chix = (chid) t_available;
|
||||
struct ioc_in_use *piiu = &iiu[chix->iocix];
|
||||
register evid monix;
|
||||
|
||||
|
||||
LOCK;
|
||||
/* remove any orphaned get callbacks for this channel */
|
||||
for( monix = (evid) pend_read_list.node.next;
|
||||
monix;
|
||||
monix = (evid) monix->node.next)
|
||||
if(monix->chan == chix){
|
||||
lstDelete(&pend_read_list, monix);
|
||||
lstAdd(&free_event_list, monix);
|
||||
}
|
||||
|
||||
lstConcat(&free_event_list, &chix->eventq);
|
||||
lstDelete(&piiu->chidlist, chix);
|
||||
if(free(chix)<0)
|
||||
abort();
|
||||
if(!piiu->chidlist.count)
|
||||
close_ioc(piiu);
|
||||
UNLOCK;
|
||||
break;
|
||||
}
|
||||
case IOC_ERROR:
|
||||
{
|
||||
char context[255];
|
||||
char *name;
|
||||
struct extmsg *req = hdrptr+1;
|
||||
int op;
|
||||
struct exception_handler_args args;
|
||||
|
||||
|
||||
/*
|
||||
* dont process the message if they have disable notification
|
||||
*/
|
||||
if(!ca_static->ca_exception_func)
|
||||
break;
|
||||
|
||||
name = (char *) host_from_addr(net_addr);
|
||||
if(!name)
|
||||
name = "an unregistered IOC";
|
||||
|
||||
if(t_postsize>sizeof(struct extmsg))
|
||||
sprintf(context, "detected by: %s for: %s", name, hdrptr+2);
|
||||
else
|
||||
sprintf(context, "detected by: %s", name);
|
||||
|
||||
/*
|
||||
* Map internal op id to external op id so I can freely change the
|
||||
* protocol in the future. This is quite wasteful of space however.
|
||||
*/
|
||||
switch(ntohs(req->m_cmmd)){
|
||||
case IOC_READ_NOTIFY:
|
||||
case IOC_READ:
|
||||
op = CA_OP_GET;
|
||||
break;
|
||||
case IOC_WRITE:
|
||||
op = CA_OP_PUT;
|
||||
break;
|
||||
case IOC_SEARCH:
|
||||
case IOC_BUILD:
|
||||
op = CA_OP_SEARCH;
|
||||
break;
|
||||
case IOC_EVENT_ADD:
|
||||
op = CA_OP_ADD_EVENT;
|
||||
break;
|
||||
case IOC_EVENT_CANCEL:
|
||||
op = CA_OP_CLEAR_EVENT;
|
||||
break;
|
||||
default:
|
||||
op = CA_OP_OTHER;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
args.usr = ca_static->ca_exception_arg; /* user arg */
|
||||
args.chid = hdrptr->m_pciu; /* the chid if appropriate */
|
||||
args.type = ntohs(req->m_type); /* req type if approp */
|
||||
args.count = ntohs(req->m_count); /* req count if approp */
|
||||
args.addr = (void *) (req->m_available);/* req user addr if approp */
|
||||
args.stat = ntohl((int)t_available); /* the CA message code */
|
||||
args.op = op; /* the CA operation */
|
||||
args.ctx = context; /* context string */
|
||||
(*ca_static->ca_exception_func)(args);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
printf("post_msg(): Corrupt message or unsupported m_cmmd type\n");
|
||||
return;
|
||||
printf("post_msg(): Corrupt Cmd in msg %x\n",t_cmmd);
|
||||
abort();
|
||||
}
|
||||
|
||||
bufcnt -= msgcnt;
|
||||
@@ -323,3 +470,80 @@ array_loop_exit:
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* RECONNECT_CHANNEL()
|
||||
* LOCK must be on
|
||||
*
|
||||
*/
|
||||
void reconnect_channel(hdrptr,net_addr,piiu)
|
||||
register struct extmsg *hdrptr;
|
||||
struct in_addr net_addr;
|
||||
struct ioc_in_use *piiu;
|
||||
{
|
||||
chid chan = (chid) hdrptr->m_available;
|
||||
unsigned short newiocix;
|
||||
evid pevent;
|
||||
int status;
|
||||
|
||||
void ca_request_event();
|
||||
|
||||
status = alloc_ioc (
|
||||
net_addr,
|
||||
IPPROTO_TCP,
|
||||
&newiocix
|
||||
);
|
||||
if(status != ECA_NORMAL){
|
||||
printf("... %s ...\n", ca_message(status));
|
||||
printf("for %s on %s\n", chan+1, host_from_addr(net_addr));
|
||||
printf("ignored broadcast reply- proceeding\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Update rmt chid fields from extmsg fields */
|
||||
chan->type = ntohs(hdrptr->m_type);
|
||||
chan->count = ntohs(hdrptr->m_count);
|
||||
chan->paddr = hdrptr->m_pciu;
|
||||
|
||||
if(chan->iocix != newiocix){
|
||||
struct ioc_in_use *chpiiu = &iiu[chan->iocix];
|
||||
/*
|
||||
* The address changed (or was found for the first time)
|
||||
*/
|
||||
if(chan->iocix != BROADCAST_IIU)
|
||||
ca_signal(ECA_NEWADDR, chan+1);
|
||||
lstDelete(&chpiiu->chidlist, chan);
|
||||
chan->iocix = newiocix;
|
||||
lstAdd(&iiu[newiocix].chidlist, chan);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* NOTE: monitor and callback reissue must occur prior to calling
|
||||
* their connection routine otherwise they could be requested twice.
|
||||
*/
|
||||
#ifdef CALLBACK_REISSUE
|
||||
/* reissue any outstanding get callbacks for this channel */
|
||||
if(pend_read_list.count){
|
||||
for( pevent = (evid) pend_read_list.node.next;
|
||||
pevent;
|
||||
pevent = (evid) pevent->node.next)
|
||||
if(pevent->chan == chan){
|
||||
issue_get_callback(pevent);
|
||||
send_msg();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* reissue any events (monitors) for this channel */
|
||||
if(chan->eventq.count){
|
||||
for( pevent = (evid)chan->eventq.node.next;
|
||||
pevent;
|
||||
pevent = (evid)pevent->node.next)
|
||||
ca_request_event(pevent);
|
||||
send_msg();
|
||||
}
|
||||
chan->state = cs_conn;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,48 +5,44 @@
|
||||
|
||||
|
||||
void
|
||||
ca_test_event(usr,chix,type,count,pval)
|
||||
void *usr;
|
||||
chid chix;
|
||||
chtype type;
|
||||
int count;
|
||||
void *pval;
|
||||
ca_test_event(args)
|
||||
struct event_handler_args args;
|
||||
{
|
||||
|
||||
printf("~~~### in test event for [%s] ###~~~\n",chix+1);
|
||||
printf("user arg\t%x\n",usr);
|
||||
printf("val ptr\t%x\n",pval);
|
||||
printf("mon type\t%x\n",type);
|
||||
printf("channel type\t%x\n",chix->type);
|
||||
switch(type){
|
||||
printf("~~~### in test event for [%s] ###~~~\n",args.chid+1);
|
||||
printf("User argument\t%x\n", args.usr);
|
||||
printf("Native channel data type\t%x\n", args.chid->type);
|
||||
printf("Monitor data type\t%x\n", args.type);
|
||||
switch(args.type){
|
||||
case DBR_STRING:
|
||||
printf("Value:\t<%s>\n",pval);
|
||||
printf("Value:\t<%s>\n",args.dbr);
|
||||
break;
|
||||
case DBR_INT:
|
||||
case DBR_ENUM:
|
||||
printf("Value:\t<%d>\n",*(int *)pval);
|
||||
printf("Value:\t<%d>\n",*(int *)args.dbr);
|
||||
break;
|
||||
case DBR_FLOAT:
|
||||
printf("Value:\t<%f>\n",*(float *)pval);
|
||||
printf("Value:\t<%f>\n",*(float *)args.dbr);
|
||||
break;
|
||||
case DBR_STS_STRING:
|
||||
printf("Value:\t<%s>\n",((struct dbr_sts_string *)pval)->value);
|
||||
printf("Value:\t<%s>\n",((struct dbr_sts_string *)args.dbr)->value);
|
||||
break;
|
||||
case DBR_STS_INT:
|
||||
printf("Value:\t<%d>\n",((struct dbr_sts_int *)pval)->value);
|
||||
printf("Value:\t<%d>\n",((struct dbr_sts_int *)args.dbr)->value);
|
||||
break;
|
||||
case DBR_STS_FLOAT:
|
||||
printf("Value:\t<%f>\n",((struct dbr_sts_float *)pval)->value);
|
||||
printf("Value:\t<%f>\n",((struct dbr_sts_float *)args.dbr)->value);
|
||||
break;
|
||||
case DBR_STS_ENUM:
|
||||
printf("Value:\t<%d>\n",((struct dbr_sts_enum *)pval)->value);
|
||||
printf("Value:\t<%d>\n",((struct dbr_sts_enum *)args.dbr)->value);
|
||||
break;
|
||||
case DBR_GR_FLOAT:
|
||||
printf("Value:\t<%f>\n",((struct dbr_gr_float *)pval)->value);
|
||||
printf("Value:\t<%f>\n",((struct dbr_gr_float *)args.dbr)->value);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Sorry test_event does not handle this type monitor yet\n");
|
||||
printf( "Sorry test_event does not handle data type %d yet\n",
|
||||
args.type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1098
src/db/dbEvent.c
1098
src/db/dbEvent.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
562
src/db/db_test.c
562
src/db/db_test.c
@@ -1,7 +1,3 @@
|
||||
|
||||
/* db_test.c */
|
||||
/* share/src/db $Id$ */
|
||||
|
||||
/*
|
||||
*
|
||||
* database access subroutines
|
||||
@@ -34,6 +30,10 @@
|
||||
* -----------------
|
||||
*/
|
||||
#include <db_access.h>
|
||||
|
||||
/* function declarations */
|
||||
static print_returned();
|
||||
|
||||
|
||||
/*
|
||||
* TGF
|
||||
@@ -41,7 +41,7 @@
|
||||
*/
|
||||
char tgf_buffer[1200];
|
||||
#define MAX_ELEMS 250
|
||||
int tgf(name,index)
|
||||
int gft(name,index)
|
||||
char *name;
|
||||
register short index;
|
||||
{
|
||||
@@ -58,51 +58,109 @@ register short index;
|
||||
printf(" Field Address: 0x%x\n",addr.pfield);
|
||||
printf(" Field Size: %d\n",addr.field_size);
|
||||
printf(" No Elements: %d\n",addr.no_elements);
|
||||
printf(" Special: %d\n",addr.special);
|
||||
printf(" Choice Set: %d\n",addr.choice_set);
|
||||
number_elements =
|
||||
((addr.no_elements > MAX_ELEMS)?MAX_ELEMS:addr.no_elements);
|
||||
|
||||
/* failedfetch as each type */
|
||||
if (db_get_field(paddr,DBR_STRING,tgf_buffer,1) < 0)
|
||||
printf("DBR_STRING failed\n");
|
||||
printf("\n\tDBR_STRING failed");
|
||||
else print_returned(DBR_STRING,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_INT,tgf_buffer,number_elements) < 0)
|
||||
printf("DBR_INT failed\n");
|
||||
else print_returned(DBR_INT,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_SHORT,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_SHORT failed");
|
||||
else print_returned(DBR_SHORT,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_FLOAT,tgf_buffer,number_elements) < 0)
|
||||
printf("DBR_FLOAT failed\n");
|
||||
printf("\n\tDBR_FLOAT failed");
|
||||
else print_returned(DBR_FLOAT,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_ENUM,tgf_buffer,number_elements) < 0)
|
||||
printf("DBR_ENUM failed\n");
|
||||
printf("\n\tDBR_ENUM failed");
|
||||
else print_returned(DBR_ENUM,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_CHAR,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_CHAR failed");
|
||||
else print_returned(DBR_CHAR,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_LONG,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_LONG failed");
|
||||
else print_returned(DBR_LONG,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_DOUBLE,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_DOUBLE failed");
|
||||
else print_returned(DBR_DOUBLE,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_STS_STRING,tgf_buffer,1) < 0)
|
||||
printf("DBR_STS_STRING failed\n");
|
||||
printf("\n\tDBR_STS_STRING failed");
|
||||
else print_returned(DBR_STS_STRING,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_STS_INT,tgf_buffer,number_elements) < 0)
|
||||
printf("DBR_STS_INT failed\n");
|
||||
else print_returned(DBR_STS_INT,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_STS_SHORT,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_STS_SHORT failed");
|
||||
else print_returned(DBR_STS_SHORT,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_STS_FLOAT,tgf_buffer,number_elements) < 0)
|
||||
printf("DBR_STS_FLOAT failed\n");
|
||||
printf("\n\tDBR_STS_FLOAT failed");
|
||||
else print_returned(DBR_STS_FLOAT,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_STS_ENUM,tgf_buffer,number_elements) < 0)
|
||||
printf("DBR_STS_ENUM failed\n");
|
||||
printf("\n\tDBR_STS_ENUM failed");
|
||||
else print_returned(DBR_STS_ENUM,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_GR_INT,tgf_buffer,number_elements) < 0)
|
||||
printf("DBR_GR_INT failed\n");
|
||||
else print_returned(DBR_GR_INT,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_STS_CHAR,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_STS_CHAR failed");
|
||||
else print_returned(DBR_STS_CHAR,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_STS_LONG,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_STS_LONG failed");
|
||||
else print_returned(DBR_STS_LONG,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_STS_DOUBLE,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_STS_DOUBLE failed");
|
||||
else print_returned(DBR_STS_DOUBLE,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_TIME_STRING,tgf_buffer,1) < 0)
|
||||
printf("\n\tDBR_TIME_STRING failed");
|
||||
else print_returned(DBR_TIME_STRING,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_TIME_SHORT,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_TIME_SHORT failed");
|
||||
else print_returned(DBR_TIME_SHORT,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_TIME_FLOAT,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_TIME_FLOAT failed");
|
||||
else print_returned(DBR_TIME_FLOAT,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_TIME_ENUM,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_TIME_ENUM failed");
|
||||
else print_returned(DBR_TIME_ENUM,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_TIME_CHAR,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_TIME_CHAR failed");
|
||||
else print_returned(DBR_TIME_CHAR,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_TIME_LONG,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_TIME_LONG failed");
|
||||
else print_returned(DBR_TIME_LONG,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_TIME_DOUBLE,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_TIME_DOUBLE failed");
|
||||
else print_returned(DBR_TIME_DOUBLE,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_GR_STRING,tgf_buffer,1) < 0)
|
||||
printf("\n\tDBR_GR_STRING failed");
|
||||
else print_returned(DBR_GR_STRING,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_GR_SHORT,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_GR_SHORT failed");
|
||||
else print_returned(DBR_GR_SHORT,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_GR_FLOAT,tgf_buffer,number_elements) < 0)
|
||||
printf("DBR_GR_FLOAT failed\n");
|
||||
printf("\n\tDBR_GR_FLOAT failed");
|
||||
else print_returned(DBR_GR_FLOAT,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_CTRL_INT,tgf_buffer,number_elements) < 0)
|
||||
printf("DBR_CTRL_INT failed\n");
|
||||
else print_returned(DBR_CTRL_INT,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_GR_ENUM,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_GR_ENUM failed");
|
||||
else print_returned(DBR_GR_ENUM,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_GR_CHAR,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_GR_CHAR failed");
|
||||
else print_returned(DBR_GR_CHAR,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_GR_LONG,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_GR_LONG failed");
|
||||
else print_returned(DBR_GR_LONG,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_GR_DOUBLE,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_GR_DOUBLE failed");
|
||||
else print_returned(DBR_GR_DOUBLE,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_CTRL_SHORT,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_CTRL_SHORT failed");
|
||||
else print_returned(DBR_CTRL_SHORT,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_CTRL_FLOAT,tgf_buffer,number_elements) < 0)
|
||||
printf("DBR_CTRL_FLOAT failed\n");
|
||||
printf("\n\tDBR_CTRL_FLOAT failed");
|
||||
else print_returned(DBR_CTRL_FLOAT,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_CTRL_ENUM,tgf_buffer,number_elements) < 0)
|
||||
printf("DBR_CTRL_ENUM failed\n");
|
||||
else print_returned(DBR_CTRL_ENUM,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_CTRL_CHAR,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_CTRL_CHAR failed");
|
||||
else print_returned(DBR_CTRL_CHAR,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_CTRL_LONG,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_CTRL_LONG failed");
|
||||
else print_returned(DBR_CTRL_LONG,tgf_buffer,number_elements);
|
||||
if (db_get_field(paddr,DBR_CTRL_DOUBLE,tgf_buffer,number_elements) < 0)
|
||||
printf("\n\tDBR_CTRL_DOUBLE failed");
|
||||
else print_returned(DBR_CTRL_DOUBLE,tgf_buffer,number_elements);
|
||||
printf("\n");
|
||||
return(0);
|
||||
}
|
||||
@@ -111,7 +169,7 @@ register short index;
|
||||
* TPF
|
||||
* Test put field
|
||||
*/
|
||||
int tpf(pname,pvalue,index)
|
||||
int pft(pname,pvalue,index)
|
||||
char *pname;
|
||||
char *pvalue;
|
||||
register short index;
|
||||
@@ -141,26 +199,54 @@ register short index;
|
||||
printf(" Field Address: 0x%x\n",addr.pfield);
|
||||
printf(" Field Size: %d\n",addr.field_size);
|
||||
printf(" No Elements: %d\n",addr.no_elements);
|
||||
printf(" Special: %d\n",addr.special);
|
||||
printf(" Choice Set: %d\n",addr.choice_set);
|
||||
if (db_put_field(paddr,DBR_STRING,pvalue,1) < 0) printf(" failed\n");
|
||||
if (db_get_field(paddr,DBR_STRING,buffer,1) < 0) printf("failed\n");
|
||||
if (db_put_field(paddr,DBR_STRING,pvalue,1) < 0) printf("\n\t failed ");
|
||||
if (db_get_field(paddr,DBR_STRING,buffer,1) < 0) printf("\n\tfailed");
|
||||
else print_returned(DBR_STRING,buffer,1);
|
||||
if(addr.field_type<=DBF_STRING || addr.field_type>=DBF_NO_ACCESS)return(0);
|
||||
if(addr.field_type<=DBF_STRING || addr.field_type>=DBF_NO_ACCESS)
|
||||
return(0);
|
||||
if(sscanf(pvalue,"%hd",&shortvalue)==1) {
|
||||
if (db_put_field(paddr,DBR_INT,&shortvalue,1) < 0) printf(" INT failed\n");
|
||||
if (db_get_field(paddr,DBR_INT,buffer,1) < 0) printf("INT GET failed\n");
|
||||
else print_returned(DBR_INT,buffer,1);
|
||||
if (db_put_field(paddr,DBR_SHORT,&shortvalue,1) < 0)
|
||||
printf("\n\t SHORT failed ");
|
||||
if (db_get_field(paddr,DBR_SHORT,buffer,1) < 0)
|
||||
printf("\n\t SHORT GET failed");
|
||||
else print_returned(DBR_SHORT,buffer,1);
|
||||
}
|
||||
if(sscanf(pvalue,"%ld",&longvalue)==1) {
|
||||
if (db_put_field(paddr,DBR_LONG,&longvalue,1) < 0)
|
||||
printf("\n\t LONG failed ");
|
||||
if (db_get_field(paddr,DBR_LONG,buffer,1) < 0)
|
||||
printf("\n\t LONG GET failed");
|
||||
else print_returned(DBR_LONG,buffer,1);
|
||||
}
|
||||
if(sscanf(pvalue,"%f",&floatvalue)==1) {
|
||||
if (db_put_field(paddr,DBR_FLOAT,&floatvalue,1) < 0) printf("FLOAT failed\n");
|
||||
if (db_get_field(paddr,DBR_FLOAT,buffer,1) < 0) printf("FLOAT GET failed\n");
|
||||
else print_returned(DBR_FLOAT,buffer,1);
|
||||
if (db_put_field(paddr,DBR_FLOAT,&floatvalue,1) < 0)
|
||||
printf("\n\t FLOAT failed ");
|
||||
if (db_get_field(paddr,DBR_FLOAT,buffer,1) < 0)
|
||||
printf("\n\t FLOAT GET failed");
|
||||
else print_returned(DBR_FLOAT,buffer,1);
|
||||
}
|
||||
if(sscanf(pvalue,"%f",&floatvalue)==1) {
|
||||
doublevalue=floatvalue;
|
||||
if (db_put_field(paddr,DBR_DOUBLE,&doublevalue,1) < 0)
|
||||
printf("\n\t DOUBLE failed ");
|
||||
if (db_get_field(paddr,DBR_DOUBLE,buffer,1) < 0)
|
||||
printf("\n\t DOUBLE GET failed");
|
||||
else print_returned(DBR_DOUBLE,buffer,1);
|
||||
}
|
||||
if(sscanf(pvalue,"%hd",&shortvalue)==1) {
|
||||
charvalue=(unsigned char)shortvalue;
|
||||
if (db_put_field(paddr,DBR_CHAR,&charvalue,1) < 0)
|
||||
printf("\n\t CHAR failed ");
|
||||
if (db_get_field(paddr,DBR_CHAR,buffer,1) < 0)
|
||||
printf("\n\t CHAR GET failed");
|
||||
else print_returned(DBR_CHAR,buffer,1);
|
||||
}
|
||||
if(sscanf(pvalue,"%hu",&shortvalue)==1) {
|
||||
if (db_put_field(paddr,DBR_ENUM,&shortvalue,1) < 0) printf("ENUM failed\n");
|
||||
if (db_get_field(paddr,DBR_ENUM,buffer,1) < 0) printf("ENUM GET failed\n");
|
||||
else print_returned(DBR_ENUM,buffer,1);
|
||||
if (db_put_field(paddr,DBR_ENUM,&shortvalue,1) < 0)
|
||||
printf("\n\t ENUM failed ");
|
||||
if (db_get_field(paddr,DBR_ENUM,buffer,1) < 0)
|
||||
printf("\n\t ENUM GET failed");
|
||||
else print_returned(DBR_ENUM,buffer,1);
|
||||
}
|
||||
printf("\n");
|
||||
return(0);
|
||||
@@ -172,30 +258,30 @@ register short index;
|
||||
* print out the values in a database access interface structure
|
||||
*/
|
||||
static print_returned(type,pbuffer,count)
|
||||
register short type;
|
||||
register char *pbuffer;
|
||||
short count;
|
||||
register short type;
|
||||
register char *pbuffer;
|
||||
short count;
|
||||
{
|
||||
register short i;
|
||||
|
||||
switch(type){
|
||||
case (DBR_STRING):
|
||||
printf("DBR_STRING: %s",pbuffer);
|
||||
printf("\n\tDBR_STRING Value: %s",pbuffer);
|
||||
break;
|
||||
case (DBR_INT):
|
||||
case (DBR_SHORT):
|
||||
{
|
||||
register short *pvalue = (short *)pbuffer;
|
||||
printf("DBR_INT: ");
|
||||
printf("\n\tDBR_SHORT ");
|
||||
for (i = 0; i < count; i++,pvalue++){
|
||||
printf("%d ",*(short *)pvalue);
|
||||
if ((i % 16) == 15) printf("\t\n");
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_FLOAT):
|
||||
{
|
||||
register float *pvalue = (float *)pbuffer;
|
||||
printf("DBR_FLOAT: ");
|
||||
printf("\n\tDBR_FLOAT ");
|
||||
for (i = 0; i < count; i++,pvalue++){
|
||||
printf("%6.4f ",*(float *)pvalue);
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
@@ -205,23 +291,59 @@ short count;
|
||||
case (DBR_ENUM):
|
||||
{
|
||||
register short *pvalue = (short *)pbuffer;
|
||||
printf("DBR_ENUM: %d",*pvalue);
|
||||
printf("\n\tDBR_ENUM %d",*pvalue);
|
||||
break;
|
||||
}
|
||||
case (DBR_CHAR):
|
||||
{
|
||||
int value;
|
||||
|
||||
printf("\n\tDBR_CHAR ");
|
||||
for (i = 0; i < count; i++,pbuffer++){
|
||||
value = *(unsigned char *)pbuffer;
|
||||
printf("%d ",value);
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_LONG):
|
||||
{
|
||||
register long *pvalue = (long *)pbuffer;
|
||||
printf("\n\tDBR_LONG ");
|
||||
for (i = 0; i < count; i++,pvalue++){
|
||||
printf("0x%x ",*pvalue);
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_DOUBLE):
|
||||
{
|
||||
register double *pvalue = (double *)pbuffer;
|
||||
printf("\n\tDBR_DOUBLE ");
|
||||
for (i = 0; i < count; i++,pvalue++){
|
||||
printf("%6.4f ",(float)(*pvalue));
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_STS_STRING):
|
||||
case (DBR_GR_STRING):
|
||||
case (DBR_CTRL_STRING):
|
||||
{
|
||||
register struct dbr_sts_string *pvalue
|
||||
= (struct dbr_sts_string *) pbuffer;
|
||||
printf("DBR_STS_STRING %2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\n\tDBR_STS_STRING %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\tValue: %s",pvalue->value);
|
||||
break;
|
||||
}
|
||||
case (DBR_STS_INT):
|
||||
case (DBR_STS_SHORT):
|
||||
{
|
||||
register struct dbr_sts_int *pvalue
|
||||
= (struct dbr_sts_int *)pbuffer;
|
||||
register struct dbr_sts_short *pvalue
|
||||
= (struct dbr_sts_short *)pbuffer;
|
||||
register short *pshort = &pvalue->value;
|
||||
printf("DBR_STS_INT %2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\n\tDBR_STS_SHORT %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\tValue: ");
|
||||
for (i = 0; i < count; i++,pshort++){
|
||||
printf("%d ",*pshort);
|
||||
@@ -234,7 +356,8 @@ short count;
|
||||
register struct dbr_sts_float *pvalue
|
||||
= (struct dbr_sts_float *)pbuffer;
|
||||
register float *pfloat = &pvalue->value;
|
||||
printf("DBR_STS_FLOAT %2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\n\tDBR_STS_FLOAT %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\tValue: ");
|
||||
for (i = 0; i < count; i++,pfloat++){
|
||||
printf("%6.4f ",*pfloat);
|
||||
@@ -246,21 +369,165 @@ short count;
|
||||
{
|
||||
register struct dbr_sts_enum *pvalue
|
||||
= (struct dbr_sts_enum *)pbuffer;
|
||||
printf("DBR_STS_ENUM %2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\n\tDBR_STS_ENUM %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\tValue: %d",pvalue->value);
|
||||
break;
|
||||
}
|
||||
case (DBR_GR_INT):
|
||||
case (DBR_STS_CHAR):
|
||||
{
|
||||
register struct dbr_gr_int *pvalue
|
||||
= (struct dbr_gr_int *)pbuffer;
|
||||
register struct dbr_sts_char *pvalue
|
||||
= (struct dbr_sts_char *)pbuffer;
|
||||
register unsigned char *pchar = &pvalue->value;
|
||||
short value;
|
||||
|
||||
printf("\n\tDBR_STS_CHAR %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\tValue: ");
|
||||
for (i = 0; i < count; i++,pchar++){
|
||||
value=*pchar;
|
||||
printf("%d ",value);
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_STS_LONG):
|
||||
{
|
||||
register struct dbr_sts_long *pvalue
|
||||
= (struct dbr_sts_long *)pbuffer;
|
||||
register long *plong = &pvalue->value;
|
||||
printf("\n\tDBR_STS_LONG %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\tValue: ");
|
||||
for (i = 0; i < count; i++,plong++){
|
||||
printf("0x%lx ",*plong);
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_STS_DOUBLE):
|
||||
{
|
||||
register struct dbr_sts_double *pvalue
|
||||
= (struct dbr_sts_double *)pbuffer;
|
||||
register double *pdouble = &pvalue->value;
|
||||
printf("\n\tDBR_STS_DOUBLE %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\tValue: ");
|
||||
for (i = 0; i < count; i++,pdouble++){
|
||||
printf("%6.4f ",(float)(*pdouble));
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_TIME_STRING):
|
||||
{
|
||||
register struct dbr_time_string *pvalue
|
||||
= (struct dbr_time_string *) pbuffer;
|
||||
printf("\n\tDBR_TIME_STRING %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\n\tTimeStamp: %lx %lx \n\tValue: ",
|
||||
pvalue->stamp.secPastEpoch, pvalue->stamp.nsec);
|
||||
printf("%s\n\t",pvalue->value);
|
||||
break;
|
||||
}
|
||||
case (DBR_TIME_SHORT):
|
||||
{
|
||||
register struct dbr_time_short *pvalue
|
||||
= (struct dbr_time_short *)pbuffer;
|
||||
register short *pshort = &pvalue->value;
|
||||
printf("DBR_GR_INT %2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\n\tDBR_TIME_SHORT %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\tTimeStamp: %lx %lx \n\tValue: ",
|
||||
pvalue->stamp.secPastEpoch, pvalue->stamp.nsec);
|
||||
for (i = 0; i < count; i++,pshort++){
|
||||
printf("%d ",*pshort);
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_TIME_FLOAT):
|
||||
{
|
||||
register struct dbr_time_float *pvalue
|
||||
= (struct dbr_time_float *)pbuffer;
|
||||
register float *pfloat = &pvalue->value;
|
||||
printf("\n\tDBR_TIME_FLOAT %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\tTimeStamp: %lx %lx \n\tValue: ",
|
||||
pvalue->stamp.secPastEpoch, pvalue->stamp.nsec);
|
||||
for (i = 0; i < count; i++,pfloat++){
|
||||
printf("%6.4f ",*pfloat);
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_TIME_ENUM):
|
||||
{
|
||||
register struct dbr_time_enum *pvalue
|
||||
= (struct dbr_time_enum *)pbuffer;
|
||||
printf("\n\tDBR_TIME_ENUM %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\tTimeStamp: %lx %lx \n\tValue: ",
|
||||
pvalue->stamp.secPastEpoch, pvalue->stamp.nsec);
|
||||
printf("%d\n\t",pvalue->value);
|
||||
break;
|
||||
}
|
||||
case (DBR_TIME_CHAR):
|
||||
{
|
||||
register struct dbr_time_char *pvalue
|
||||
= (struct dbr_time_char *)pbuffer;
|
||||
register unsigned char *pchar = &pvalue->value;
|
||||
printf("\n\tDBR_TIME_CHAR %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\tTimeStamp: %lx %lx \n\tValue: ",
|
||||
pvalue->stamp.secPastEpoch, pvalue->stamp.nsec);
|
||||
for (i = 0; i < count; i++,pchar++){
|
||||
printf("%d ",(short)(*pchar));
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_TIME_LONG):
|
||||
{
|
||||
register struct dbr_time_long *pvalue
|
||||
= (struct dbr_time_long *)pbuffer;
|
||||
register long *plong = &pvalue->value;
|
||||
printf("\n\tDBR_TIME_LONG %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\tTimeStamp: %lx %lx \n\tValue: ",
|
||||
pvalue->stamp.secPastEpoch, pvalue->stamp.nsec);
|
||||
for (i = 0; i < count; i++,plong++){
|
||||
printf("0x%lx ",*plong);
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_TIME_DOUBLE):
|
||||
{
|
||||
register struct dbr_time_double *pvalue
|
||||
= (struct dbr_time_double *)pbuffer;
|
||||
register double *pdouble = &pvalue->value;
|
||||
printf("\n\tDBR_TIME_DOUBLE %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\tTimeStamp: %lx %lx \n\tValue: ",
|
||||
pvalue->stamp.secPastEpoch, pvalue->stamp.nsec);
|
||||
for (i = 0; i < count; i++,pdouble++){
|
||||
printf("%6.4f ",(float)(*pdouble));
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_GR_SHORT):
|
||||
{
|
||||
register struct dbr_gr_short *pvalue
|
||||
= (struct dbr_gr_short *)pbuffer;
|
||||
register short *pshort = &pvalue->value;
|
||||
printf("\n\tDBR_GR_SHORT %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf(" %.8s %6d %6d %6d %6d %6d %6d",pvalue->units,
|
||||
pvalue->upper_disp_limit,pvalue->lower_disp_limit,
|
||||
pvalue->upper_alarm_limit,pvalue->upper_warning_limit,
|
||||
pvalue->lower_warning_limit,pvalue->lower_alarm_limit);
|
||||
printf("\nValue:\t");
|
||||
printf("\n\tValue: ");
|
||||
for (i = 0; i < count; i++,pshort++){
|
||||
printf("%d ",*pshort);
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
@@ -272,32 +539,105 @@ short count;
|
||||
register struct dbr_gr_float *pvalue
|
||||
= (struct dbr_gr_float *)pbuffer;
|
||||
register float *pfloat = &pvalue->value;
|
||||
printf("DBR_GR_FLOAT%2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\n\tDBR_GR_FLOAT%2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf(" %3d %.8s\n\t%6.4f %6.4f %6.4f %6.4f %6.4f %6.4f",
|
||||
pvalue->precision, pvalue->units,
|
||||
pvalue->upper_disp_limit,pvalue->lower_disp_limit,
|
||||
pvalue->upper_alarm_limit,pvalue->upper_warning_limit,
|
||||
pvalue->lower_warning_limit,pvalue->lower_alarm_limit);
|
||||
printf("\nValue\t");
|
||||
printf("\n\tValue: ");
|
||||
for (i = 0; i < count; i++,pfloat++){
|
||||
printf("%6.4f ",*pfloat);
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_CTRL_INT):
|
||||
case (DBR_GR_ENUM):
|
||||
case (DBR_CTRL_ENUM):
|
||||
{
|
||||
register struct dbr_ctrl_int *pvalue
|
||||
= (struct dbr_ctrl_int *)pbuffer;
|
||||
register struct dbr_gr_enum *pvalue
|
||||
= (struct dbr_gr_enum *)pbuffer;
|
||||
printf("\n\tDBR_GR_ENUM%2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("\n\t%3d",pvalue->no_str);
|
||||
for (i = 0; i < pvalue->no_str; i++)
|
||||
printf("\n\t%.26s",pvalue->strs[i]);
|
||||
printf("\n\tValue: %d",pvalue->value);
|
||||
break;
|
||||
}
|
||||
case (DBR_GR_CHAR):
|
||||
{
|
||||
register struct dbr_gr_char *pvalue
|
||||
= (struct dbr_gr_char *)pbuffer;
|
||||
register unsigned char *pchar = &pvalue->value;
|
||||
printf("\n\tDBR_GR_CHAR%2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf(" %.8s %4d %4d %4d %4d %4d %4d",pvalue->units,
|
||||
pvalue->upper_disp_limit,pvalue->lower_disp_limit,
|
||||
pvalue->upper_alarm_limit,pvalue->upper_warning_limit,
|
||||
pvalue->lower_warning_limit,pvalue->lower_alarm_limit);
|
||||
printf("\n\tValue: ");
|
||||
for (i = 0; i < count; i++,pchar++){
|
||||
printf("%d ",(short)(*pchar));
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_GR_LONG):
|
||||
{
|
||||
register struct dbr_gr_long *pvalue
|
||||
= (struct dbr_gr_long *)pbuffer;
|
||||
register long *plong = &pvalue->value;
|
||||
printf("\n\tDBR_GR_LONG %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf("%.8s\n\t%8d %8d %8d %8d %8d %8d",pvalue->units,
|
||||
pvalue->upper_disp_limit,pvalue->lower_disp_limit,
|
||||
pvalue->upper_alarm_limit,pvalue->upper_warning_limit,
|
||||
pvalue->lower_warning_limit,pvalue->lower_alarm_limit);
|
||||
printf("\n\tValue: ");
|
||||
for (i = 0; i < count; i++,plong++){
|
||||
printf("0x%lx ",*plong);
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_GR_DOUBLE):
|
||||
{
|
||||
register struct dbr_gr_double *pvalue
|
||||
= (struct dbr_gr_double *)pbuffer;
|
||||
register double *pdouble = &pvalue->value;
|
||||
printf("\n\tDBR_GR_DOUBLE %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf(" %3d %.8s\n\t%6.4f %6.4f %6.4f %6.4f %6.4f %6.4f",
|
||||
pvalue->precision, pvalue->units,
|
||||
(float)(pvalue->upper_disp_limit),
|
||||
(float)(pvalue->lower_disp_limit),
|
||||
(float)(pvalue->upper_alarm_limit),
|
||||
(float)(pvalue->upper_warning_limit),
|
||||
(float)(pvalue->lower_warning_limit),
|
||||
(float)(pvalue->lower_alarm_limit));
|
||||
printf("\n\tValue: ");
|
||||
for (i = 0; i < count; i++,pdouble++){
|
||||
printf("%6.4f ",(float)(*pdouble));
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_CTRL_SHORT):
|
||||
{
|
||||
register struct dbr_ctrl_short *pvalue
|
||||
= (struct dbr_ctrl_short *)pbuffer;
|
||||
register short *pshort = &pvalue->value;
|
||||
printf("DBR_CTRL_INT %2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\n\tDBR_CTRL_SHORT %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf(" %.8s\n\t%6d %6d %6d %6d %6d %6d",pvalue->units,
|
||||
pvalue->upper_disp_limit,pvalue->lower_disp_limit,
|
||||
pvalue->upper_alarm_limit,pvalue->upper_warning_limit,
|
||||
pvalue->lower_warning_limit,pvalue->lower_alarm_limit);
|
||||
printf(" %6d %6d",
|
||||
pvalue->upper_ctrl_limit,pvalue->lower_ctrl_limit);
|
||||
printf("\n\t");
|
||||
printf("\n\tValue: ");
|
||||
for (i = 0; i < count; i++,pshort++){
|
||||
printf("%d ",*pshort);
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
@@ -309,7 +649,8 @@ short count;
|
||||
register struct dbr_ctrl_float *pvalue
|
||||
= (struct dbr_ctrl_float *)pbuffer;
|
||||
register float *pfloat = &pvalue->value;
|
||||
printf("DBR_CTRL_FLOAT %2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\n\tDBR_CTRL_FLOAT %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf(" %3d %.8s\n\t%6.4f %6.4f %6.4f %6.4f %6.4f %6.4f",
|
||||
pvalue->precision, pvalue->units,
|
||||
pvalue->upper_disp_limit,pvalue->lower_disp_limit,
|
||||
@@ -317,25 +658,78 @@ short count;
|
||||
pvalue->lower_warning_limit,pvalue->lower_alarm_limit);
|
||||
printf(" %6.4f %6.4f",
|
||||
pvalue->upper_ctrl_limit,pvalue->lower_ctrl_limit);
|
||||
printf("\n\t");
|
||||
printf("\n\tValue: ");
|
||||
for (i = 0; i < count; i++,pfloat++){
|
||||
printf("%6.4f ",*pfloat);
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_CTRL_ENUM):
|
||||
case (DBR_CTRL_CHAR):
|
||||
{
|
||||
register struct dbr_ctrl_enum *pvalue
|
||||
= (struct dbr_ctrl_enum *)pbuffer;
|
||||
printf("DBR_GR_ENUM%2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\n\t%3d",pvalue->no_str);
|
||||
for (i = 0; i < pvalue->no_str; i++)
|
||||
printf("\n\t%.26s",pvalue->strs[i]);
|
||||
printf("Value: %d",pvalue->value);
|
||||
register struct dbr_ctrl_char *pvalue
|
||||
= (struct dbr_ctrl_char *)pbuffer;
|
||||
register unsigned char *pchar = &pvalue->value;
|
||||
printf("\n\tDBR_CTRL_CHAR %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf(" %.8s %4d %4d %4d %4d %4d %4d",pvalue->units,
|
||||
pvalue->upper_disp_limit,pvalue->lower_disp_limit,
|
||||
pvalue->upper_alarm_limit,pvalue->upper_warning_limit,
|
||||
pvalue->lower_warning_limit,pvalue->lower_alarm_limit);
|
||||
printf(" %4d %4d",
|
||||
pvalue->upper_ctrl_limit,pvalue->lower_ctrl_limit);
|
||||
printf("\n\tValue: ");
|
||||
for (i = 0; i < count; i++,pchar++){
|
||||
printf("%4d ",(short)(*pchar));
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_CTRL_LONG):
|
||||
{
|
||||
register struct dbr_ctrl_long *pvalue
|
||||
= (struct dbr_ctrl_long *)pbuffer;
|
||||
register long *plong = &pvalue->value;
|
||||
printf("\n\tDBR_CTRL_LONG %2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf(" %.8s %8d %8d\n\t%8d %8d %8d %8d",pvalue->units,
|
||||
pvalue->upper_disp_limit,pvalue->lower_disp_limit,
|
||||
pvalue->upper_alarm_limit,pvalue->upper_warning_limit,
|
||||
pvalue->lower_warning_limit,pvalue->lower_alarm_limit);
|
||||
printf(" %8d %8d",
|
||||
pvalue->upper_ctrl_limit,pvalue->lower_ctrl_limit);
|
||||
printf("\n\tValue: ");
|
||||
for (i = 0; i < count; i++,plong++){
|
||||
printf("0x%lx ",*plong);
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (DBR_CTRL_DOUBLE):
|
||||
{
|
||||
register struct dbr_ctrl_double *pvalue
|
||||
= (struct dbr_ctrl_double *)pbuffer;
|
||||
register double *pdouble = &pvalue->value;
|
||||
printf("\n\tDBR_CTRL_DOUBLE%2d %2d",pvalue->status,
|
||||
pvalue->severity);
|
||||
printf(" %3d %.8s\n\t%6.6f %6.6f %6.6f %6.6f %6.6f %6.6f",
|
||||
pvalue->precision, pvalue->units,
|
||||
(float)(pvalue->upper_disp_limit),
|
||||
(float)(pvalue->lower_disp_limit),
|
||||
(float)(pvalue->upper_alarm_limit),
|
||||
(float)(pvalue->upper_warning_limit),
|
||||
(float)(pvalue->lower_warning_limit),
|
||||
(float)(pvalue->lower_alarm_limit));
|
||||
printf(" %6.6f %6.6f",
|
||||
(float)(pvalue->upper_ctrl_limit),
|
||||
(float)(pvalue->lower_ctrl_limit));
|
||||
printf("\n\tValue: ");
|
||||
for (i = 0; i < count; i++,pdouble++){
|
||||
printf("%6.6f ",(float)(*pdouble));
|
||||
if ((i % 16) == 15) printf("\n\t");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* iocInit.c ioc initialization */
|
||||
/* share/src/db $Id$ */
|
||||
/* share/src/db @(#)iocInit.c 1.7 3/6/91 */
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
@@ -29,15 +29,14 @@
|
||||
|
||||
static initialized=FALSE;
|
||||
|
||||
|
||||
/* define forward references*/
|
||||
long initBusController();
|
||||
long sdrLoad();
|
||||
long initDrvSup();
|
||||
long initRecSup();
|
||||
long initDevSup();
|
||||
long initDatabase();
|
||||
long addToSet();
|
||||
extern long initBusController();
|
||||
extern long sdrLoad();
|
||||
extern long initDrvSup();
|
||||
extern long initRecSup();
|
||||
extern long initDevSup();
|
||||
extern long initDatabase();
|
||||
extern long addToSet();
|
||||
|
||||
|
||||
iocInit(pfilename)
|
||||
@@ -70,7 +69,10 @@ char * pfilename;
|
||||
logMsg("Scanners Initialized\n");
|
||||
rsrv_init();
|
||||
logMsg("Channel Access Servers Initialized\n");
|
||||
ts_init();
|
||||
logMsg("Time Stamp Driver Initialized\n");
|
||||
logMsg("iocInit: All initialization complete\n");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -88,7 +90,7 @@ long initBusController(){ /*static */
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long initDrvSup() /* Locate all driver support entry tables */
|
||||
long initDrvSup() /* Locate all driver support entry tables */
|
||||
{
|
||||
char *pname;
|
||||
char name[40];
|
||||
@@ -122,7 +124,7 @@ static long initDrvSup() /* Locate all driver support entry tables */
|
||||
return(rtnval);
|
||||
}
|
||||
|
||||
static long initRecSup()
|
||||
long initRecSup()
|
||||
{
|
||||
char name[40];
|
||||
int i;
|
||||
@@ -164,7 +166,7 @@ static long initRecSup()
|
||||
return(rtnval);
|
||||
}
|
||||
|
||||
static long initDevSup() /* Locate all device support entry tables */
|
||||
long initDevSup() /* Locate all device support entry tables */
|
||||
{
|
||||
char *pname;
|
||||
char name[40];
|
||||
@@ -218,7 +220,7 @@ static long initDevSup() /* Locate all device support entry tables */
|
||||
return(rtnval);
|
||||
}
|
||||
|
||||
static long initDatabase()
|
||||
long initDatabase()
|
||||
{
|
||||
char name[PVNAME_SZ+FLDNAME_SZ+2];
|
||||
short i,j,k;
|
||||
@@ -332,7 +334,7 @@ static long initDatabase()
|
||||
return(rtnval);
|
||||
}
|
||||
|
||||
static long addToSet(precord,record_type,lookAhead,i,j,lset)
|
||||
long addToSet(precord,record_type,lookAhead,i,j,lset)
|
||||
struct dbCommon *precord; /* record being added to lock set*/
|
||||
short record_type; /* record being added to lock set*/
|
||||
short lookAhead; /*should following records be checked*/
|
||||
|
||||
Reference in New Issue
Block a user