irioCoreCpp Library Module  2.1.0
irio::TerminalsDMAIMAQ Class Reference

Class managing the resources used for IMAQ DAQ operations. More...

#include <terminalsDMAIMAQ.h>

Inheritance diagram for irio::TerminalsDMAIMAQ:

Public Member Functions

 TerminalsDMAIMAQ (std::shared_ptr< TerminalsDMAIMAQImpl > impl)
 Manages finding IMAQ resources. More...
 
void configCameraLink (const std::int32_t fvalHigh, const std::int32_t lvalHigh, const std::int32_t dvalHigh, const std::int32_t spareHigh, const std::int32_t controlEnable, const std::int32_t linescan, const CLSignalMapping &signalMapping, const CLMode &mode) const
 Configure CameraLink frame grabber. More...
 
size_t readImageNonBlocking (const std::uint32_t n, const size_t imagePixelSize, std::uint64_t *imageRead) const
 Tries to read an specifeid number of pixels. More...
 
size_t readImageBlocking (const std::uint32_t n, const size_t imagePixelSize, std::uint64_t *imageRead, const std::uint32_t timeout=0) const
 Waits to read an specified number of pixels from a DMA group. More...
 
size_t readImage (const std::uint32_t n, const size_t imagePixelSize, std::uint64_t *imageRead, const bool blockRead, const std::uint32_t timeout=0) const
 Reads an specified number of pixels from a DMA group. More...
 
void sendUARTMsg (const std::vector< std::uint8_t > &msg, const std::uint32_t timeout=0) const
 Sends an UART message to the CameraLink system. More...
 
std::vector< std::uint8_t > recvUARTMsg (const size_t bytesToRecv=0, const std::uint32_t timeout=1000) const
 Reads an UART message from the CameraLink system. More...
 
void setUARTBaudRate (const UARTBaudRates &baudRate, const std::uint32_t timeout=0) const
 Sets UART baud rate. More...
 
UARTBaudRates getUARTBaudRate () const
 Read UART baud rate. More...
 
std::uint16_t getUARTBreakIndicator () const
 Read UART Break Indicator. More...
 
std::uint16_t getUARTFramingError () const
 Read UART Framing Error. More...
 
std::uint16_t getUARTOverrunError () const
 Read UART Overrun Error. More...
 
- Public Member Functions inherited from irio::TerminalsDMACommon
 TerminalsDMACommon (std::shared_ptr< TerminalsDMACommonImpl > impl)
 Manages finding DMA resources common to all terminals that use them, DAQ/IMAQ. More...
 
std::uint16_t getNCh (const std::uint32_t n) const
 Returns number of channels in specific DMA. More...
 
bool getDMAOverflow (const std::uint16_t n) const
 Returns the FPGA DMA Overflow register of a specific DMA. More...
 
std::uint16_t getAllDMAOverflows () const
 Returns the FPGA DMA Overflow register. More...
 
FrameType getFrameType (const std::uint32_t n) const
 Return the type of frame used in a specific DMA. More...
 
std::vector< FrameType > getAllFrameType () const
 Returns a vector of the frame types used by each DMA in the FPGA. More...
 
std::uint8_t getSampleSize (const std::uint32_t n) const
 Returns the sample size of each data for a specific DMA. More...
 
std::vector< std::uint8_t > getAllSampleSizes () const
 Returns a vector of sample sizes used by each DMA in the FPGA. More...
 
void startDMA (const std::uint32_t n) const
 Configure a specified DMA, start it and clean its contents. More...
 
void startAllDMAs () const
 Configures and starts all DMAs in the FPGA. More...
 
void stopDMA (const std::uint32_t n) const
 Stops the specified DMA group. More...
 
void stopAllDMAs () const
 Stops all DMAs in the FPGA. More...
 
void cleanDMA (const std::uint32_t n) const
 Cleans the contents of a specified DMA group. More...
 
void cleanAllDMAs () const
 Cleans the contents of all DMAs in the FPGA. More...
 
bool isDMAEnable (const std::uint32_t n) const
 Returns if a DMA group is enabled or not. More...
 
void enableDMA (const std::uint32_t n) const
 Enables a DMA group. More...
 
void disableDMA (const std::uint32_t n) const
 Disables a DMA group. More...
 
void enaDisDMA (const std::uint32_t n, bool enaDis) const
 Enables or disables a DMA group. More...
 
