Driver Documentation
psi_ms_daq.h File Reference

Go to the source code of this file.

Classes

struct  PsiMsDaq_WinInfo_t
 Window definition struct, used for more compact passing of common parameters. More...
 
struct  PsiMsDaq_StrConfig_t
 Stream configuration struct. More...
 
struct  PsiMsDaq_AccessFct_t
 Memory access functions struct. More...
 

Typedefs

typedef void * PsiMsDaq_IpHandle
 Handle to an instance of the driver for a complete IP. More...
 
typedef void * PsiMsDaq_StrHandle
 Handle to a specific stream of the driver. More...
 
typedef void PsiMsDaq_DataCopy_f(void *dst, void *src, size_t n)
 Copy used to copy data recorded to other memory locations in PsiMsDaq_StrWin_GetDataUnwrapped() More...
 
typedef void PsiMsDaq_RegWrite_f(const uint32_t addr, const uint32_t value)
 Write an IP-register. More...
 
typedef uint32_t PsiMsDaq_RegRead_f(const uint32_t addr)
 Read an IP-register. More...
 
typedef void PsiMsDaqn_WinIrq_f(PsiMsDaq_WinInfo_t winInfo, void *arg)
 Interrupt callback function for the window based IRQ scheme. In this IRQ scheme, one callback function is called for each window that arrives. This IRQ scheme is only usable if window-overwrite is disable (config.onverwrite = false). After the window data is processed, it must be freed by calling PsiMsDaq_StrWin_MarkAsFree(). More...
 
typedef void PsiMsDaqn_StrIrq_f(PsiMsDaq_StrHandle strHandle, void *arg)
 Interrupt callback function for the stream based IRQ scheme. In this IRQ scheme, one callback function is called whenever the IP fires an IRQ. This IRQ scheme is always usable but usually only required if window-overwrite is used (since the more elaborate window based IRQ scheme is not usable in this case). More...
 

Enumerations

enum  PsiMsDaq_RecMode_t { PsiMsDaqn_RecMode_Continuous = 0, PsiMsDaqn_RecMode_TriggerMask = 1, PsiMsDaqn_RecMode_SingleShot = 2, PsiMsDaqn_RecMode_Manual = 3 }
 Recorder mode (see documentation) More...
 
enum  PsiMsDaq_RetCode_t {
  PsiMsDaq_RetCode_Success = 0, PsiMsDaq_RetCode_IllegalStrNr = -1, PsiMsDaq_RetCode_IllegalStrWidth = -2, PsiMsDaq_RetCode_StrNotDisabled = -3,
  PsiMsDaq_RetCode_IllegalWinCnt = -4, PsiMsDaq_RetCode_IllegalWinNr = -5, PsiMsDaq_RetCode_NoTrigInWin = -6, PsiMsDaq_RetCode_BufferTooSmall = -7,
  PsiMsDaq_RetCode_MorePostTrigThanConfigured = -8, PsiMsDaq_RetCode_MorePreTrigThanAvailable = -9, PsiMsDaq_RetCode_WinSizeMustBeMultipleOfSamples = -10, PsiMsDaq_RetCode_IrqSchemesWinAndStrAreExclusive = -11
}
 Return codes. More...
 

Functions

PsiMsDaq_IpHandle PsiMsDaq_Init (const uint32_t baseAddr, const uint8_t maxStreams, const uint8_t maxWindows, const PsiMsDaq_AccessFct_t *const accessFct_p)
 Initialize the psi_ms_daq IP-Core. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_GetStrHandle (PsiMsDaq_IpHandle ipHandle, const uint8_t streamNr, PsiMsDaq_StrHandle *const strHndl_p)
 Get a handle to a specific stream number. More...
 
