xilinx_axidma.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* AXI DMA connection. Used until qdev provides a generic way. */
  2. typedef void (*DMAPushFn)(void *opaque,
  3. unsigned char *buf, size_t len, uint32_t *app);
  4. struct XilinxDMAConnection {
  5. void *dma;
  6. void *client;
  7. DMAPushFn to_dma;
  8. DMAPushFn to_client;
  9. };
  10. static inline void xlx_dma_connect_client(struct XilinxDMAConnection *dmach,
  11. void *c, DMAPushFn f)
  12. {
  13. dmach->client = c;
  14. dmach->to_client = f;
  15. }
  16. static inline void xlx_dma_connect_dma(struct XilinxDMAConnection *dmach,
  17. void *d, DMAPushFn f)
  18. {
  19. dmach->dma = d;
  20. dmach->to_dma = f;
  21. }
  22. static inline
  23. void xlx_dma_push_to_dma(struct XilinxDMAConnection *dmach,
  24. uint8_t *buf, size_t len, uint32_t *app)
  25. {
  26. dmach->to_dma(dmach->dma, buf, len, app);
  27. }
  28. static inline
  29. void xlx_dma_push_to_client(struct XilinxDMAConnection *dmach,
  30. uint8_t *buf, size_t len, uint32_t *app)
  31. {
  32. dmach->to_client(dmach->client, buf, len, app);
  33. }