#include #include #include #include #include #include #include #include #include #include #include #include /* for SCAN_IO_EVENT */ #include #include /* for mbbiRecord structure */ #include /* for epicsExportAddress */ #include /* for DEBUGPRINT */ #include "drvMpsLinkNode.h" /* for mpsGet* routines */ typedef struct mbbiMps_s { int routine; int module; } mbbiMps_t; typedef struct { long number; DEVSUPFUN report; DEVSUPFUN init; DEVSUPFUN init_record; DEVSUPFUN get_ioint_info; DEVSUPFUN read_mbbii; } MBBIDSET; #ifdef DEBUG_PRINT int devMbbiMpsFlag = 2; #endif LOCAL long init_mbbi(); LOCAL long mbbi_ioinfo(); LOCAL long read_mbbi(); MBBIDSET devMbbiMpsLinkNode = { 5, NULL, NULL, init_mbbi, mbbi_ioinfo, read_mbbi }; epicsExportAddress(dset, devMbbiMpsLinkNode); LOCAL long init_mbbi(struct mbbiRecord *pmbbi) { mbbiMps_t *pmbbip; switch(pmbbi->inp.type) { case(INST_IO): /* Allocate the memory for this records private data structure */ pmbbip = (mbbiMps_t *) malloc(sizeof(mbbiMps_t)); if (pmbbip == NULL) { return S_dev_noMemory; } /* Tell the record about its private data structure */ pmbbi->dpvt = pmbbip; DEBUGPRINT(DP_INFO, devMbbiMpsFlag, ("init_ai: %s: has parm: %s\n", pmbbi->name, pmbbi->inp.value.instio.string)); sscanf(pmbbi->inp.value.instio.string, "%d %d", &(pmbbip->routine), &(pmbbip->module)); DEBUGPRINT(DP_INFO, devMbbiMpsFlag, ("init_ai: %s's dpvt has routine: %d module: %d\n", pmbbi->name, pmbbip->routine, pmbbip->module)); break; default: DEBUGPRINT(DP_ERROR, devMbbiMpsFlag, ("init_ai: %s: illegal INP field: %d", pmbbi->name, (int) pmbbi->inp.type)); break; } return 0; } LOCAL long mbbi_ioinfo( int cmd, struct mbbiRecord *pmbbi, IOSCANPVT *ppvt ) { return 0; } LOCAL long read_mbbi(struct mbbiRecord *pmbbi) { mbbiMps_t *pmbbip; DEBUGPRINT(DP_INFO, devMbbiMpsFlag, ("read_mbbi for %s\n", pmbbi->name)); /* Set this to facilitate easy access to index field */ pmbbip = (mbbiMps_t *)pmbbi->dpvt; switch(pmbbip->routine) { case 0: pmbbi->rval = mpsGetLinkNodeType(); break; /* 4/13/9 just added PV for this to pic. Not part of any blm template */ case 1: pmbbi->rval = mpsGetCSR3SyncOutputPulseSourceSelectionMUX(pmbbip->module); break; default: pmbbi->udf = 1; return ERROR; } DEBUGPRINT(DP_INFO, devMbbiMpsFlag, ("%s's rval is %lu\n", pmbbi->name, (unsigned long) pmbbi->rval)); return OK; }