added std hdrs and some fixes

This commit is contained in:
Janet B. Anderson
1991-06-07 16:56:23 +00:00
parent 657d8c331b
commit 96a09018d5
8 changed files with 251 additions and 237 deletions

View File

@@ -1,42 +1,35 @@
/* dbAccess.c */
/* share/src/db $Id$ */
/* share/src/db $Id$ */
/*dbAccess.c
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 11-7-90
*
* This is the former IOCDBACCESS.C
* Experimental Physics and Industrial Control System (EPICS)
*
* database access subroutines
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Author: Bob Dalesio(LANL) and Marty Kraimer(ANL)
* Date: 11/7/90
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Control System Software for the GTA Project
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Copyright 1988, 1989, the Regents of the University of California.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
* .xx mm-dd-yy mrk Comment
*
* .01 mm-dd-yy iii Comment
*/
/* Global Database Access Routines
@@ -236,7 +229,7 @@ long dbProcess(paddr)
prset=GET_PRSET(paddr->record_type);
if( prset && prset->get_value ){
(*prset->get_value)(precord,&valueDes);
db_post_events(precord,valueDes.pvalue,DBE_VALUE|DBE_ALARM|DBE_LOG);
db_post_events(precord,valueDes.pvalue,DBE_VALUE|DBE_ALARM);
}
return(0);
} else precord->lcnt=0;
@@ -476,10 +469,6 @@ int precision;
short number;
char *pfirst_digit;
if(flt_value>0e0 && flt_value<udfFtest) {
strcpy(pstr_value,"undefined");
return;
}
pfirst_digit = pstr_value;
if (flt_value < 0){
*pstr_value = '-';
@@ -625,10 +614,6 @@ static void short_to_str(source,pdest)
*pdest = 0;
return;
}
if(source==udfShort) {
strcpy(pdest,"undefined");
return;
}
if(source<0) {
*pdest++ = '-';
if(source == -32768) {
@@ -663,10 +648,6 @@ static void ushort_to_str(source,pdest)
*pdest = 0;
return;
}
if(source==udfUshort) {
strcpy(pdest,"undefined");
return;
}
val = source;
for(i=0; val!=0; i++) {
temp = val/10;
@@ -693,10 +674,6 @@ static void long_to_str(source,pdest)
*pdest = 0;
return;
}
if(source==udfLong) {
strcpy(pdest,"undefined");
return;
}
if(source<0) {
*pdest++ = '-';
if(source == -2147483648) {
@@ -731,10 +708,6 @@ static void ulong_to_str(source,pdest)
*pdest = 0;
return;
}
if(source==udfUlong) {
strcpy(pdest,"undefined");
return;
}
val = source;
for(i=0; val!=0; i++) {
temp = val/10;
@@ -5892,6 +5865,8 @@ long nRequest;
/* if the field is VAL and process_passive is true dont propagate*/
pfldDes = (struct fldDes *)(paddr->pfldDes);
pfield_name = (long *)&(pfldDes->fldname[0]);
/* if field is val set udf FALSE */
if (*pval == *pfield_name) precord->udf=FALSE;
if(precord->mlis.count &&
((*pval != *pfield_name) || (!pfldDes->process_passive)))
db_post_events(precord,paddr->pfield,DBE_VALUE);

View File

@@ -1,32 +1,31 @@
/* DB_EVENT.C */
/* share/src/db $Id$ */
/* routines for scheduling events to lower priority tasks via the RT kernel */
/*
*
* DB_EVENT.C
*
* routines for scheduling events to lower priority tasks via the RT kernel
*
* Author: Jeffrey O. Hill
* hill@luke.lanl.gov
* (505) 665-1831
* Date: 4-1-89
*
* Control System Software for the GTA Project
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1988, 1989, the Regents of the University of California.
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Andy Kozubal, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-6508
* E-mail: kozubal@k2.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* NOTES:
* 01 I have assumed that all C compilers align unions so that
@@ -590,7 +589,6 @@ register struct event_block *pevent;
ev_que->evque[putix] = pevent;
ev_que->valque[putix].stat = precord->stat;
sevr = precord->sevr;
if (sevr >1) sevr--; /* equivalent to adjust_severity() in db_access.c */
ev_que->valque[putix].sevr = sevr;
ev_que->valque[putix].time = precord->time;
/*
@@ -666,7 +664,6 @@ register unsigned int select;
ev_que->evque[putix] = event;
ev_que->valque[putix].stat = precord->stat;
sevr = precord->sevr;
if (sevr >1) sevr--; /* equivalent to adjust_severity() in db_access.c */
ev_que->valque[putix].sevr = sevr;
ev_que->valque[putix].time = precord->time;

