rogue
Loading...
Searching...
No Matches
Classes | Macros | Functions
DmaDriver.h File Reference
#include <stdint.h>
#include <string>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/signal.h>
#include <sys/socket.h>
#include <unistd.h>

Go to the source code of this file.

Classes

struct  DmaWriteData
 Structure representing a DMA write operation. More...
 
struct  DmaReadData
 Structure representing a DMA read operation. More...
 
struct  DmaRegisterData
 Register data structure. More...
 

Macros

#define DMA_VERSION   0x06
 
#define DMA_ERR_FIFO   0x01
 
#define DMA_ERR_LEN   0x02
 
#define DMA_ERR_MAX   0x04
 
#define DMA_ERR_BUS   0x08
 
#define DMA_Get_Buff_Count   0x1001
 
#define DMA_Get_Buff_Size   0x1002
 
#define DMA_Set_Debug   0x1003
 
#define DMA_Set_Mask   0x1004
 
#define DMA_Ret_Index   0x1005
 
#define DMA_Get_Index   0x1006
 
#define DMA_Read_Ready   0x1007
 
#define DMA_Set_MaskBytes   0x1008
 
#define DMA_Get_Version   0x1009
 
#define DMA_Write_Register   0x100A
 
#define DMA_Read_Register   0x100B
 
#define DMA_Get_RxBuff_Count   0x100C
 
#define DMA_Get_TxBuff_Count   0x100D
 
#define DMA_Get_TxBuffinUser_Count   0x100F
 
#define DMA_Get_TxBuffinHW_Count   0x1010
 
#define DMA_Get_TxBuffinPreHWQ_Count   0x1011
 
#define DMA_Get_TxBuffinSWQ_Count   0x1012
 
#define DMA_Get_TxBuffMiss_Count   0x1013
 
#define DMA_Get_RxBuffinUser_Count   0x1014
 
#define DMA_Get_RxBuffinHW_Count   0x1015
 
#define DMA_Get_RxBuffinPreHWQ_Count   0x1016
 
#define DMA_Get_RxBuffinSWQ_Count   0x1017
 
#define DMA_Get_RxBuffMiss_Count   0x1018
 
#define DMA_Get_GITV   0x1019
 
#define DMA_MASK_SIZE   512
 

Functions

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.
 
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.
 
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.
 
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.
 
static ssize_t dmaRead (int32_t fd, void *buf, size_t maxSize, uint32_t *flags, uint32_t *error, uint32_t *dest)
 Receive Frame.
 
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.
 
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.
 
static ssize_t dmaRetIndex (int32_t fd, uint32_t index)
 Post an index back to the DMA.
 
static ssize_t dmaRetIndexes (int32_t fd, uint32_t count, uint32_t *indexes)
 Post multiple indices back to the DMA.
 
static int32_t dmaGetIndex (int32_t fd)
 Get the current write buffer index.
 
static ssize_t dmaReadReady (int32_t fd)
 Check if read is ready.
 
static ssize_t dmaGetRxBuffCount (int32_t fd)
 Get the receive buffer count.
 
static ssize_t dmaGetRxBuffinUserCount (int32_t fd)
 Get the receive buffer count in user.
 
static ssize_t dmaGetRxBuffinHwCount (int32_t fd)
 Get the receive buffer count in hardware.
 
static ssize_t dmaGetRxBuffinPreHwQCount (int32_t fd)
 Get the receive buffer count in pre-hardware queue.
 
static ssize_t dmaGetRxBuffinSwQCount (int32_t fd)
 Get the receive buffer count in software queue.
 
static ssize_t dmaGetRxBuffMissCount (int32_t fd)
 Get the receive buffer missing count.
 
static ssize_t dmaGetTxBuffCount (int32_t fd)
 Get the transmit buffer count.
 
static ssize_t dmaGetTxBuffinUserCount (int32_t fd)
 Get the transmit buffer count in user.
 
static ssize_t dmaGetTxBuffinHwCount (int32_t fd)
 Get the transmit buffer count in hardware.
 
static ssize_t dmaGetTxBuffinPreHwQCount (int32_t fd)
 Get the transmit buffer count in pre-hardware queue.
 
static ssize_t dmaGetTxBuffinSwQCount (int32_t fd)
 Get the transmit buffer count in software queue.
 
