/alps/ipecamera

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/ipecamera

« back to all changes in this revision

Viewing changes to base.c

  • Committer: Suren A. Chilingaryan
  • Date: 2015-07-23 16:36:04 UTC
  • Revision ID: csa@suren.me-20150723163604-5ot6xjmom62zbosy
Support for new CMOSIS 20MPix camera

Show diffs side-by-side

added added

removed removed

Lines of Context:
107
107
 
108
108
        GET_REG(firmware_version_reg, value);
109
109
        switch (value) {
110
 
         case 5:
 
110
         case IPECAMERA_FIRMWARE_UFO5:
111
111
            ctx->firmware = value;
112
112
            err = pcilib_add_registers(pcilib, 0, cmosis_registers);
113
113
            break;
114
 
         case 6:
 
114
         case IPECAMERA_FIRMWARE_CMOSIS20:
115
115
            ctx->firmware = value;
116
116
            err = pcilib_add_registers(pcilib, 0, cmosis20000_registers);
117
117
            break;
118
118
         default:
119
 
            ctx->firmware = 5;
 
119
            ctx->firmware = IPECAMERA_FIRMWARE_UNKNOWN;
120
120
            pcilib_warning("Unsupported version of firmware (%lu)", value);
121
121
        }
122
122
 
294
294
    ctx->buffer_pos = 0;
295
295
    ctx->parse_data = (flags&PCILIB_EVENT_FLAG_RAW_DATA_ONLY)?0:1;
296
296
    ctx->cur_size = 0;
297
 
    
298
 
    ctx->dim.width = IPECAMERA_WIDTH;
299
 
    ctx->dim.height = IPECAMERA_MAX_LINES;
300
 
//    GET_REG(n_lines_reg, ctx->dim.height);
301
 
    
302
 
    GET_REG(output_mode_reg, value);
303
 
    switch (value) {
304
 
     case IPECAMERA_MODE_16_CHAN_IO:
305
 
        ctx->cmosis_outputs = 16;
306
 
        break;
307
 
     case IPECAMERA_MODE_4_CHAN_IO:
308
 
        ctx->cmosis_outputs = 4;
309
 
        break;
 
297
 
 
298
    switch (ctx->firmware) {
 
299
     case IPECAMERA_FIRMWARE_UFO5:
 
300
        ctx->dim.width = CMOSIS_WIDTH;
 
301
        ctx->dim.height = CMOSIS_MAX_LINES;
 
302
        break;
 
303
     case IPECAMERA_FIRMWARE_CMOSIS20:
 
304
        ctx->dim.width = CMOSIS20_WIDTH;
 
305
        ctx->dim.height = CMOSIS20_MAX_LINES;
 
306
        ctx->cmosis_outputs = CMOSIS20_MAX_CHANNELS;
 
307
        break;
310
308
     default:
311
 
        pcilib_error("IPECamera reporting invalid output_mode 0x%lx", value);
312
 
        return PCILIB_ERROR_INVALID_STATE;
313
 
    }
314
 
    
315
 
    ipecamera_compute_buffer_size(ctx, ctx->dim.height);
 
309
        pcilib_error("Can't start undefined version (%lu) of IPECamera", ctx->firmware);
 
310
        return PCILIB_ERROR_INVALID_REQUEST;
 
311
    }
 
312
 
 
313
    if (ctx->firmware == IPECAMERA_FIRMWARE_UFO5) {
 
314
        GET_REG(output_mode_reg, value);
 
315
        switch (value) {
 
316
         case IPECAMERA_MODE_16_CHAN_IO:
 
317
            ctx->cmosis_outputs = 16;
 
318
            break;
 
319
         case IPECAMERA_MODE_4_CHAN_IO:
 
320
            ctx->cmosis_outputs = 4;
 
321
            break;
 
322
         default:
 
323
            pcilib_error("IPECamera reporting invalid output_mode 0x%lx", value);
 
324
            return PCILIB_ERROR_INVALID_STATE;
 
325
        }
 
326
    }
 
327
 
 
328
        // We should be careful here (currently firmware matches format, but this may not be the case in future)
 
329
    ipecamera_compute_buffer_size(ctx, ctx->firmware, CMOSIS_FRAME_HEADER_SIZE, ctx->dim.height);
316
330
 
317
331
    ctx->raw_size = ctx->roi_raw_size;
318
332
    ctx->padded_size = ctx->roi_padded_size;
628
642
            return PCILIB_ERROR_BUSY;
629
643
    }
630
644
 
631
 
    GET_REG(control_reg, value); 
 
645
    GET_REG(control_reg, value);
632
646
    SET_REG(control_reg, value|IPECAMERA_FRAME_REQUEST);
633
647
    usleep(IPECAMERA_TRIGGER_DELAY);
634
648
    SET_REG(control_reg, value);