size_t readDataNonBlocking (const std::uint32_t n, const size_t elementsToRead, std::uint64_t *data) const
 Tries to read an specified number of elements from a DMA group. More...
 
size_t readDataBlocking (const std::uint32_t n, const size_t elementsToRead, std::uint64_t *data, const std::uint32_t timeout=0) const
 Waits to read an specified number of elements from a DMA group. More...
 
size_t readData (const std::uint32_t n, const size_t elementsToRead, std::uint64_t *data, const bool blockRead, const std::uint32_t timeout=0) const
 Reads an specified number of elements from a DMA group. More...
 
size_t countDMAs () const
 Returns the number of DMAs found. More...
 
- Public Member Functions inherited from irio::TerminalsBase
 TerminalsBase (std::shared_ptr< TerminalsBaseImpl > impl)
 Base class used for terminals. More...
 

Additional Inherited Members

- Protected Attributes inherited from irio::TerminalsBase
std::shared_ptr< TerminalsBaseImpl > m_impl
 Smart pointer with the terminal implementation.
 

Detailed Description

Class managing the resources used for IMAQ DAQ operations.

Definition at line 17 of file terminalsDMAIMAQ.h.

Constructor & Destructor Documentation

◆ TerminalsDMAIMAQ()

irio::TerminalsDMAIMAQ::TerminalsDMAIMAQ ( std::shared_ptr< TerminalsDMAIMAQImpl >  impl)
explicit

Manages finding IMAQ resources.

Exceptions
irio::errors::NiFpgaErrorError reading resources from the FPGA
Parameters
implShared pointer to a class implementing the functionality

Member Function Documentation

◆ configCameraLink()

void irio::TerminalsDMAIMAQ::configCameraLink ( const std::int32_t  fvalHigh,
const std::int32_t  lvalHigh,
const std::int32_t  dvalHigh,
const std::int32_t  spareHigh,
const std::int32_t  controlEnable,
const std::int32_t  linescan,
const CLSignalMapping &  signalMapping,
const CLMode &  mode 
) const

Configure CameraLink frame grabber.

Configure CameraLink frame grabber with the camera parameters. This configuration includes:

  • Set whether the CaneraLink signals FVAL, LVAL, DVAL, and SPARE are active high or active low.
  • Set whether the CameraLink control signals will be driven by the FPGA or not.
  • Set the scanning mode between regular and line scan.
  • Set the signal mapping when using extended configuration mode.
  • Set the configuration mode.

This configuration must be done before running the FPGA.

Exceptions
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
fvalHigh0=FVAL active low 1=FVAL active high
lvalHigh0=LVAL active low 1=LVAL active high
dvalHigh0=DVAL active low 1=DVAL active high
spareHigh0=SPARE active low 1=SPARE active high
controlEnable0=High impedance on conrol signals 1=Control signals driver by the FPGA.
linescan0=Regular scan (complete image) 1=Line scan
signalMappingSignal map to be used.
modeConfiguration to be used.

◆ getUARTBaudRate()

UARTBaudRates irio::TerminalsDMAIMAQ::getUARTBaudRate ( ) const

Read UART baud rate.

Exceptions
irio::errors::NiFpgaErrorError occurred in an FPGA operation
irio::errors::CLUARTInvalidBaudRateThe baud rate read from the FPGA does nto match any of the expected values
Returns
Baud rate read

◆ getUARTBreakIndicator()

std::uint16_t irio::TerminalsDMAIMAQ::getUARTBreakIndicator ( ) const

Read UART Break Indicator.

Reads the value from CameraLink UART break indicator port. A non-zero value returned indicates an interruption in the UART communication.

Exceptions
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Returns
Current value of the UART Break Indicator

◆ getUARTFramingError()

std::uint16_t irio::TerminalsDMAIMAQ::getUARTFramingError ( ) const

Read UART Framing Error.

Reads the value from CameraLink UART framing error port. A non-zero value returned indicates problems while receiving UART data.

Exceptions
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Returns
Current value of the UART Framing Error

◆ getUARTOverrunError()

std::uint16_t irio::TerminalsDMAIMAQ::getUARTOverrunError ( ) const

Read UART Overrun Error.

Reads the value from CameraLink UART overrun error port. A non-zero value returned indicates an overrun in a UART buffer, causing data loss.

