summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/FindIPE.cmake2
-rw-r--r--src/cameras/ipe.c32
-rw-r--r--src/uca.c4
3 files changed, 30 insertions, 8 deletions
diff --git a/cmake/FindIPE.cmake b/cmake/FindIPE.cmake
index 3667235..11e8d90 100644
--- a/cmake/FindIPE.cmake
+++ b/cmake/FindIPE.cmake
@@ -9,7 +9,7 @@
find_package(PackageHandleStandardArgs)
find_path(IPE_INCLUDE_DIRS pcilib.h)
-find_library(IPE_LIBRARIES pcidriver)
+find_library(IPE_LIBRARIES pcilib)
find_package_handle_standard_args(IPE DEFAULT_MSG IPE_LIBRARIES IPE_INCLUDE_DIRS)
diff --git a/src/cameras/ipe.c b/src/cameras/ipe.c
index 30c7b16..94cd4ed 100644
--- a/src/cameras/ipe.c
+++ b/src/cameras/ipe.c
@@ -7,10 +7,11 @@
#include "uca-grabber.h"
#define set_void(p, type, value) { *((type *) p) = value; }
+#define GET_HANDLE(cam) ((pcilib_t *) cam->user)
-static uint32_t uca_ipe_acquire_image(struct uca_camera_t *cam, void *buffer)
+static void uca_ipe_handle_error(const char *format, ...)
{
- return UCA_NO_ERROR;
+ /* Do nothing, we just check errno. */
}
static uint32_t uca_ipe_set_property(struct uca_camera_t *cam, enum uca_property_ids property, void *data)
@@ -20,31 +21,51 @@ static uint32_t uca_ipe_set_property(struct uca_camera_t *cam, enum uca_property
static uint32_t uca_ipe_get_property(struct uca_camera_t *cam, enum uca_property_ids property, void *data)
{
+ switch (property) {
+ case UCA_PROP_NAME:
+ strcpy((char *) data, "IPE PCIe");
+ break;
+
+ default:
+ return UCA_ERR_PROP_INVALID;
+ }
return UCA_NO_ERROR;
}
-uint32_t uca_ipe_start_recording(struct uca_camera_t *cam)
+static uint32_t uca_ipe_start_recording(struct uca_camera_t *cam)
{
return UCA_NO_ERROR;
}
-uint32_t uca_ipe_stop_recording(struct uca_camera_t *cam)
+static uint32_t uca_ipe_stop_recording(struct uca_camera_t *cam)
{
return UCA_NO_ERROR;
}
-uint32_t uca_ipe_grab(struct uca_camera_t *cam, char *buffer)
+static uint32_t uca_ipe_grab(struct uca_camera_t *cam, char *buffer)
{
return UCA_NO_ERROR;
}
static uint32_t uca_ipe_destroy(struct uca_camera_t *cam)
{
+ pcilib_close(GET_HANDLE(cam));
return UCA_NO_ERROR;
}
uint32_t uca_ipe_init(struct uca_camera_t **cam, struct uca_grabber_t *grabber)
{
+ pcilib_model_t model = PCILIB_MODEL_DETECT;
+ pcilib_bar_t bar = PCILIB_BAR_DETECT;
+ pcilib_t *handle = pcilib_open("/dev/fpga0", model);
+ if (handle < 0)
+ return UCA_ERR_CAM_NOT_FOUND;
+
+ pcilib_set_error_handler(&uca_ipe_handle_error);
+ model = pcilib_get_model(handle);
+
+ struct uca_camera_t *uca = (struct uca_camera_t *) malloc(sizeof(struct uca_camera_t));
+
/* Camera found, set function pointers... */
uca->destroy = &uca_ipe_destroy;
uca->set_property = &uca_ipe_set_property;
@@ -54,6 +75,7 @@ uint32_t uca_ipe_init(struct uca_camera_t **cam, struct uca_grabber_t *grabber)
uca->grab = &uca_ipe_grab;
uca->state = UCA_CAM_CONFIGURABLE;
+ uca->user = handle;
*cam = uca;
return UCA_NO_ERROR;
diff --git a/src/uca.c b/src/uca.c
index 4e1af56..fc36f2e 100644
--- a/src/uca.c
+++ b/src/uca.c
@@ -19,7 +19,7 @@
#include "cameras/pf.h"
#endif
-#ifdef HAVE_IPE_CAM
+#ifdef HAVE_IPE_CAMERA
#include "cameras/ipe.h"
#endif
@@ -94,7 +94,7 @@ struct uca_t *uca_init(void)
#ifdef HAVE_PHOTON_FOCUS
uca_pf_init,
#endif
-#ifdef HAVE_IPE_CAM
+#ifdef HAVE_IPE_CAMERA
uca_ipe_init,
#endif
#ifdef HAVE_PH