BEST PCIe driver
 All Data Structures Files Functions Variables Macros Pages
BEST_dma_device.h
Go to the documentation of this file.
1 
10 #ifndef BEST_DMA_DEVICE_H_
11 #define BEST_DMA_DEVICE_H_
12 
13 
15 #define DMA_MAX_BUFFER_NR 32
16 
17 
19  char name[16];
20 
22  void* desc_addr;
23 
25  void* csr_addr;
26 
29 
31  uint8_t buf_number;
32 
33  uint32_t buf_len;
34 
37 
39  uint8_t curent_buff_idx;
40 
42  dev_t cdevno;
43 
45  struct cdev cdev;
46 };
47 
56 int dma_dev_create(struct dma_dev_struct* dev, struct class* best_class);
57 
62 void dma_dev_remove(struct dma_dev_struct* dev, struct class* best_class);
63 
65 void dma_reset(struct dma_dev_struct* dev);
66 
71 void dma_advance_buf(struct dma_dev_struct* dev);
72 
79 int dma_dev_allocate_buffers(struct pci_dev *dev, struct dma_dev_struct* dma);
80 
85 void dma_dev_free_buffers(struct pci_dev *dev, struct dma_dev_struct* dma);
86 
87 #endif /* BEST_DMA_DEVICE_H_ */
void * buf[DMA_MAX_BUFFER_NR]
pointer to DMA buffer for mSGDMA on FPGA
Definition: BEST_dma_device.h:28
uint8_t curent_buff_idx
current buffer to read from, set with ioctl
Definition: BEST_dma_device.h:39
void dma_dev_free_buffers(struct pci_dev *dev, struct dma_dev_struct *dma)
Frees DMA buffers.
Definition: BEST_dma_device.c:369
void dma_reset(struct dma_dev_struct *dev)
Resets DMA.
Definition: BEST_dma_device.c:110
void * desc_addr
virual address of mSGDMA descriptor mem
Definition: BEST_dma_device.h:22
int dma_dev_allocate_buffers(struct pci_dev *dev, struct dma_dev_struct *dma)
Allocates DMA buffers.
Definition: BEST_dma_device.c:336
uint8_t buf_number
number of buffers, must be < DMA_MAX_BUFFER_NR
Definition: BEST_dma_device.h:31
#define DMA_MAX_BUFFER_NR
Number of DMA buffers.
Definition: BEST_dma_device.h:15
int dma_dev_create(struct dma_dev_struct *dev, struct class *best_class)
Creates new DMA char device.
Definition: BEST_dma_device.c:276
void dma_advance_buf(struct dma_dev_struct *dev)
Advacnes to next buffer, returns pointer to it.
Definition: BEST_dma_device.c:219
void dma_dev_remove(struct dma_dev_struct *dev, struct class *best_class)
Removes DMA char device.
Definition: BEST_dma_device.c:327
Definition: BEST_dma_device.h:18
struct cdev cdev
character device
Definition: BEST_dma_device.h:45
dma_addr_t dma_handle[DMA_MAX_BUFFER_NR]
physical address of buffers
Definition: BEST_dma_device.h:36
void * csr_addr
virtual address of mSGDMA CSR mem
Definition: BEST_dma_device.h:25
dev_t cdevno
character device number
Definition: BEST_dma_device.h:42