/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-09 03:33:18 UTC
  • Revision ID: csa@dside.dyndns.org-20110709033318-2k7vk5s5p5u7btem
Support dynamic registers, support register offsets and multiregisters (bitmasks), list NWL DMA registers

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
        return 0;
89
89
    }
90
90
 
91
 
    if (!ctx->model_info->dma_api) {
 
91
    if (!ctx->model_info.dma_api) {
92
92
        pcilib_error("DMA Engine is not configured in the current model");
93
93
        return 0;
94
94
    }
95
95
    
96
 
    if (!ctx->model_info->dma_api->stream) {
 
96
    if (!ctx->model_info.dma_api->stream) {
97
97
        pcilib_error("The DMA read is not supported by configured DMA engine");
98
98
        return 0;
99
99
    }
108
108
        return 0;
109
109
    }
110
110
 
111
 
    return ctx->model_info->dma_api->stream(ctx->dma_ctx, dma, addr, size, flags, timeout, cb, cbattr);
 
111
    return ctx->model_info.dma_api->stream(ctx->dma_ctx, dma, addr, size, flags, timeout, cb, cbattr);
112
112
}
113
113
 
114
114
size_t pcilib_read_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, uintptr_t addr, size_t size, void *buf) {
141
141
        return 0;
142
142
    }
143
143
 
144
 
    if (!ctx->model_info->dma_api) {
 
144
    if (!ctx->model_info.dma_api) {
145
145
        pcilib_error("DMA Engine is not configured in the current model");
146
146
        return 0;
147
147
    }
148
148
    
149
 
    if (!ctx->model_info->dma_api->push) {
 
149
    if (!ctx->model_info.dma_api->push) {
150
150
        pcilib_error("The DMA write is not supported by configured DMA engine");
151
151
        return 0;
152
152
    }
161
161
        return 0;
162
162
    }
163
163
    
164
 
    return ctx->model_info->dma_api->push(ctx->dma_ctx, dma, addr, size, flags, timeout, buf);
 
164
    return ctx->model_info.dma_api->push(ctx->dma_ctx, dma, addr, size, flags, timeout, buf);
165
165
}
166
166
 
167
167
 
178
178
        return 0;
179
179
    }
180
180
 
181
 
    if (!ctx->model_info->dma_api) {
 
181
    if (!ctx->model_info.dma_api) {
182
182
        pcilib_error("DMA Engine is not configured in the current model");
183
183
        return -1;
184
184
    }
185
185
    
186
 
    if (!ctx->model_info->dma_api->benchmark) {
 
186
    if (!ctx->model_info.dma_api->benchmark) {
187
187
        pcilib_error("The DMA benchmark is not supported by configured DMA engine");
188
188
        return -1;
189
189
   }
193
193
        return -1;
194
194
    }
195
195
 
196
 
    return ctx->model_info->dma_api->benchmark(ctx->dma_ctx, dma, addr, size, iterations, direction);
 
196
    return ctx->model_info.dma_api->benchmark(ctx->dma_ctx, dma, addr, size, iterations, direction);
197
197
}