/alps/ipecamera

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

« back to all changes in this revision

Viewing changes to dma.c

  • Committer: Suren A. Chilingaryan
  • Date: 2011-12-12 04:45:35 UTC
  • Revision ID: csa@dside.dyndns.org-20111212044535-6no1q7g230i8uvlv
multithread preprocessing of ipecamera frames and code reorganization

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
 
56
56
int pcilib_set_dma_engine_description(pcilib_t *ctx, pcilib_dma_engine_t engine, pcilib_dma_engine_description_t *desc) {
57
57
    ctx->dma_info.engines[engine] = desc;
 
58
 
 
59
    return 0;
58
60
}
59
61
 
60
62
int pcilib_start_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, pcilib_dma_flags_t flags) {
61
 
    int err; 
62
 
 
63
63
    const pcilib_dma_info_t *info =  pcilib_get_dma_info(ctx);
64
64
    if (!info) {
65
65
        pcilib_error("DMA is not supported by the device");
79
79
}
80
80
 
81
81
int pcilib_stop_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, pcilib_dma_flags_t flags) {
82
 
    int err; 
83
 
 
84
82
    const pcilib_dma_info_t *info =  pcilib_get_dma_info(ctx);
85
83
    if (!info) {
86
84
        pcilib_error("DMA is not supported by the device");
100
98
}
101
99
 
102
100
int pcilib_enable_irq(pcilib_t *ctx, pcilib_irq_type_t irq_type, pcilib_dma_flags_t flags) {
103
 
    int err; 
104
 
 
105
101
    const pcilib_dma_info_t *info =  pcilib_get_dma_info(ctx);
106
102
    if (!info) {
107
103
        pcilib_error("DMA is not supported by the device");
121
117
}
122
118
 
123
119
int pcilib_disable_irq(pcilib_t *ctx, pcilib_dma_flags_t flags) {
124
 
    int err; 
125
 
 
126
120
    const pcilib_dma_info_t *info =  pcilib_get_dma_info(ctx);
127
121
    if (!info) {
128
122
        pcilib_error("DMA is not supported by the device");
142
136
}
143
137
 
144
138
int pcilib_acknowledge_irq(pcilib_t *ctx, pcilib_irq_type_t irq_type, pcilib_irq_source_t irq_source) {
145
 
    int err; 
146
 
 
147
139
    const pcilib_dma_info_t *info =  pcilib_get_dma_info(ctx);
148
140
    if (!info) {
149
141
        pcilib_error("DMA is not supported by the device");
208
200
}
209
201
 
210
202
int pcilib_stream_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, uintptr_t addr, size_t size, pcilib_dma_flags_t flags, pcilib_timeout_t timeout, pcilib_dma_callback_t cb, void *cbattr) {
211
 
    int err; 
212
 
 
213
203
    const pcilib_dma_info_t *info =  pcilib_get_dma_info(ctx);
214
204
    if (!info) {
215
205
        pcilib_error("DMA is not supported by the device");
231
221
        return PCILIB_ERROR_NOTAVAILABLE;
232
222
    }
233
223
 
234
 
    if (info->engines[dma]->direction&PCILIB_DMA_FROM_DEVICE == 0) {
 
224
    if ((info->engines[dma]->direction&PCILIB_DMA_FROM_DEVICE) == 0) {
235
225
        pcilib_error("The selected engine (%i) is S2C-only and does not support reading", dma);
236
226
        return PCILIB_ERROR_NOTSUPPORTED;
237
227
    }
286
276
 
287
277
 
288
278
int pcilib_push_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, uintptr_t addr, size_t size, pcilib_dma_flags_t flags, pcilib_timeout_t timeout, void *buf, size_t *written) {
289
 
    int err; 
290
 
 
291
279
    const pcilib_dma_info_t *info =  pcilib_get_dma_info(ctx);
292
280
    if (!info) {
293
281
        pcilib_error("DMA is not supported by the device");
309
297
        return PCILIB_ERROR_NOTAVAILABLE;
310
298
    }
311
299
 
312
 
    if (info->engines[dma]->direction&PCILIB_DMA_TO_DEVICE == 0) {
 
300
    if ((info->engines[dma]->direction&PCILIB_DMA_TO_DEVICE) == 0) {
313
301
        pcilib_error("The selected engine (%i) is C2S-only and does not support writes", dma);
314
302
        return PCILIB_ERROR_NOTSUPPORTED;
315
303
    }
323
311
}
324
312
 
325
313
double pcilib_benchmark_dma(pcilib_t *ctx, pcilib_dma_engine_addr_t dma, uintptr_t addr, size_t size, size_t iterations, pcilib_dma_direction_t direction) {
326
 
    int err; 
327
 
 
328
314
    const pcilib_dma_info_t *info =  pcilib_get_dma_info(ctx);
329
315
    if (!info) {
330
316
        pcilib_error("DMA is not supported by the device");
350
336
}
351
337
 
352
338
int pcilib_get_dma_status(pcilib_t *ctx, pcilib_dma_engine_t dma, pcilib_dma_engine_status_t *status, size_t n_buffers, pcilib_dma_buffer_status_t *buffers) {
353
 
    int err; 
354
 
 
355
339
    const pcilib_dma_info_t *info =  pcilib_get_dma_info(ctx);
356
340
    if (!info) {
357
341
        pcilib_error("DMA is not supported by the device");
374
358
    }
375
359
 
376
360
    return ctx->model_info.dma_api->status(ctx->dma_ctx, dma, status, n_buffers, buffers);
377
 
 
378
361
}