summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cameras/uca_pco.c43
-rw-r--r--src/uca.c27
-rw-r--r--src/uca.h37
3 files changed, 86 insertions, 21 deletions
diff --git a/src/cameras/uca_pco.c b/src/cameras/uca_pco.c
index 3effde4..93d50f6 100644
--- a/src/cameras/uca_pco.c
+++ b/src/cameras/uca_pco.c
@@ -60,11 +60,23 @@ static uint32_t uca_pco_set_property(struct uca_t *uca, int32_t property, void *
{
switch (property) {
case UCA_PROP_WIDTH:
- Fg_setParameter(GET_FG(uca), FG_WIDTH, (uint32_t *) data, PORT_A);
+ if (Fg_setParameter(GET_FG(uca), FG_WIDTH, (uint32_t *) data, PORT_A) != FG_OK)
+ return UCA_ERR_PROP_VALUE_OUT_OF_RANGE;
break;
case UCA_PROP_HEIGHT:
- Fg_setParameter(GET_FG(uca), FG_HEIGHT, (uint32_t *) data, PORT_A);
+ if (Fg_setParameter(GET_FG(uca), FG_HEIGHT, (uint32_t *) data, PORT_A) != FG_OK)
+ return UCA_ERR_PROP_VALUE_OUT_OF_RANGE;
+ break;
+
+ case UCA_PROP_X_OFFSET:
+ if (Fg_setParameter(GET_FG(uca), FG_XOFFSET, (uint32_t *) data, PORT_A) != FG_OK)
+ return UCA_ERR_PROP_VALUE_OUT_OF_RANGE;
+ break;
+
+ case UCA_PROP_Y_OFFSET:
+ if (Fg_setParameter(GET_FG(uca), FG_YOFFSET, (uint32_t *) data, PORT_A) != FG_OK)
+ return UCA_ERR_PROP_VALUE_OUT_OF_RANGE;
break;
case UCA_PROP_EXPOSURE:
@@ -93,6 +105,26 @@ static uint32_t uca_pco_get_property(struct uca_t *uca, int32_t property, void *
}
break;
+ case UCA_PROP_WIDTH:
+ if (Fg_getParameter(GET_FG(uca), FG_WIDTH, (uint32_t *) data, PORT_A) != FG_OK)
+ return UCA_ERR_PROP_GENERAL;
+ break;
+
+ case UCA_PROP_HEIGHT:
+ if (Fg_getParameter(GET_FG(uca), FG_HEIGHT, (uint32_t *) data, PORT_A) != FG_OK)
+ return UCA_ERR_PROP_GENERAL;
+ break;
+
+ case UCA_PROP_X_OFFSET:
+ if (Fg_getParameter(GET_FG(uca), FG_XOFFSET, (uint32_t *) data, PORT_A) != FG_OK)
+ return UCA_ERR_PROP_GENERAL;
+ break;
+
+ case UCA_PROP_Y_OFFSET:
+ if (Fg_getParameter(GET_FG(uca), FG_YOFFSET, (uint32_t *) data, PORT_A) != FG_OK)
+ return UCA_ERR_PROP_GENERAL;
+ break;
+
case UCA_PROP_MAX_WIDTH:
{
uint32_t w, h;
@@ -113,6 +145,11 @@ static uint32_t uca_pco_get_property(struct uca_t *uca, int32_t property, void *
return UCA_NO_ERROR;
}
+uint32_t uca_pco_alloc(struct uca_t *uca, uint32_t n_buffers)
+{
+
+}
+
uint32_t uca_pco_init(struct uca_t *uca)
{
uca->user = (struct pco_cam_t *) malloc(sizeof(struct pco_cam_t));
@@ -133,6 +170,7 @@ uint32_t uca_pco_init(struct uca_t *uca)
uca->cam_destroy = &uca_pco_destroy;
uca->cam_set_property = &uca_pco_set_property;
uca->cam_get_property = &uca_pco_get_property;
+ uca->cam_alloc = &uca_pco_alloc;
uca->cam_acquire_image = &uca_pco_acquire_image;
/* Prepare camera for recording */
@@ -160,7 +198,6 @@ uint32_t uca_pco_init(struct uca_t *uca)
/* Yes, we really have to take an image twice as large because we set the
* CameraLink interface to 8-bit 10 Taps, but are actually using 5x16 bits. */
width *= 2;
- height *= 2;
Fg_setParameter(fg, FG_WIDTH, &width, PORT_A);
Fg_setParameter(fg, FG_HEIGHT, &height, PORT_A);
diff --git a/src/uca.c b/src/uca.c
index c0f1459..9f2064f 100644
--- a/src/uca.c
+++ b/src/uca.c
@@ -33,6 +33,8 @@ struct uca_t *uca_init()
/* Set all function pointers to NULL and thus make the class abstract */
uca->cam_set_property = NULL;
uca->cam_get_property = NULL;
+ uca->cam_alloc = NULL;
+ uca->cam_acquire_image = NULL;
int i = 0;
while (inits[i] != NULL) {
@@ -58,19 +60,28 @@ void uca_destroy(struct uca_t *uca)
static const char* property_map[] = {
"name",
"width",
+ "width.min",
+ "width.max",
"height",
- "x-offset",
- "y-offset",
- "max-width",
- "max-height",
+ "height.min",
+ "height.max",
+ "offset.x",
+ "offset.y",
"bit-depth",
"exposure",
+ "exposure.min",
+ "exposure.max",
"delay",
- "frame-rate",
+ "delay.min",
+ "delay.max",
"trigger-mode",
- "interlace-sample-rate",
- "interlace-pixel-threshold",
- "interlace-row-threshold",
+ "frame-rate",
+ "timestamp-mode",
+ "scan-mode",
+ "interlace.sample-rate",
+ "interlace.threshold.pixel",
+ "interlace.threshold.row",
+ "correction-mode",
NULL
};
diff --git a/src/uca.h b/src/uca.h
index 8614cb7..93dbbff 100644
--- a/src/uca.h
+++ b/src/uca.h
@@ -29,7 +29,8 @@ typedef uint32_t (*uca_cam_destroy) (struct uca_t *uca);
/**
* \brief Set a property
* \param[in] property_name Name of the property as defined in XXX
- * \return UCA_ERR_PROP_INVALID if property is not supported on the camera
+ * \return UCA_ERR_PROP_INVALID if property is not supported on the camera or
+ * UCA_ERR_PROP_VALUE_OUT_OF_RANGE if value cannot be set.
*/
typedef uint32_t (*uca_cam_set_property) (struct uca_t *uca, int32_t property, void *data);
@@ -40,6 +41,12 @@ typedef uint32_t (*uca_cam_set_property) (struct uca_t *uca, int32_t property, v
*/
typedef uint32_t (*uca_cam_get_property) (struct uca_t *uca, int32_t property, void *data);
+/** \brief Allocate number of buffers
+ *
+ * The size of each buffer is width x height x bits
+ */
+typedef uint32_t (*uca_cam_alloc) (struct uca_t *uca, uint32_t n_buffers);
+
/**
* \brief Acquire one frame
*/
@@ -71,6 +78,7 @@ const char* uca_get_property_name(int32_t property_id);
#define UCA_ERR_INIT_NOT_FOUND 1 /**< camera probing or initialization failed */
#define UCA_ERR_PROP_INVALID 2 /**< the requested property is not supported by the camera */
#define UCA_ERR_PROP_GENERAL 3 /**< error occured reading/writing the property */
+#define UCA_ERR_PROP_VALUE_OUT_OF_RANGE 4 /**< error occured writing the property */
/* The property IDs must start with 0 and must be continuous. Whenever this
@@ -78,27 +86,36 @@ const char* uca_get_property_name(int32_t property_id);
#define UCA_PROP_INVALID -1
#define UCA_PROP_NAME 0
#define UCA_PROP_WIDTH 1
-#define UCA_PROP_HEIGHT 2
+#define UCA_PROP_WIDTH_MIN 2
+#define UCA_PROP_WIDTH_MAX 3
+#define UCA_PROP_HEIGHT 4
+#define UCA_PROP_HEIGHT_MIN 5
+#define UCA_PROP_HEIGHT_MAX 6
#define UCA_PROP_X_OFFSET 3
#define UCA_PROP_Y_OFFSET 4
#define UCA_PROP_MAX_WIDTH 5
#define UCA_PROP_MAX_HEIGHT 6
#define UCA_PROP_BITDEPTH 7
#define UCA_PROP_EXPOSURE 8
-#define UCA_PROP_DELAY 9
-#define UCA_PROP_FRAMERATE 10
-#define UCA_PROP_TRIGGER_MODE 11
+#define UCA_PROP_EXPOSURE_MIN 9
+#define UCA_PROP_EXPOSURE_MAX 10
+#define UCA_PROP_DELAY 11
+#define UCA_PROP_DELAY_MIN 12
+#define UCA_PROP_DELAY_MAX 13
+#define UCA_PROP_FRAMERATE 14
+#define UCA_PROP_TRIGGER_MODE 15
/* pco.edge specific */
-#define UCA_PROP_TIMESTAMP_MODE 12
+#define UCA_PROP_TIMESTAMP_MODE 16
+#define UCA_PROP_SCAN_MODE 17
/* IPE camera specific */
-#define UCA_PROP_INTERLACE_SAMPLE_RATE 13
-#define UCA_PROP_INTERLACE_PIXEL_THRESH 14
-#define UCA_PROP_INTERLACE_ROW_THRESH 15
+#define UCA_PROP_INTERLACE_SAMPLE_RATE 18
+#define UCA_PROP_INTERLACE_PIXEL_THRESH 19
+#define UCA_PROP_INTERLACE_ROW_THRESH 20
/* Photon Focus specific */
-#define UCA_PROP_CORRECTION_MODE 16
+#define UCA_PROP_CORRECTION_MODE 21
/* Possible timestamp modes for UCA_PROP_TIMESTAMP_MODE */
#define UCA_TIMESTAMP_ASCII 0x01