summaryrefslogtreecommitdiffstats
path: root/dma/ipe.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-04-30 19:51:49 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-04-30 19:51:49 +0200
commit8da61292f595c5e700a4fef981b0e0d07910b4b2 (patch)
treea012e6312d95d50c3e8bd58bc972dbccdd3bd0bf /dma/ipe.c
parenta740fcee56bd456a759e03526df476e1791fb2bd (diff)
downloadpcitool-8da61292f595c5e700a4fef981b0e0d07910b4b2.tar.gz
pcitool-8da61292f595c5e700a4fef981b0e0d07910b4b2.tar.bz2
pcitool-8da61292f595c5e700a4fef981b0e0d07910b4b2.tar.xz
pcitool-8da61292f595c5e700a4fef981b0e0d07910b4b2.zip
Provide an interface for logging debug messages
Diffstat (limited to 'dma/ipe.c')
-rw-r--r--dma/ipe.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/dma/ipe.c b/dma/ipe.c
index 439b231..855109c 100644
--- a/dma/ipe.c
+++ b/dma/ipe.c
@@ -12,6 +12,7 @@
#include "pcilib.h"
#include "error.h"
#include "tools.h"
+#include "debug.h"
#include "ipe.h"
#include "ipe_private.h"
@@ -425,9 +426,7 @@ int dma_ipe_stream_read(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, uin
// case PCILIB_STREAMING_CHECK: wait = 0; break;
}
-#ifdef IPEDMA_DEBUG
- printf("Waiting for data: %u (last read) 0x%x (last read addr) 0x%x (last_written)\n", ctx->last_read, ctx->last_read_addr, *last_written_addr_ptr);
-#endif /* IPEDMA_DEBUG */
+ pcilib_debug(DMA, "Waiting for data: %u (last read) 0x%x (last read addr) 0x%x (last_written)\n", ctx->last_read, ctx->last_read_addr, *last_written_addr_ptr);
gettimeofday(&start, NULL);
memcpy(&cur, &start, sizeof(struct timeval));
@@ -442,10 +441,10 @@ int dma_ipe_stream_read(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, uin
// Failing out if we exited on timeout
if ((ctx->last_read_addr == (*last_written_addr_ptr))||(*last_written_addr_ptr == 0)) {
#ifdef IPEDMA_SUPPORT_EMPTY_DETECTED
-# ifdef IPEDMA_DEBUG
+# ifdef PCILIB_DEBUG_DMA
if ((wait)&&(*last_written_addr_ptr)&&(!*empty_detected_ptr))
- pcilib_warning("The empty_detected flag is not set, but no data arrived within %lu us\n", wait);
-# endif /* IPEDMA_DEBUG */
+ pcilib_debug(DMA, "The empty_detected flag is not set, but no data arrived within %lu us\n", wait);
+# endif /* PCILIB_DEBUG_DMA */
#endif /* IPEDMA_SUPPORT_EMPTY_DETECTED */
return (ret&PCILIB_STREAMING_FAIL)?PCILIB_ERROR_TIMEOUT:0;
}
@@ -454,9 +453,7 @@ int dma_ipe_stream_read(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, uin
cur_read = ctx->last_read + 1;
if (cur_read == ctx->ring_size) cur_read = 0;
-#ifdef IPEDMA_DEBUG
- printf("Reading: %u (last read) 0x%x (last read addr) 0x%x (last_written)\n", cur_read, ctx->last_read_addr, *last_written_addr_ptr);
-#endif /* IPEDMA_DEBUG */
+ pcilib_debug(DMA, "Reading: %u (last read) 0x%x (last read addr) 0x%x (last_written)\n", cur_read, ctx->last_read_addr, *last_written_addr_ptr);
#ifdef IPEDMA_DETECT_PACKETS
if ((*empty_detected_ptr)&&(pcilib_kmem_get_block_ba(ctx->dmactx.pcilib, ctx->pages, cur_read) == (*last_written_addr_ptr))) packet_flags = PCILIB_DMA_FLAG_EOP;