summaryrefslogtreecommitdiffstats
path: root/cli.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-07-11 03:48:13 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-07-11 03:48:13 +0200
commit40c61a3b927ce31e05a6eb0d7b36e09e67c6ca97 (patch)
treebaf559a19f5dd348856012d469935b2b29a86de1 /cli.c
parent82167742d62f1cd583d7eb99b356864df70afd8b (diff)
downloadipecamera-40c61a3b927ce31e05a6eb0d7b36e09e67c6ca97.tar.gz
ipecamera-40c61a3b927ce31e05a6eb0d7b36e09e67c6ca97.tar.bz2
ipecamera-40c61a3b927ce31e05a6eb0d7b36e09e67c6ca97.tar.xz
ipecamera-40c61a3b927ce31e05a6eb0d7b36e09e67c6ca97.zip
Wait for the completion of DMA operations during writes
Diffstat (limited to 'cli.c')
-rw-r--r--cli.c8
1 files changed, 4 insertions, 4 deletions
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);
}