summaryrefslogtreecommitdiffstats
path: root/dma.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-07-18 16:42:51 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-07-18 16:42:51 +0200
commit9e424252a35879f121e7ea4531a9ab3dda56d595 (patch)
tree2cf3dfeceb67eee989a6cc4b20f639baf68748f8 /dma.c
parente9904116a5b39e47744fb39cc5aad574c8bee03f (diff)
downloadpcitool-9e424252a35879f121e7ea4531a9ab3dda56d595.tar.gz
pcitool-9e424252a35879f121e7ea4531a9ab3dda56d595.tar.bz2
pcitool-9e424252a35879f121e7ea4531a9ab3dda56d595.tar.xz
pcitool-9e424252a35879f121e7ea4531a9ab3dda56d595.zip
IRQ acknowledgement support in the engine API
Diffstat (limited to 'dma.c')
-rw-r--r--dma.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/dma.c b/dma.c
index 7ae56f7..1bab0f9 100644
--- a/dma.c
+++ b/dma.c
@@ -114,7 +114,6 @@ 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 0;
}
@@ -136,13 +135,34 @@ 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 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) {
+ 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->acknowledge_irq) {
+ return 0;
+ }
+
+ return ctx->model_info.dma_api->acknowledge_irq(ctx->dma_ctx, irq_type, irq_source);
+}
+
+
typedef struct {
size_t size;