#include #include #include #include #include /* for dbGetPdbAddrFromLink indirectly fromdbAccessDefs.h */ #include /* for DBADDR */ #include /* for dbScanLock */ #ifdef DEBUG_PRINT #include /* for DEBUGPRINT */ #endif #ifdef DEBUG_PRINT int dbSubPduFlag = 4; #endif long PDUII_assemble_wf_init(subRecord *precord) { return(0); } long PDUII_assemble_wf(subRecord *precord) { int rc; int incl_1 = (int)(precord->a); int incl_2 = (int)(precord->b); int incl_3 = (int)(precord->c); int incl_4 = (int)(precord->d); int incl_5 = (int)(precord->e); int excl_1 = (int)(precord->f); int excl_2 = (int)(precord->g); int excl_3 = (int)(precord->h); int excl_4 = (int)(precord->i); int excl_5 = (int)(precord->j); int beam_code = (int)(precord->k); short data[21]; short* bptr; DBADDR *waveformAddr; struct rset *prset; int ii; #ifdef DEBUG_PRINT DEBUGPRINT(DP_INFO, dbSubPduFlag, ("PDUII_assemble_wf %s: %d %d %d %d %d %d %d %d %d %d %d\n", precord->name, incl_1, incl_2, incl_3, incl_4, incl_5, excl_1, excl_2, excl_3, excl_4, excl_5, beam_code)); #endif /* Confirm order: incl, excl, beam code; confirm byte order in 32 bits */ data[0]=(short) incl_1; data[1]=(short) (incl_1 >> 16); data[2]=(short) incl_2; data[3]=(short) (incl_2 >> 16); data[4]=(short) incl_3; data[5]=(short) (incl_3 >> 16); data[6]=(short) incl_4; data[7]=(short) (incl_4 >> 16); data[8]=(short) incl_5; data[9]=(short) (incl_5 >> 16); data[10]=(short) excl_1; data[11]=(short) (excl_1 >> 16); data[12]=(short) excl_2; data[13]=(short) (excl_2 >> 16); data[14]=(short) excl_3; data[15]=(short) (excl_3 >> 16); data[16]=(short) excl_4; data[17]=(short) (excl_4 >> 16); data[18]=(short) excl_5; data[19]=(short) (excl_5 >> 16); data[20]=(short) beam_code; /* * waveformAddr must be a DB link and must be the proper type. */ waveformAddr = dbGetPdbAddrFromLink(&precord->inpl); if (!waveformAddr) { printf("NULL link to waveform\n"); return -1; } dbScanLock(waveformAddr->precord); if ((waveformAddr->field_type == DBF_SHORT) && ((prset = dbGetRset(waveformAddr)))) { printf("waveform ok\n"); /*(*prset->put_array_info)(waveformAddr,21);*/ /*(*prset->set_value)(data);*/ /* set NORD? */ /* dbProcess(precord); causes seg fault */ /* precord->nord = 21; structure has no member named `nord' - doesn't compile */ rc = 0; } else { rc = -1; } dbScanUnlock(waveformAddr->precord); /* do before any return */ precord->udf = 0; return rc; } /* Register these symbols for use by IOC code: */ #ifdef DEBUG_PRINT epicsExportAddress(int, dbSubPduFlag); #endif epicsRegisterFunction(PDUII_assemble_wf_init); epicsRegisterFunction(PDUII_assemble_wf);