rogue
Loading...
Searching...
No Matches
AxiStreamDma.cpp
Go to the documentation of this file.
1
17#include "rogue/Directives.h"
18
20
21#include <inttypes.h>
22
23#include <cstdio>
24#include <cstdlib>
25#include <map>
26#include <memory>
27#include <string>
28
29#include "rogue/GeneralError.h"
30#include "rogue/GilRelease.h"
31#include "rogue/Helpers.h"
36
37namespace rha = rogue::hardware::axi;
39
40#ifndef NO_PYTHON
41 #include <boost/python.hpp>
42namespace bp = boost::python;
43#endif
44
45std::map<std::string, std::shared_ptr<rha::AxiStreamDmaShared> > rha::AxiStreamDma::sharedBuffers_;
46
47rha::AxiStreamDmaShared::AxiStreamDmaShared(std::string path) {
48 this->fd = -1;
49 this->path = path;
50 this->openCount = 1;
51 this->rawBuff = NULL;
52 this->bCount = 0;
53 this->bSize = 0;
54 this->zCopyEn = true;
55}
56
58rha::AxiStreamDmaSharedPtr rha::AxiStreamDma::openShared(std::string path, rogue::LoggingPtr log) {
59 std::map<std::string, rha::AxiStreamDmaSharedPtr>::iterator it;
61
62 // Entry already exists
63 if ((it = sharedBuffers_.find(path)) != sharedBuffers_.end()) {
64 ret = it->second;
65 log->debug("Reusing existing shared file descriptor for %s", path.c_str());
66
67 // Create new record
68 } else {
69 ret = std::make_shared<rha::AxiStreamDmaShared>(path);
70 log->debug("Opening new shared file descriptor for %s", path.c_str());
71 }
72
73 // Check if already open
74 if (ret->fd != -1) {
75 ret->openCount++;
76 log->debug("Shared file descriptor already opened for %s", path.c_str());
77 return ret;
78 }
79
80 // Check if zero copy is disabled, if so don't open or map buffers
81 if (!ret->zCopyEn) {
82 log->debug("Zero copy is disabled. Not Mapping Buffers for %s", path.c_str());
83 return ret;
84 }
85
86 // We need to open device and create shared buffers
87 if ((ret->fd = ::open(path.c_str(), O_RDWR)) < 0)
88 throw(rogue::GeneralError::create("AxiStreamDma::openShared", "Failed to open device file: %s", path.c_str()));
89
90 // Check driver version ( ApiVersion 0x05 (or less) is the 32-bit address version)
91 if (dmaGetApiVersion(ret->fd) < 0x06) {
92 ::close(ret->fd);
93 throw(rogue::GeneralError("AxiStreamDma::openShared",
94 R"(Bad kernel driver version detected. Please re-compile kernel driver.
95 Note that aes-stream-driver (v5.15.2 or earlier) and rogue (v5.11.1 or earlier) are compatible with the 32-bit address API.
96 To use later versions (64-bit address API),, you will need to upgrade both rogue and aes-stream-driver at the same time to:
97 \t\taes-stream-driver = v5.16.0 (or later)
98 \t\trogue = v5.13.0 (or later))"));
99 }
100
101 // Check for mismatch in the rogue/loaded_driver API versions
102 if (dmaCheckVersion(ret->fd) < 0) {
103 ::close(ret->fd);
105 "AxiStreamDma::openShared",
106 "Rogue DmaDriver.h API Version (DMA_VERSION) does not match the aes-stream-driver API version"));
107 }
108
109 // Result may be that rawBuff = NULL
110 // Should this just be a warning?
111 ret->rawBuff = dmaMapDma(ret->fd, &(ret->bCount), &(ret->bSize));
112 if (ret->rawBuff == NULL) {
113 ret->bCount = dmaGetBuffCount(ret->fd);
114
115 // New map limit should be 8K more than the total number of buffers we require
116 uint32_t mapSize = ret->bCount + 8192;
117
118 ::close(ret->fd);
120 "AxiStreamDma::openShared",
121 "Failed to map dma buffers. Increase vm map limit to : sudo sysctl -w vm.max_map_count=%i",
122 mapSize));
123 }
124 log->debug("Mapped buffers. bCount = %i, bSize=%i for %s", ret->bCount, ret->bSize, path.c_str());
125
126 // Add entry to map and return
127 sharedBuffers_.insert(std::pair<std::string, rha::AxiStreamDmaSharedPtr>(path, ret));
128 return ret;
129}
130
132void rha::AxiStreamDma::closeShared(rha::AxiStreamDmaSharedPtr desc) {
133 desc->openCount--;
134
135 if (desc->openCount == 0) {
136 if (desc->rawBuff != NULL) {
137 dmaUnMapDma(desc->fd, desc->rawBuff);
138 }
139
140 ::close(desc->fd);
141 desc->fd = -1;
142 desc->bCount = 0;
143 desc->bSize = 0;
144 desc->rawBuff = NULL;
146}
147
149rha::AxiStreamDmaPtr rha::AxiStreamDma::create(std::string path, uint32_t dest, bool ssiEnable) {
150 rha::AxiStreamDmaPtr r = std::make_shared<rha::AxiStreamDma>(path, dest, ssiEnable);
151 return (r);
152}
153
154void rha::AxiStreamDma::zeroCopyDisable(std::string path) {
155 std::map<std::string, rha::AxiStreamDmaSharedPtr>::iterator it;
156
157 // Entry already exists
158 if ((it = sharedBuffers_.find(path)) != sharedBuffers_.end())
159 throw(rogue::GeneralError("AxiStreamDma::zeroCopyDisable",
160 "zeroCopyDisable can't be called twice or after a device has been opened"));
161
162 // Create new record
163 rha::AxiStreamDmaSharedPtr ret = std::make_shared<rha::AxiStreamDmaShared>(path);
164 ret->zCopyEn = false;
165
166 sharedBuffers_.insert(std::pair<std::string, rha::AxiStreamDmaSharedPtr>(path, ret));
167}
168
170rha::AxiStreamDma::AxiStreamDma(std::string path, uint32_t dest, bool ssiEnable) {
171 uint8_t mask[DMA_MASK_SIZE];
172
173 dest_ = dest;
174 enSsi_ = ssiEnable;
175 retThold_ = 1;
176
177 // Create a shared pointer to use as a lock for runThread()
178 std::shared_ptr<int> scopePtr = std::make_shared<int>(0);
179
180 rogue::defaultTimeout(timeout_);
181
182 log_ = rogue::Logging::create("axi.AxiStreamDma");
183
184 rogue::GilRelease noGil;
185
186 // Attempt to open shared structure
187 desc_ = openShared(path, log_);
188
189 if (desc_->bCount >= 1000) retThold_ = 80;
190
191 // Open non shared file descriptor
192 if ((fd_ = ::open(path.c_str(), O_RDWR)) < 0) {
193 closeShared(desc_);
194 throw(
195 rogue::GeneralError::create("AxiStreamDma::AxiStreamDma", "Failed to open device file: %s", path.c_str()));
196 }
197
198 // Zero copy is disabled
199 if (desc_->rawBuff == NULL) {
200 desc_->bCount = dmaGetTxBuffCount(fd_) + dmaGetRxBuffCount(fd_);
201 desc_->bSize = dmaGetBuffSize(fd_);
202 }
203 if (desc_->bCount >= 1000) retThold_ = 80;
204
205 dmaInitMaskBytes(mask);
206 dmaAddMaskBytes(mask, dest_);
207
208 if (dmaSetMaskBytes(fd_, mask) < 0) {
209 closeShared(desc_);
210 ::close(fd_);
211 throw(rogue::GeneralError::create("AxiStreamDma::AxiStreamDma",
212 "Failed to open device file %s with dest 0x%" PRIx32
213 "! Another process may already have it open!",
214 path.c_str(),
215 dest));
216 }
217
218 // Start read thread
219 threadEn_ = true;
220 thread_ = new std::thread(&rha::AxiStreamDma::runThread, this, std::weak_ptr<int>(scopePtr));
221
222 // Set a thread name
223#ifndef __MACH__
224 pthread_setname_np(thread_->native_handle(), "AxiStreamDma");
225#endif
226}
227
229rha::AxiStreamDma::~AxiStreamDma() {
230 this->stop();
231}
232
233void rha::AxiStreamDma::stop() {
234 if (threadEn_) {
235 rogue::GilRelease noGil;
236
237 // Stop read thread
238 threadEn_ = false;
239 thread_->join();
240
241 closeShared(desc_);
242 ::close(fd_);
243 fd_ = -1;
245}
246
248void rha::AxiStreamDma::setTimeout(uint32_t timeout) {
249 if (timeout > 0) {
250 div_t divResult = div(timeout, 1000000);
251 timeout_.tv_sec = divResult.quot;
252 timeout_.tv_usec = divResult.rem;
254}
255
257void rha::AxiStreamDma::setDriverDebug(uint32_t level) {
258 dmaSetDebug(fd_, level);
259}
260
262void rha::AxiStreamDma::dmaAck() {
263 if (fd_ >= 0) axisReadAck(fd_);
264}
265
267ris::FramePtr rha::AxiStreamDma::acceptReq(uint32_t size, bool zeroCopyEn) {
268 int32_t res;
269 fd_set fds;
270 struct timeval tout;
271 uint32_t alloc;
272 ris::BufferPtr buff;
273 ris::FramePtr frame;
274 uint32_t buffSize;
275
277 if (size > desc_->bSize)
278 buffSize = desc_->bSize;
279 else
280 buffSize = size;
281
282 // Zero copy is disabled. Allocate from memory.
283 if (zeroCopyEn == false || desc_->rawBuff == NULL) {
284 frame = reqLocalFrame(size, false);
285
286 // Allocate zero copy buffers from driver
287 } else {
288 rogue::GilRelease noGil;
289
290 // Create empty frame
291 frame = ris::Frame::create();
292 alloc = 0;
293
294 // Request may be serviced with multiple buffers
295 while (alloc < size) {
296 // Keep trying since select call can fire
297 // but getIndex fails because we did not win the buffer lock
298 do {
299 // Setup fds for select call
300 FD_ZERO(&fds);
301 FD_SET(fd_, &fds);
302
303 // Setup select timeout
304 tout = timeout_;
305
306 if (select(fd_ + 1, NULL, &fds, NULL, &tout) <= 0) {
307 log_->critical("AxiStreamDma::acceptReq: Timeout waiting for outbound buffer after %" PRIuLEAST32
308 ".%" PRIuLEAST32 " seconds! May be caused by outbound back pressure.",
309 timeout_.tv_sec,
310 timeout_.tv_usec);
311 res = -1;
312 } else {
313 // Attempt to get index.
314 // return of less than 0 is a failure to get a buffer
315 res = dmaGetIndex(fd_);
316 }
317 } while (res < 0);
318
319 // Mark zero copy meta with bit 31 set, lower bits are index
320 buff = createBuffer(desc_->rawBuff[res], 0x80000000 | res, buffSize, desc_->bSize);
321 frame->appendBuffer(buff);
322 alloc += buffSize;
323 }
324 }
325 return (frame);
326}
327
329void rha::AxiStreamDma::acceptFrame(ris::FramePtr frame) {
330 int32_t res;
331 fd_set fds;
332 struct timeval tout;
333 uint32_t meta;
334 uint32_t fuser;
335 uint32_t luser;
336 uint32_t cont;
337 bool emptyFrame;
338
339 rogue::GilRelease noGil;
340 ris::FrameLockPtr lock = frame->lock();
341 emptyFrame = false;
342
343 // Drop errored frames
344 if (frame->getError()) {
345 log_->warning("Dumping errored frame");
346 return;
347 }
348
349 // Go through each (*it)er in the frame
350 ris::Frame::BufferIterator it;
351 for (it = frame->beginBuffer(); it != frame->endBuffer(); ++it) {
352 (*it)->zeroHeader();
353
354 // First buffer
355 if (it == frame->beginBuffer()) {
356 fuser = frame->getFirstUser();
357 if (enSsi_) fuser |= 0x2;
358 } else {
359 fuser = 0;
360 }
361
362 // Last Buffer
363 if (it == (frame->endBuffer() - 1)) {
364 cont = 0;
365 luser = frame->getLastUser();
366
367 // Continue flag is set if this is not the last (*it)er
368 } else {
369 cont = 1;
370 luser = 0;
371 }
372
373 // Get (*it)er meta field
374 meta = (*it)->getMeta();
375
376 // Meta is zero copy as indicated by bit 31
377 if ((meta & 0x80000000) != 0) {
378 emptyFrame = true;
379
380 // Buffer is not already stale as indicates by bit 30
381 if ((meta & 0x40000000) == 0) {
382 // Write by passing (*it)er index to driver
383 if (dmaWriteIndex(fd_,
384 meta & 0x3FFFFFFF,
385 (*it)->getPayload(),
386 axisSetFlags(fuser, luser, cont),
387 dest_) <= 0) {
388 throw(rogue::GeneralError("AxiStreamDma::acceptFrame", "AXIS Write Call Failed"));
389 }
390
391 // Mark (*it)er as stale
392 meta |= 0x40000000;
393 (*it)->setMeta(meta);
394 }
395
396 // Write to pgp with (*it)er copy in driver
397 } else {
398 // Keep trying since select call can fire
399 // but write fails because we did not win the (*it)er lock
400 do {
401 // Setup fds for select call
402 FD_ZERO(&fds);
403 FD_SET(fd_, &fds);
404
405 // Setup select timeout
406 tout = timeout_;
407
408 if (select(fd_ + 1, NULL, &fds, NULL, &tout) <= 0) {
409 log_->critical("AxiStreamDma::acceptFrame: Timeout waiting for outbound write after %" PRIuLEAST32
410 ".%" PRIuLEAST32 " seconds! May be caused by outbound back pressure.",
411 timeout_.tv_sec,
412 timeout_.tv_usec);
413 res = 0;
414 } else {
415 // Write with (*it)er copy
416 if ((res =
417 dmaWrite(fd_, (*it)->begin(), (*it)->getPayload(), axisSetFlags(fuser, luser, 0), dest_)) <
418 0) {
419 throw(rogue::GeneralError("AxiStreamDma::acceptFrame", "AXIS Write Call Failed!!!!"));
420 }
421 }
422 } while (res == 0); // Exit out if return flag was set false
423 }
424 }
425
426 if (emptyFrame) frame->clear();
427}
428
430void rha::AxiStreamDma::retBuffer(uint8_t* data, uint32_t meta, uint32_t size) {
431 rogue::GilRelease noGil;
432 uint32_t ret[100];
433 uint32_t count;
434 uint32_t x;
435
436 // Buffer is zero copy as indicated by bit 31
437 if ((meta & 0x80000000) != 0) {
438 // Device is open and buffer is not stale
439 // Bit 30 indicates buffer has already been returned to hardware
440 if ((fd_ >= 0) && ((meta & 0x40000000) == 0)) {
441#if 0
442 // Add to queue
443 printf("Adding to queue\n");
444 retQueue_.push(meta);
445
446 // Bulk return
447 if ( (count = retQueue_.size()) >= retThold_ ) {
448 printf("Return count=%" PRIu32 "\n", count);
449 if ( count > 100 ) count = 100;
450 for (x=0; x < count; x++) ret[x] = retQueue_.pop() & 0x3FFFFFFF;
451
452 if ( dmaRetIndexes(fd_, count, ret) < 0 )
453 throw(rogue::GeneralError("AxiStreamDma::retBuffer", "AXIS Return Buffer Call Failed!!!!"));
454
455 decCounter(size*count);
456 printf("Return done\n");
457 }
458
459#else
460 if (dmaRetIndex(fd_, meta & 0x3FFFFFFF) < 0)
461 throw(rogue::GeneralError("AxiStreamDma::retBuffer", "AXIS Return Buffer Call Failed!!!!"));
462
463#endif
464 }
465 decCounter(size);
466
467 // Buffer is allocated from Pool class
468 } else {
469 Pool::retBuffer(data, meta, size);
470 }
471}
472
474void rha::AxiStreamDma::runThread(std::weak_ptr<int> lockPtr) {
475 ris::BufferPtr buff[RxBufferCount];
476 uint32_t meta[RxBufferCount];
477 uint32_t rxFlags[RxBufferCount];
478 uint32_t rxError[RxBufferCount];
479 int32_t rxSize[RxBufferCount];
480 int32_t rxCount;
481 int32_t x;
482 ris::FramePtr frame;
483 fd_set fds;
484 uint8_t error;
485 uint32_t fuser;
486 uint32_t luser;
487 uint32_t cont;
488 struct timeval tout;
489
490 fuser = 0;
491 luser = 0;
492 cont = 0;
493
494 // Wait until constructor completes
495 while (!lockPtr.expired()) continue;
496
497 log_->logThreadId();
498
499 // Preallocate empty frame
500 frame = ris::Frame::create();
501
502 while (threadEn_) {
503 // Setup fds for select call
504 FD_ZERO(&fds);
505 FD_SET(fd_, &fds);
506
507 // Setup select timeout
508 tout.tv_sec = 0;
509 tout.tv_usec = 1000;
510
511 // Select returns with available buffer
512 if (select(fd_ + 1, &fds, NULL, NULL, &tout) > 0) {
513 // Zero copy buffers were not allocated
514 if (desc_->rawBuff == NULL) {
515 // Allocate a buffer
516 buff[0] = allocBuffer(desc_->bSize, NULL);
517
518 // Attempt read, dest is not needed since only one lane/vc is open
519 rxSize[0] = dmaRead(fd_, buff[0]->begin(), buff[0]->getAvailable(), rxFlags, rxError, NULL);
520 if (rxSize[0] <= 0)
521 rxCount = rxSize[0];
522 else
523 rxCount = 1;
524
525 // Zero copy read
526 } else {
527 // Attempt read, dest is not needed since only one lane/vc is open
528 rxCount = dmaReadBulkIndex(fd_, RxBufferCount, rxSize, meta, rxFlags, rxError, NULL);
529
530 // Allocate a buffer, Mark zero copy meta with bit 31 set, lower bits are index
531 for (x = 0; x < rxCount; x++)
532 buff[x] = createBuffer(desc_->rawBuff[meta[x]], 0x80000000 | meta[x], desc_->bSize, desc_->bSize);
533 }
534
535 // Return of -1 is bad
536 if (rxCount < 0) throw(rogue::GeneralError("AxiStreamDma::runThread", "DMA Interface Failure!"));
537
538 // Read was successful
539 for (x = 0; x < rxCount; x++) {
540 fuser = axisGetFuser(rxFlags[x]);
541 luser = axisGetLuser(rxFlags[x]);
542 cont = axisGetCont(rxFlags[x]);
543
544 buff[x]->setPayload(rxSize[x]);
545
546 error = frame->getError();
547
548 // Receive error
549 error |= (rxError[x] & 0xFF);
550
551 // First buffer of frame
552 if (frame->isEmpty()) frame->setFirstUser(fuser & 0xFF);
553
554 // Last buffer of frame
555 if (cont == 0) {
556 frame->setLastUser(luser & 0xFF);
557 if (enSsi_ && ((luser & 0x1) != 0)) error |= 0x80;
558 }
559
560 frame->setError(error);
561 frame->appendBuffer(buff[x]);
562 buff[x].reset();
563
564 // If continue flag is not set, push frame and get a new empty frame
565 if (cont == 0) {
566 sendFrame(frame);
567 frame = ris::Frame::create();
568 }
569 }
570 }
572}
573
575std::string rha::AxiStreamDma::getGitVersion() {
576 return dmaGetGitVersion(fd_);
577}
578
580uint32_t rha::AxiStreamDma::getApiVersion() {
581 return dmaGetApiVersion(fd_);
582}
583
585uint32_t rha::AxiStreamDma::getBuffSize() {
586 return dmaGetBuffSize(fd_);
587}
588
590uint32_t rha::AxiStreamDma::getRxBuffCount() {
591 return dmaGetRxBuffCount(fd_);
592}
593
595uint32_t rha::AxiStreamDma::getRxBuffinUserCount() {
597}
598
600uint32_t rha::AxiStreamDma::getRxBuffinHwCount() {
602}
603
605uint32_t rha::AxiStreamDma::getRxBuffinPreHwQCount() {
607}
608
610uint32_t rha::AxiStreamDma::getRxBuffinSwQCount() {
612}
613
615uint32_t rha::AxiStreamDma::getRxBuffMissCount() {
617}
618
620uint32_t rha::AxiStreamDma::getTxBuffCount() {
621 return dmaGetTxBuffCount(fd_);
622}
623
625uint32_t rha::AxiStreamDma::getTxBuffinUserCount() {
627}
628
630uint32_t rha::AxiStreamDma::getTxBuffinHwCount() {
632}
633
635uint32_t rha::AxiStreamDma::getTxBuffinPreHwQCount() {
637}
638
640uint32_t rha::AxiStreamDma::getTxBuffinSwQCount() {
642}
643
645uint32_t rha::AxiStreamDma::getTxBuffMissCount() {
646 return dmaGetTxBuffMissCount(fd_);
647}
648
649void rha::AxiStreamDma::setup_python() {
650#ifndef NO_PYTHON
651
652 bp::class_<rha::AxiStreamDma, rha::AxiStreamDmaPtr, bp::bases<ris::Master, ris::Slave>, boost::noncopyable>(
653 "AxiStreamDma",
654 bp::init<std::string, uint32_t, bool>())
655 .def("setDriverDebug", &rha::AxiStreamDma::setDriverDebug)
656 .def("dmaAck", &rha::AxiStreamDma::dmaAck)
657 .def("setTimeout", &rha::AxiStreamDma::setTimeout)
658 .def("getGitVersion", &rha::AxiStreamDma::getGitVersion)
659 .def("getApiVersion", &rha::AxiStreamDma::getApiVersion)
660 .def("getBuffSize", &rha::AxiStreamDma::getBuffSize)
661 .def("getRxBuffCount", &rha::AxiStreamDma::getRxBuffCount)
662 .def("getRxBuffinUserCount", &rha::AxiStreamDma::getRxBuffinUserCount)
663 .def("getRxBuffinHwCount", &rha::AxiStreamDma::getRxBuffinHwCount)
664 .def("getRxBuffinPreHwQCount", &rha::AxiStreamDma::getRxBuffinPreHwQCount)
665 .def("getRxBuffinSwQCount", &rha::AxiStreamDma::getRxBuffinSwQCount)
666 .def("getRxBuffMissCount", &rha::AxiStreamDma::getRxBuffMissCount)
667 .def("getTxBuffCount", &rha::AxiStreamDma::getTxBuffCount)
668 .def("getTxBuffinUserCount", &rha::AxiStreamDma::getTxBuffinUserCount)
669 .def("getTxBuffinHwCount", &rha::AxiStreamDma::getTxBuffinHwCount)
670 .def("getTxBuffinPreHwQCount", &rha::AxiStreamDma::getTxBuffinPreHwQCount)
671 .def("getTxBuffinSwQCount", &rha::AxiStreamDma::getTxBuffinSwQCount)
672 .def("getTxBuffMissCount", &rha::AxiStreamDma::getTxBuffMissCount)
673 .def("zeroCopyDisable", &rha::AxiStreamDma::zeroCopyDisable);
674
675 bp::implicitly_convertible<rha::AxiStreamDmaPtr, ris::MasterPtr>();
676 bp::implicitly_convertible<rha::AxiStreamDmaPtr, ris::SlavePtr>();
677#endif
678}
static uint32_t axisGetLuser(uint32_t flags)
Extracts last-user flag from packed AXIS flags.
Definition AxisDriver.h:80
static uint32_t axisSetFlags(uint32_t fuser, uint32_t luser, uint32_t cont)
Packs AXIS first-user, last-user, and continuation bits.
Definition AxisDriver.h:51
static uint32_t axisGetFuser(uint32_t flags)
Extracts first-user flag from packed AXIS flags.
Definition AxisDriver.h:69
static void axisReadAck(int32_t fd)
Issues AXIS read-acknowledge ioctl command.
Definition AxisDriver.h:104
static uint32_t axisGetCont(uint32_t flags)
Extracts continuation flag from packed AXIS flags.
Definition AxisDriver.h:91
static std::string dmaGetGitVersion(int32_t fd)
Get the DMA Driver's Git Version.
Definition DmaDriver.h:678
static ssize_t dmaGetTxBuffinPreHwQCount(int32_t fd)
Get the transmit buffer count in pre-hardware queue.
Definition DmaDriver.h:613
static ssize_t dmaGetTxBuffCount(int32_t fd)
Get the transmit buffer count.
Definition DmaDriver.h:574
static ssize_t dmaGetTxBuffMissCount(int32_t fd)
Get the transmit buffer missing count.
Definition DmaDriver.h:639
static ssize_t dmaGetRxBuffinHwCount(int32_t fd)
Get the receive buffer count in hardware.
Definition DmaDriver.h:522
static ssize_t dmaGetApiVersion(int32_t fd)
Get API version of the DMA driver.
Definition DmaDriver.h:881
static ssize_t dmaWriteIndex(int32_t fd, uint32_t index, size_t size, uint32_t flags, uint32_t dest)
Writes data to a DMA channel using an index.
Definition DmaDriver.h:197
static void dmaInitMaskBytes(uint8_t *mask)
Initialize DMA mask byte array.
Definition DmaDriver.h:818
static void dmaAddMaskBytes(uint8_t *mask, uint32_t dest)
Add a destination to the DMA mask byte array.
Definition DmaDriver.h:832
static ssize_t dmaReadBulkIndex(int32_t fd, uint32_t count, int32_t *ret, uint32_t *index, uint32_t *flags, uint32_t *error, uint32_t *dest)
Receive frame and access memory-mapped buffer.
Definition DmaDriver.h:400
#define DMA_MASK_SIZE
Definition DmaDriver.h:69
static ssize_t dmaSetMaskBytes(int32_t fd, uint8_t *mask)
Set mask byte array to the driver.
Definition DmaDriver.h:853
static ssize_t dmaGetRxBuffinUserCount(int32_t fd)
Get the receive buffer count in user.
Definition DmaDriver.h:509
static ssize_t dmaGetTxBuffinHwCount(int32_t fd)
Get the transmit buffer count in hardware.
Definition DmaDriver.h:600
static ssize_t dmaGetBuffSize(int32_t fd)
Get the buffer size.
Definition DmaDriver.h:652
static ssize_t dmaGetRxBuffinSwQCount(int32_t fd)
Get the receive buffer count in software queue.
Definition DmaDriver.h:548
static ssize_t dmaGetRxBuffCount(int32_t fd)
Get the receive buffer count.
Definition DmaDriver.h:496
static int32_t dmaGetIndex(int32_t fd)
Get the current write buffer index.
Definition DmaDriver.h:470
static ssize_t dmaGetRxBuffinPreHwQCount(int32_t fd)
Get the receive buffer count in pre-hardware queue.
Definition DmaDriver.h:535
static ssize_t dmaRetIndex(int32_t fd, uint32_t index)
Post an index back to the DMA.
Definition DmaDriver.h:437
static ssize_t dmaSetDebug(int32_t fd, uint32_t level)
Set debugging level for DMA operations.
Definition DmaDriver.h:767
static ssize_t dmaGetTxBuffinSwQCount(int32_t fd)
Get the transmit buffer count in software queue.
Definition DmaDriver.h:626
static ssize_t dmaGetBuffCount(int32_t fd)
Get the buffer count.
Definition DmaDriver.h:665
static ssize_t dmaCheckVersion(int32_t fd)
Check API version of the DMA driver.
Definition DmaDriver.h:866
static void ** dmaMapDma(int32_t fd, uint32_t *count, uint32_t *size)
Map user space to DMA buffers.
Definition DmaDriver.h:698
static ssize_t dmaUnMapDma(int32_t fd, void **buffer)
Unmap user space from DMA buffers.
Definition DmaDriver.h:742
static ssize_t dmaRead(int32_t fd, void *buf, size_t maxSize, uint32_t *flags, uint32_t *error, uint32_t *dest)
Receive Frame.
Definition DmaDriver.h:331
static ssize_t dmaGetTxBuffinUserCount(int32_t fd)
Get the transmit buffer count in user.
Definition DmaDriver.h:587
static ssize_t dmaWrite(int32_t fd, const void *buf, size_t size, uint32_t flags, uint32_t dest)
Writes data to a DMA channel.
Definition DmaDriver.h:169
static ssize_t dmaGetRxBuffMissCount(int32_t fd)
Get the receive buffer missing count.
Definition DmaDriver.h:561
static ssize_t dmaRetIndexes(int32_t fd, uint32_t count, uint32_t *indexes)
Post multiple indices back to the DMA.
Definition DmaDriver.h:455
Generic Rogue exception type.
static GeneralError create(std::string src, const char *fmt,...)
Creates a formatted error instance.
RAII helper that releases the Python GIL for a scope.
Definition GilRelease.h:36
static std::shared_ptr< rogue::Logging > create(const std::string &name, bool quiet=false)
Creates a logger instance.
Definition Logging.cpp:60
std::shared_ptr< rogue::hardware::axi::AxiStreamDma > AxiStreamDmaPtr
std::shared_ptr< rogue::hardware::axi::AxiStreamDmaShared > AxiStreamDmaSharedPtr
std::shared_ptr< rogue::interfaces::stream::Buffer > BufferPtr
Shared pointer alias for Buffer.
Definition Buffer.h:270
std::shared_ptr< rogue::interfaces::stream::Frame > FramePtr
Shared pointer alias for Frame.
Definition Frame.h:549
std::shared_ptr< rogue::interfaces::stream::FrameLock > FrameLockPtr
Shared pointer alias for FrameLock.
Definition FrameLock.h:110
std::shared_ptr< rogue::Logging > LoggingPtr
Shared pointer alias for Logging.
Definition Logging.h:159
void defaultTimeout(struct timeval &tout)
Returns Rogue default timeout as a timeval.
Definition Helpers.h:49