irioCoreCpp Library Module  2.1.0
irio::TerminalsDMACommon Class Reference

Class managing the terminals common to all other terminals that use DMAs in the RIO device. More...

#include <terminalsDMACommon.h>

Inheritance diagram for irio::TerminalsDMACommon:

Public Member Functions

 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 terminals common to all other terminals that use DMAs in the RIO device.

Definition at line 19 of file terminalsDMACommon.h.

Constructor & Destructor Documentation

◆ TerminalsDMACommon()

irio::TerminalsDMACommon::TerminalsDMACommon ( std::shared_ptr< TerminalsDMACommonImpl >  impl)
explicit

Manages finding DMA resources common to all terminals that use them, DAQ/IMAQ.

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

Member Function Documentation

◆ cleanAllDMAs()

void irio::TerminalsDMACommon::cleanAllDMAs ( ) const

Cleans the contents of all DMAs in the FPGA.

Warning: If the DMA is running, it may lead to a situation where more data is read that is possible to clean, which may lead to a infinite loop

Exceptions
irio::errors::NiFpgaErrorError occurred in an FPGA operation

◆ cleanDMA()

void irio::TerminalsDMACommon::cleanDMA ( const std::uint32_t  n) const

Cleans the contents of a specified DMA group.

Warning: If the DMA is running, it may lead to a situation where more data is read that is possible to clean, which may lead to a infinite loop

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
nDMA group to clean

◆ countDMAs()

size_t irio::TerminalsDMACommon::countDMAs ( ) const

Returns the number of DMAs found.

Returns
Number of found DMAs

◆ disableDMA()

void irio::TerminalsDMACommon::disableDMA ( const std::uint32_t  n) const

Disables a DMA group.

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
nNumber of DMA group

◆ enableDMA()

void irio::TerminalsDMACommon::enableDMA ( const std::uint32_t  n) const

Enables a DMA group.

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
nNumber of DMA group

◆ enaDisDMA()

void irio::TerminalsDMACommon::enaDisDMA ( const std::uint32_t  n,
bool  enaDis 
) const

Enables or disables a DMA group.

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
nNumber of DMA group
enaDisTrue to enable, false to disable

◆ getAllDMAOverflows()

std::uint16_t irio::TerminalsDMACommon::getAllDMAOverflows ( ) const

Returns the FPGA DMA Overflow register.

The nth bit of the register corresponds to the overflow value of the nth DMA.

Exceptions
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Returns
FPGA DMA Overflow register value

◆ getAllFrameType()

std::vector<FrameType> irio::TerminalsDMACommon::getAllFrameType ( ) const

Returns a vector of the frame types used by each DMA in the FPGA.

Returns
Vector of frame types, the position corresponds to the number of DMA

◆ getAllSampleSizes()

std::vector<std::uint8_t> irio::TerminalsDMACommon::getAllSampleSizes ( ) const

Returns a vector of sample sizes used by each DMA in the FPGA.

Returns
Vector of sample sizes (in bytes), the position corresponds to the number of DMA

◆ getDMAOverflow()

bool irio::TerminalsDMACommon::getDMAOverflow ( const std::uint16_t  n) const

Returns the FPGA DMA Overflow register of a specific DMA.

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
nNumber of DMA group
Returns
True if overflows occurred, false if not

◆ getFrameType()

FrameType irio::TerminalsDMACommon::getFrameType ( const std::uint32_t  n) const

Return the type of frame used in a specific DMA.

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
Parameters
nNumber of DMA group
Returns
Type of frame used by the DMA

◆ getNCh()

std::uint16_t irio::TerminalsDMACommon::getNCh ( const std::uint32_t  n) const

Returns number of channels in specific DMA.

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
Parameters
nNumber of DMA group
Returns
Number of channels implemented in the specified DMA

◆ getSampleSize()

std::uint8_t irio::TerminalsDMACommon::getSampleSize ( const std::uint32_t  n) const

Returns the sample size of each data for a specific DMA.

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
nNumber of DMA group
Returns
Sample size in bytes for the specified DMA

◆ isDMAEnable()

bool irio::TerminalsDMACommon::isDMAEnable ( const std::uint32_t  n) const

Returns if a DMA group is enabled or not.

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
nNumber of DMA group
Returns
True if enabled, false if not

◆ readData()

size_t irio::TerminalsDMACommon::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.

It can be configure to wait until there are the specified number of elements 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
elementsToReadNumber of elements to read from the DMA
dataBuffer to write the read data. Allocation and deallocation of data is user responsibility
blockReadWhether to wait until the requested number of elements (elementsToRead) are available or not
timeoutIf blockRead is true. Max time in milliseconds to wait for the elementsToRead 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 elementsToRead it they were.

◆ readDataBlocking()

size_t irio::TerminalsDMACommon::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.

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
elementsToReadNumber of elements to read from the DMA
dataBuffer to write the read data. Allocation and deallocation of data 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

◆ readDataNonBlocking()

size_t irio::TerminalsDMACommon::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.

If there are less elements than requested nothing is read.

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
nNumber of DMA group
elementsToReadNumber of elements to read from the DMA
dataBuffer 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.

◆ startAllDMAs()

void irio::TerminalsDMACommon::startAllDMAs ( ) const

Configures and starts all DMAs in the FPGA.

Exceptions
irio::errors::NiFpgaErrorError occurred in an FPGA operation

◆ startDMA()

void irio::TerminalsDMACommon::startDMA ( const std::uint32_t  n) const

Configure a specified DMA, start it and clean its contents.

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
nDMA group to configure and start

◆ stopAllDMAs()

void irio::TerminalsDMACommon::stopAllDMAs ( ) const

Stops all DMAs in the FPGA.

Exceptions
irio::errors::NiFpgaErrorError occurred in an FPGA operation

◆ stopDMA()

void irio::TerminalsDMACommon::stopDMA ( const std::uint32_t  n) const

Stops the specified DMA group.

Exceptions
irio::errors::ResourceNotFoundErrorResource specified not found
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
nDMA to stop

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