diff options
| author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2012-10-19 03:36:45 +0200 | 
|---|---|---|
| committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2012-10-19 03:36:45 +0200 | 
| commit | 84bb1bb6130f1745ecc19a0210d06e2fe7a1635f (patch) | |
| tree | a810f239c64749abf2b59021ad03902953277fdc /ipecamera | |
| parent | ab78594d091c8be7e942ff77d7937550261db6c7 (diff) | |
| download | pcitool-84bb1bb6130f1745ecc19a0210d06e2fe7a1635f.tar.gz pcitool-84bb1bb6130f1745ecc19a0210d06e2fe7a1635f.tar.bz2 pcitool-84bb1bb6130f1745ecc19a0210d06e2fe7a1635f.tar.xz pcitool-84bb1bb6130f1745ecc19a0210d06e2fe7a1635f.zip | |
Detect firmware version during initialization
Diffstat (limited to 'ipecamera')
| -rw-r--r-- | ipecamera/ipecamera.c | 26 | 
1 files changed, 14 insertions, 12 deletions
| diff --git a/ipecamera/ipecamera.c b/ipecamera/ipecamera.c index f8136d4..acd423f 100644 --- a/ipecamera/ipecamera.c +++ b/ipecamera/ipecamera.c @@ -88,8 +88,10 @@ pcilib_context_t *ipecamera_init(pcilib_t *pcilib) {      ipecamera_t *ctx = malloc(sizeof(ipecamera_t));      if (ctx) { -	memset(ctx, 0, sizeof(ipecamera_t)); +	pcilib_register_value_t value; +	memset(ctx, 0, sizeof(ipecamera_t)); +  	ctx->buffer_size = IPECAMERA_DEFAULT_BUFFER_SIZE;  	ctx->dim.bpp = sizeof(ipecamera_pixel_t) * 8; @@ -113,6 +115,17 @@ pcilib_context_t *ipecamera_init(pcilib_t *pcilib) {  	FIND_REG(max_frames_reg, "fpga", "ddr_max_frames");  	FIND_REG(num_frames_reg, "fpga", "ddr_num_frames"); + +	GET_REG(firmware_version_reg, value); +	switch (value) { +	 case 4: +	 case 5: +	    ctx->firmware = value; +	    break; +	 default: +    	    pcilib_error("Unsupported version of firmware (%lu)", value); +	} +  	ctx->rdma = PCILIB_DMA_ENGINE_INVALID;  	ctx->wdma = PCILIB_DMA_ENGINE_INVALID; @@ -263,17 +276,6 @@ int ipecamera_start(pcilib_context_t *vctx, pcilib_event_t event_mask, pcilib_ev  	return PCILIB_ERROR_INVALID_REQUEST;      } - -    GET_REG(firmware_version_reg, value); -    switch (value) { -     case 4: -     case 5: -	ctx->firmware = value; -	break; -     default: -        pcilib_error("Unsupported version of firmware (%lu)", value); -    } -  	// Allow readout and clean the FRAME_REQUEST mode if set for some reason      SET_REG(control_reg, IPECAMERA_IDLE|IPECAMERA_READOUT_FLAG);      usleep(IPECAMERA_SLEEP_TIME); | 
