#include #include #include #include #include unsigned fidDiff=0; unsigned minFidDiff = -1; unsigned maxSame=0; unsigned nSame=0; unsigned doFidSend=1; static long bpmEvrFidProcess(subRecord *precord) { epicsTimeStamp ts; epicsTimeStamp *ts_p; static unsigned lts=0; #ifdef __PPC__ static unsigned ltb=0; unsigned tb; #endif ts_p = evrTimeGet(&ts, 0) ? 0 : &ts; /* Tag stream with latest timestamp and * make sure all PADs are started */ if ( ts_p ) { if ( lts == ts_p->nsec ) { nSame ++; if ( nSame > maxSame ) maxSame = nSame; } else { nSame = 0; if ( doFidSend ) drvPadUdpCommSendStartAll(ts_p); } lts = ts_p->nsec; } #ifdef __PPC__ asm volatile("mftb %0":"=r"(tb)); fidDiff = tb - ltb; ltb = tb; if ( fidDiff < minFidDiff ) minFidDiff = fidDiff; #endif return 0; } epicsRegisterFunction(bpmEvrFidProcess);