/* devSoftInterrupt.c */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "MachineStateBuffer.h" int debugDevMpsUnlatchBo = 0; struct dpvt { unsigned int faultNumber; }; struct dsetStruct { long number; DEVSUPFUN dev_report; DEVSUPFUN init; DEVSUPFUN init_record; /*returns:(0,2) => (success,success no convert) */ DEVSUPFUN get_ioint_info; DEVSUPFUN write_bo; /*returns: (-1,0) => (failure,success)*/ }; static long init(int pass) { return 0; } static long init_record(struct boRecord *prec) { char *pout = NULL; struct dpvt *pdpvt = NULL; pdpvt = callocMustSucceed(1, sizeof(struct dpvt), "devMpsUnlatchBo: init_record"); pdpvt->faultNumber = -1; prec->dpvt = (void *) pdpvt; /* point pout to everthing after the OUT field's @ sign */ pout = prec->out.value.instio.string; if (pout == NULL) { return -1; } pdpvt->faultNumber = (unsigned int) strtol(pout, NULL, 10); if (debugDevMpsUnlatchBo) { printf("devMpsUnlatchBo: %s out = %s = %u\n", prec->name, pout, pdpvt->faultNumber); } return 0; } static long write_bo(struct boRecord *prec) { struct dpvt *pdpvt = NULL; pdpvt = (struct dpvt *) prec->dpvt; if (pdpvt->faultNumber == 0) { unlatchAllFaults(); return 0; } unlatchFault(pdpvt->faultNumber); return 0; } /* Configure and export device support entry table */ struct dsetStruct devMpsUnlatchBo = { 5, NULL, init, init_record, NULL, write_bo }; epicsExportAddress(dset,devMpsUnlatchBo);