static ssize_t dmaGetTxBuffMissCount (int32_t fd)
 Get the transmit buffer missing count.
 
static ssize_t dmaGetBuffSize (int32_t fd)
 Get the buffer size.
 
static ssize_t dmaGetBuffCount (int32_t fd)
 Get the buffer count.
 
static std::string dmaGetGitVersion (int32_t fd)
 Get the DMA Driver's Git Version.
 
static void ** dmaMapDma (int32_t fd, uint32_t *count, uint32_t *size)
 Map user space to DMA buffers.
 
static ssize_t dmaUnMapDma (int32_t fd, void **buffer)
 Unmap user space from DMA buffers.
 
static ssize_t dmaSetDebug (int32_t fd, uint32_t level)
 Set debugging level for DMA operations.
 
static void dmaAssignHandler (int32_t fd, void(*handler)(int32_t))
 Assign a signal handler for asynchronous DMA operations.
 
static ssize_t dmaSetMask (int32_t fd, uint32_t mask)
 Set DMA mask.
 
static void dmaInitMaskBytes (uint8_t *mask)
 Initialize DMA mask byte array.
 
static void dmaAddMaskBytes (uint8_t *mask, uint32_t dest)
 Add a destination to the DMA mask byte array.
 
static ssize_t dmaSetMaskBytes (int32_t fd, uint8_t *mask)
 Set mask byte array to the driver.
 
static ssize_t dmaCheckVersion (int32_t fd)
 Check API version of the DMA driver.
 
static ssize_t dmaGetApiVersion (int32_t fd)
 Get API version of the DMA driver.
 
static ssize_t dmaWriteRegister (int32_t fd, uint64_t address, uint32_t data)
 Write to a DMA register.
 
static ssize_t dmaReadRegister (int32_t fd, uint64_t address, uint32_t *data)
 Read a value from a DMA register.
 
static void * dmaMapRegister (int32_t fd, off_t offset, uint32_t size)
 Map a DMA register space to user space.
 
static ssize_t dmaUnMapRegister (int32_t fd, void *ptr, uint32_t size)
 Unmap a DMA register space from user space.
 

Macro Definition Documentation

◆ DMA_ERR_BUS

#define DMA_ERR_BUS   0x08

Definition at line 40 of file DmaDriver.h.

◆ DMA_ERR_FIFO

#define DMA_ERR_FIFO   0x01

Definition at line 37 of file DmaDriver.h.

◆ DMA_ERR_LEN

#define DMA_ERR_LEN   0x02

Definition at line 38 of file DmaDriver.h.

◆ DMA_ERR_MAX

#define DMA_ERR_MAX   0x04

Definition at line 39 of file DmaDriver.h.

◆ DMA_Get_Buff_Count

#define DMA_Get_Buff_Count   0x1001

Definition at line 43 of file DmaDriver.h.

◆ DMA_Get_Buff_Size

#define DMA_Get_Buff_Size   0x1002

Definition at line 44 of file DmaDriver.h.

◆ DMA_Get_GITV

#define DMA_Get_GITV   0x1019

Definition at line 66 of file DmaDriver.h.

◆ DMA_Get_Index

#define DMA_Get_Index   0x1006

Definition at line 48 of file DmaDriver.h.

◆ DMA_Get_RxBuff_Count

#define DMA_Get_RxBuff_Count   0x100C

Definition at line 54 of file DmaDriver.h.

◆ DMA_Get_RxBuffinHW_Count

#define DMA_Get_RxBuffinHW_Count   0x1015

Definition at line 62 of file DmaDriver.h.

◆ DMA_Get_RxBuffinPreHWQ_Count

#define DMA_Get_RxBuffinPreHWQ_Count   0x1016

Definition at line 63 of file DmaDriver.h.

◆ DMA_Get_RxBuffinSWQ_Count

#define DMA_Get_RxBuffinSWQ_Count   0x1017

Definition at line 64 of file DmaDriver.h.

◆ DMA_Get_RxBuffinUser_Count

#define DMA_Get_RxBuffinUser_Count   0x1014

Definition at line 61 of file DmaDriver.h.

◆ DMA_Get_RxBuffMiss_Count

