From 40c61a3b927ce31e05a6eb0d7b36e09e67c6ca97 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Mon, 11 Jul 2011 03:48:13 +0200 Subject: Wait for the completion of DMA operations during writes --- cli.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cli.c') diff --git a/cli.c b/cli.c index eaafe2d..8f912ef 100644 --- a/cli.c +++ b/cli.c @@ -543,8 +543,8 @@ int ReadData(pcilib_t *handle, ACCESS_MODE mode, pcilib_dma_engine_addr_t dma, p case ACCESS_DMA: dmaid = pcilib_find_dma_by_addr(handle, PCILIB_DMA_FROM_DEVICE, dma); if (dmaid == PCILIB_DMA_INVALID) Error("Invalid DMA engine (%lu) is specified", dma); - ret = pcilib_read_dma(handle, dmaid, addr, size, buf); - if (ret <= 0) Error("No data is returned by DMA engine"); + err = pcilib_read_dma(handle, dmaid, addr, size, buf, &ret); + if ((err)||(ret <= 0)) Error("No data is returned by DMA engine"); size = ret; addr = 0; break; @@ -718,8 +718,8 @@ int WriteData(pcilib_t *handle, ACCESS_MODE mode, pcilib_dma_engine_addr_t dma, case ACCESS_DMA: dmaid = pcilib_find_dma_by_addr(handle, PCILIB_DMA_TO_DEVICE, dma); if (dmaid == PCILIB_DMA_INVALID) Error("Invalid DMA engine (%lu) is specified", dma); - ret = pcilib_write_dma(handle, dmaid, addr, size, buf); - if (ret != size) { + err = pcilib_write_dma(handle, dmaid, addr, size, buf, &ret); + if ((err)||(ret != size)) { if (!ret) Error("No data is written by DMA engine"); else Error("Only %lu bytes of %lu is written by DMA engine", ret, size); } -- cgit v1.2.3