diff --git a/src/epics/seq/main.c b/src/epics/seq/main.c index efe12884af534185f700a9ef2de1dcd468d5cffd..53bf10d2d5bf5886472526b30dc28e424b683f86 100644 --- a/src/epics/seq/main.c +++ b/src/epics/seq/main.c @@ -50,6 +50,20 @@ of this distribution. #include "asDbLib.h" #ifdef CA_SDF + +// The identifiers below were defined in the EPICS local db headers but +// also are defined in cadef.h. +// They are undefined here to avoid compiler warnings. +#undef DBR_SHORT +#undef DBR_GR_LONG +#undef DBR_GR_DOUBLE +#undef DBR_CTRL_LONG +#undef DBR_CTRL_DOUBLE +#undef DBR_PUT_ACKT +#undef DBR_PUT_ACKS +#undef VALID_DB_REQ +#undef INVALID_DB_REQ + #include <pthread.h> #include "cadef.h" #endif @@ -243,7 +257,7 @@ long droppedPVCount; #define CLEANUP cleanupCASDF(); #define GET_ADDRESS(NAME,ADDRP) getCAIndex((NAME),(ADDRP)) #define PUT_VALUE(ADDR,TYPE,PVAL) setCAValue((ADDR),(TYPE),(PVAL)) -#define PUT_VALUE_INT(ADDR,PVAL) setCAValueLong((ADDR),(PVAL)) +#define PUT_VALUE_INT(ADDR,PVAL) setCAValueEPICSLong((ADDR),(PVAL)) #define GET_VALUE_NUM(ADDR,DESTP,TIMEP,CONNP) syncEpicsDoubleValue((ADDR),(DESTP),(TIMEP),(CONNP)) #define GET_VALUE_INT(ADDR,DESTP,TIMEP,CONNP) syncEpicsIntValue((ADDR),(DESTP),(TIMEP),(CONNP)) #define GET_VALUE_STR(ADDR,DESTP,LEN,TIMEP,CONNP) syncEpicsStrValue((ADDR),(DESTP),(LEN),(TIMEP),(CONNP)) @@ -253,7 +267,7 @@ long droppedPVCount; #define CLEANUP #define GET_ADDRESS(NAME,ADDRP) dbNameToAddr((NAME),(ADDRP)) #define PUT_VALUE(ADDR,TYPE,PVAL) dbPutField(&(ADDR),((TYPE)==SDF_NUM ? DBR_DOUBLE : DBR_STRING),(PVAL),1) -#define PUT_VALUE_INT(ADDR,PVAL) dbPutField(&(ADDR),DBR_LONG,(PVAL),1); +#define PUT_VALUE_INT(ADDR,PVAL) dbPutField(&(ADDR),DBR_LONG,(int *)(PVAL),1); #define GET_VALUE_NUM(ADDR,DESTP,TIMEP,CONNP) getDbValueDouble(&(ADDR),(double*)(DESTP),(TIMEP)) #define GET_VALUE_INT(ADDR,DESTP,TIMEP,CONNP) getDbValueLong(&(ADDR),(unsigned int*)(DESTP),(TIMEP)) #define GET_VALUE_STR(ADDR,DESTP,LEN,TIMEP,CONNP) getDbValueString(&(ADDR),(char*)(DESTP),(LEN),(TIMEP)) @@ -304,7 +318,7 @@ int getCAIndex(char *, ADDRESS *); int canFindCAChannel(char *entry); int setCAValue(ADDRESS, int, void *); -int setCAValueLong(ADDRESS, unsigned long *); +int setCAValueEPICSLong(ADDRESS, unsigned int *); int syncEpicsDoubleValue(ADDRESS, double *, time_t *, int *); int syncEpicsIntValue(ADDRESS, unsigned int *, time_t *, int *); @@ -1779,7 +1793,7 @@ void newfilterstats(int numchans) { int ii; FILE *log=0; char chname[128]; - unsigned int mask = 0x1ffff; + int mask = 0x1ffff; int tmpreq; int counter = 0; int rsw1,rsw2; @@ -1814,7 +1828,7 @@ void newfilterstats(int numchans) { strcat(chname,"SWMASK"); status = GET_ADDRESS(chname,&paddr); if(!status) { - status = PUT_VALUE_INT(paddr,&mask); + status = PUT_VALUE_INT(paddr,(unsigned int*)&mask); } // printf("New filter %d %s = 0x%x\t0x%x\t0x%x\n",ii,filterTable[ii].fname,filterTable[ii].swreq,filterTable[ii].sw[0],filterTable[ii].sw[1]); } @@ -2102,8 +2116,9 @@ int readConfig( char *pref, ///< EPICS channel prefix from EPICS environment. // printf("CNF for %s \n",cdTableP[chNumP].chname); if(chNotFound < SDF_ERR_TSIZE) { sprintf(unknownChans[chNotFound].chname,"%s",cdTableP[chNumP].chname); - status = GET_ADDRESS(cdTableP[chNumP].chname,&paddr); - if(!status) { + ADDRESS tmpaddr; + status = GET_ADDRESS(cdTableP[chNumP].chname, &tmpaddr); + if(!status) { sprintf(unknownChans[chNotFound].liveset,"%s","RO Channel "); } else { sprintf(unknownChans[chNotFound].liveset,"%s"," "); @@ -2366,7 +2381,7 @@ int setCAValue(ADDRESS ii, int type, void *data) return result; } -int setCAValueLong(ADDRESS ii, unsigned long *data) { +int setCAValueEPICSLong(ADDRESS ii, unsigned int *data) { double tmp = 0.0; if (!data) return 1; @@ -2796,7 +2811,7 @@ void setupCASDF() caTable[ii].datatype = SDF_NUM; caTable[ii].data.chval = 0.0; caTable[ii].connected = 0; - caTable[ii].chanid = -1; + caTable[ii].chanid = (void *)-1; caTable[ii].mod_time = (time_t)0; caTable[ii].chanIndex = ii; @@ -2804,7 +2819,7 @@ void setupCASDF() caConnTable[ii].datatype = SDF_NUM; caConnTable[ii].data.chval = 0.0; caConnTable[ii].connected = 0; - caConnTable[ii].chanid = -1; + caConnTable[ii].chanid = (void *)-1; caConnTable[ii].mod_time = (time_t)0; caConnTable[ii].chanIndex = 0; @@ -2812,7 +2827,7 @@ void setupCASDF() caConnEnumTable[ii].datatype = SDF_UNKNOWN; caConnEnumTable[ii].data.chval = 0.0; caConnEnumTable[ii].connected = 0; - caConnEnumTable[ii].chanid = -1; + caConnEnumTable[ii].chanid = (void *)-1; caConnEnumTable[ii].mod_time = (time_t)0; caConnEnumTable[ii].chanIndex = ii;