void PsiMsDaq_HandleIrq (PsiMsDaq_IpHandle inst_p)
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_Configure (PsiMsDaq_StrHandle strHndl, PsiMsDaq_StrConfig_t *const config_p)
 Configure stream. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_SetEnable (PsiMsDaq_StrHandle strHndl, const bool enable)
 Enable/Disable a stream. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_SetIrqCallbackWin (PsiMsDaq_StrHandle strHndl, PsiMsDaqn_WinIrq_f *irqCb, void *arg_p)
 Set window based interrupt callback function for a stream to be called whenever a new windows is recorded. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_SetIrqCallbackStr (PsiMsDaq_StrHandle strHndl, PsiMsDaqn_StrIrq_f *irqCb, void *arg_p)
 Set stream based interrupt callback function for a stream to be called whenever a new windows is recorded. Usually PsiMsDaq_Str_SetIrqCallbackWin() is used instead of this function. So without special reasons, use PsiMsDaq_Str_SetIrqCallbackWin(). More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_SetIrqEnable (PsiMsDaq_StrHandle strHndl, const bool irqEna)
 Enable/Disable IRQ for a stream. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_Arm (PsiMsDaq_StrHandle strHndl)
 Arm the recorder for a given stream. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_GetMaxLvl (PsiMsDaq_StrHandle strHndl, uint32_t *const maxLvl_p)
 Get maximum input buffer fill level. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_GetFreeWindows (PsiMsDaq_StrHandle strHndl, uint8_t *const freeWindows_p)
 Get the number of free windows. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_GetUsedWindows (PsiMsDaq_StrHandle strHndl, uint8_t *const usedWindows_p)
 Get the number of used (non-free) windows. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_GetTotalWindows (PsiMsDaq_StrHandle strHndl, uint8_t *const windows_p)
 Get the number of windows configured to be used for a given stream. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_GetIpHandle (PsiMsDaq_StrHandle strHndl, PsiMsDaq_IpHandle *ipHandle_p)
 Get the IP Handle of the IP a stream belongs to. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_GetStrNr (PsiMsDaq_StrHandle strHndl, uint8_t *strNr_p)
 Get the stream number from a stream handle. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_StrWin_GetNoOfBytes (PsiMsDaq_WinInfo_t winInfo, uint32_t *const noOfBytes_p)
 Get number of valid and unacknowledged bytes in a window. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_StrWin_GetNoOfSamples (PsiMsDaq_WinInfo_t winInfo, uint32_t *const noOfSamples_p)
 Get number of valid and unacknowledged samples in a window. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_StrWin_GetPreTrigSamples (PsiMsDaq_WinInfo_t winInfo, uint32_t *const preTrigSamples_p)
 Get the number of pre-trigger samples in a window (post trigger samples are known by config) More...
 
PsiMsDaq_RetCode_t PsiMsDaq_StrWin_GetTimestamp (PsiMsDaq_WinInfo_t winInfo, uint64_t *const timestamp_p)
 Get the timestamp of a window. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_StrWin_GetDataUnwrapped (PsiMsDaq_WinInfo_t winInfo, const uint32_t preTrigSamples, const uint32_t postTrigSamples, void *const buffer_p, const size_t bufferSize)
 Get unwrapped copy of the data in a window. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_StrWin_MarkAsFree (PsiMsDaq_WinInfo_t winInfo)
 Mark a window as free so it can receive new data. This function must be called after the window data is read. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_StrWin_GetLastSplAddr (PsiMsDaq_WinInfo_t winInfo, uint32_t *const lastSplAddr_p)
 Get the address of the last sample (not byte) written into a window. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_IsRecording (PsiMsDaq_StrHandle strHndl, bool *const isRecording_p)
 Check if the recorder of a given stream is currently recording data. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_CurrentWin (PsiMsDaq_StrHandle strHndl, uint8_t *const currentWin_p)
 Get the currently used recorder window. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_CurrentPtr (PsiMsDaq_StrHandle strHndl, uint32_t *const currentPtr_p)
 Get the current write pointer of the recording logic. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_Str_GetLastWrittenWin (PsiMsDaq_StrHandle strHndl, uint8_t *const lastWrittenWin_p)
 Get the number of the last window that was written to memory completely. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_RegWrite (PsiMsDaq_IpHandle ipHandle, const uint32_t addr, const uint32_t value)
 Write to a register. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_RegRead (PsiMsDaq_IpHandle ipHandle, const uint32_t addr, uint32_t *const value_p)
 Read a register. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_RegSetField (PsiMsDaq_IpHandle ipHandle, const uint32_t addr, const uint8_t lsb, const uint8_t msb, const uint32_t value)
 Set a field in a register (RMW) More...
 
