1
#ifndef _PCILIB_DMA_IPE_PRIVATE_H
2
#define _PCILIB_DMA_IPE_PRIVATE_H
5
#define IPEDMA_TLP_SIZE 32
6
#define IPEDMA_PAGE_SIZE 4096
7
#define IPEDMA_DMA_PAGES 16 /**< number of DMA pages in the ring buffer to allocate */
8
#define IPEDMA_DMA_PROGRESS_THRESHOLD 1 /**< how many pages the DMA engine should fill before reporting progress */
9
#define IPEDMA_DESCRIPTOR_SIZE 128
10
#define IPEDMA_DESCRIPTOR_ALIGNMENT 64
12
//#define IPEDMA_DEBUG
13
//#define IPEDMA_BUG_DMARD /**< No register read during DMA transfer */
14
//#define IPEDMA_DETECT_PACKETS /**< Using empty_deceted flag */
15
#define IPEDMA_SUPPORT_EMPTY_DETECTED /**< Avoid waiting for data when empty_detected flag is set in hardware */
16
#define IPEDMA_DMA_TIMEOUT 100000 /**< us, overrides PCILIB_DMA_TIMEOUT (actual hardware timeout is 50ms according to Lorenzo) */
18
#define IPEDMA_REG_RESET 0x00
19
#define IPEDMA_REG_CONTROL 0x04
20
#define IPEDMA_REG_TLP_SIZE 0x0C
21
#define IPEDMA_REG_TLP_COUNT 0x10
22
#define IPEDMA_REG_PAGE_ADDR 0x50
23
#define IPEDMA_REG_UPDATE_ADDR 0x54
24
#define IPEDMA_REG_LAST_READ 0x58
25
#define IPEDMA_REG_PAGE_COUNT 0x5C
26
#define IPEDMA_REG_UPDATE_THRESHOLD 0x60
30
typedef struct ipe_dma_s ipe_dma_t;
33
struct pcilib_dma_context_s dmactx;
34
pcilib_dma_engine_description_t engine[2];
38
pcilib_register_bank_description_t *dma_bank;
41
pcilib_irq_type_t irq_enabled; /**< indicates that IRQs are enabled */
42
pcilib_irq_type_t irq_preserve; /**< indicates that IRQs should not be disabled during clean-up */
43
int irq_started; /**< indicates that IRQ subsystem is initialized (detecting which types should be preserverd) */
45
int started; /**< indicates that DMA buffers are initialized and reading is allowed */
46
int writting; /**< indicates that we are in middle of writting packet */
47
int reused; /**< indicates that DMA was found intialized, buffers were reused, and no additional initialization is needed */
48
int preserve; /**< indicates that DMA should not be stopped during clean-up */
49
int mode64; /**< indicates 64-bit operation mode */
51
pcilib_kmem_handle_t *desc; /**< in-memory status descriptor written by DMA engine upon operation progess */
52
pcilib_kmem_handle_t *pages; /**< collection of memory-locked pages for DMA operation */
54
size_t ring_size, page_size;
55
size_t last_read, last_read_addr, last_written;
59
#endif /* _PCILIB_DMA_IPE_PRIVATE_H */