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

  • Committer: Suren A. Chilingaryan
  • Date: 2015-03-29 16:05:58 UTC
  • Revision ID: csa@suren.me-20150329160558-326s1v2vlh850s6t
Fix frame size computation in ipecamera and few debuging options

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
        FIND_REG(status_reg, "fpga", "status");
98
98
        FIND_REG(control_reg, "fpga", "control");
99
99
 
 
100
        FIND_REG(status2_reg, "fpga", "status2");
100
101
        FIND_REG(status3_reg, "fpga", "status3");
101
102
 
102
103
        FIND_REG(n_lines_reg, "cmosis", "cmosis_number_lines");
304
305
    if (value&0x1000) ctx->fr_mode = 1;
305
306
    else {
306
307
        ctx->fr_mode = 0;
307
 
        CHECK_STATUS_REG();
308
 
        if (err) return err;
 
308
        
 
309
//      CHECK_STATUS_REG();
 
310
//      if (err) return err;
309
311
    }
310
312
 
311
313
    ctx->event_id = 0;
659
661
        return PCILIB_ERROR_BUSY;
660
662
    }
661
663
*/
662
 
/*
663
 
    do {
664
 
        usleep(10);
665
 
        GET_REG(status3_reg, value);
666
 
    } while (value&0x20000000);
667
 
*/
 
664
 
 
665
    GET_REG(status2_reg, value);
 
666
    if (value&0x40000000) {
 
667
//      printf("%x\n", value);
 
668
//      GET_REG(status3_reg, value);
 
669
//      printf("3: %x\n", value);
 
670
//      GET_REG(status_reg, value);
 
671
//      printf("1: %x\n", value);
 
672
 
 
673
#ifdef IPECAMERA_TRIGGER_WAIT_IDLE
 
674
        if (IPECAMERA_TRIGGER_WAIT_IDLE) {
 
675
            struct timeval deadline;
 
676
            pcilib_calc_deadline(&deadline, IPECAMERA_TRIGGER_WAIT_IDLE);
 
677
            do {
 
678
                usleep(IPECAMERA_READ_STATUS_DELAY);
 
679
                GET_REG(status2_reg, value);
 
680
            } while ((value&0x40000000)&&(pcilib_calc_time_to_deadline(&deadline) > 0));
 
681
        }
 
682
        if (value&0x40000000)
 
683
#endif /* IPECAMERA_TRIGGER_WAIT_IDLE */
 
684
            return PCILIB_ERROR_BUSY;
 
685
    }
668
686
 
669
687
    GET_REG(control_reg, value); 
670
688
    SET_REG(control_reg, value|IPECAMERA_FRAME_REQUEST);
672
690
    //CHECK_REG(status_reg, IPECAMERA_EXPECTED_STATUS);
673
691
    SET_REG(control_reg, value);
674
692
 
675
 
 
 
693
        // We need to compute it differently, on top of that add exposure time and the time FPGA takes to read frame from CMOSIS
676
694
    pcilib_calc_deadline(&ctx->next_trigger, IPECAMERA_NEXT_FRAME_DELAY);
677
695
 
678
696
    return 0;