#define DMA_Get_RxBuffMiss_Count   0x1018

Definition at line 65 of file DmaDriver.h.

◆ DMA_Get_TxBuff_Count

#define DMA_Get_TxBuff_Count   0x100D

Definition at line 55 of file DmaDriver.h.

◆ DMA_Get_TxBuffinHW_Count

#define DMA_Get_TxBuffinHW_Count   0x1010

Definition at line 57 of file DmaDriver.h.

◆ DMA_Get_TxBuffinPreHWQ_Count

#define DMA_Get_TxBuffinPreHWQ_Count   0x1011

Definition at line 58 of file DmaDriver.h.

◆ DMA_Get_TxBuffinSWQ_Count

#define DMA_Get_TxBuffinSWQ_Count   0x1012

Definition at line 59 of file DmaDriver.h.

◆ DMA_Get_TxBuffinUser_Count

#define DMA_Get_TxBuffinUser_Count   0x100F

Definition at line 56 of file DmaDriver.h.

◆ DMA_Get_TxBuffMiss_Count

#define DMA_Get_TxBuffMiss_Count   0x1013

Definition at line 60 of file DmaDriver.h.

◆ DMA_Get_Version

#define DMA_Get_Version   0x1009

Definition at line 51 of file DmaDriver.h.

◆ DMA_MASK_SIZE

#define DMA_MASK_SIZE   512

Definition at line 69 of file DmaDriver.h.

◆ DMA_Read_Ready

#define DMA_Read_Ready   0x1007

Definition at line 49 of file DmaDriver.h.

◆ DMA_Read_Register

#define DMA_Read_Register   0x100B

Definition at line 53 of file DmaDriver.h.

◆ DMA_Ret_Index

#define DMA_Ret_Index   0x1005

Definition at line 47 of file DmaDriver.h.

◆ DMA_Set_Debug

#define DMA_Set_Debug   0x1003

Definition at line 45 of file DmaDriver.h.

◆ DMA_Set_Mask

#define DMA_Set_Mask   0x1004

Definition at line 46 of file DmaDriver.h.

◆ DMA_Set_MaskBytes

#define DMA_Set_MaskBytes   0x1008

Definition at line 50 of file DmaDriver.h.

◆ DMA_VERSION

#define DMA_VERSION   0x06

Company: SLAC National Accelerator Laboratory

Description: This header file defines the interfaces and data structures used by DMA (Direct Memory Access) drivers in the aes_stream_drivers package. These drivers facilitate efficient data transfer between memory and devices without requiring CPU intervention, improving throughput and

reducing latency for I/O operations.

This file is part of the aes_stream_drivers package. It is subject to the license terms in the LICENSE.txt file found in the top-level directory of this distribution and at: https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. No part of the aes_stream_drivers package, including this file, may be copied, modified, propagated, or distributed except according to the terms

contained in the LICENSE.txt file.

Definition at line 34 of file DmaDriver.h.

◆ DMA_Write_Register

#define DMA_Write_Register   0x100A

Definition at line 52 of file DmaDriver.h.

Function Documentation

◆ dmaAddMaskBytes()

static void dmaAddMaskBytes ( uint8_t *  mask,
uint32_t  dest 
)
inlinestatic

Add a destination to the DMA mask byte array.

Adds a destination to the DMA mask byte array by setting the appropriate bit based on the destination index.

Parameters
maskPointer to the DMA mask byte array.
destDestination index to set in the mask.

Definition at line 832 of file DmaDriver.h.

◆ dmaAssignHandler()

static void dmaAssignHandler ( int32_t  fd,
void(*)(int32_t)  handler 
)
inlinestatic

Assign a signal handler for asynchronous DMA operations.

This function sets up a signal action structure to handle SIGIO signals with the specified handler function. It also sets the file descriptor to receive signals for asynchronous I/O.

Parameters
fdFile descriptor for the DMA device.
handlerFunction pointer to the signal handler.

Definition at line 782 of file DmaDriver.h.

◆ dmaCheckVersion()

static ssize_t dmaCheckVersion ( int32_t  fd)
inlinestatic

Check API version of the DMA driver.

Checks the API version of the DMA driver to ensure compatibility.

Parameters
fdFile descriptor for the DMA device.
Returns
0 if the version matches, -1 otherwise.