PsiMsDaq_RetCode_t PsiMsDaq_RegGetField (PsiMsDaq_IpHandle ipHandle, const uint32_t addr, const uint8_t lsb, const uint8_t msb, uint32_t *const value_p)
 Read a field from a register. More...
 
PsiMsDaq_RetCode_t PsiMsDaq_RegSetBit (PsiMsDaq_IpHandle ipHandle, const uint32_t addr, const uint32_t mask, const bool value)
 Set a bit in a register (RMW) More...
 
PsiMsDaq_RetCode_t PsiMsDaq_RegGetBit (PsiMsDaq_IpHandle ipHandle, const uint32_t addr, const uint32_t mask, bool *const value_p)
 Read a bit from a register. More...
 

Typedef Documentation

◆ PsiMsDaq_DataCopy_f

typedef void PsiMsDaq_DataCopy_f(void *dst, void *src, size_t n)

Copy used to copy data recorded to other memory locations in PsiMsDaq_StrWin_GetDataUnwrapped()

Parameters
srcSource memory address (exactly the way the IP sees the address space)
dstDesitnation memory address (as the CPU sees it)
nNumber of bytes to copy

◆ PsiMsDaq_IpHandle

typedef void* PsiMsDaq_IpHandle

Handle to an instance of the driver for a complete IP.

◆ PsiMsDaq_RegRead_f

typedef uint32_t PsiMsDaq_RegRead_f(const uint32_t addr)

Read an IP-register.

Parameters
addrAddress to read from (byte address)
Returns
Read value

◆ PsiMsDaq_RegWrite_f

typedef void PsiMsDaq_RegWrite_f(const uint32_t addr, const uint32_t value)

Write an IP-register.

Parameters
addrAddress to write (byte address)
valueValue to write

◆ PsiMsDaq_StrHandle

typedef void* PsiMsDaq_StrHandle

Handle to a specific stream of the driver.

◆ PsiMsDaqn_StrIrq_f

typedef void PsiMsDaqn_StrIrq_f(PsiMsDaq_StrHandle strHandle, void *arg)

Interrupt callback function for the stream based IRQ scheme. In this IRQ scheme, one callback function is called whenever the IP fires an IRQ. This IRQ scheme is always usable but usually only required if window-overwrite is used (since the more elaborate window based IRQ scheme is not usable in this case).

Parameters
strHandleHandle of the stream that fired the IRQ
argUser argument list

◆ PsiMsDaqn_WinIrq_f

typedef void PsiMsDaqn_WinIrq_f(PsiMsDaq_WinInfo_t winInfo, void *arg)

Interrupt callback function for the window based IRQ scheme. In this IRQ scheme, one callback function is called for each window that arrives. This IRQ scheme is only usable if window-overwrite is disable (config.onverwrite = false). After the window data is processed, it must be freed by calling PsiMsDaq_StrWin_MarkAsFree().

Parameters
winInfoWindow information struct (allocated on stack!)
argUser argument list

Enumeration Type Documentation

◆ PsiMsDaq_RecMode_t

Recorder mode (see documentation)

Enumerator
PsiMsDaqn_RecMode_Continuous 

Continuous recording.

PsiMsDaqn_RecMode_TriggerMask 

Continuously record pre-trigger data but only detect triggers after PsiMsDaq_Str_Arm() was called.

PsiMsDaqn_RecMode_SingleShot 

Only record pre-trigger after PsiMsDaq_Str_Arm() was called and stop recording after one trigger.

PsiMsDaqn_RecMode_Manual 

Manaully control the recording by setting and clearing the arm bit.

◆ PsiMsDaq_RetCode_t

Return codes.

Enumerator
PsiMsDaq_RetCode_Success 

