nwl_private.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef _PCILIB_DMA_NWL_PRIVATE_H
  2. #define _PCILIB_DMA_NWL_PRIVATE_H
  3. typedef struct nwl_dma_s nwl_dma_t;
  4. typedef struct pcilib_nwl_engine_description_s pcilib_nwl_engine_description_t;
  5. #define NWL_DMA_IRQ_SOURCE 0
  6. #define NWL_XAUI_ENGINE 0
  7. #define NWL_XRAWDATA_ENGINE 1
  8. #define NWL_MAX_PACKET_SIZE 4096 //16384
  9. //#define NWL_GENERATE_DMA_IRQ
  10. #define PCILIB_NWL_ALIGNMENT 64 // in bytes
  11. #define PCILIB_NWL_DMA_DESCRIPTOR_SIZE 64 // in bytes
  12. #define PCILIB_NWL_DMA_PAGES 256 // 1024
  13. //#define DEBUG_HARDWARE
  14. //#define DEBUG_NWL
  15. #include "nwl.h"
  16. #include "nwl_irq.h"
  17. #include "nwl_register.h"
  18. #include "nwl_engine.h"
  19. #include "nwl_loopback.h"
  20. #define nwl_read_register(var, ctx, base, reg) pcilib_datacpy(&var, base + reg, 4, 1, ctx->dma_bank->raw_endianess)
  21. #define nwl_write_register(var, ctx, base, reg) pcilib_datacpy(base + reg, &var, 4, 1, ctx->dma_bank->raw_endianess)
  22. struct pcilib_nwl_engine_description_s {
  23. pcilib_dma_engine_description_t desc;
  24. char *base_addr;
  25. size_t ring_size, page_size;
  26. size_t head, tail;
  27. pcilib_kmem_handle_t *ring;
  28. pcilib_kmem_handle_t *pages;
  29. int started; /**< indicates that DMA buffers are initialized and reading is allowed */
  30. int writting; /**< indicates that we are in middle of writting packet */
  31. int reused; /**< indicates that DMA was found intialized, buffers were reused, and no additional initialization is needed */
  32. int preserve; /**< indicates that DMA should not be stopped during clean-up */
  33. };
  34. struct nwl_dma_s {
  35. struct pcilib_dma_context_s dmactx;
  36. pcilib_t *pcilib;
  37. pcilib_dma_modification_t type;
  38. pcilib_register_bank_description_t *dma_bank;
  39. char *base_addr;
  40. pcilib_irq_type_t irq_enabled; /**< indicates that IRQs are enabled */
  41. pcilib_irq_type_t irq_preserve; /**< indicates that IRQs should not be disabled during clean-up */
  42. int started; /**< indicates that DMA subsystem is initialized and DMA engine can start */
  43. int irq_started; /**< indicates that IRQ subsystem is initialized (detecting which types should be preserverd) */
  44. int loopback_started; /**< indicates that benchmarking subsystem is initialized */
  45. pcilib_dma_engine_t n_engines;
  46. pcilib_nwl_engine_description_t engines[PCILIB_MAX_DMA_ENGINES + 1];
  47. };
  48. #endif /* _PCILIB_DMA_NWL_PRIVATE_H */