Definition at line 866 of file DmaDriver.h.

◆ dmaGetApiVersion()

static ssize_t dmaGetApiVersion ( int32_t  fd)
inlinestatic

Get API version of the DMA driver.

Get the API version of the DMA driver

Parameters
fdFile descriptor for the DMA device.
Returns
The API version of the DMA driver

Definition at line 881 of file DmaDriver.h.

◆ dmaGetBuffCount()

static ssize_t dmaGetBuffCount ( int32_t  fd)
inlinestatic

Get the buffer count.

This function retrieves the count of DMA buffers.

Parameters
fdFile descriptor to use.
Returns
The count of DMA buffers.

Definition at line 665 of file DmaDriver.h.

◆ dmaGetBuffSize()

static ssize_t dmaGetBuffSize ( int32_t  fd)
inlinestatic

Get the buffer size.

This function retrieves the size of DMA buffers.

Parameters
fdFile descriptor to use.
Returns
The size of DMA buffers.

Definition at line 652 of file DmaDriver.h.

◆ dmaGetGitVersion()

static std::string dmaGetGitVersion ( int32_t  fd)
inlinestatic

Get the DMA Driver's Git Version.

This function retrieves the DMA Driver's Git Version string

Parameters
fdFile descriptor to use.
Returns
The DMA Driver's Git Version string

Definition at line 678 of file DmaDriver.h.

◆ dmaGetIndex()

static int32_t dmaGetIndex ( int32_t  fd)
inlinestatic

Get the current write buffer index.

This function retrieves the current index for writing to the DMA buffer.

Parameters
fdFile descriptor to use.
Returns
The current write buffer index.

Definition at line 470 of file DmaDriver.h.

◆ dmaGetRxBuffCount()

static ssize_t dmaGetRxBuffCount ( int32_t  fd)
inlinestatic

Get the receive buffer count.

This function retrieves the count of receive buffers available.

Parameters
fdFile descriptor to use.
Returns
The count of receive buffers.

Definition at line 496 of file DmaDriver.h.

◆ dmaGetRxBuffinHwCount()

static ssize_t dmaGetRxBuffinHwCount ( int32_t  fd)
inlinestatic

Get the receive buffer count in hardware.

This function retrieves the count of receive buffers in hardware.

Parameters
fdFile descriptor to use.
Returns
The count of receive buffers in hardware

Definition at line 522 of file DmaDriver.h.

◆ dmaGetRxBuffinPreHwQCount()

static ssize_t dmaGetRxBuffinPreHwQCount ( int32_t  fd)
inlinestatic

Get the receive buffer count in pre-hardware queue.

This function retrieves the count of receive buffers in pre-hardware queue

Parameters
fdFile descriptor to use.
Returns
The count of receive buffers in pre-hardware queue

Definition at line 535 of file DmaDriver.h.

◆ dmaGetRxBuffinSwQCount()

static ssize_t dmaGetRxBuffinSwQCount ( int32_t  fd)
inlinestatic

Get the receive buffer count in software queue.

This function retrieves the count of receive buffers in software queue

Parameters
fdFile descriptor to use.
Returns
The count of receive buffers in software queue

Definition at line 548 of file DmaDriver.h.

◆ dmaGetRxBuffinUserCount()

static ssize_t dmaGetRxBuffinUserCount ( int32_t  fd)
inlinestatic

Get the receive buffer count in user.

This function retrieves the count of receive buffers in user.

Parameters
fdFile descriptor to use.
Returns
The count of receive buffers in user

Definition at line 509 of file DmaDriver.h.

◆ dmaGetRxBuffMissCount()

static ssize_t dmaGetRxBuffMissCount ( int32_t  fd)
inlinestatic

Get the receive buffer missing count.

This function retrieves the count of receive buffer missing

Parameters
fdFile descriptor to use.
Returns
The count of receive buffers missing

Definition at line 561 of file DmaDriver.h.

◆ dmaGetTxBuffCount()

static ssize_t dmaGetTxBuffCount ( int32_t  fd)
inlinestatic

Get the transmit buffer count.

This function retrieves the count of transmit buffers available.

Parameters
fdFile descriptor to use.
Returns
The count of transmit buffers.

