diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2014-04-03 00:37:21 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2014-04-03 00:37:21 +0200 |
commit | a1925232b26bc0d9801d7c1dcd58301841877af1 (patch) | |
tree | 8da70a5e091d5400fd063c385ec473d17b708583 /ipecamera | |
parent | d8c13eb6ff5a1c9cc28617d83dbde454c7222be4 (diff) | |
parent | c57db04f528e671040256d322bb8f21a8d8e9ac1 (diff) | |
download | ipecamera-a1925232b26bc0d9801d7c1dcd58301841877af1.tar.gz ipecamera-a1925232b26bc0d9801d7c1dcd58301841877af1.tar.bz2 ipecamera-a1925232b26bc0d9801d7c1dcd58301841877af1.tar.xz ipecamera-a1925232b26bc0d9801d7c1dcd58301841877af1.zip |
Merge changes from xilinx_dma branch providing support of multipage kmem allocations and mapping memory regions reserved with memmap boot option
Diffstat (limited to 'ipecamera')
-rw-r--r-- | ipecamera/ipecamera.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/ipecamera/ipecamera.c b/ipecamera/ipecamera.c index 605d733..1681f7c 100644 --- a/ipecamera/ipecamera.c +++ b/ipecamera/ipecamera.c @@ -123,7 +123,8 @@ pcilib_context_t *ipecamera_init(pcilib_t *pcilib) { ctx->firmware = value; break; default: - pcilib_error("Unsupported version of firmware (%lu)", value); +// pcilib_error("Unsupported version of firmware (%lu)", value); + ctx->firmware = 0; } #ifdef IPECAMERA_BUG_POSTPONED_READ @@ -155,7 +156,9 @@ void ipecamera_free(pcilib_context_t *vctx) { } pcilib_dma_context_t *ipecamera_init_dma(pcilib_context_t *vctx) { -// ipecamera_t *ctx = (ipecamera_t*)vctx; +#ifdef IPECAMERA_DMA_R3 + ipecamera_t *ctx = (ipecamera_t*)vctx; +#endif pcilib_model_description_t *model_info = pcilib_get_model_description(vctx->pcilib); if ((!model_info->dma_api)||(!model_info->dma_api->init)) { @@ -165,7 +168,11 @@ pcilib_dma_context_t *ipecamera_init_dma(pcilib_context_t *vctx) { #ifdef IPECAMERA_DMA_R3 - return model_info->dma_api->init(vctx->pcilib, PCILIB_NWL_MODIFICATION_IPECAMERA, NULL); + if (ctx->firmware) { + return model_info->dma_api->init(vctx->pcilib, PCILIB_NWL_MODIFICATION_IPECAMERA, NULL); + } else { + return model_info->dma_api->init(vctx->pcilib, PCILIB_DMA_MODIFICATION_DEFAULT, NULL); + } #else return model_info->dma_api->init(vctx->pcilib, PCILIB_DMA_MODIFICATION_DEFAULT, NULL); #endif @@ -204,6 +211,11 @@ int ipecamera_reset(pcilib_context_t *vctx) { pcilib_error("IPECamera imaging is not initialized"); return PCILIB_ERROR_NOTINITIALIZED; } + + if (!ctx->firmware) { + pcilib_warning("Unsupported version of firmware (%lu)", ctx->firmware); + return 0; + } pcilib = vctx->pcilib; control = ctx->control_reg; @@ -278,13 +290,17 @@ int ipecamera_start(pcilib_context_t *vctx, pcilib_event_t event_mask, pcilib_ev pcilib_error("IPECamera imaging is not initialized"); return PCILIB_ERROR_NOTINITIALIZED; } + + if (!ctx->firmware) { + pcilib_error("Unsupported version of firmware (%lu)", ctx->firmware); + return PCILIB_ERROR_INVALID_REQUEST; + } if (ctx->started) { pcilib_error("IPECamera grabbing is already started"); return PCILIB_ERROR_INVALID_REQUEST; } - // Allow readout and clean the FRAME_REQUEST mode if set for some reason GET_REG(control_reg, value); SET_REG(control_reg, value|IPECAMERA_READOUT_FLAG); @@ -634,7 +650,12 @@ int ipecamera_trigger(pcilib_context_t *vctx, pcilib_event_t event, size_t trigg pcilib_error("IPECamera imaging is not initialized"); return PCILIB_ERROR_NOTINITIALIZED; } - + + if (!ctx->firmware) { + pcilib_error("Unsupported version of firmware (%lu)", ctx->firmware); + return PCILIB_ERROR_INVALID_REQUEST; + } + pcilib_sleep_until_deadline(&ctx->next_trigger); GET_REG(num_frames_reg, value); |