No error, everything OK.

PsiMsDaq_RetCode_IllegalStrNr 

Illegal stream number passed.

PsiMsDaq_RetCode_IllegalStrWidth 

Illegal steram width selected.

PsiMsDaq_RetCode_StrNotDisabled 

This function is only allowed if the stream is disbled but it was enabled.

PsiMsDaq_RetCode_IllegalWinCnt 

Illegal window count passed.

PsiMsDaq_RetCode_IllegalWinNr 

Illegal window number passed.

PsiMsDaq_RetCode_NoTrigInWin 

This window does not contain a trigger as required for this function call.

PsiMsDaq_RetCode_BufferTooSmall 

The buffer passed is too small to contain all data.

PsiMsDaq_RetCode_MorePostTrigThanConfigured 

More post trigger data requested than configured to be recorded.

PsiMsDaq_RetCode_MorePreTrigThanAvailable 

More pre-trigger data requested than available.

PsiMsDaq_RetCode_WinSizeMustBeMultipleOfSamples 

Window size must be a multiple of the sample size.

PsiMsDaq_RetCode_IrqSchemesWinAndStrAreExclusive 

Only one IRQ scheme (...Str or ...Win) can be used.

Function Documentation

◆ PsiMsDaq_GetStrHandle()

PsiMsDaq_RetCode_t PsiMsDaq_GetStrHandle ( PsiMsDaq_IpHandle  ipHandle,
const uint8_t  streamNr,
PsiMsDaq_StrHandle *const  strHndl_p 
)

Get a handle to a specific stream number.

Parameters
ipHandleDriver handle for the whole IP
streamNrStream number to get handle for
strHndl_pPointer to write the stream handle to
Returns
Return Code

◆ PsiMsDaq_HandleIrq()

void PsiMsDaq_HandleIrq ( PsiMsDaq_IpHandle  inst_p)

◆ PsiMsDaq_Init()

PsiMsDaq_IpHandle PsiMsDaq_Init ( const uint32_t  baseAddr,
const uint8_t  maxStreams,
const uint8_t  maxWindows,
const PsiMsDaq_AccessFct_t *const  accessFct_p 
)

Initialize the psi_ms_daq IP-Core.

Parameters
baseAddrBase address of the IP core to access
maxStreamsMaximum number of streams supported by this IP (must match setting in Vivado IPI)
maxWindowsMaximum number of windows per stream supported by this IP (must match setting in Vivado IPI)
accessFct_pMemory access functions to use (pass NULL to use the default functions)
Returns
Driver Handle

◆ PsiMsDaq_RegGetBit()

PsiMsDaq_RetCode_t PsiMsDaq_RegGetBit ( PsiMsDaq_IpHandle  ipHandle,
const uint32_t  addr,
const uint32_t  mask,
bool *const  value_p 
)

Read a bit from a register.

Parameters
ipHandleDriver handle for the whole IP
addrRegister address
maskBitmask
value_pRead value
Returns
Return Code

◆ PsiMsDaq_RegGetField()

PsiMsDaq_RetCode_t PsiMsDaq_RegGetField ( PsiMsDaq_IpHandle  ipHandle,
const uint32_t  addr,
const uint8_t  lsb,
const uint8_t  msb,
uint32_t *const  value_p 
)

Read a field from a register.

Parameters
ipHandleDriver handle for the whole IP
addrRegister address
lsbLeast significant bit number of the field
msbMost significant bit number of the field
value_pRead value
Returns
Return Code

◆ PsiMsDaq_RegRead()

PsiMsDaq_RetCode_t PsiMsDaq_RegRead ( PsiMsDaq_IpHandle  ipHandle,
const uint32_t  addr,
uint32_t *const  value_p 
)

Read a register.

Parameters
ipHandleDriver handle for the whole IP
addrRegister address
value_pRead value
Returns
Return Code

◆ PsiMsDaq_RegSetBit()

PsiMsDaq_RetCode_t PsiMsDaq_RegSetBit ( PsiMsDaq_IpHandle  ipHandle,
const uint32_t  addr,
const uint32_t  mask,
const bool  value 
)