Definition at line 574 of file DmaDriver.h.

◆ dmaGetTxBuffinHwCount()

static ssize_t dmaGetTxBuffinHwCount ( int32_t  fd)
inlinestatic

Get the transmit buffer count in hardware.

This function retrieves the count of transmit buffers in hardware.

Parameters
fdFile descriptor to use.
Returns
The count of transmit buffers in hardware

Definition at line 600 of file DmaDriver.h.

◆ dmaGetTxBuffinPreHwQCount()

static ssize_t dmaGetTxBuffinPreHwQCount ( int32_t  fd)
inlinestatic

Get the transmit buffer count in pre-hardware queue.

This function retrieves the count of transmit buffers in pre-hardware queue

Parameters
fdFile descriptor to use.
Returns
The count of transmit buffers in pre-hardware queue

Definition at line 613 of file DmaDriver.h.

◆ dmaGetTxBuffinSwQCount()

static ssize_t dmaGetTxBuffinSwQCount ( int32_t  fd)
inlinestatic

Get the transmit buffer count in software queue.

This function retrieves the count of transmit buffers in software queue

Parameters
fdFile descriptor to use.
Returns
The count of transmit buffers in software queue

Definition at line 626 of file DmaDriver.h.

◆ dmaGetTxBuffinUserCount()

static ssize_t dmaGetTxBuffinUserCount ( int32_t  fd)
inlinestatic

Get the transmit buffer count in user.

This function retrieves the count of transmit buffers in user.

Parameters
fdFile descriptor to use.
Returns
The count of transmit buffers in user

Definition at line 587 of file DmaDriver.h.

◆ dmaGetTxBuffMissCount()

static ssize_t dmaGetTxBuffMissCount ( int32_t  fd)
inlinestatic

Get the transmit buffer missing count.

This function retrieves the count of transmit buffer missing

Parameters
fdFile descriptor to use.
Returns
The count of transmit buffers missing

Definition at line 639 of file DmaDriver.h.

◆ dmaInitMaskBytes()

static void dmaInitMaskBytes ( uint8_t *  mask)
inlinestatic

Initialize DMA mask byte array.

Initializes the DMA mask byte array to zeros.

Parameters
maskPointer to the DMA mask byte array.

Definition at line 818 of file DmaDriver.h.

◆ dmaMapDma()

static void ** dmaMapDma ( int32_t  fd,
uint32_t *  count,
uint32_t *  size 
)
inlinestatic

Map user space to DMA buffers.

This function maps DMA buffers into user space, allowing direct access.

Parameters
fdFile descriptor to use.
countPointer to store the count of buffers.
sizePointer to store the size of each buffer.
Returns
Pointer to an array of pointers to the mapped buffers, or NULL on failure.

Definition at line 698 of file DmaDriver.h.

◆ dmaMapRegister()

static void * dmaMapRegister ( int32_t  fd,
off_t  offset,
uint32_t  size 
)
inlinestatic

Map a DMA register space to user space.

This function calculates an internal offset based on the buffer size and count obtained from the DMA device. It then attempts to map a region of memory into the user space corresponding to this calculated offset plus the specified offset.

Parameters
fdFile descriptor for the DMA device.
offsetOffset from the start of the register space to be mapped.
sizeSize of the memory region to map.
Returns
A pointer to the mapped memory region in user space, or MAP_FAILED on failure.

Definition at line 946 of file DmaDriver.h.

◆ dmaRead()

static ssize_t dmaRead ( int32_t  fd,
void *  buf,
size_t  maxSize,
uint32_t *  flags,
uint32_t *  error,
uint32_t *  dest 
)
inlinestatic

Receive Frame.

This function reads a frame from a device using DMA.

Parameters
fdFile descriptor for DMA operation.
bufBuffer to store received data.
maxSizeMaximum size to read.
flagsPointer to store flags after reading.
errorPointer to store error code if any.
destPointer to store destination address.
Returns
Size of the data received, or negative on failure.

Definition at line 331 of file DmaDriver.h.

◆ dmaReadBulkIndex()

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 
)
inlinestatic

Receive frame and access memory-mapped buffer.

This function reads bulk data from a DMA channel and extracts the metadata associated with each read operation, including return values, indices, flags, error codes, and destination addresses.

