/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to dma.c

  • Committer: Suren A. Chilingaryan
  • Date: 2011-07-12 12:39:06 UTC
  • Revision ID: csa@dside.dyndns.org-20110712123906-4tas2h34i0b2tkp8
Provide IRQ enable/disable call

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
int pcilib_stop_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, pcilib_dma_flags_t flags) {
61
61
}
62
62
 
63
 
int pcilib_enable_irq(pcilib_t *ctx, pcilib_dma_flags_t flags) {
 
63
int pcilib_enable_irq(pcilib_t *ctx, pcilib_irq_type_t irq_type, pcilib_dma_flags_t flags) {
 
64
    int err; 
 
65
 
 
66
    const pcilib_dma_info_t *info =  pcilib_get_dma_info(ctx);
 
67
    if (!info) {
 
68
        pcilib_error("DMA is not supported by the device");
 
69
        return PCILIB_ERROR_NOTSUPPORTED;
 
70
    }
 
71
 
 
72
    if (!ctx->model_info.dma_api) {
 
73
        pcilib_error("DMA Engine is not configured in the current model");
 
74
        return PCILIB_ERROR_NOTAVAILABLE;
 
75
    }
 
76
    
 
77
    if (!ctx->model_info.dma_api->enable_irq) {
 
78
        pcilib_error("The IRQs are not supported by configured DMA engine");
 
79
        return PCILIB_ERROR_NOTSUPPORTED;
 
80
    }
 
81
    
 
82
    return ctx->model_info.dma_api->enable_irq(ctx->dma_ctx, irq_type, flags);
64
83
}
65
84
 
66
85
int pcilib_disable_irq(pcilib_t *ctx, pcilib_dma_flags_t flags) {
 
86
    int err; 
 
87
 
 
88
    const pcilib_dma_info_t *info =  pcilib_get_dma_info(ctx);
 
89
    if (!info) {
 
90
        pcilib_error("DMA is not supported by the device");
 
91
        return PCILIB_ERROR_NOTSUPPORTED;
 
92
    }
 
93
 
 
94
    if (!ctx->model_info.dma_api) {
 
95
        pcilib_error("DMA Engine is not configured in the current model");
 
96
        return PCILIB_ERROR_NOTAVAILABLE;
 
97
    }
 
98
    
 
99
    if (!ctx->model_info.dma_api->disable_irq) {
 
100
        pcilib_error("The IRQs are not supported by configured DMA engine");
 
101
        return PCILIB_ERROR_NOTSUPPORTED;
 
102
    }
 
103
    
 
104
    return ctx->model_info.dma_api->disable_irq(ctx->dma_ctx, flags);
67
105
}
68
106
 
69
107