Set a bit in a register (RMW)

Parameters
ipHandleDriver handle for the whole IP
addrRegister address
maskBitmask
valueValue to write
Returns
Return Code
Note
This function should only be used for debugging purposes! Otherwise the driver might not work.

◆ PsiMsDaq_RegSetField()

PsiMsDaq_RetCode_t PsiMsDaq_RegSetField ( PsiMsDaq_IpHandle  ipHandle,
const uint32_t  addr,
const uint8_t  lsb,
const uint8_t  msb,
const uint32_t  value 
)

Set a field in a register (RMW)

Parameters
ipHandleDriver handle for the whole IP
addrRegister address
lsbLeast significant bit number of the field
msbMost significant bit number of the field
valueValue to write
Returns
Return Code
Note
This function should only be used for debugging purposes! Otherwise the driver might not work.

◆ PsiMsDaq_RegWrite()

PsiMsDaq_RetCode_t PsiMsDaq_RegWrite ( PsiMsDaq_IpHandle  ipHandle,
const uint32_t  addr,
const uint32_t  value 
)

Write to a register.

Parameters
ipHandleDriver handle for the whole IP
addrRegister address
valueValue to write
Returns
Return Code
Note
This function should only be used for debugging purposes! Otherwise the driver might not work.

◆ PsiMsDaq_Str_Arm()

PsiMsDaq_RetCode_t PsiMsDaq_Str_Arm ( PsiMsDaq_StrHandle  strHndl)

Arm the recorder for a given stream.

Parameters
strHndlDriver handle for the stream
Returns
Return Code

◆ PsiMsDaq_Str_Configure()

PsiMsDaq_RetCode_t PsiMsDaq_Str_Configure ( PsiMsDaq_StrHandle  strHndl,
PsiMsDaq_StrConfig_t *const  config_p 
)

Configure stream.

Parameters
strHndlDriver handle for the stream
config_pStruct containing all settings
Returns
Return Code
Note
This function is only allwed if the corresponding stream is disabled

◆ PsiMsDaq_Str_CurrentPtr()

PsiMsDaq_RetCode_t PsiMsDaq_Str_CurrentPtr ( PsiMsDaq_StrHandle  strHndl,
uint32_t *const  currentPtr_p 
)

Get the current write pointer of the recording logic.

Parameters
strHndlDriver handle for the stream
currentPtr_pPointer to write the result into
Returns
Return Code

◆ PsiMsDaq_Str_CurrentWin()

PsiMsDaq_RetCode_t PsiMsDaq_Str_CurrentWin ( PsiMsDaq_StrHandle  strHndl,
uint8_t *const  currentWin_p 
)

Get the currently used recorder window.

Parameters
strHndlDriver handle for the stream
currentWin_pPointer to write the result into
Returns
Return Code

◆ PsiMsDaq_Str_GetFreeWindows()

PsiMsDaq_RetCode_t PsiMsDaq_Str_GetFreeWindows ( PsiMsDaq_StrHandle  strHndl,
uint8_t *const  freeWindows_p 
)

Get the number of free windows.

This function is implemented by looping over all windows and checking if they contain any unacknowledged data. This is quite slow but the only safe approach. So do not use this function excessively.

Parameters
strHndlDriver handle for the stream
freeWindows_pPointer to write the number of free windows into
Returns
Return Code

◆ PsiMsDaq_Str_GetIpHandle()

PsiMsDaq_RetCode_t PsiMsDaq_Str_GetIpHandle ( PsiMsDaq_StrHandle  strHndl,
PsiMsDaq_IpHandle ipHandle_p 
)

Get the IP Handle of the IP a stream belongs to.

Parameters
strHndlDriver handle for the stream
ipHandle_pPointer to write the IP handle into
Returns
Return Code

◆ PsiMsDaq_Str_GetLastWrittenWin()

PsiMsDaq_RetCode_t PsiMsDaq_Str_GetLastWrittenWin ( PsiMsDaq_StrHandle  strHndl,
uint8_t *const  lastWrittenWin_p 
)

