diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-07-12 16:35:24 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-07-12 16:35:24 +0200 |
commit | e455f83ca2e4ee7c39837309a422732167994cbf (patch) | |
tree | 0411940c804b8abf33a2bbaa2c2294c9b77d4bb6 /dma.c | |
parent | 6c922712fd8ee7e75a1b45c4980be22d36d0d1d9 (diff) | |
download | ipecamera-e455f83ca2e4ee7c39837309a422732167994cbf.tar.gz ipecamera-e455f83ca2e4ee7c39837309a422732167994cbf.tar.bz2 ipecamera-e455f83ca2e4ee7c39837309a422732167994cbf.tar.xz ipecamera-e455f83ca2e4ee7c39837309a422732167994cbf.zip |
Separate NWL loopback code, provide DMA start/stop interfaces
Diffstat (limited to 'dma.c')
-rw-r--r-- | dma.c | 46 |
1 files changed, 42 insertions, 4 deletions
@@ -55,9 +55,47 @@ int pcilib_set_dma_engine_description(pcilib_t *ctx, pcilib_dma_engine_t engine, } int pcilib_start_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, pcilib_dma_flags_t flags) { + int err; + + const pcilib_dma_info_t *info = pcilib_get_dma_info(ctx); + if (!info) { + pcilib_error("DMA is not supported by the device"); + return PCILIB_ERROR_NOTSUPPORTED; + } + + if (!ctx->model_info.dma_api) { + pcilib_error("DMA Engine is not configured in the current model"); + return PCILIB_ERROR_NOTAVAILABLE; + } + + if (!ctx->model_info.dma_api->start_dma) { + //pcilib_error("The IRQs are not supported by configured DMA engine"); + return 0; + } + + return ctx->model_info.dma_api->start_dma(ctx->dma_ctx, dma, flags); } int pcilib_stop_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, pcilib_dma_flags_t flags) { + int err; + + const pcilib_dma_info_t *info = pcilib_get_dma_info(ctx); + if (!info) { + pcilib_error("DMA is not supported by the device"); + return PCILIB_ERROR_NOTSUPPORTED; + } + + if (!ctx->model_info.dma_api) { + pcilib_error("DMA Engine is not configured in the current model"); + return PCILIB_ERROR_NOTAVAILABLE; + } + + if (!ctx->model_info.dma_api->stop_dma) { + //pcilib_error("The IRQs are not supported by configured DMA engine"); + return 0; + } + + return ctx->model_info.dma_api->stop_dma(ctx->dma_ctx, dma, flags); } int pcilib_enable_irq(pcilib_t *ctx, pcilib_irq_type_t irq_type, pcilib_dma_flags_t flags) { @@ -75,8 +113,8 @@ int pcilib_enable_irq(pcilib_t *ctx, pcilib_irq_type_t irq_type, pcilib_dma_flag } if (!ctx->model_info.dma_api->enable_irq) { - pcilib_error("The IRQs are not supported by configured DMA engine"); - return PCILIB_ERROR_NOTSUPPORTED; + //pcilib_error("The IRQs are not supported by configured DMA engine"); + return 0; } return ctx->model_info.dma_api->enable_irq(ctx->dma_ctx, irq_type, flags); @@ -97,8 +135,8 @@ int pcilib_disable_irq(pcilib_t *ctx, pcilib_dma_flags_t flags) { } if (!ctx->model_info.dma_api->disable_irq) { - pcilib_error("The IRQs are not supported by configured DMA engine"); - return PCILIB_ERROR_NOTSUPPORTED; + //pcilib_error("The IRQs are not supported by configured DMA engine"); + return 0; } return ctx->model_info.dma_api->disable_irq(ctx->dma_ctx, flags); |