summaryrefslogtreecommitdiffstats
path: root/dma.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-07-12 14:39:06 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-07-12 14:39:06 +0200
commit493958c9cf11eaa25251d91e9ecab9a28bd6d68f (patch)
treebdda549da425acc5bdbddb5006b6980ec4233a77 /dma.c
parentde984f8b9706cfac79f7658e5b3863e78b052458 (diff)
downloadipecamera-493958c9cf11eaa25251d91e9ecab9a28bd6d68f.tar.gz
ipecamera-493958c9cf11eaa25251d91e9ecab9a28bd6d68f.tar.bz2
ipecamera-493958c9cf11eaa25251d91e9ecab9a28bd6d68f.tar.xz
ipecamera-493958c9cf11eaa25251d91e9ecab9a28bd6d68f.zip
Provide IRQ enable/disable call
Diffstat (limited to 'dma.c')
-rw-r--r--dma.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/dma.c b/dma.c
index 42b14cc..0619a45 100644
--- a/dma.c
+++ b/dma.c
@@ -60,10 +60,48 @@ 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) {
}
-int pcilib_enable_irq(pcilib_t *ctx, pcilib_dma_flags_t flags) {
+int pcilib_enable_irq(pcilib_t *ctx, pcilib_irq_type_t irq_type, 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->enable_irq) {
+ pcilib_error("The IRQs are not supported by configured DMA engine");
+ return PCILIB_ERROR_NOTSUPPORTED;
+ }
+
+ 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) {
+ 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->disable_irq) {
+ pcilib_error("The IRQs are not supported by configured DMA engine");
+ return PCILIB_ERROR_NOTSUPPORTED;
+ }
+
+ return ctx->model_info.dma_api->disable_irq(ctx->dma_ctx, flags);
}