rogue
Loading...
Searching...
No Matches
DmaDriver.h
Go to the documentation of this file.
1
22#ifndef __DMA_DRIVER_H__
23#define __DMA_DRIVER_H__
24
25#ifdef DMA_IN_KERNEL
26 #include <linux/types.h>
27#else
28 #include <stdint.h>
29
30 #include <string>
31#endif
32
33/* API Version */
34#define DMA_VERSION 0x06
35
36/* Error values */
37#define DMA_ERR_FIFO 0x01
38#define DMA_ERR_LEN 0x02
39#define DMA_ERR_MAX 0x04
40#define DMA_ERR_BUS 0x08
41
42/* Commands */
43
45#define DMA_Get_Buff_Count 0x1001
46
48#define DMA_Get_Buff_Size 0x1002
49
51#define DMA_Set_Debug 0x1003
52
54#define DMA_Set_Mask 0x1004
55
58#define DMA_Ret_Index 0x1005
59
61#define DMA_Get_Index 0x1006
62
64#define DMA_Read_Ready 0x1007
65
67#define DMA_Set_MaskBytes 0x1008
68
70#define DMA_Get_Version 0x1009
71
73#define DMA_Write_Register 0x100A
74
76#define DMA_Read_Register 0x100B
77
79#define DMA_Get_RxBuff_Count 0x100C
80
82#define DMA_Get_TxBuff_Count 0x100D
83
85#define DMA_Get_TxBuffinUser_Count 0x100F
86
88#define DMA_Get_TxBuffinHW_Count 0x1010
89
91#define DMA_Get_TxBuffinPreHWQ_Count 0x1011
92
94#define DMA_Get_TxBuffinSWQ_Count 0x1012
95
97#define DMA_Get_TxBuffMiss_Count 0x1013
98
100#define DMA_Get_RxBuffinUser_Count 0x1014
101
103#define DMA_Get_RxBuffinHW_Count 0x1015
104
106#define DMA_Get_RxBuffinPreHWQ_Count 0x1016
107
109#define DMA_Get_RxBuffinSWQ_Count 0x1017
110
112#define DMA_Get_RxBuffMiss_Count 0x1018
113
115#define DMA_Get_GITV 0x1019
116
117/* Mask size */
118#define DMA_MASK_SIZE 512
119
137 uint64_t data;
138 uint32_t dest;
139 uint32_t flags;
140 uint32_t index;
141 uint32_t size;
142 uint32_t is32;
143 uint32_t pad;
144};
145
164 uint64_t data;
165 uint32_t dest;
166 uint32_t flags;
167 uint32_t index;
168 uint32_t error;
169 uint32_t size;
170 uint32_t is32;
171 int32_t ret;
172};
173
185 uint64_t address;
186 uint32_t data;
187};
188
189// Conditional inclusion for non-kernel environments
190#ifndef DMA_IN_KERNEL
191 #include <signal.h>
192 #include <stdio.h>
193 #include <stdlib.h>
194 #include <string.h>
195 #include <sys/fcntl.h>
196 #include <sys/ioctl.h>
197 #include <sys/mman.h>
198 #include <sys/signal.h>
199 #include <sys/socket.h>
200 #include <unistd.h>
201
218static inline ssize_t dmaWrite(int32_t fd, const void* buf, size_t size, uint32_t flags, uint32_t dest) {
219 struct DmaWriteData w;
220
221 memset(&w, 0, sizeof(struct DmaWriteData));
222 w.dest = dest;
223 w.flags = flags;
224 w.size = size;
225 w.is32 = (sizeof(void*) == 4);
226 w.data = (uint64_t)buf;//NOLINT
227
228 return (write(fd, &w, sizeof(struct DmaWriteData)));
229}
230
246static inline ssize_t dmaWriteIndex(int32_t fd, uint32_t index, size_t size, uint32_t flags, uint32_t dest) {
247 struct DmaWriteData w;
248
249 memset(&w, 0, sizeof(struct DmaWriteData));
250 w.dest = dest;
251 w.flags = flags;
252 w.size = size;
253 w.is32 = (sizeof(void*) == 4);
254 w.index = index;
255
256 return (write(fd, &w, sizeof(struct DmaWriteData)));
257}
258
278static inline ssize_t dmaWriteVector(int32_t fd,
279 struct iovec* iov,
280 size_t iovlen,
281 uint32_t begFlags,
282 uint32_t midFlags,
283 uint32_t endFlags,
284 uint32_t dest) {
285 uint32_t x;
286 ssize_t ret;
287 ssize_t res;
288 struct DmaWriteData w;
289
290 ret = 0;
291
292 for (x = 0; x < iovlen; x++) {
293 memset(&w, 0, sizeof(struct DmaWriteData));
294 w.dest = dest;
295 w.flags = (x == 0) ? begFlags : ((x == (iovlen - 1)) ? endFlags : midFlags);
296 w.size = iov[x].iov_len;
297 w.is32 = (sizeof(void*) == 4);
298 w.data = (uint64_t)iov[x].iov_base;//NOLINT
299
300 do {
301 res = write(fd, &w, sizeof(struct DmaWriteData));
302
303 if (res < 0)
304 return (res);
305 else if (res == 0)
306 usleep(10);
307 else
308 ret += res;
309 } while (res == 0);
310 }
311 return (ret);
312}
313
330static inline ssize_t dmaWriteIndexVector(int32_t fd,
331 struct iovec* iov,
332 size_t iovlen,
333 uint32_t begFlags,
334 uint32_t midFlags,
335 uint32_t endFlags,
336 uint32_t dest) {
337 uint32_t x;
338 ssize_t ret;
339 ssize_t res;
340 struct DmaWriteData w;
341
342 ret = 0;
343
344 for (x = 0; x < iovlen; x++) {
345 memset(&w, 0, sizeof(struct DmaWriteData));
346 w.dest = dest;
347 w.flags = (x == 0) ? begFlags : ((x == (iovlen - 1)) ? endFlags : midFlags);
348 w.size = iov[x].iov_len;
349 w.is32 = (sizeof(void*) == 4);
350 w.index = (uint32_t)(((uint64_t)iov[x].iov_base) & 0xFFFFFFFF);//NOLINT
351
352 do {
353 res = write(fd, &w, sizeof(struct DmaWriteData));
354
355 if (res < 0)
356 return (res);
357 else if (res == 0)
358 usleep(10);
359 else
360 ret += res;
361 } while (res == 0);
362 }
363 return (ret);
364}
365
380static inline ssize_t dmaRead(int32_t fd, void* buf, size_t maxSize, uint32_t* flags, uint32_t* error, uint32_t* dest) {
381 struct DmaReadData r;
382 ssize_t ret;
383
384 memset(&r, 0, sizeof(struct DmaReadData));
385 r.size = maxSize;
386 r.is32 = (sizeof(void*) == 4);
387 r.data = (uint64_t)buf;//NOLINT
388
389 ret = read(fd, &r, sizeof(struct DmaReadData));
390
391 if (ret <= 0) return (ret);
392
393 if (dest != NULL) *dest = r.dest;
394 if (flags != NULL) *flags = r.flags;
395 if (error != NULL) *error = r.error;
396
397 return (r.ret);
398}
399
414static inline ssize_t dmaReadIndex(int32_t fd, uint32_t* index, uint32_t* flags, uint32_t* error, uint32_t* dest) {
415 struct DmaReadData r;
416 ssize_t ret;
417
418 memset(&r, 0, sizeof(struct DmaReadData));
419
420 ret = read(fd, &r, sizeof(struct DmaReadData));
421
422 if (ret <= 0) return (ret);
423
424 if (dest != NULL) *dest = r.dest;
425 if (flags != NULL) *flags = r.flags;
426 if (error != NULL) *error = r.error;
427
428 *index = r.index;
429 return (r.ret);
430}
431
449static inline ssize_t dmaReadBulkIndex(int32_t fd,
450 uint32_t count,
451 int32_t* ret,
452 uint32_t* index,
453 uint32_t* flags,
454 uint32_t* error,
455 uint32_t* dest) {
456 struct DmaReadData r[count];
457 ssize_t res;
458 ssize_t x;
459
460 memset(r, 0, count * sizeof(struct DmaReadData));
461
462 res = read(fd, r, count * sizeof(struct DmaReadData));
463
464 for (x = 0; x < res; ++x) {
465 if (dest != NULL) dest[x] = r[x].dest;
466 if (flags != NULL) flags[x] = r[x].flags;
467 if (error != NULL) error[x] = r[x].error;
468
469 index[x] = r[x].index;
470 ret[x] = r[x].ret;
471 }
472 return (res);
473}
474
486static inline ssize_t dmaRetIndex(int32_t fd, uint32_t index) {
487 uint32_t cmd = DMA_Ret_Index | 0x10000;
488
489 return (ioctl(fd, cmd, &index));
490}
491
504static inline ssize_t dmaRetIndexes(int32_t fd, uint32_t count, uint32_t* indexes) {
505 uint32_t cmd = DMA_Ret_Index | ((count << 16) & 0xFFFF0000);
506
507 return (ioctl(fd, cmd, indexes));
508}
509
519static inline int32_t dmaGetIndex(int32_t fd) {
520 return (ioctl(fd, DMA_Get_Index, 0));
521}
522
532static inline ssize_t dmaReadReady(int32_t fd) {
533 return (ioctl(fd, DMA_Read_Ready, 0));
534}
535
545static inline ssize_t dmaGetRxBuffCount(int32_t fd) {
546 return (ioctl(fd, DMA_Get_RxBuff_Count, 0));
547}
548
558static inline ssize_t dmaGetRxBuffinUserCount(int32_t fd) {
559 return (ioctl(fd, DMA_Get_RxBuffinUser_Count, 0));
560}
561
571static inline ssize_t dmaGetRxBuffinHwCount(int32_t fd) {
572 return (ioctl(fd, DMA_Get_RxBuffinHW_Count, 0));
573}
574
584static inline ssize_t dmaGetRxBuffinPreHwQCount(int32_t fd) {
585 return (ioctl(fd, DMA_Get_RxBuffinPreHWQ_Count, 0));
586}
587
597static inline ssize_t dmaGetRxBuffinSwQCount(int32_t fd) {
598 return (ioctl(fd, DMA_Get_RxBuffinSWQ_Count, 0));
599}
600
610static inline ssize_t dmaGetRxBuffMissCount(int32_t fd) {
611 return (ioctl(fd, DMA_Get_RxBuffMiss_Count, 0));
612}
613
623static inline ssize_t dmaGetTxBuffCount(int32_t fd) {
624 return (ioctl(fd, DMA_Get_TxBuff_Count, 0));
625}
626
636static inline ssize_t dmaGetTxBuffinUserCount(int32_t fd) {
637 return (ioctl(fd, DMA_Get_TxBuffinUser_Count, 0));
638}
639
649static inline ssize_t dmaGetTxBuffinHwCount(int32_t fd) {
650 return (ioctl(fd, DMA_Get_TxBuffinHW_Count, 0));
651}
652
662static inline ssize_t dmaGetTxBuffinPreHwQCount(int32_t fd) {
663 return (ioctl(fd, DMA_Get_TxBuffinPreHWQ_Count, 0));
664}
665
675static inline ssize_t dmaGetTxBuffinSwQCount(int32_t fd) {
676 return (ioctl(fd, DMA_Get_TxBuffinSWQ_Count, 0));
677}
678
688static inline ssize_t dmaGetTxBuffMissCount(int32_t fd) {
689 return (ioctl(fd, DMA_Get_TxBuffMiss_Count, 0));
690}
691
701static inline ssize_t dmaGetBuffSize(int32_t fd) {
702 return (ioctl(fd, DMA_Get_Buff_Size, 0));
703}
704
714static inline ssize_t dmaGetBuffCount(int32_t fd) {
715 return (ioctl(fd, DMA_Get_Buff_Count, 0));
716}
717
727static inline std::string dmaGetGitVersion(int32_t fd) {
728 char gitv[32] = {0}; // Initialize with zeros to ensure null-termination
729 if (ioctl(fd, DMA_Get_GITV, gitv) < 0) {
730 return "";
731 }
732 gitv[32 - 1] = '\0'; // Ensure null-termination
733 return std::string(gitv);
734}
735
747static inline void** dmaMapDma(int32_t fd, uint32_t* count, uint32_t* size) {
748 void* temp;
749 void** ret;
750 uint32_t bCount;
751 uint32_t gCount;
752 uint32_t bSize;
753 off_t offset;
754
755 bSize = ioctl(fd, DMA_Get_Buff_Size, 0);
756 bCount = ioctl(fd, DMA_Get_Buff_Count, 0);
757
758 if (count != NULL) *count = bCount;
759 if (size != NULL) *size = bSize;
760
761 if ((ret = reinterpret_cast<void**>(calloc(sizeof(void*), bCount))) == 0) return (NULL);
762
763 // Attempt to map
764 gCount = 0;
765 while (gCount < bCount) {
766 offset = (off_t)bSize * (off_t)gCount;
767
768 if ((temp = mmap(0, bSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == MAP_FAILED) break;
769 ret[gCount++] = temp;
770 }
771
772 // Map failed
773 if (gCount != bCount) {
774 while (gCount != 0) munmap(ret[--gCount], bSize);
775 free(ret);
776 ret = NULL;
777 }
778 return (ret);
779}
780
791static inline ssize_t dmaUnMapDma(int32_t fd, void** buffer) {
792 uint32_t bCount;
793 uint32_t bSize;
794 uint32_t x;
795
796 bCount = ioctl(fd, DMA_Get_Buff_Count, 0);
797 bSize = ioctl(fd, DMA_Get_Buff_Size, 0);
798
799 for (x = 0; x < bCount; x++) munmap(buffer[x], bSize);
800
801 free(buffer);
802 return (0);
803}
804
816static inline ssize_t dmaSetDebug(int32_t fd, uint32_t level) {
817 return (ioctl(fd, DMA_Set_Debug, level));
818}
819
831static inline void dmaAssignHandler(int32_t fd, void (*handler)(int32_t)) {
832 struct sigaction act;
833 int32_t oflags;
834
835 act.sa_handler = handler;
836 sigemptyset(&act.sa_mask);
837 act.sa_flags = 0;
838
839 sigaction(SIGIO, &act, NULL);
840 fcntl(fd, F_SETOWN, getpid());
841 oflags = fcntl(fd, F_GETFL);
842 fcntl(fd, F_SETFL, oflags | FASYNC);
843}
844
855static inline ssize_t dmaSetMask(int32_t fd, uint32_t mask) {
856 return (ioctl(fd, DMA_Set_Mask, mask));
857}
858
867static inline void dmaInitMaskBytes(uint8_t* mask) {
868 memset(mask, 0, DMA_MASK_SIZE);
869}
870
881static inline void dmaAddMaskBytes(uint8_t* mask, uint32_t dest) {
882 uint32_t byte;
883 uint32_t bit;
884
885 if (dest < 8 * (DMA_MASK_SIZE)) {
886 byte = dest / 8;
887 bit = dest % 8;
888 mask[byte] += (1 << bit);
889 }
890}
891
902static inline ssize_t dmaSetMaskBytes(int32_t fd, uint8_t* mask) {
903 return (ioctl(fd, DMA_Set_MaskBytes, mask));
904}
905
915static inline ssize_t dmaCheckVersion(int32_t fd) {
916 int32_t version;
917 version = ioctl(fd, DMA_Get_Version);
918 return ((version == DMA_VERSION) ? 0 : -1);
919}
920
930static inline ssize_t dmaGetApiVersion(int32_t fd) {
931 return (ioctl(fd, DMA_Get_Version, 0));
932}
933
945static inline ssize_t dmaWriteRegister(int32_t fd, uint64_t address, uint32_t data) {
946 struct DmaRegisterData reg;
947
948 reg.address = address;
949 reg.data = data;
950 return (ioctl(fd, DMA_Write_Register, &reg));
951}
952
965static inline ssize_t dmaReadRegister(int32_t fd, uint64_t address, uint32_t* data) {
966 struct DmaRegisterData reg;
967 ssize_t res;
968
969 // Initialize register data structure
970 reg.address = address;
971 reg.data = 0;
972
973 // Perform ioctl to read the register
974 res = ioctl(fd, DMA_Read_Register, &reg);
975
976 // If data pointer is valid, update it with the read value
977 if (data != NULL) *data = reg.data;
978
979 return res;
980}
981
995static inline void* dmaMapRegister(int32_t fd, off_t offset, uint32_t size) {
996 uint32_t bSize;
997 uint32_t bCount;
998 off_t intOffset;
999
1000 // Obtain buffer size and count from the DMA device
1001 bSize = ioctl(fd, DMA_Get_Buff_Size, 0);
1002 bCount = ioctl(fd, DMA_Get_Buff_Count, 0);
1003
1004 // Calculate internal offset
1005 intOffset = ((off_t)bSize * bCount) + offset;
1006
1007 // Attempt to map the memory region into user space
1008 return mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, intOffset);
1009}
1010
1023static inline ssize_t dmaUnMapRegister(int32_t fd, void* ptr, uint32_t size) {
1024 // Unmap the memory region
1025 munmap(ptr, size);
1026 return 0;
1027}
1028
1029#endif // !DMA_IN_KERNEL
1030#endif // __DMA_DRIVER_H__
static ssize_t dmaSetMask(int32_t fd, uint32_t mask)
Set DMA mask.
Definition DmaDriver.h:855
static std::string dmaGetGitVersion(int32_t fd)
Get the DMA Driver's Git Version.
Definition DmaDriver.h:727
#define DMA_Set_Debug
ioctl command code: set the kernel debug verbosity level (0 = off).
Definition DmaDriver.h:51
#define DMA_Get_Index
ioctl command code: get the index of the next available write buffer.
Definition DmaDriver.h:61
#define DMA_Get_Buff_Size
ioctl command code: get the size in bytes of each DMA buffer.
Definition DmaDriver.h:48
#define DMA_Get_GITV
ioctl command code: get the driver git version string into a caller-supplied char[32] buffer.
Definition DmaDriver.h:115
static ssize_t dmaGetTxBuffinPreHwQCount(int32_t fd)
Get the transmit buffer count in pre-hardware queue.
Definition DmaDriver.h:662
static ssize_t dmaGetTxBuffCount(int32_t fd)
Get the transmit buffer count.
Definition DmaDriver.h:623
static ssize_t dmaGetTxBuffMissCount(int32_t fd)
Get the transmit buffer missing count.
Definition DmaDriver.h:688
static ssize_t dmaGetRxBuffinHwCount(int32_t fd)
Get the receive buffer count in hardware.
Definition DmaDriver.h:571
#define DMA_Get_Buff_Count
ioctl command code: get the total number of DMA buffers in the pool.
Definition DmaDriver.h:45
#define DMA_Write_Register
ioctl command code: write a 32-bit value to a device BAR register; argument is struct DmaRegisterData...
Definition DmaDriver.h:73
#define DMA_Get_RxBuff_Count
ioctl command code: get the total number of receive DMA buffers in the pool.
Definition DmaDriver.h:79
static ssize_t dmaGetApiVersion(int32_t fd)
Get API version of the DMA driver.
Definition DmaDriver.h:930
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:246
#define DMA_Get_TxBuffinUser_Count
ioctl command code: get the count of TX buffers currently held in user space.
Definition DmaDriver.h:85
static ssize_t dmaReadRegister(int32_t fd, uint64_t address, uint32_t *data)
Read a value from a DMA register.
Definition DmaDriver.h:965
#define DMA_Get_RxBuffinPreHWQ_Count
ioctl command code: get the count of RX buffers in the pre-hardware queue.
Definition DmaDriver.h:106
#define DMA_Get_TxBuffinHW_Count
ioctl command code: get the count of TX buffers currently submitted to hardware.
Definition DmaDriver.h:88
static ssize_t dmaWriteRegister(int32_t fd, uint64_t address, uint32_t data)
Write to a DMA register.
Definition DmaDriver.h:945
#define DMA_Get_TxBuff_Count
ioctl command code: get the total number of transmit DMA buffers in the pool.
Definition DmaDriver.h:82
static void dmaInitMaskBytes(uint8_t *mask)
Initialize DMA mask byte array.
Definition DmaDriver.h:867
#define DMA_Set_Mask
ioctl command code: set the 32-bit destination channel mask (convenience wrapper for single-mask use)...
Definition DmaDriver.h:54
#define DMA_Ret_Index
ioctl command code: return one or more buffer indices to the DMA free pool. The upper 16 bits of the ...
Definition DmaDriver.h:58
#define DMA_Get_RxBuffinHW_Count
ioctl command code: get the count of RX buffers currently submitted to hardware.
Definition DmaDriver.h:103
static void dmaAddMaskBytes(uint8_t *mask, uint32_t dest)
Add a destination to the DMA mask byte array.
Definition DmaDriver.h:881
#define DMA_Get_TxBuffMiss_Count
ioctl command code: get the TX buffer allocation miss count (buffers requested but unavailable).
Definition DmaDriver.h:97
#define DMA_Set_MaskBytes
ioctl command code: set the destination channel mask using a 512-byte bitmap (DMA_MASK_SIZE bytes).
Definition DmaDriver.h:67
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:449
static ssize_t dmaUnMapRegister(int32_t fd, void *ptr, uint32_t size)
Unmap a DMA register space from user space.
Definition DmaDriver.h:1023
#define DMA_MASK_SIZE
Definition DmaDriver.h:118
static ssize_t dmaSetMaskBytes(int32_t fd, uint8_t *mask)
Set mask byte array to the driver.
Definition DmaDriver.h:902
static ssize_t dmaGetRxBuffinUserCount(int32_t fd)
Get the receive buffer count in user.
Definition DmaDriver.h:558
#define DMA_Get_Version
ioctl command code: get the driver API version integer; compare to DMA_VERSION for compatibility.
Definition DmaDriver.h:70
static void * dmaMapRegister(int32_t fd, off_t offset, uint32_t size)
Map a DMA register space to user space.
Definition DmaDriver.h:995
static ssize_t dmaGetTxBuffinHwCount(int32_t fd)
Get the transmit buffer count in hardware.
Definition DmaDriver.h:649
static ssize_t dmaGetBuffSize(int32_t fd)
Get the buffer size.
Definition DmaDriver.h:701
static ssize_t dmaGetRxBuffinSwQCount(int32_t fd)
Get the receive buffer count in software queue.
Definition DmaDriver.h:597
static ssize_t dmaGetRxBuffCount(int32_t fd)
Get the receive buffer count.
Definition DmaDriver.h:545
static int32_t dmaGetIndex(int32_t fd)
Get the current write buffer index.
Definition DmaDriver.h:519
static ssize_t dmaReadIndex(int32_t fd, uint32_t *index, uint32_t *flags, uint32_t *error, uint32_t *dest)
Receive Frame, access memory mapped buffer.
Definition DmaDriver.h:414
static ssize_t dmaGetRxBuffinPreHwQCount(int32_t fd)
Get the receive buffer count in pre-hardware queue.
Definition DmaDriver.h:584
#define DMA_Get_RxBuffinUser_Count
ioctl command code: get the count of RX buffers currently held in user space.
Definition DmaDriver.h:100
static ssize_t dmaRetIndex(int32_t fd, uint32_t index)
Post an index back to the DMA.
Definition DmaDriver.h:486
static ssize_t dmaWriteVector(int32_t fd, struct iovec *iov, size_t iovlen, uint32_t begFlags, uint32_t midFlags, uint32_t endFlags, uint32_t dest)
Writes an array of data frames to a DMA channel.
Definition DmaDriver.h:278
#define DMA_Get_TxBuffinPreHWQ_Count
ioctl command code: get the count of TX buffers in the pre-hardware queue.
Definition DmaDriver.h:91
static ssize_t dmaSetDebug(int32_t fd, uint32_t level)
Set debugging level for DMA operations.
Definition DmaDriver.h:816
static void dmaAssignHandler(int32_t fd, void(*handler)(int32_t))
Assign a signal handler for asynchronous DMA operations.
Definition DmaDriver.h:831
static ssize_t dmaWriteIndexVector(int32_t fd, struct iovec *iov, size_t iovlen, uint32_t begFlags, uint32_t midFlags, uint32_t endFlags, uint32_t dest)
Write Frame, memory mapped from iovector.
Definition DmaDriver.h:330
#define DMA_VERSION
Definition DmaDriver.h:34
#define DMA_Get_RxBuffinSWQ_Count
ioctl command code: get the count of RX buffers in the software queue.
Definition DmaDriver.h:109
static ssize_t dmaGetTxBuffinSwQCount(int32_t fd)
Get the transmit buffer count in software queue.
Definition DmaDriver.h:675
static ssize_t dmaReadReady(int32_t fd)
Check if read is ready.
Definition DmaDriver.h:532
static ssize_t dmaGetBuffCount(int32_t fd)
Get the buffer count.
Definition DmaDriver.h:714
static ssize_t dmaCheckVersion(int32_t fd)
Check API version of the DMA driver.
Definition DmaDriver.h:915
static void ** dmaMapDma(int32_t fd, uint32_t *count, uint32_t *size)
Map user space to DMA buffers.
Definition DmaDriver.h:747
static ssize_t dmaUnMapDma(int32_t fd, void **buffer)
Unmap user space from DMA buffers.
Definition DmaDriver.h:791
#define DMA_Get_TxBuffinSWQ_Count
ioctl command code: get the count of TX buffers in the software queue.
Definition DmaDriver.h:94
#define DMA_Get_RxBuffMiss_Count
ioctl command code: get the RX buffer allocation miss count (buffers requested but unavailable).
Definition DmaDriver.h:112
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:380
static ssize_t dmaGetTxBuffinUserCount(int32_t fd)
Get the transmit buffer count in user.
Definition DmaDriver.h:636
#define DMA_Read_Ready
ioctl command code: check whether a receive frame is pending (returns 1 if data ready).
Definition DmaDriver.h:64
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:218
static ssize_t dmaGetRxBuffMissCount(int32_t fd)
Get the receive buffer missing count.
Definition DmaDriver.h:610
#define DMA_Read_Register
ioctl command code: read a 32-bit value from a device BAR register; argument is struct DmaRegisterDat...
Definition DmaDriver.h:76
static ssize_t dmaRetIndexes(int32_t fd, uint32_t count, uint32_t *indexes)
Post multiple indices back to the DMA.
Definition DmaDriver.h:504
Structure representing a DMA read operation.
Definition DmaDriver.h:163
uint32_t error
Definition DmaDriver.h:168
uint32_t index
Definition DmaDriver.h:167
uint32_t flags
Definition DmaDriver.h:166
uint32_t size
Definition DmaDriver.h:169
uint32_t is32
Definition DmaDriver.h:170
uint64_t data
Definition DmaDriver.h:164
int32_t ret
Definition DmaDriver.h:171
uint32_t dest
Definition DmaDriver.h:165
Register data structure.
Definition DmaDriver.h:184
uint64_t address
Definition DmaDriver.h:185
uint32_t data
Definition DmaDriver.h:186
Structure representing a DMA write operation.
Definition DmaDriver.h:136
uint32_t size
Definition DmaDriver.h:141
uint32_t pad
Definition DmaDriver.h:143
uint32_t is32
Definition DmaDriver.h:142
uint64_t data
Definition DmaDriver.h:137
uint32_t index
Definition DmaDriver.h:140
uint32_t flags
Definition DmaDriver.h:139
uint32_t dest
Definition DmaDriver.h:138