View File

@@ -1,34 +1,31 @@
/* dbScan.c */
/* share/src/db $Id$ */
/* share/src/db $Id$ */
/* tasks and subroutines to scan the database */
/*
* dbScan.c - Database scanners
* Author: Bob Dalesio
* Date: 11-30-88
*
* tasks and subroutines to scan the database
* Experimental Physics and Industrial Control System (EPICS)
*
* Author: Bob Dalesio
* Date: 11-30-88
* @(#)dbscan.c 1.1S
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Control System Software for the GTA Project
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Copyright 1988, 1989, the Regents of the University of California.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -187,6 +184,7 @@
#include <interruptEvent.h>
#include <taskParams.h>
#include <module_types.h>
#include <fast_lock.h>
/* local routines */
static int add_to_periodic_list();
@@ -208,7 +206,7 @@ typedef unsigned long TIME;
/* db address struct: will contain the scan lists for all tasks */
struct scan_list{
unsigned short lock;
FAST_LOCK lock;
unsigned short scan_type;
unsigned short num_records;
unsigned short num_scan;
@@ -221,14 +219,15 @@ struct scan_list{
};
/* scan types */
/* These must match the GBL_SCAN choices in choiceGbl.ascii */
/* NOTE NOTE recAi.c and recWaveform.c both use E_IO_INTERRUPT*/
#define PASSIVE 0
#define P2SECOND 1
#define PSECOND 2
#define PHALFSECOND 3
#define PFIFTHSECOND 4
#define PTENTHSECOND 5
#define E_IO_INTERRUPT 6
#define E_EXTERNAL 7
#define E_EXTERNAL 6
#define E_IO_INTERRUPT 7
#define SL2SECOND 0
#define SLSECOND 1
@@ -250,7 +249,7 @@ struct scan_element{
#define MAX_IO_EVENTS 10
#define MAX_IO_EVENT_CHANS 32
struct io_event_list{
short lock;
FAST_LOCK lock;
short defined;
short io_type;
short card_type;
@@ -264,7 +263,7 @@ struct io_event_list{
#define MAX_EVENTS 100
#define MAX_EVENT_CHANS 10
struct event_list{
short lock;
FAST_LOCK lock;
short defined;
short event_number;
short number_defined;
@@ -329,6 +328,7 @@ static int eventTaskId = 0;
/* WATCHDOG GLOBALS */
static int wdScanTaskId = 0;
static int wdScanOff = 0;
int wdRestart=0;
/* CALLBACK GLOBALS */
@@ -385,7 +385,7 @@ periodicScanTask()
if(disableListScan[list]) continue;
/* lock the list */
if (!vxTas(&plist->lock)) continue;
FASTLOCK(&plist->lock);
/* process each set in each scan list */
for (scan=0; scan < plist->num_scan; scan++){
@@ -420,7 +420,7 @@ periodicScanTask()
}
}
/* unlock it */
plist->lock = 0;
FASTUNLOCK(&plist->lock);
}
/* sleep until next tenth second */
@@ -501,7 +501,7 @@ ioEventTask()
}
/* process each record in the scan list */
if (!vxTas(&pio_event_list->lock)) return; /* lock it */
FASTLOCK(&pio_event_list->lock); /* lock it */
index = 0;
pelement = &pio_event_list->element[0];
while (index < pio_event_list->number_defined){
@@ -517,7 +517,7 @@ ioEventTask()
pelement++;
index++;
}
pio_event_list->lock = 0; /* unlock it */
FASTUNLOCK(&pio_event_list->lock); /* unlock it */
}
}
}
@@ -564,7 +564,7 @@ eventTask()
}
/* process each record in the scan list */
if (!vxTas(&pevent_list->lock)) return; /* lock it */
FASTLOCK(&pevent_list->lock); /* lock it */
index = 0;
pelement = &pevent_list->element[0];
while (index < pevent_list->number_defined){
@@ -580,7 +580,7 @@ eventTask()
pelement++;
index++;
}
pevent_list->lock = 0; /* unlock it */
FASTUNLOCK(&pevent_list->lock); /* unlock it */
}
}
}
@@ -619,7 +619,7 @@ wdScanTask()
}
/* if any are suspended - restart them */
if (lists){
if (lists && wdRestart){
/* remove scan tasks */
remove_scan_tasks(lists);
@@ -672,6 +672,19 @@ callbackRequest(pcallback)
*/
scan_init()
{
int i;
/* Initialize all the fast locks */
for(i=0; i<NUM_LISTS; i++) {
FASTLOCKINIT(&lists[i].lock);
}
for(i=0; i<MAX_IO_EVENTS; i++) {
FASTLOCKINIT(&io_event_lists[i].lock);
}
for(i=0; i<MAX_EVENTS; i++) {
FASTLOCKINIT(&event_lists[i].lock);
}
/* remove scan tasks */
remove_scan_tasks(EVENT | IO_EVENT | PERIODIC | CALLBACK);
@@ -986,9 +999,9 @@ register short lists;
return;
}
if (status < 0){
((struct dbCommon *)(paddr->precord))->stat = SCAN_ALARM;
((struct dbCommon *)(paddr->precord))->sevr = MAJOR_ALARM;
if (status < 0 && (precord->nsev<MAJOR_ALARM)){
precord->nsta = SCAN_ALARM;
precord->nsev = MAJOR_ALARM;
}
return;
}
@@ -1008,18 +1021,18 @@ short list_index;
register struct scan_element *ptest_element;
/* lock the list during modification */
if (!vxTas(&lists[list_index].lock)) return(-1); /* lock it */
FASTLOCK(&lists[list_index].lock); /* lock it */
/* determine if we need to create a new set on this scan list */
set = lists[list_index].num_records / NUM_RECS_PER_SET;
if ((lists[list_index].num_records % NUM_RECS_PER_SET) == 0){
if (set >= NUM_SETS){
lists[list_index].lock = 0; /* unlock it */
FASTUNLOCK(&lists[list_index].lock); /* unlock it */
return(-1);
}
if ((lists[list_index].psets[set] =
(struct scan_element *)malloc(NUM_RECS_PER_SET*sizeof(struct scan_element))) == 0){
lists[list_index].lock = 0; /* unlock it */
FASTUNLOCK(&lists[list_index].lock); /* unlock it */
return(-1);
}
fill(lists[list_index].psets[set],NUM_RECS_PER_SET*sizeof(struct scan_element),0);
@@ -1078,7 +1091,7 @@ short list_index;
lists[list_index].set = 0;
/* unlock it */
lists[list_index].lock = 0;
FASTUNLOCK(&lists[list_index].lock);
return(0);
}
@@ -1152,7 +1165,7 @@ short card_number;
}
/* lock the list during modification */
if (!vxTas(&pio_event_list->lock)) return(-1);
FASTLOCK(&pio_event_list->lock);
/* add this record to the list */
if (pio_event_list->number_defined == 0){
@@ -1174,7 +1187,7 @@ short card_number;
pio_event_list->number_defined++;
/* unlock the list */
pio_event_list->lock = 0;
FASTUNLOCK(&pio_event_list->lock);
return(0);
}
@@ -1238,7 +1251,7 @@ short event;
}
/* lock the list during modification */
if (!vxTas(&pevent_list->lock)) return(-1);
FASTLOCK(&pevent_list->lock);
/* add this record to the list */
if (pevent_list->number_defined == 0){
@@ -1260,7 +1273,7 @@ short event;
pevent_list->number_defined++;
/* unlock the list */
pevent_list->lock = 0;
FASTUNLOCK(&pevent_list->lock);
return(0);
}
@@ -1334,7 +1347,7 @@ short list_index;
short end_of_list;
/* lock the list during modification */
if (!vxTas(&lists[list_index].lock)) return(-1);
FASTLOCK(&lists[list_index].lock);
/* find this record */
found = FALSE;
@@ -1358,7 +1371,7 @@ short list_index;
}
}
if (!found){
lists[list_index].lock = 0; /* unlock it */
FASTUNLOCK(&lists[list_index].lock); /* unlock it */
return(-1);
}
@@ -1398,7 +1411,7 @@ short list_index;
}
/* unlock the scan list */
lists[list_index].lock = 0;
FASTUNLOCK(&lists[list_index].lock);
return(0);
}
@@ -1441,7 +1454,7 @@ short card_number;
if (!found) return(-1);
/* lock the list during modification */
if (!vxTas(&pio_event_list->lock)) return(-1);
FASTLOCK(&pio_event_list->lock);
/* find this record in the list */
index = 0;
@@ -1457,7 +1470,7 @@ short card_number;
}
}
if (!found){
pio_event_list->lock = 0; /* unlock it */
FASTUNLOCK(&pio_event_list->lock); /* unlock it */
return(-1);
}
@@ -1482,7 +1495,7 @@ short card_number;
}
/* unlock the list */
pio_event_list->lock = 0;
FASTUNLOCK(&pio_event_list->lock);
return(0);
}
@@ -1521,7 +1534,7 @@ short event;
if (!found) return(-1);
/* lock the list during modification */
if (!vxTas(&pevent_list->lock)) return(-1);
FASTLOCK(&pevent_list->lock);
/* find this record in the list */
index = 0;
@@ -1537,7 +1550,7 @@ short event;
}
}
if (!found){
pevent_list->lock = 0; /* unlock it */
FASTUNLOCK(&pevent_list->lock); /* unlock it */
return(-1);
}
@@ -1560,7 +1573,7 @@ short event;
}
/* unlock the list */
pevent_list->lock = 0;
FASTUNLOCK(&pevent_list->lock);
return(0);
}
@@ -1764,5 +1777,3 @@ short event_number;
rngBufPut(eventQ,&event_number,sizeof(short));
semGive(&eventSem);
}

