/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 reader.c

  • Committer: Suren A. Chilingaryan
  • Date: 2017-08-16 20:41:23 UTC
  • Revision ID: csa@suren.me-20170816204123-rahgc2euzxhrc4op
Support HighFlex-based ipecamera

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
 
62
62
    switch (format) {
63
63
     case IPECAMERA_FORMAT_CMOSIS:
 
64
     case IPECAMERA_FORMAT_CMOSIS20:
64
65
        max_channels = CMOSIS_MAX_CHANNELS;
65
 
        line_size = (1 + CMOSIS_PIXELS_PER_CHANNEL) * 32; 
66
 
        break;
67
 
     case IPECAMERA_FORMAT_CMOSIS20:
68
 
        max_channels = CMOSIS20_MAX_CHANNELS;
69
 
        line_size = (1 + CMOSIS20_PIXELS_PER_CHANNEL) * 32 / 2;
 
66
        line_size = ctx->data_line_size;
70
67
        break;
71
68
     default:
72
69
        pcilib_warning("Unsupported version (%u) of frame format...", format);
92
89
 
93
90
 
94
91
static int ipecamera_parse_header(ipecamera_t *ctx, ipecamera_payload_t *buf, size_t buf_size) {
 
92
    int err;
95
93
    int last = buf[0] & 1;
96
94
    int version = (buf[0] >> 1) & 7;
97
95
    size_t size = 0, n_lines;
129
127
    }
130
128
 
131
129
    size += CMOSIS_FRAME_HEADER_SIZE;
132
 
    ipecamera_compute_buffer_size(ctx, format, size, n_lines);
 
130
 
 
131
    err = ipecamera_compute_buffer_size(ctx, format, size, n_lines);
 
132
    if (err) return 0;
133
133
 
134
134
        // Returns total size of found headers or 0 on the error
135
135
    return size;
348
348
                if ((!err)&&(value&0x2FFFFFFF)) {
349
349
                    pcilib_warning("Camera stuck in busy, trying to recover...");
350
350
                    GET_REG(control_reg, saved);
351
 
                    SET_REG(control_reg, IPECAMERA_IDLE);
 
351
                    SET_REG(control_reg, IPECAMERA_IDLE|(saved&0xFFFF0000));
352
352
                    while ((value&0x2FFFFFFF)&&(ctx->run_reader)) {
353
353
                        usleep(IPECAMERA_NOFRAME_SLEEP);
354
354
                    }