Parameters
fdFile descriptor to read from.
countNumber of elements in the buffers.
retPointer to store the return values.
indexBuffer to store the indices of the DMA read operations.
flagsBuffer to store flags of the DMA read operations.
errorBuffer to store error codes of the DMA read operations.
destBuffer to store destination addresses of the DMA read operations.
Returns
The number of bytes read.

Definition at line 400 of file DmaDriver.h.

◆ dmaReadIndex()

static ssize_t dmaReadIndex ( int32_t  fd,
uint32_t *  index,
uint32_t *  flags,
uint32_t *  error,
uint32_t *  dest 
)
inlinestatic

Receive Frame, access memory mapped buffer.

This function reads a frame from a device using DMA, specifically accessing the memory-mapped buffer and retrieves the index of the received data.

Parameters
fdFile descriptor for DMA operation.
indexPointer to store the index of the received data.
flagsPointer to store flags after reading.
errorPointer to store error code if any.
destPointer to store destination address.
Returns
Size of the data received, or negative on failure.

Definition at line 365 of file DmaDriver.h.

◆ dmaReadReady()

static ssize_t dmaReadReady ( int32_t  fd)
inlinestatic

Check if read is ready.

This function checks if the DMA is ready for reading.

Parameters
fdFile descriptor to use.
Returns
Result of the IOCTL operation, indicating read readiness.

Definition at line 483 of file DmaDriver.h.

◆ dmaReadRegister()

static ssize_t dmaReadRegister ( int32_t  fd,
uint64_t  address,
uint32_t *  data 
)
inlinestatic

Read a value from a DMA register.

This function reads a 32-bit value from a specified DMA register address. The read value is stored in the location pointed to by data if data is not NULL.

Parameters
fdFile descriptor for the DMA device.
addressThe address of the register to be read.
dataPointer to store the read data.
Returns
The result of the ioctl operation, indicating success or failure.

Definition at line 916 of file DmaDriver.h.

◆ dmaRetIndex()

static ssize_t dmaRetIndex ( int32_t  fd,
uint32_t  index 
)
inlinestatic

Post an index back to the DMA.

This function posts a single index back to the DMA, indicating that the buffer associated with this index can be reused.

Parameters
fdFile descriptor to use.
indexIndex to be returned.
Returns
Result of the IOCTL operation.

Definition at line 437 of file DmaDriver.h.

◆ dmaRetIndexes()

static ssize_t dmaRetIndexes ( int32_t  fd,
uint32_t  count,
uint32_t *  indexes 
)
inlinestatic

Post multiple indices back to the DMA.

This function posts multiple indices back to the DMA, indicating that the buffers associated with these indices can be reused.

Parameters
fdFile descriptor to use.
countNumber of indices to be returned.
indexesArray of indices to be returned.
Returns
Result of the IOCTL operation.

Definition at line 455 of file DmaDriver.h.

◆ dmaSetDebug()

static ssize_t dmaSetDebug ( int32_t  fd,
uint32_t  level 
)
inlinestatic

Set debugging level for DMA operations.

This function sets the specified debugging level for DMA operations using an IOCTL command.

Parameters
fdFile descriptor for the DMA device.
levelDebugging level to be set.
Returns
Result from the IOCTL call.

Definition at line 767 of file DmaDriver.h.

◆ dmaSetMask()

static ssize_t dmaSetMask ( int32_t  fd,
uint32_t  mask 
)
inlinestatic

Set DMA mask.

Sets a DMA mask using an IOCTL command.

Parameters
fdFile descriptor for the DMA device.
maskDMA mask to be set.
Returns
Result from the IOCTL call.

Definition at line 806 of file DmaDriver.h.

◆ dmaSetMaskBytes()

static ssize_t dmaSetMaskBytes ( int32_t  fd,
uint8_t *  mask 
)
inlinestatic

Set mask byte array to the driver.

Sets the DMA mask byte array using an IOCTL command.

Parameters
fdFile descriptor for the DMA device.
maskPointer to the DMA mask byte array.
Returns
Result from the IOCTL call.

Definition at line 853 of file DmaDriver.h.

◆ dmaUnMapDma()

static ssize_t dmaUnMapDma ( int32_t  fd,
void **  buffer 
)
inlinestatic