Get the number of the last window that was written to memory completely.

Parameters
strHndlDriver handle for the stream
lastWrittenWin_pPointer to write the result into
Returns
Return Code

◆ PsiMsDaq_Str_GetMaxLvl()

PsiMsDaq_RetCode_t PsiMsDaq_Str_GetMaxLvl ( PsiMsDaq_StrHandle  strHndl,
uint32_t *const  maxLvl_p 
)

Get maximum input buffer fill level.

Parameters
strHndlDriver handle for the stream
maxLvl_pPointer to write the level into
Returns
Return Code

◆ PsiMsDaq_Str_GetStrNr()

PsiMsDaq_RetCode_t PsiMsDaq_Str_GetStrNr ( PsiMsDaq_StrHandle  strHndl,
uint8_t *  strNr_p 
)

Get the stream number from a stream handle.

Parameters
strHndlDriver handle for the stream
strNr_pPointer to write the stream number into
Returns
Return Code

◆ PsiMsDaq_Str_GetTotalWindows()

PsiMsDaq_RetCode_t PsiMsDaq_Str_GetTotalWindows ( PsiMsDaq_StrHandle  strHndl,
uint8_t *const  windows_p 
)

Get the number of windows configured to be used for a given stream.

Parameters
strHndlDriver handle for the stream
windows_pPointer to write the number of windows into
Returns
Return Code

◆ PsiMsDaq_Str_GetUsedWindows()

PsiMsDaq_RetCode_t PsiMsDaq_Str_GetUsedWindows ( PsiMsDaq_StrHandle  strHndl,
uint8_t *const  usedWindows_p 
)

Get the number of used (non-free) windows.

This function is implemented by looping over all windows and checking if they contain any unacknowledged data. This is quite slow but the only safe approach. So do not use this function excessively.

Parameters
strHndlDriver handle for the stream
usedWindows_pPointer to write the number of used windows into
Returns
Return Code

◆ PsiMsDaq_Str_IsRecording()

PsiMsDaq_RetCode_t PsiMsDaq_Str_IsRecording ( PsiMsDaq_StrHandle  strHndl,
bool *const  isRecording_p 
)

Check if the recorder of a given stream is currently recording data.

Parameters
strHndlDriver handle for the stream
isRecording_pPointer to write the result into
Returns
Return Code

◆ PsiMsDaq_Str_SetEnable()

PsiMsDaq_RetCode_t PsiMsDaq_Str_SetEnable ( PsiMsDaq_StrHandle  strHndl,
const bool  enable 
)

Enable/Disable a stream.

Parameters
strHndlDriver handle for the stream
enabletrue for enable, false for disable
Returns
Return Code

◆ PsiMsDaq_Str_SetIrqCallbackStr()

PsiMsDaq_RetCode_t PsiMsDaq_Str_SetIrqCallbackStr ( PsiMsDaq_StrHandle  strHndl,
PsiMsDaqn_StrIrq_f irqCb,
void *  arg_p 
)

Set stream based interrupt callback function for a stream to be called whenever a new windows is recorded. Usually PsiMsDaq_Str_SetIrqCallbackWin() is used instead of this function. So without special reasons, use PsiMsDaq_Str_SetIrqCallbackWin().

Parameters
strHndlDriver handle for the stream
irqCbCallback function. Pass NULL to unregister the callback.
arg_pArguments passed to the user callback function
Returns
Return Code
Note
Only one IRQ scheme (...Win or ...Str) can be used. Usually ...Win is used if window overwriting is disabled (config.overwrite = false) and ...Str otherwise.

◆ PsiMsDaq_Str_SetIrqCallbackWin()

PsiMsDaq_RetCode_t PsiMsDaq_Str_SetIrqCallbackWin ( PsiMsDaq_StrHandle  strHndl,
PsiMsDaqn_WinIrq_f irqCb,
void *  arg_p 
)

Set window based interrupt callback function for a stream to be called whenever a new windows is recorded.

