summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2011-03-23 11:44:02 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2011-03-23 11:44:02 +0100
commit6c822e1dedff95eeb64733e8ae0f7554b01bcd17 (patch)
tree19af6ae5c84a06e400caf7323b94c2882a6baa1d /src
parent8c48a8ad1c6153770c24ae2e8a9b0f9efedfc4af (diff)
downloaduca-6c822e1dedff95eeb64733e8ae0f7554b01bcd17.tar.gz
uca-6c822e1dedff95eeb64733e8ae0f7554b01bcd17.tar.bz2
uca-6c822e1dedff95eeb64733e8ae0f7554b01bcd17.tar.xz
uca-6c822e1dedff95eeb64733e8ae0f7554b01bcd17.zip
Implement grab timeout
Diffstat (limited to 'src')
-rw-r--r--src/cameras/pco.c13
-rw-r--r--src/cameras/pf.c21
-rw-r--r--src/grabbers/me4.c20
-rw-r--r--src/uca-grabber.h2
-rw-r--r--src/uca.c1
-rw-r--r--src/uca.h3
6 files changed, 53 insertions, 7 deletions
diff --git a/src/cameras/pco.c b/src/cameras/pco.c
index ac2e950..1cad698 100644
--- a/src/cameras/pco.c
+++ b/src/cameras/pco.c
@@ -75,6 +75,11 @@ static uint32_t uca_pco_set_property(struct uca_camera *cam, enum uca_property_i
case UCA_PROP_TIMESTAMP_MODE:
return pco_set_timestamp_mode(GET_PCO(cam), *((uint16_t *) data));
+ case UCA_PROP_GRAB_TIMEOUT:
+ if (grabber->set_property(grabber, UCA_GRABBER_TIMEOUT, data) != UCA_NO_ERROR)
+ return UCA_ERR_PROP_VALUE_OUT_OF_RANGE;
+ break;
+
default:
return UCA_ERR_PROP_INVALID;
}
@@ -188,6 +193,14 @@ static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_i
set_void(data, uint32_t, 16);
break;
+ case UCA_PROP_GRAB_TIMEOUT:
+ {
+ uint32_t timeout;
+ cam->grabber->get_property(cam->grabber, UCA_GRABBER_TIMEOUT, &timeout);
+ set_void(data, uint32_t, timeout);
+ }
+ break;
+
default:
return UCA_ERR_PROP_INVALID;
}
diff --git a/src/cameras/pf.c b/src/cameras/pf.c
index 48f2192..0bcf674 100644
--- a/src/cameras/pf.c
+++ b/src/cameras/pf.c
@@ -70,26 +70,26 @@ static uint32_t uca_pf_set_property(struct uca_camera *cam, enum uca_property_id
switch (property) {
case UCA_PROP_WIDTH:
- if (grabber->set_property(grabber, UCA_GRABBER_WIDTH, (uint32_t *) data) != UCA_NO_ERROR)
+ if (grabber->set_property(grabber, UCA_GRABBER_WIDTH, data) != UCA_NO_ERROR)
return UCA_ERR_PROP_VALUE_OUT_OF_RANGE;
if (uca_pf_set_uint32_property(token, data, &cam->frame_width) < 0)
return UCA_ERR_PROP_VALUE_OUT_OF_RANGE;
break;
case UCA_PROP_HEIGHT:
- if (grabber->set_property(grabber, UCA_GRABBER_HEIGHT, (uint32_t *) data) != UCA_NO_ERROR)
+ if (grabber->set_property(grabber, UCA_GRABBER_HEIGHT, data) != UCA_NO_ERROR)
return UCA_ERR_PROP_VALUE_OUT_OF_RANGE;
if (uca_pf_set_uint32_property(token, data, &cam->frame_height) < 0)
return UCA_ERR_PROP_VALUE_OUT_OF_RANGE;
break;
case UCA_PROP_X_OFFSET:
- if (grabber->set_property(grabber, UCA_GRABBER_OFFSET_X, (uint32_t *) data) != UCA_NO_ERROR)
+ if (grabber->set_property(grabber, UCA_GRABBER_OFFSET_X, data) != UCA_NO_ERROR)
return UCA_ERR_PROP_VALUE_OUT_OF_RANGE;
break;
case UCA_PROP_Y_OFFSET:
- if (grabber->set_property(grabber, UCA_GRABBER_OFFSET_Y, (uint32_t *) data) != UCA_NO_ERROR)
+ if (grabber->set_property(grabber, UCA_GRABBER_OFFSET_Y, data) != UCA_NO_ERROR)
return UCA_ERR_PROP_VALUE_OUT_OF_RANGE;
break;
@@ -102,6 +102,11 @@ static uint32_t uca_pf_set_property(struct uca_camera *cam, enum uca_property_id
return UCA_ERR_PROP_VALUE_OUT_OF_RANGE;
break;
+ case UCA_PROP_GRAB_TIMEOUT:
+ if (grabber->set_property(grabber, UCA_GRABBER_TIMEOUT, data) != UCA_NO_ERROR)
+ return UCA_ERR_PROP_VALUE_OUT_OF_RANGE;
+ break;
+
default:
return UCA_ERR_PROP_INVALID;
}
@@ -157,6 +162,14 @@ static uint32_t uca_pf_get_property(struct uca_camera *cam, enum uca_property_id
set_void(data, uint32_t, 8);
break;
+ case UCA_PROP_GRAB_TIMEOUT:
+ {
+ uint32_t timeout;
+ cam->grabber->get_property(cam->grabber, UCA_GRABBER_TIMEOUT, &timeout);
+ set_void(data, uint32_t, timeout);
+ }
+ break;
+
default:
return UCA_ERR_PROP_INVALID;
}
diff --git a/src/grabbers/me4.c b/src/grabbers/me4.c
index f1073ff..6cd72ae 100644
--- a/src/grabbers/me4.c
+++ b/src/grabbers/me4.c
@@ -11,6 +11,7 @@
struct fg_apc_data {
Fg_Struct *fg;
dma_mem *mem;
+ uint32_t timeout;
/* End-user related callback variables */
uca_cam_grab_callback callback;
@@ -31,6 +32,7 @@ static struct uca_sisofg_map_t uca_to_fg[] = {
{ UCA_GRABBER_OFFSET_X, FG_XOFFSET, false },
{ UCA_GRABBER_OFFSET_Y, FG_YOFFSET, false },
{ UCA_GRABBER_EXPOSURE, FG_EXPOSURE, false },
+ { UCA_GRABBER_TIMEOUT, FG_TIMEOUT, false },
{ UCA_GRABBER_TRIGGER_MODE, FG_TRIGGERMODE, true},
{ UCA_GRABBER_FORMAT, FG_FORMAT, true},
{ UCA_GRABBER_CAMERALINK_TYPE, FG_CAMERA_LINK_CAMTYP, true },
@@ -74,6 +76,15 @@ uint32_t uca_me4_set_property(struct uca_grabber *grabber, enum uca_grabber_cons
if (fg_prop == NULL)
return UCA_ERR_PROP_INVALID;
+ switch (property) {
+ case UCA_GRABBER_TIMEOUT:
+ ((struct fg_apc_data *) grabber->user)->timeout = *((uint32_t *) data);
+ break;
+
+ default:
+ break;
+ }
+
if (fg_prop->interpret_data) {
/* Data is not a value but a SiSo specific constant that we need to
* translate to Silicon Software speak. Therefore, we try to find it in
@@ -141,17 +152,18 @@ uint32_t uca_me4_stop_acquire(struct uca_grabber *grabber)
uint32_t uca_me4_grab(struct uca_grabber *grabber, void **buffer, uint64_t *frame_number)
{
static frameindex_t last_frame = 0;
+ struct fg_apc_data *me4 = (struct fg_apc_data *) grabber->user;
if (grabber->asynchronous)
- last_frame = Fg_getLastPicNumberEx(GET_FG(grabber), PORT_A, GET_MEM(grabber));
+ last_frame = Fg_getLastPicNumberEx(me4->fg, PORT_A, me4->mem);
else
- last_frame = Fg_getLastPicNumberBlockingEx(GET_FG(grabber), last_frame+1, PORT_A, 10, GET_MEM(grabber));
+ last_frame = Fg_getLastPicNumberBlockingEx(me4->fg, last_frame+1, PORT_A, me4->timeout, me4->mem);
if (last_frame <= 0)
return UCA_ERR_PROP_GENERAL;
*frame_number = (uint64_t) last_frame;
- *buffer = Fg_getImagePtrEx(GET_FG(grabber), last_frame, PORT_A, GET_MEM(grabber));
+ *buffer = Fg_getImagePtrEx(me4->fg, last_frame, PORT_A, me4->mem);
return UCA_NO_ERROR;
}
@@ -200,6 +212,8 @@ uint32_t uca_me4_init(struct uca_grabber **grabber)
memset(me4, 0, sizeof(struct fg_apc_data));
me4->fg = fg;
+ Fg_getParameter(fg, FG_TIMEOUT, &me4->timeout, PORT_A);
+
uca->user = me4;
uca->destroy = &uca_me4_destroy;
uca->set_property = &uca_me4_set_property;
diff --git a/src/uca-grabber.h b/src/uca-grabber.h
index 024777e..56c10e3 100644
--- a/src/uca-grabber.h
+++ b/src/uca-grabber.h
@@ -11,6 +11,7 @@
enum uca_grabber_constants {
UCA_GRABBER_INVALID = -1,
+
/* properties */
UCA_GRABBER_WIDTH = 0,
UCA_GRABBER_HEIGHT,
@@ -19,6 +20,7 @@ enum uca_grabber_constants {
UCA_GRABBER_OFFSET_X,
UCA_GRABBER_OFFSET_Y,
UCA_GRABBER_EXPOSURE,
+ UCA_GRABBER_TIMEOUT,
UCA_GRABBER_FORMAT,
UCA_GRABBER_TRIGGER_MODE,
UCA_GRABBER_CAMERALINK_TYPE,
diff --git a/src/uca.c b/src/uca.c
index cb76f78..5b0ad85 100644
--- a/src/uca.c
+++ b/src/uca.c
@@ -77,6 +77,7 @@ static struct uca_property property_map[UCA_PROP_LAST+1] = {
{ "Gain.ADC.Min", uca_na, uca_uint32t, uca_read },
{ "Gain.ADC.Max", uca_na, uca_uint32t, uca_read },
{ "Gain.ADC.Step", uca_na, uca_uint32t, uca_read },
+ { "Grabber.Timeout", uca_s, uca_uint32t, uca_readwrite },
{ "Mode.Timestamp", uca_na, uca_uint32t, uca_readwrite },
{ "Mode.Scan", uca_na, uca_uint32t, uca_readwrite },
{ "Interlace.Samplerate", uca_na, uca_uint32t, uca_readwrite },
diff --git a/src/uca.h b/src/uca.h
index 64eb3a4..1664fb3 100644
--- a/src/uca.h
+++ b/src/uca.h
@@ -101,6 +101,9 @@ enum uca_property_ids {
UCA_PROP_ADC_GAIN_MAX,
UCA_PROP_ADC_GAIN_STEPS,
+ /* grabber specific */
+ UCA_PROP_GRAB_TIMEOUT,
+
/* pco.edge specific */
UCA_PROP_TIMESTAMP_MODE,
UCA_PROP_SCAN_MODE,