summaryrefslogtreecommitdiffstats
path: root/ipecamera
diff options
context:
space:
mode:
Diffstat (limited to 'ipecamera')
-rw-r--r--ipecamera/ipecamera.c12
-rw-r--r--ipecamera/model.h4
-rw-r--r--ipecamera/private.h6
3 files changed, 18 insertions, 4 deletions
diff --git a/ipecamera/ipecamera.c b/ipecamera/ipecamera.c
index 0710f4d..1ea54f4 100644
--- a/ipecamera/ipecamera.c
+++ b/ipecamera/ipecamera.c
@@ -105,6 +105,9 @@ pcilib_context_t *ipecamera_init(pcilib_t *pcilib) {
FIND_REG(adc_resolution_reg, "fpga", "adc_resolution");
FIND_REG(output_mode_reg, "fpga", "output_mode");
+
+ FIND_REG(max_frames_reg, "fpga", "ddr_max_frames");
+ FIND_REG(num_frames_reg, "fpga", "ddr_num_frames");
ctx->rdma = PCILIB_DMA_ENGINE_INVALID;
ctx->wdma = PCILIB_DMA_ENGINE_INVALID;
@@ -264,7 +267,6 @@ int ipecamera_start(pcilib_context_t *vctx, pcilib_event_t event_mask, pcilib_ev
CHECK_REG(status_reg, IPECAMERA_EXPECTED_STATUS);
if (err) return err;
-
ctx->event_id = 0;
ctx->preproc_id = 0;
ctx->reported_id = 0;
@@ -296,6 +298,10 @@ int ipecamera_start(pcilib_context_t *vctx, pcilib_event_t event_mask, pcilib_ev
ctx->image_size = ctx->dim.width * ctx->dim.height;
+
+ GET_REG(max_frames_reg, value);
+ ctx->max_frames = value;
+
ctx->buffer = malloc(ctx->padded_size * ctx->buffer_size);
if (!ctx->buffer) {
ipecamera_stop(vctx, PCILIB_EVENT_FLAGS_DEFAULT);
@@ -594,6 +600,10 @@ int ipecamera_trigger(pcilib_context_t *vctx, pcilib_event_t event, size_t trigg
pcilib_sleep_until_deadline(&ctx->next_trigger);
+ GET_REG(num_frames_reg, value);
+ if (value == ctx->max_frames) {
+ return PCILIB_ERROR_BUSY;
+ }
/*
do {
usleep(10);
diff --git a/ipecamera/model.h b/ipecamera/model.h
index 9034e59..4c527df 100644
--- a/ipecamera/model.h
+++ b/ipecamera/model.h
@@ -114,8 +114,8 @@ pcilib_register_description_t ipecamera_registers[] = {
{0x170, 0, 32, 0, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "num_triggers", ""},
{0x180, 0, 32, 0x280, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "trigger_period", ""},
{0x190, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "temperature_sample_period", ""},
-{0x1a0, 0, 32, 0x64, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "max_frames", ""},
-{0x1b0, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "num_frames", ""},
+{0x1a0, 0, 32, 0x64, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "ddr_max_frames", ""},
+{0x1b0, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "ddr_num_frames", ""},
{0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL}
};
diff --git a/ipecamera/private.h b/ipecamera/private.h
index 5dc10d1..a200b75 100644
--- a/ipecamera/private.h
+++ b/ipecamera/private.h
@@ -86,6 +86,9 @@ struct ipecamera_s {
pcilib_register_t adc_resolution_reg;
pcilib_register_t output_mode_reg;
+
+ pcilib_register_t max_frames_reg;
+ pcilib_register_t num_frames_reg;
int started; /**< Camera is in grabbing mode (start function is called) */
int streaming; /**< Camera is in streaming mode (we are within stream call) */
@@ -112,7 +115,8 @@ struct ipecamera_s {
size_t image_size; /**< Size of a single image in bytes */
- int cmosis_outputs;
+ size_t max_frames; /**< Maximal number of frames what may be buffered in camera DDR memory */
+ int cmosis_outputs; /**< Number of active cmosis outputs: 4 or 16 */
int width, height;