Parameters
strHndlDriver handle for the stream
irqCbCallback function. Pass NULL to unregister the callback.
arg_pArguments passed to the user callback function
Returns
Return Code
Note
Only one IRQ scheme (...Win or ...Str) can be used. Usually ...Win is used if window overwriting is disabled (config.overwrite = false) and ...Str otherwise.

◆ PsiMsDaq_Str_SetIrqEnable()

PsiMsDaq_RetCode_t PsiMsDaq_Str_SetIrqEnable ( PsiMsDaq_StrHandle  strHndl,
const bool  irqEna 
)

Enable/Disable IRQ for a stream.

Parameters
strHndlDriver handle for the stream
irqEnatrue for enable, false for disable
Returns
Return Code

◆ PsiMsDaq_StrWin_GetDataUnwrapped()

PsiMsDaq_RetCode_t PsiMsDaq_StrWin_GetDataUnwrapped ( PsiMsDaq_WinInfo_t  winInfo,
const uint32_t  preTrigSamples,
const uint32_t  postTrigSamples,
void *const  buffer_p,
const size_t  bufferSize 
)

Get unwrapped copy of the data in a window.

Parameters
winInfoWindow information
preTrigSamplesNumber of pre trigger samples to read
postTrigSamplesNumber of post trigger samples to read (including the trigger sample)
buffer_pBuffer to copy the data into
bufferSizeSize of buffer_p
Returns
Return Code
Note
This function does not acknowledge the reading of the data. To do so, use PsiMsDaq_StrWin_MarkAsFree()

◆ PsiMsDaq_StrWin_GetLastSplAddr()

PsiMsDaq_RetCode_t PsiMsDaq_StrWin_GetLastSplAddr ( PsiMsDaq_WinInfo_t  winInfo,
uint32_t *const  lastSplAddr_p 
)

Get the address of the last sample (not byte) written into a window.

Parameters
winInfoWindow information
lastSplAddr_pPointer to write the address of the last sample into
Returns
Return Code

◆ PsiMsDaq_StrWin_GetNoOfBytes()

PsiMsDaq_RetCode_t PsiMsDaq_StrWin_GetNoOfBytes ( PsiMsDaq_WinInfo_t  winInfo,
uint32_t *const  noOfBytes_p 
)

Get number of valid and unacknowledged bytes in a window.

Parameters
winInfoWindow information
noOfBytes_pPointer to write number of bytes into
Returns
Return Code

◆ PsiMsDaq_StrWin_GetNoOfSamples()

PsiMsDaq_RetCode_t PsiMsDaq_StrWin_GetNoOfSamples ( PsiMsDaq_WinInfo_t  winInfo,
uint32_t *const  noOfSamples_p 
)

Get number of valid and unacknowledged samples in a window.

Parameters
winInfoWindow information
noOfSamples_pPointer to write number of samples into
Returns
Return Code

◆ PsiMsDaq_StrWin_GetPreTrigSamples()

PsiMsDaq_RetCode_t PsiMsDaq_StrWin_GetPreTrigSamples ( PsiMsDaq_WinInfo_t  winInfo,
uint32_t *const  preTrigSamples_p 
)

Get the number of pre-trigger samples in a window (post trigger samples are known by config)

Parameters
winInfoWindow information
preTrigSamples_pPointer to write number of pre-trigger samples into
Returns
Return Code

◆ PsiMsDaq_StrWin_GetTimestamp()

PsiMsDaq_RetCode_t PsiMsDaq_StrWin_GetTimestamp ( PsiMsDaq_WinInfo_t  winInfo,
uint64_t *const  timestamp_p 
)

Get the timestamp of a window.

Parameters
winInfoWindow information
timestamp_pPointer to write the timestamp to
Returns
Return Code

◆ PsiMsDaq_StrWin_MarkAsFree()

PsiMsDaq_RetCode_t PsiMsDaq_StrWin_MarkAsFree ( PsiMsDaq_WinInfo_t  winInfo)

Mark a window as free so it can receive new data. This function must be called after the window data is read.

Parameters
winInfoWindow information
Returns
Return Code