Unmap user space from DMA buffers.

This function unmaps DMA buffers from user space, releasing the resources.

Parameters
fdFile descriptor to use.
bufferArray of pointers to the mapped buffers.
Returns
0 on success.

Definition at line 742 of file DmaDriver.h.

◆ dmaUnMapRegister()

static ssize_t dmaUnMapRegister ( int32_t  fd,
void *  ptr,
uint32_t  size 
)
inlinestatic

Unmap a DMA register space from user space.

This function unmaps a previously mapped region of memory from the user space. The fd parameter is not used but is included for symmetry with the dmaMapRegister function.

Parameters
fdFile descriptor for the DMA device. (Unused in this function, but kept for symmetry with map function)
ptrPointer to the start of the mapped memory region.
sizeSize of the memory region to unmap.
Returns
Always returns 0 indicating success.

Definition at line 974 of file DmaDriver.h.

◆ dmaWrite()

static ssize_t dmaWrite ( int32_t  fd,
const void *  buf,
size_t  size,
uint32_t  flags,
uint32_t  dest 
)
inlinestatic

Writes data to a DMA channel.

This function writes a single frame of data to a DMA channel, specified by the file descriptor fd. The data to be written is pointed to by buf, with a specified size of size. Additional parameters include flags (flags) and a destination address (dest).

Parameters
fdFile descriptor for the DMA device.
bufPointer to the data buffer.
sizeSize of the data to write.
flagsFlags for the write operation.
destDestination address for the write.
Returns
Number of bytes written, or a negative error code on failure.

Definition at line 169 of file DmaDriver.h.

◆ dmaWriteIndex()

static ssize_t dmaWriteIndex ( int32_t  fd,
uint32_t  index,
size_t  size,
uint32_t  flags,
uint32_t  dest 
)
inlinestatic

Writes data to a DMA channel using an index.

Similar to dmaWrite, but uses an index (index) to specify the data buffer instead of a direct pointer. This is useful for memory-mapped I/O operations where data buffers are identified by indexes.

Parameters
fdFile descriptor for the DMA device.
indexIndex of the data buffer.
sizeSize of the data to write.
flagsFlags for the write operation.
destDestination address for the write.
Returns
Number of bytes written, or a negative error code on failure.

Definition at line 197 of file DmaDriver.h.

◆ dmaWriteIndexVector()

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 
)
inlinestatic

Write Frame, memory mapped from iovector.

This function writes a frame to a device, using DMA, where the frame data is described by an array of iovec structures.

Parameters
fdFile descriptor for DMA operation.
iovPointer to array of iovec structures.
iovlenLength of the iov array.
begFlagsFlags to use for the beginning of the DMA transaction.
midFlagsFlags to use for the middle of the DMA transaction.
endFlagsFlags to use for the end of the DMA transaction.
destDestination address for the DMA write.
Returns
Total number of bytes written, or negative on failure.

Definition at line 281 of file DmaDriver.h.

◆ dmaWriteRegister()

static ssize_t dmaWriteRegister ( int32_t  fd,
uint64_t  address,
uint32_t  data 
)
inlinestatic

Write to a DMA register.

Writes data to a specified register address using an IOCTL command.

Parameters
fdFile descriptor for the DMA device.
addressRegister address.
dataData to write.
Returns
Result from the IOCTL call.

Definition at line 896 of file DmaDriver.h.

◆ dmaWriteVector()

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 
)
inlinestatic

Writes an array of data frames to a DMA channel.

This function writes multiple data frames to a DMA channel, where each frame is specified by an iovec structure in the array pointed to by iov. The number of frames to write is specified by iovlen. Flags for the beginning, middle, and end of the data stream are specified by begFlags, midFlags, and endFlags, respectively. The destination address for the write operation is specified by dest.

Parameters
fdFile descriptor for the DMA device.
iovPointer to the array of iovec structures.
iovlenNumber of elements in the iov array.
begFlagsFlags for the beginning of the data stream.
midFlagsFlags for the middle of the data stream.
endFlagsFlags for the end of the data stream.
destDestination address for the write.
Returns
Total number of bytes written, or a negative error code on failure.

Definition at line 229 of file DmaDriver.h.