irioCoreCpp Library Module  2.1.0
terminalsDMACommon.h
1 #pragma once
2 
3 #include <vector>
4 #include <memory>
5 
6 #include "terminals/terminalsBase.h"
7 #include "frameTypes.h"
8 
9 namespace irio {
10 
11 class TerminalsDMACommonImpl;
12 
20  public:
30  std::shared_ptr<TerminalsDMACommonImpl> impl);
31 
40  std::uint16_t getNCh(const std::uint32_t n) const;
41 
51  bool getDMAOverflow(const std::uint16_t n) const;
52 
63  std::uint16_t getAllDMAOverflows() const;
64 
73  FrameType getFrameType(const std::uint32_t n) const;
74 
79  std::vector<FrameType> getAllFrameType() const;
80 
90  std::uint8_t getSampleSize(const std::uint32_t n) const;
91 
97  std::vector<std::uint8_t> getAllSampleSizes() const;
98 
107  void startDMA(const std::uint32_t n) const;
108 
115  void startAllDMAs() const;
116 
125  void stopDMA(const std::uint32_t n) const;
126 
133  void stopAllDMAs() const;
134 
147  void cleanDMA(const std::uint32_t n) const;
148 
158  void cleanAllDMAs() const;
159 
169  bool isDMAEnable(const std::uint32_t n) const;
170 
179  void enableDMA(const std::uint32_t n) const;
180 
189  void disableDMA(const std::uint32_t n) const;
190 
200  void enaDisDMA(const std::uint32_t n, bool enaDis) const;
201 
219  const std::uint32_t n,
220  const size_t elementsToRead,
221  std::uint64_t *data) const;
222 
246  const std::uint32_t n,
247  const size_t elementsToRead,
248  std::uint64_t *data,
249  const std::uint32_t timeout = 0) const;
250 
274  size_t readData(
275  const std::uint32_t n,
276  const size_t elementsToRead,
277  std::uint64_t *data,
278  const bool blockRead,
279  const std::uint32_t timeout = 0) const;
280 
286  size_t countDMAs() const;
287 };
288 } // namespace irio
Base class for all terminals.
Definition: terminalsBase.h:21
Class managing the terminals common to all other terminals that use DMAs in the RIO device.
void stopAllDMAs() const
Stops all DMAs in the FPGA.
bool isDMAEnable(const std::uint32_t n) const
Returns if a DMA group is enabled or not.
void enableDMA(const std::uint32_t n) const
Enables a DMA group.
void cleanAllDMAs() const
Cleans the contents of all DMAs in the FPGA.
std::uint16_t getNCh(const std::uint32_t n) const
Returns number of channels in specific DMA.
bool getDMAOverflow(const std::uint16_t n) const
Returns the FPGA DMA Overflow register of a specific DMA.
void disableDMA(const std::uint32_t n) const
Disables a DMA group.
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.
void startDMA(const std::uint32_t n) const
Configure a specified DMA, start it and clean its contents.
std::uint8_t getSampleSize(const std::uint32_t n) const
Returns the sample size of each data for a specific DMA.
void enaDisDMA(const std::uint32_t n, bool enaDis) const
Enables or disables a DMA group.
std::uint16_t getAllDMAOverflows() const
Returns the FPGA DMA Overflow register.
std::vector< FrameType > getAllFrameType() const
Returns a vector of the frame types used by each DMA in the FPGA.
size_t countDMAs() const
Returns the number of DMAs found.
std::vector< std::uint8_t > getAllSampleSizes() const
Returns a vector of sample sizes used by each DMA in the FPGA.
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.
void stopDMA(const std::uint32_t n) const
Stops the specified DMA group.
void startAllDMAs() const
Configures and starts all DMAs in the FPGA.
TerminalsDMACommon(std::shared_ptr< TerminalsDMACommonImpl > impl)
Manages finding DMA resources common to all terminals that use them, DAQ/IMAQ.
void cleanDMA(const std::uint32_t n) const
Cleans the contents of a specified DMA group.
FrameType getFrameType(const std::uint32_t n) const
Return the type of frame used in a specific DMA.
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.