diff --git a/exploreApp/src/Makefile b/exploreApp/src/Makefile index 57e5865..8fbb8c7 100644 --- a/exploreApp/src/Makefile +++ b/exploreApp/src/Makefile @@ -7,7 +7,7 @@ include $(TOP)/configure/CONFIG USR_CPPFLAGS += -I$(TOP)/common -PROD_SYS_LIBS_WIN32 += ws2_32 advapi32 user32 +USR_SYS_LIBS_WIN32 += ws2_32 advapi32 user32 # explore app doesn't build with older vxworks (eg. tornado22) # don't build at all until someone asks diff --git a/exploreApp/src/devexplore.cpp b/exploreApp/src/devexplore.cpp index 833dd86..b0438ee 100644 --- a/exploreApp/src/devexplore.cpp +++ b/exploreApp/src/devexplore.cpp @@ -138,7 +138,7 @@ struct priv { template VAL read(epicsUInt32 off=0) const { - epicsUInt32 OV(readraw(off)); + epicsUInt32 OV(readraw(off)); if(vmask) OV &= vmask; OV >>= vshift; return OV; @@ -152,7 +152,7 @@ struct priv { unsigned i; for(i=0; i(addr); + epicsUInt32 OV = read(addr); *val++ = castval::op(OV); } return i; @@ -408,14 +408,14 @@ long explore_read_real_val(REC *prec) Guard G(pvt->lock); ival = pun.ival = pvt->read(); } + epicsFloat64 dval = pun.fval; + dval += prec->roff; + if(prec->aslo) dval *= prec->aslo; + dval += prec->aoff; + if(prec->eslo) dval *= prec->eslo; + dval += prec->eoff; - pun.fval += prec->roff; - if(prec->aslo) pun.fval *= prec->aslo; - pun.fval += prec->aoff; - if(prec->eslo) pun.fval *= prec->eslo; - pun.fval += prec->eoff; - - prec->val = pun.fval; + prec->val = dval; if(prec->tpro>1) { errlogPrintf("%s: read %08x -> %08x -> VAL=%g\n", prec->name, (unsigned)pvt->offset, (unsigned)ival, prec->val); @@ -430,13 +430,14 @@ long explore_write_real_val(REC *prec) { TRY { punny32 pun; - pun.fval = prec->val; + epicsFloat64 dval = prec->val; - pun.fval -= prec->eoff; - if(prec->eslo) pun.fval /= prec->eslo; - pun.fval -= prec->aoff; - if(prec->aslo) pun.fval /= prec->aslo; - pun.fval -= prec->roff; + dval -= prec->eoff; + if(prec->eslo) dval /= prec->eslo; + dval -= prec->aoff; + if(prec->aslo) dval /= prec->aslo; + dval -= prec->roff; + pun.fval = (epicsFloat32)dval; if(prec->tpro>1) { errlogPrintf("%s: write %08x <- %08x <- VAL=%g\n", prec->name, (unsigned)pvt->offset, (unsigned)pun.ival, prec->val); @@ -485,7 +486,7 @@ long explore_write_wf(waveformRecord *prec) { TRY { Guard G(pvt->lock); - unsigned nwritten = -1; + unsigned nwritten = 0; switch(prec->ftvl) { case menuFtypeCHAR : case menuFtypeUCHAR : nwritten = pvt->writeArray((epicsUInt8*) prec->bptr, prec->nord); break; @@ -527,6 +528,8 @@ struct dset6 { } // namespace +extern "C" { + #define SUP(NAME, REC, OP, DIR, SIZE, END) static dset6 NAME = \ {6, NULL, NULL, &explore_init_record_##OP, NULL, &explore_##DIR##_##OP, NULL}; \ epicsExportAddress(dset, NAME) @@ -637,3 +640,4 @@ SUP(devExploreWfWriteU16MSB, write, 2, priv::BE); SUP(devExploreWfWriteU32NAT, write, 4, priv::NAT); SUP(devExploreWfWriteU32LSB, write, 4, priv::LE); SUP(devExploreWfWriteU32MSB, write, 4, priv::BE); +} // extern "C" diff --git a/exploreApp/src/devexplore_frib.cpp b/exploreApp/src/devexplore_frib.cpp index 21ae974..2b00067 100644 --- a/exploreApp/src/devexplore_frib.cpp +++ b/exploreApp/src/devexplore_frib.cpp @@ -4,6 +4,8 @@ */ // FRIB specific operations +#define NOMINMAX +#include #include #include #include @@ -18,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -161,7 +164,7 @@ struct flashProg : public epicsThreadRunable { assert((file.size()%16u==0)); const epicsUInt32 fstart = flash_offset, - fend = flash_offset + std::min(file.size(), (size_t)flash_size); + fend = flash_offset + std::min((epicsUInt32)file.size(), flash_size); epicsUInt32 id = read32(REG_LOCKOUT); if(id!=0xF1A54001) @@ -440,6 +443,9 @@ struct dset6 { } // namespace +extern "C" { DSET(devExploreFRIBFlashWf, &init_record_common, NULL, &load_bitfile_wf); DSET(devExploreFRIBFlashLo, &init_record_common, NULL, &startstop_lo); DSET(devExploreFRIBFlashMbbi, &init_record_common, &status_get_iointr_info, &status_mbbi); +} // extern "C" + diff --git a/exploreApp/src/testexplore.cpp b/exploreApp/src/testexplore.cpp index 250cba2..e2bdcde 100644 --- a/exploreApp/src/testexplore.cpp +++ b/exploreApp/src/testexplore.cpp @@ -50,7 +50,7 @@ struct Channel { val.resize(nReq); } void put_int32(const std::vector& val) { - if(dbChannelPutField(chan, DBF_ULONG, &val[0], val.size())) + if(dbChannelPutField(chan, DBF_ULONG, &val[0], (long)val.size())) testAbort("get %s fails", dbChannelName(chan)); } }; diff --git a/pciApp/devLibPCI.c b/pciApp/devLibPCI.c index 1325ff8..e0f92cd 100644 --- a/pciApp/devLibPCI.c +++ b/pciApp/devLibPCI.c @@ -39,6 +39,11 @@ #define strdup(x) ({char*s=malloc(strlen(x)+1);s?strcpy(s,x):s;}) #endif +#ifdef _WIN32 +/* Windows uses different name for strtok_r */ + #define strtok_r strtok_s +#endif + int devPCIDebug = 0; static ELLLIST pciDrivers; diff --git a/pciApp/os/Linux/devLibPCIOSD.c b/pciApp/os/Linux/devLibPCIOSD.c index 35a11ab..5b2927b 100644 --- a/pciApp/os/Linux/devLibPCIOSD.c +++ b/pciApp/os/Linux/devLibPCIOSD.c @@ -772,7 +772,7 @@ linuxDevPCIFindCB( static const char* fd2filename(int fd, char* buffer, size_t buffersize) { char procfile[32]; - size_t n; + ssize_t n; sprintf(procfile, "/proc/self/fd/%d", fd); n = readlink(procfile, buffer, buffersize-1); diff --git a/vmeApp/vmesh.c b/vmeApp/vmesh.c index ccfa34a..ec80b06 100644 --- a/vmeApp/vmesh.c +++ b/vmeApp/vmesh.c @@ -67,7 +67,7 @@ int validate_widths(epicsUInt32 addr, int amod, int dmod, int count, volatile vo return 1; } - epicsPrintf("Mapped to 0x%08lx\n",(unsigned long)*mptr); + epicsPrintf("Mapped to 0x%p\n",*mptr); return 0; } @@ -182,7 +182,7 @@ static void vmesh_handler(void *raw) { volatile epicsUInt8 *ent = raw; - unsigned vect = ent-vmeautodisable; + unsigned char vect = (unsigned char)(ent-vmeautodisable); char msg[] = "VME IRQ on vector 0xXY\n"; unsigned I = sizeof(msg)-3;