Exceptions
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Returns
Current value of the UART Overrun Error

◆ readImage()

size_t irio::TerminalsDMAIMAQ::readImage ( const std::uint32_t  n,
const size_t  imagePixelSize,
std::uint64_t *  imageRead,
const bool  blockRead,
const std::uint32_t  timeout = 0 
) const

Reads an specified number of pixels from a DMA group.

It can be configure to wait until there are the specified number of pixels in the DMA or read nothing if there are not enough. If configured to wait, a timeout can be specified.

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
irio::errors::DMAReadTimeoutIf reading is in blocking mode, and the timeout expires waiting for enough data to be read
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
nNumber of DMA group
imagePixelSizeNumber of pixels to read from the DMA
imageReadBuffer to write the read image. Allocation and deallocation of this buffer is user responsibility
blockReadWhether to wait until the requested number of pixels ( imagePixelSize) are available or not
timeoutIf blockRead is true. Max time in milliseconds to wait for the imagePixelSize to be available, 0 means wait indefinitely. If blockRead is false, this parameter is ignored.
Returns
Number of elements read. 0 if they were not enough, the number specified in imagePixelSize it they were.

◆ readImageBlocking()

size_t irio::TerminalsDMAIMAQ::readImageBlocking ( const std::uint32_t  n,
const size_t  imagePixelSize,
std::uint64_t *  imageRead,
const std::uint32_t  timeout = 0 
) const

Waits to read an specified number of pixels from a DMA group.

The read operation will block until the requested number of elements are available or a timeout expires if specified.

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
irio::errors::DMAReadTimeoutIf reading is in blocking mode, and the timeout expires waiting for enough data to be read
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
nNumber of DMA group
imagePixelSizeNumber of pixels to read from the DMA
imageReadBuffer to write the read image. Allocation and deallocation of this buffer is user responsibility
timeoutMax time in milliseconds to wait for the elementsToRead to be available, 0 to wait indefinitely.
Returns
Unless the timeout expires, this function will always return the specified elementsToRead

◆ readImageNonBlocking()

size_t irio::TerminalsDMAIMAQ::readImageNonBlocking ( const std::uint32_t  n,
const size_t  imagePixelSize,
std::uint64_t *  imageRead 
) const

Tries to read an specifeid number of pixels.

If there are less pixels than requested available, nothing is read.

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
nNumber of DMA group where image is stored
imagePixelSizeSize of the image in pixels
imageReadBuffer to write the read data. Allocation and deallocation of data is user responsibility
Returns
Number of elements read. 0 if they were not enough, the number specified in elementsToRead it they were.

◆ recvUARTMsg()

std::vector<std::uint8_t> irio::TerminalsDMAIMAQ::recvUARTMsg ( const size_t  bytesToRecv = 0,
const std::uint32_t  timeout = 1000 
) const

Reads an UART message from the CameraLink system.

Do not use bytesToRecv = 0 and timeout = 0 at the same time!

Exceptions
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
bytesToRecvNumber of bytes to read. If it is 0, reads everything until timeout
timeoutMax time (ms) to wait between bytes. (0 to wait indefinetly)
Returns
Message read

◆ sendUARTMsg()

void irio::TerminalsDMAIMAQ::sendUARTMsg ( const std::vector< std::uint8_t > &  msg,
const std::uint32_t  timeout = 0 
) const

Sends an UART message to the CameraLink system.

Streams the given vector to the CameraLink camera connected to the frame grabber.

Exceptions
irio::errors::NiFpgaErrorError occurred in an FPGA operation
irio::errors::CLUARTTimeoutTimeout waiting for TERMINAL_UARTTXREADY to be ready
Parameters
msgMessage to send
timeoutTime in ms to wait for line to be ready to send message. (0 to wait indefinetly)

◆ setUARTBaudRate()

void irio::TerminalsDMAIMAQ::setUARTBaudRate ( const UARTBaudRates &  baudRate,
const std::uint32_t  timeout = 0 
) const

Sets UART baud rate.

Exceptions
irio::errors::NiFpgaErrorError occurred in an FPGA operation
irio::errors::CLUARTTimeoutTimeout waiting for TERMINAL_UARTSETBAUDRATE to be ready
Parameters
baudRateBaud rate to configure.
timeoutTime in ms to wait for the line to be ready (0 to wait indefinetly)

The documentation for this class was generated from the following file: