diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-07-12 19:51:27 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-07-12 19:51:27 +0200 |
commit | 9a7ec0c7c063c86e0c2775bbf7fb485c691d9bb9 (patch) | |
tree | c7b4a4ca1008490d677b18a261743a0ff85cc9dc /dma | |
parent | e455f83ca2e4ee7c39837309a422732167994cbf (diff) | |
download | pcitool-9a7ec0c7c063c86e0c2775bbf7fb485c691d9bb9.tar.gz pcitool-9a7ec0c7c063c86e0c2775bbf7fb485c691d9bb9.tar.bz2 pcitool-9a7ec0c7c063c86e0c2775bbf7fb485c691d9bb9.tar.xz pcitool-9a7ec0c7c063c86e0c2775bbf7fb485c691d9bb9.zip |
Few fixes
Diffstat (limited to 'dma')
-rw-r--r-- | dma/nwl.c | 23 | ||||
-rw-r--r-- | dma/nwl_buffers.h | 2 |
2 files changed, 18 insertions, 7 deletions
@@ -128,11 +128,13 @@ void dma_nwl_free(pcilib_dma_context_t *vctx) { pcilib_dma_engine_t i; nwl_dma_t *ctx = (nwl_dma_t*)vctx; - dma_nwl_stop_loopback(ctx); - dma_nwl_free_irq(ctx); - dma_nwl_stop(ctx, PCILIB_DMA_ENGINE_ALL, PCILIB_DMA_FLAGS_DEFAULT); - - free(ctx); + if (ctx) { + dma_nwl_stop_loopback(ctx); + dma_nwl_free_irq(ctx); + dma_nwl_stop(ctx, PCILIB_DMA_ENGINE_ALL, PCILIB_DMA_FLAGS_DEFAULT); + + free(ctx); + } } @@ -144,7 +146,7 @@ double dma_nwl_benchmark(pcilib_dma_context_t *vctx, pcilib_dma_engine_addr_t dm uint32_t val; uint32_t *buf, *cmp; const char *error = NULL; -// pcilib_register_value_t regval; + pcilib_register_value_t regval; size_t us = 0; struct timeval start, cur; @@ -208,6 +210,11 @@ double dma_nwl_benchmark(pcilib_dma_context_t *vctx, pcilib_dma_engine_addr_t dm // Benchmark for (i = 0; i < iterations; i++) { +// puts("===================================="); + pcilib_write_register(ctx->pcilib, NULL, "control", 0x1e1); +// pcilib_read_register(ctx->pcilib, NULL, "control", ®val); +// printf("Control: %lx\n", regval); + gettimeofday(&start, NULL); if (direction&PCILIB_DMA_TO_DEVICE) { memcpy(buf, cmp, size * sizeof(uint32_t)); @@ -241,6 +248,10 @@ double dma_nwl_benchmark(pcilib_dma_context_t *vctx, pcilib_dma_engine_addr_t dm nwl_read_register(val, ctx, write_base, REG_DMA_ENG_CTRL_STATUS); printf("Write DMA control (after write): %lx\n", val); */ + pcilib_write_register(ctx->pcilib, NULL, "control", 0x3e1); +// pcilib_read_register(ctx->pcilib, NULL, "control", ®val); +// printf("Control: %lx\n", regval); + memset(buf, 0, size * sizeof(uint32_t)); err = pcilib_read_dma(ctx->pcilib, readid, addr, size * sizeof(uint32_t), buf, &bytes); diff --git a/dma/nwl_buffers.h b/dma/nwl_buffers.h index 35f4781..565eccf 100644 --- a/dma/nwl_buffers.h +++ b/dma/nwl_buffers.h @@ -151,7 +151,7 @@ static size_t dma_nwl_get_next_buffer(nwl_dma_t * ctx, pcilib_nwl_engine_descrip } static int dma_nwl_push_buffer(nwl_dma_t *ctx, pcilib_nwl_engine_description_t *info, size_t size, int eop, pcilib_timeout_t timeout) { - int flags; + int flags = 0; uint32_t val; unsigned char *ring = pcilib_kmem_get_ua(ctx->pcilib, info->ring); |