diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-06-12 17:24:18 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-06-12 17:24:18 +0200 |
commit | 36385f1e83c7f6dd45954033b91d1871e62005c4 (patch) | |
tree | 7cff125d99c62704b6f9dda202928827a37871c0 /dma/ipe.c | |
parent | 860ca5277c37cc93d8e44e5b7a7757b930b83603 (diff) | |
download | pcitool-36385f1e83c7f6dd45954033b91d1871e62005c4.tar.gz pcitool-36385f1e83c7f6dd45954033b91d1871e62005c4.tar.bz2 pcitool-36385f1e83c7f6dd45954033b91d1871e62005c4.tar.xz pcitool-36385f1e83c7f6dd45954033b91d1871e62005c4.zip |
Support streaming mode in IPEDMA
Diffstat (limited to 'dma/ipe.c')
-rw-r--r-- | dma/ipe.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -111,10 +111,12 @@ int dma_ipe_start(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, pcilib_dm else if ((reuse_desc & PCILIB_KMEM_REUSE_HARDWARE) == 0) pcilib_warning("Lost DMA buffers are found (missing HW reference), reinitializing..."); else { #ifndef IPEDMA_BUG_DMARD +# ifndef IPEDMA_STREAMING_MODE RD(IPEDMA_REG_PAGE_COUNT, value); if (value != IPEDMA_DMA_PAGES) pcilib_warning("Inconsistent DMA buffers are found (Number of allocated buffers (%lu) does not match current request (%lu)), reinitializing...", value + 1, IPEDMA_DMA_PAGES); else +# endif /* IPEDMA_STREAMING_MODE */ #endif /* IPEDMA_BUG_DMARD */ preserve = 1; } @@ -501,9 +503,21 @@ int dma_ipe_stream_read(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, uin ret = cb(cbattr, packet_flags, ctx->page_size, buf); if (ret < 0) return -ret; - // We don't need this because hardwaredoes not intend to read anything from the memory + // We don't need this because hardware does not intend to read anything from the memory // pcilib_kmem_sync_block(ctx->dmactx.pcilib, ctx->pages, PCILIB_KMEM_SYNC_TODEVICE, cur_read); + // Return buffer into the DMA pool when processed +#ifdef IPEDMA_STREAMING_MODE + uintptr_t buf_ba = pcilib_kmem_get_block_ba(ctx->dmactx.pcilib, ctx->pages, cur_read); + WR(IPEDMA_REG_PAGE_ADDR, buf_ba); +# ifdef IPEDMA_STREAMING_CHECKS + pcilib_register_value_t streaming_status; + RD(IPEDMA_REG_STREAMING_STATUS, streaming_status); + if (streaming_status) + pcilib_error("Invalid status (0x%lx) adding a DMA buffer into the queue", streaming_status); +# endif /* IPEDMA_STREAMING_MODE */ +#endif /* IPEDMA_STREAMING_MODE */ + // Numbered from 1 #ifdef IPEDMA_BUG_LAST_READ WR(IPEDMA_REG_LAST_READ, cur_read?cur_read:IPEDMA_DMA_PAGES); |