#include #include #include #include #include #include #include #include #include /* Masks used to decode pulse ID from the nsec part of the timestamp */ #define UPPER_15_BIT_MASK (0xFFFE0000) /* (2^32)-1 - (2^17)-1 */ #define LOWER_17_BIT_MASK (0x0001FFFF) /* (2^17)-1 */ /* Pulse ID Definitions */ #define PULSEID(time) ((time).nsec & LOWER_17_BIT_MASK) int evrTimeGet(epicsTimeStamp *epicsTime_ps, unsigned int eventCode); static long dbSubLEDInit(subRecord *precord) { return 0; } static long dbSubLED(subRecord *precord) { epicsTimeStamp t; if(precord->scan == menuScanEvent) { evrTimeGet(&t, atoi(precord->evnt)); } else { evrTimeGet(&t, 0); } precord->time = t; precord->val = PULSEID(t); //printf("%d.%d: Event: %d, PulseID: %d\n", precord->time.secPastEpoch, // precord->time.nsec, atoi(precord->evnt), (int)precord->val); return 0; } epicsRegisterFunction(dbSubLEDInit); epicsRegisterFunction(dbSubLED);