diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2012-11-13 15:58:41 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2012-11-13 15:58:41 +0100 |
commit | 4a39fdf798b4f8f6dadc7109f04587dced12b5a9 (patch) | |
tree | a7884cae8cc77c4d173d98e661c3ab64c6f43699 /dma.c | |
parent | 67cd67b13eeefb8b89fc7448f8dad176897c8f7b (diff) | |
download | pcitool-4a39fdf798b4f8f6dadc7109f04587dced12b5a9.tar.gz pcitool-4a39fdf798b4f8f6dadc7109f04587dced12b5a9.tar.bz2 pcitool-4a39fdf798b4f8f6dadc7109f04587dced12b5a9.tar.xz pcitool-4a39fdf798b4f8f6dadc7109f04587dced12b5a9.zip |
DMA-independent IRQ functions
Diffstat (limited to 'dma.c')
-rw-r--r-- | dma.c | 44 |
1 files changed, 5 insertions, 39 deletions
@@ -80,6 +80,7 @@ int pcilib_start_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, pcilib_dma_flags_t int pcilib_stop_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, pcilib_dma_flags_t flags) { 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; @@ -99,63 +100,28 @@ int pcilib_stop_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, pcilib_dma_flags_t f int pcilib_enable_irq(pcilib_t *ctx, pcilib_irq_type_t irq_type, pcilib_dma_flags_t flags) { 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->enable_irq) { - return 0; - } + if ((!info)||(!ctx->model_info.dma_api)||(!ctx->model_info.dma_api->enable_irq)) return 0; return ctx->model_info.dma_api->enable_irq(ctx->dma_ctx, irq_type, flags); } int pcilib_disable_irq(pcilib_t *ctx, pcilib_dma_flags_t flags) { 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->disable_irq) { - return 0; - } - + if ((!info)||(!ctx->model_info.dma_api)||(!ctx->model_info.dma_api->disable_irq)) return 0; + return ctx->model_info.dma_api->disable_irq(ctx->dma_ctx, flags); } int pcilib_acknowledge_irq(pcilib_t *ctx, pcilib_irq_type_t irq_type, pcilib_irq_source_t irq_source) { 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->acknowledge_irq) { - return 0; - } + if ((!info)||(!ctx->model_info.dma_api)||(!ctx->model_info.dma_api->acknowledge_irq)) return 0; return ctx->model_info.dma_api->acknowledge_irq(ctx->dma_ctx, irq_type, irq_source); } - - typedef struct { size_t size; void *data; |