#ifndef DRV_BLM_H #define DRV_BLM_H #define BLM_2101 (1) #define BLM_2102 (2) #define BLM_2401 (3) #define BLM_2402 (4) #define BLM_2001 (5) #define BLM_2002 (6) #define BLM_NUM_STATIONS (6) #define BLM_NUM_CHANNELS 4 #define BLM_NUM_SAMPLES 512 #include #include #include #include #include #include #include #include typedef epicsInt16 BlmInNumber; #define DRVBLM_INP_FTVL menuFtypeSHORT typedef epicsInt32 BlmOutNumber; #define DRVBLM_OUT_FTVL menuFtypeLONG unsigned blmFidProcessActiveTimeslots; typedef struct BlmChannelRec_ { unsigned frags; BlmOutNumber sum_acc; BlmOutNumber sum; double imax; epicsTimeStamp tsSum; epicsTimeStamp tsImax; BlmInNumber vec[BLM_NUM_SAMPLES]; BlmOutNumber prc[BLM_NUM_SAMPLES]; } BlmChannelRec, *BlmChannel; typedef struct BlmStationRec_ { BlmChannelRec chnls[BLM_NUM_CHANNELS]; epicsThreadId fcomProcessThread; epicsEventId rawDataReady; uint32_t xid; unsigned chnlsDone; /* timedout is a bitmask. The 4 LSB represent the four sums (ch0..ch3) * the next 4 bits the imaxes (ch0..ch3). A clear bit indicates OK data. * The 'timedout' bit reflect the status of the udpComm link. If the * drvPadUdpComm watchdog fires (no udpComm traffic seen for a while) * then 'timedout' is set to all ones. Bits are cleared as new * sums/imaxes are computed. */ #define BLM_TIMEDOUT(channel) (1<<(channel)) #define BLM_TIMEDOUT_ANY_RAW 0x0f #define BLM_TIMEDOUT_ANY_IMAX 0xf0 #define BLM_TIMEDOUT_ALL (-1) unsigned timedout; int epics_event_no; epicsMutexId mutex; } BlmStationRec, *BlmStation; /* station is 1-based, channel is 0-based */ BlmStation blmGetStation(int station); /* channel 0..3 get the raw sum, 4..7 obtain imax */ double blmGetVal(int station, int channel, epicsTimeStamp *ts_p); void blmFcomTaskResumeAll(void); #endif