timingApi
Data Structures | Defines | Typedefs | Functions
/afs/slac.stanford.edu/g/lcls/vol8/epics/modules/R3-14-12/timingApi/R0.6/timingApiSup/timingFifoApi.h File Reference
#include <stdint.h>
#include "timingApiTypes.h"

Go to the source code of this file.

Data Structures

struct  _EventTimingData
 The EventTimingData structure is used to retrieve synchronous data from the eventCode arrival time FIFO. More...

Defines

#define TS_INDEX_INIT   1000000
 TS_INDEX_INIT is a magic value that when used as the incr argument to timingFifoRead() tells it to set the index to the most recently arrived timing info.

Typedefs

typedef struct _EventTimingData EventTimingData
 The EventTimingData structure is used to retrieve synchronous data from the eventCode arrival time FIFO.

Functions

int timingFifoRead (unsigned int eventCode, int incr, uint64_t *index, EventTimingData *pTimingDataDest)
 The timingFifoRead() call allows a timingFifo client to access a FIFO queue of the last TS_INDEX_INIT eventCode arrival timestamps.
TimingPulseId timingGetLastFiducial ()
 timingGetLastFiducial returns lastfid, the last fiducial set by ISR.
TimingPulseId timingGetFiducialForTimeStamp (epicsTimeStamp timeStamp)
 timingGetFiducialForTimeStamp returns the fiducial that corresponds to the specified timestamp.
int timingGetCurTimeStamp (epicsTimeStamp *pTimeStampDest)
 Retrieve the most recent timestamp available.
int timingGetEventTimeStamp (epicsTimeStamp *pTimeStampDest, int eventCode)
 Retrieve the most recent timestamp and pulseId for the specified eventCode.

Define Documentation

#define TS_INDEX_INIT   1000000

TS_INDEX_INIT is a magic value that when used as the incr argument to timingFifoRead() tells it to set the index to the most recently arrived timing info.


Typedef Documentation

The EventTimingData structure is used to retrieve synchronous data from the eventCode arrival time FIFO.

The timing service must guarantee that all values returned via this structure are for the same pulse.


Function Documentation

int timingFifoRead ( unsigned int  eventCode,
int  incr,
uint64_t *  index,
EventTimingData *  pTimingDataDest 
)

The timingFifoRead() call allows a timingFifo client to access a FIFO queue of the last TS_INDEX_INIT eventCode arrival timestamps.

Each client has their own index position in the queue which can be controlled w/ the incr argument.

Clients should not write directly to the index value.

  • incr==TS_INDEX_INIT: index set to the position of the most recent eventCode arrival.
  • incr!=TS_INDEX_INIT: index set to index+incr. Use +1/-1 to advance up and down the queue
  • incr==1: Set to 1 once synced to fetch one synced timestamp per sample indefinitely as long as you don't overrun or underrun.

The index is adjusted according to the incr argument before reading the eventCode arrival time info from the FIFO

FIFO underruns occur by trying to fetch another timestamp when you've already fetched the most recent one.

FIFO overruns occur by trying to fetch the next timestamp after it's position in the FIFO is reused by a new eventCode arrival time.

The timing service must guarantee that all values returned via this call are for the same pulse.

Return value: 0 on success -1 for NULL return ptrs -2 for invalid index -3 for FIFO overflow -4 for FIFO underflow.

These values are returned via ptr:

  • index ptr: 64 bit FIFO position. Adjusted according to the incr argument before reading the info from the FIFO
  • pTimingDataDest ptr: epicsTimeStamp, 64 bit fiducial, and 64 bit tsc
int timingGetCurTimeStamp ( epicsTimeStamp *  pTimeStampDest)

Retrieve the most recent timestamp available.

Return EPICS timestamp via this ptr

int timingGetEventTimeStamp ( epicsTimeStamp *  pTimeStampDest,
int  eventCode 
)

Retrieve the most recent timestamp and pulseId for the specified eventCode.

Which eventCode

Parameters:
pTimeStampDestReturn EPICS timestamp via this ptr
TimingPulseId timingGetFiducialForTimeStamp ( epicsTimeStamp  timeStamp)

timingGetFiducialForTimeStamp returns the fiducial that corresponds to the specified timestamp.

If the timing module cannot determine the correct fiducial, it returns TIMING_PULSEID_INVALID.

TimingPulseId timingGetLastFiducial ( )

timingGetLastFiducial returns lastfid, the last fiducial set by ISR.