ipe_private.h 2.4 KB

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