View File

@@ -1,37 +1,36 @@
/* dbTest.c */
/* share/src/db $Id$ */
/* share/src/db $Id$ */
/* dbTest.c
/* database access test subroutines */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 11-7-90
*
* database access test subroutines
* Experimental Physics and Industrial Control System (EPICS)
*
* Author: Bob Dalesio(LANL) and Marty Kraimer(ANL)
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Control System Software for the GTA Project
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Copyright 1988, 1989, the Regents of the University of California.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
* .xx mm-dd-yy mrk Comment
*
* .01 mm-dd-yy iii Comment
*/
/* Global Database Test Routines - All can be invoked via vxWorks shell
@@ -609,6 +608,7 @@ long dblls(ptypeName) /* list lock set for specified record type*/
return(1);
}
got_it:
printf(" lset lcnt disv disa pact\n");
for(rectype=beg; rectype<=end; rectype++) {
if(!(precLoc=GET_PRECLOC(rectype))) continue;
for(recnum=0; precord=(struct dbCommon *)(GET_PRECORD(precLoc,recnum));
@@ -616,7 +616,7 @@ got_it:
if(precord->name[0] == 0) continue; /*deleted record*/
strncpy(name,precord->name,PVNAME_SZ);
name[PVNAME_SZ]=0;
printf("%4.4d %4.4d %4.4d %4.4d %4.4d %s\n",
printf("%5.5d %5.5d %5.5d %5.5d %5.5d %s\n",
precord->lset,
precord->lcnt,
precord->disv,

View File

@@ -1,8 +1,36 @@
/* db_access.c */
/* share/src/db $Id$ */
/* share/src/db $Id$ */
/* db_access.c - Interface between old database access and new */
/*
* Author: Bob Dalesio
* Date: 6-1-90
*
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
* .01 mm-dd-yy iii Comment
*/
/***
@@ -81,7 +109,6 @@
/* function declarations */
static adjust_severity();
/* database access address structure (removed from db_access.h and put here) */
@@ -608,7 +635,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_STRING,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
options=0;
nRequest=no_elements;
status = dbGetField(paddr,DBR_STRING,&(pold->value[0]),
@@ -628,7 +654,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_SHORT,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
options=0;
nRequest=no_elements;
status = dbGetField(paddr,DBR_SHORT,&(pold->value),&options,
@@ -647,7 +672,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_FLOAT,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
options=0;
nRequest=no_elements;
status = dbGetField(paddr,DBR_FLOAT,&(pold->value),&options,
@@ -666,7 +690,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_ENUM,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
options=0;
nRequest=no_elements;
status = dbGetField(paddr,DBR_ENUM,&(pold->value),&options,
@@ -685,7 +708,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_UCHAR,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
options=0;
nRequest=no_elements;
status = dbGetField(paddr,DBR_UCHAR,&(pold->value),&options,
@@ -704,7 +726,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_LONG,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
options=0;
nRequest=no_elements;
status = dbGetField(paddr,DBR_LONG,&(pold->value),&options,
@@ -723,7 +744,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_DOUBLE,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
options=0;
nRequest=no_elements;
status = dbGetField(paddr,DBR_DOUBLE,&(pold->value),&options,
@@ -744,7 +764,6 @@ unsigned short no_elements;
pold->status = new.status;
pold->severity = new.severity;
pold->stamp = new.time; /* structure copy */
adjust_severity(pold);
options=0;
nRequest=no_elements;
status = dbGetField(paddr,DBR_STRING,pold->value,&options,
@@ -766,7 +785,6 @@ unsigned short no_elements;
pold->status = new.status;
pold->severity = new.severity;
pold->stamp = new.time; /* structure copy */
adjust_severity(pold);
options=0;
nRequest=no_elements;
status = dbGetField(paddr,DBR_SHORT,&(pold->value),&options,
@@ -787,7 +805,6 @@ unsigned short no_elements;
pold->status = new.status;
pold->severity = new.severity;
pold->stamp = new.time; /* structure copy */
adjust_severity(pold);
options=0;
nRequest=no_elements;
status = dbGetField(paddr,DBR_FLOAT,&(pold->value),&options,
@@ -808,7 +825,6 @@ unsigned short no_elements;
pold->status = new.status;
pold->severity = new.severity;
pold->stamp = new.time; /* structure copy */
adjust_severity(pold);
options=0;
nRequest=no_elements;
status = dbGetField(paddr,DBR_ENUM,&(pold->value),&options,
@@ -829,7 +845,6 @@ unsigned short no_elements;
pold->status = new.status;
pold->severity = new.severity;
pold->stamp = new.time; /* structure copy */
adjust_severity(pold);
options=0;
nRequest=no_elements;
status = dbGetField(paddr,DBR_CHAR,&(pold->value),&options,
@@ -850,7 +865,6 @@ unsigned short no_elements;
pold->status = new.status;
pold->severity = new.severity;
pold->stamp = new.time; /* structure copy */
adjust_severity(pold);
options=0;
nRequest=no_elements;
status = dbGetField(paddr,DBR_LONG,&(pold->value),&options,
@@ -871,7 +885,6 @@ unsigned short no_elements;
pold->status = new.status;
pold->severity = new.severity;
pold->stamp = new.time; /* structure copy */
adjust_severity(pold);
options=0;
nRequest=no_elements;
status = dbGetField(paddr,DBR_DOUBLE,&(pold->value),&options,
@@ -895,7 +908,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_SHORT,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
strncpy(pold->units,new.units,8);
pold->upper_disp_limit = new.upper_disp_limit;
pold->lower_disp_limit = new.lower_disp_limit;
@@ -926,7 +938,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_FLOAT,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
pold->precision = new.precision;
strncpy(pold->units,new.units,8);
pold->upper_disp_limit = new.upper_disp_limit;
@@ -957,7 +968,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_UCHAR,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
strncpy(pold->units,new.units,8);
pold->upper_disp_limit = new.upper_disp_limit;
pold->lower_disp_limit = new.lower_disp_limit;
@@ -986,7 +996,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_LONG,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
strncpy(pold->units,new.units,8);
pold->upper_disp_limit = new.upper_disp_limit;
pold->lower_disp_limit = new.lower_disp_limit;
@@ -1017,7 +1026,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_DOUBLE,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
pold->precision = new.precision;
strncpy(pold->units,new.units,8);
pold->upper_disp_limit = new.upper_disp_limit;
@@ -1050,7 +1058,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_SHORT,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
strncpy(pold->units,new.units,8);
pold->upper_disp_limit = new.upper_disp_limit;
pold->lower_disp_limit = new.lower_disp_limit;
@@ -1084,7 +1091,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_FLOAT,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
pold->precision = new.precision;
strncpy(pold->units,new.units,8);
pold->upper_disp_limit = new.upper_disp_limit;
@@ -1118,7 +1124,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_ENUM,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
no_str = new.no_str;
if(no_str>16) no_str=16;
pold->no_str = no_str;
@@ -1149,7 +1154,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_UCHAR,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
strncpy(pold->units,new.units,8);
pold->upper_disp_limit = new.upper_disp_limit;
pold->lower_disp_limit = new.lower_disp_limit;
@@ -1182,7 +1186,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_LONG,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
strncpy(pold->units,new.units,8);
pold->upper_disp_limit = new.upper_disp_limit;
pold->lower_disp_limit = new.lower_disp_limit;
@@ -1216,7 +1219,6 @@ unsigned short no_elements;
status = dbGetField(paddr,DBR_DOUBLE,&new,&options,&nRequest);
pold->status = new.status;
pold->severity = new.severity;
adjust_severity(pold);
pold->precision = new.precision;
strncpy(pold->units,new.units,8);
pold->upper_disp_limit = new.upper_disp_limit;
@@ -1241,38 +1243,6 @@ unsigned short no_elements;
if(!RTN_SUCCESS(status)) return(-1);
return(0);
}
/* the old software did not have a severity of INFO or VALID */
static adjust_severity(pbuffer)
struct dbr_sts_string *pbuffer;
{
/***
*** Map {NO,INFO,MINOR,MAJOR,VALID} alarms onto {NO,MINOR,MAJOR} alarms of
*** GTA ( from GTA's ..../h/fields.h )
***/
#define GTA_NO_ALARM 0x0
#define GTA_MINOR 0x1
#define GTA_MAJOR 0x2
#define GTA_COMM 0x3
switch(pbuffer->severity) {
case NO_ALARM: pbuffer->severity = GTA_NO_ALARM;
break;
case INFO_ALARM: pbuffer->severity = GTA_NO_ALARM;
break;
case MINOR_ALARM: pbuffer->severity = GTA_MINOR;
break;
case MAJOR_ALARM: pbuffer->severity = GTA_MAJOR;
break;
case VALID_ALARM: pbuffer->severity = GTA_COMM;
break;
default:
break;
}
}
/* DB_PUT_FIELD put a field and convert it to the desired type */

View File

@@ -1,34 +1,36 @@
/* share/src/db $Id$ */
/* database access subroutines */
/*
*
* database access subroutines
*
* Author: Bob Dalesio
* Date: 4/15/88
* @(#)iocdbaccess.c 1.1 9/22/88
*
* Control System Software for the GTA Project
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1988, 1989, the Regents of the University of California.
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
* .01 mm-dd-yy iii Comment
*/
#include <db_access.h>
/* function declarations */

View File

@@ -1,7 +1,37 @@
/* dbls.c - structure listing program */
/* share/src/db $Id$ */
/*
* Author: Bob Zeiman
* Date: 11-7-90
*
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
* .01 mm-dd-yy iii Comment
*/
#define SAME 0
#include <vxWorks.h>

View File

@@ -1,7 +1,36 @@
/* recGbl.c - Global record processing routines */
/* share/src/db $Id$ */
/*
* Author: Marty Kraimer
* Date: 11-7-90
*
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
* .01 mm-dd-yy iii Comment
*/
#include <vxWorks.h>
#include <types.h>
#include <stdioLib.h>