summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cameras/dummy.c27
-rw-r--r--src/cameras/pco.c39
-rw-r--r--src/cameras/pf.c20
-rw-r--r--src/grabbers/me4.c16
-rw-r--r--src/uca-grabber.h2
-rw-r--r--src/uca.h3
6 files changed, 52 insertions, 55 deletions
diff --git a/src/cameras/dummy.c b/src/cameras/dummy.c
index 5bb609a..58aa591 100644
--- a/src/cameras/dummy.c
+++ b/src/cameras/dummy.c
@@ -29,7 +29,7 @@ typedef struct dummy_cam {
} dummy_cam_t;
-static const char digits[10][20] = {
+static const char g_digits[10][20] = {
/* 0 */
{ 0x00, 0xff, 0xff, 0x00,
0xff, 0x00, 0x00, 0xff,
@@ -96,13 +96,12 @@ const int DIGIT_WIDTH = 4;
const int DIGIT_HEIGHT = 5;
#define GET_DUMMY(uca) ((struct dummy_cam *)(uca->user))
-#define set_void(p, type, value) { *((type *) p) = value; }
static void uca_dummy_print_number(char *buffer, int number, int x, int y, int width)
{
for (int i = 0; i < DIGIT_WIDTH; i++) {
for (int j = 0; j < DIGIT_HEIGHT; j++) {
- buffer[(y+j)*width + (x+i)] = digits[number][j*DIGIT_WIDTH+i];
+ buffer[(y+j)*width + (x+i)] = g_digits[number][j*DIGIT_WIDTH+i];
}
}
}
@@ -191,31 +190,31 @@ static uint32_t uca_dummy_get_property(struct uca_camera *cam, enum uca_property
break;
case UCA_PROP_WIDTH:
- set_void(data, uint32_t, cam->frame_width);
+ uca_set_void(data, uint32_t, cam->frame_width);
break;
case UCA_PROP_WIDTH_MIN:
- set_void(data, uint32_t, 1);
+ uca_set_void(data, uint32_t, 1);
break;
case UCA_PROP_WIDTH_MAX:
- set_void(data, uint32_t, 4096);
+ uca_set_void(data, uint32_t, 4096);
break;
case UCA_PROP_HEIGHT:
- set_void(data, uint32_t, cam->frame_height);
+ uca_set_void(data, uint32_t, cam->frame_height);
break;
case UCA_PROP_HEIGHT_MIN:
- set_void(data, uint32_t, 1);
+ uca_set_void(data, uint32_t, 1);
break;
case UCA_PROP_HEIGHT_MAX:
- set_void(data, uint32_t, 4096);
+ uca_set_void(data, uint32_t, 4096);
break;
case UCA_PROP_BITDEPTH:
- set_void(data, uint32_t, 8);
+ uca_set_void(data, uint32_t, 8);
break;
default:
@@ -224,7 +223,7 @@ static uint32_t uca_dummy_get_property(struct uca_camera *cam, enum uca_property
return UCA_NO_ERROR;
}
-uint32_t uca_dummy_start_recording(struct uca_camera *cam)
+static uint32_t uca_dummy_start_recording(struct uca_camera *cam)
{
if (cam->callback != NULL) {
#ifdef HAVE_PTHREADS
@@ -240,7 +239,7 @@ uint32_t uca_dummy_start_recording(struct uca_camera *cam)
return UCA_NO_ERROR;
}
-uint32_t uca_dummy_stop_recording(struct uca_camera *cam)
+static uint32_t uca_dummy_stop_recording(struct uca_camera *cam)
{
struct dummy_cam *dc = GET_DUMMY(cam);
if (cam->callback != NULL) {
@@ -252,7 +251,7 @@ uint32_t uca_dummy_stop_recording(struct uca_camera *cam)
return UCA_NO_ERROR;
}
-uint32_t uca_dummy_register_callback(struct uca_camera *cam, uca_cam_grab_callback cb, void *user)
+static uint32_t uca_dummy_register_callback(struct uca_camera *cam, uca_cam_grab_callback cb, void *user)
{
if (cam->callback == NULL) {
cam->callback = cb;
@@ -264,7 +263,7 @@ uint32_t uca_dummy_register_callback(struct uca_camera *cam, uca_cam_grab_callba
return UCA_NO_ERROR;
}
-uint32_t uca_dummy_grab(struct uca_camera *cam, char *buffer, void *meta_data)
+static uint32_t uca_dummy_grab(struct uca_camera *cam, char *buffer, void *meta_data)
{
if (cam->callback != NULL)
return UCA_ERR_CAMERA | UCA_ERR_CALLBACK | UCA_ERR_ALREADY_REGISTERED;
diff --git a/src/cameras/pco.c b/src/cameras/pco.c
index 15fec3c..29fb70e 100644
--- a/src/cameras/pco.c
+++ b/src/cameras/pco.c
@@ -15,7 +15,7 @@ typedef struct pco_desc {
#define GET_PCO_DESC(cam) ((struct pco_desc *) cam->user)
#define GET_PCO(cam) (((struct pco_desc *)(cam->user))->pco)
-#define set_void(p, type, value) { *((type *) p) = (type) value; }
+#define uca_set_void(p, type, value) { *((type *) p) = (type) value; }
static uint32_t uca_pco_set_exposure(struct uca_camera *cam, uint32_t *exposure)
@@ -120,7 +120,7 @@ static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_i
{
SC2_Temperature_Response temperature;
if (pco_read_property(pco, GET_TEMPERATURE, &temperature, sizeof(temperature)) == PCO_NOERROR)
- set_void(data, uint32_t, temperature.sCCDtemp / 10);
+ uca_set_void(data, uint32_t, temperature.sCCDtemp / 10);
}
break;
@@ -128,32 +128,32 @@ static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_i
{
SC2_Temperature_Response temperature;
if (pco_read_property(pco, GET_TEMPERATURE, &temperature, sizeof(temperature)) == PCO_NOERROR)
- set_void(data, uint32_t, temperature.sCamtemp);
+ uca_set_void(data, uint32_t, temperature.sCamtemp);
}
break;
case UCA_PROP_WIDTH:
- set_void(data, uint32_t, cam->frame_width);
+ uca_set_void(data, uint32_t, cam->frame_width);
break;
case UCA_PROP_WIDTH_MIN:
- set_void(data, uint32_t, 1);
+ uca_set_void(data, uint32_t, 1);
break;
case UCA_PROP_WIDTH_MAX:
- set_void(data, uint32_t, pco->description.wMaxHorzResStdDESC);
+ uca_set_void(data, uint32_t, pco->description.wMaxHorzResStdDESC);
break;
case UCA_PROP_HEIGHT:
- set_void(data, uint32_t, cam->frame_height);
+ uca_set_void(data, uint32_t, cam->frame_height);
break;
case UCA_PROP_HEIGHT_MIN:
- set_void(data, uint32_t, 1);
+ uca_set_void(data, uint32_t, 1);
break;
case UCA_PROP_HEIGHT_MAX:
- set_void(data, uint32_t, pco->description.wMaxVertResStdDESC);
+ uca_set_void(data, uint32_t, pco->description.wMaxVertResStdDESC);
break;
case UCA_PROP_X_OFFSET:
@@ -170,11 +170,11 @@ static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_i
break;
case UCA_PROP_DELAY_MIN:
- set_void(data, uint32_t, pco->description.dwMinDelayDESC);
+ uca_set_void(data, uint32_t, pco->description.dwMinDelayDESC);
break;
case UCA_PROP_DELAY_MAX:
- set_void(data, uint32_t, pco->description.dwMaxDelayDESC);
+ uca_set_void(data, uint32_t, pco->description.dwMaxDelayDESC);
break;
case UCA_PROP_EXPOSURE:
@@ -185,15 +185,15 @@ static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_i
break;
case UCA_PROP_EXPOSURE_MIN:
- set_void(data, uint32_t, pco->description.dwMinExposureDESC);
+ uca_set_void(data, uint32_t, pco->description.dwMinExposureDESC);
break;
case UCA_PROP_EXPOSURE_MAX:
- set_void(data, uint32_t, pco->description.dwMaxExposureDESC);
+ uca_set_void(data, uint32_t, pco->description.dwMaxExposureDESC);
break;
case UCA_PROP_BITDEPTH:
- set_void(data, uint32_t, 16);
+ uca_set_void(data, uint32_t, 16);
break;
case UCA_PROP_GRAB_TIMEOUT:
@@ -202,7 +202,7 @@ static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_i
uint32_t err = cam->grabber->get_property(cam->grabber, UCA_PROP_GRAB_TIMEOUT, &timeout);
if (err != UCA_NO_ERROR)
return err;
- set_void(data, uint32_t, timeout);
+ uca_set_void(data, uint32_t, timeout);
}
break;
@@ -212,7 +212,7 @@ static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_i
return UCA_NO_ERROR;
}
-uint32_t uca_pco_start_recording(struct uca_camera *cam)
+static uint32_t uca_pco_start_recording(struct uca_camera *cam)
{
uint32_t err = UCA_ERR_CAMERA | UCA_ERR_INIT;
struct pco_edge *pco = GET_PCO(cam);
@@ -223,14 +223,14 @@ uint32_t uca_pco_start_recording(struct uca_camera *cam)
return cam->grabber->acquire(cam->grabber, -1);
}
-uint32_t uca_pco_stop_recording(struct uca_camera *cam)
+static uint32_t uca_pco_stop_recording(struct uca_camera *cam)
{
if (pco_set_rec_state(GET_PCO(cam), 0) != PCO_NOERROR)
return UCA_ERR_CAMERA | UCA_ERR_INIT | UCA_ERR_UNCLASSIFIED;
return UCA_NO_ERROR;
}
-uint32_t uca_pco_grab(struct uca_camera *cam, char *buffer, void *meta_data)
+static uint32_t uca_pco_grab(struct uca_camera *cam, char *buffer, void *meta_data)
{
uint16_t *frame;
uint32_t err = cam->grabber->grab(cam->grabber, (void **) &frame, &cam->current_frame);
@@ -241,7 +241,7 @@ uint32_t uca_pco_grab(struct uca_camera *cam, char *buffer, void *meta_data)
return UCA_NO_ERROR;
}
-uint32_t uca_pco_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user)
+static uint32_t uca_pco_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user)
{
if (cam->callback == NULL) {
cam->callback = callback;
@@ -277,6 +277,7 @@ uint32_t uca_pco_init(struct uca_camera **cam, struct uca_grabber *grabber)
uca->start_recording = &uca_pco_start_recording;
uca->stop_recording = &uca_pco_stop_recording;
uca->grab = &uca_pco_grab;
+ uca->register_callback = &uca_pco_register_callback;
/* Prepare camera for recording */
pco_set_scan_mode(pco, PCO_SCANMODE_SLOW);
diff --git a/src/cameras/pf.c b/src/cameras/pf.c
index 86fe5e6..b787f5c 100644
--- a/src/cameras/pf.c
+++ b/src/cameras/pf.c
@@ -7,8 +7,6 @@
#include "uca-cam.h"
#include "uca-grabber.h"
-#define set_void(p, type, value) { *((type *) p) = value; }
-
struct uca_pf_map {
enum uca_property_ids uca_prop;
const char *pf_prop;
@@ -115,7 +113,7 @@ static uint32_t uca_pf_get_property(struct uca_camera *cam, enum uca_property_id
/* Handle all special cases */
switch (property) {
case UCA_PROP_BITDEPTH:
- set_void(data, uint32_t, 8);
+ uca_set_void(data, uint32_t, 8);
return UCA_NO_ERROR;
default:
@@ -131,16 +129,16 @@ static uint32_t uca_pf_get_property(struct uca_camera *cam, enum uca_property_id
switch (value.type) {
case PF_INT:
- set_void(data, uint32_t, value.value.i);
+ uca_set_void(data, uint32_t, value.value.i);
break;
case PF_FLOAT:
- set_void(data, uint32_t, (uint32_t) floor((value.value.f * 1000.0)+0.5));
+ uca_set_void(data, uint32_t, (uint32_t) floor((value.value.f * 1000.0)+0.5));
break;
case PF_STRING:
if (property == UCA_PROP_FRAMERATE) {
- set_void(data, uint32_t, (uint32_t) floor(atof(value.value.p)+0.5));
+ uca_set_void(data, uint32_t, (uint32_t) floor(atof(value.value.p)+0.5));
}
else {
strncpy((char *) data, value.value.p, num);
@@ -148,7 +146,7 @@ static uint32_t uca_pf_get_property(struct uca_camera *cam, enum uca_property_id
break;
case PF_MODE:
- set_void(data, uint32_t, (uint32_t) value.value.i);
+ uca_set_void(data, uint32_t, (uint32_t) value.value.i);
break;
default:
@@ -163,17 +161,17 @@ static uint32_t uca_pf_get_property(struct uca_camera *cam, enum uca_property_id
return cam->grabber->get_property(cam->grabber, property, data);
}
-uint32_t uca_pf_start_recording(struct uca_camera *cam)
+static uint32_t uca_pf_start_recording(struct uca_camera *cam)
{
return cam->grabber->acquire(cam->grabber, -1);
}
-uint32_t uca_pf_stop_recording(struct uca_camera *cam)
+static uint32_t uca_pf_stop_recording(struct uca_camera *cam)
{
return cam->grabber->stop_acquire(cam->grabber);
}
-uint32_t uca_pf_grab(struct uca_camera *cam, char *buffer, void *metadata)
+static uint32_t uca_pf_grab(struct uca_camera *cam, char *buffer, void *metadata)
{
uint16_t *frame;
uint32_t err = cam->grabber->grab(cam->grabber, (void **) &frame, &cam->current_frame);
@@ -184,7 +182,7 @@ uint32_t uca_pf_grab(struct uca_camera *cam, char *buffer, void *metadata)
return UCA_NO_ERROR;
}
-uint32_t uca_pf_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user)
+static uint32_t uca_pf_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user)
{
if (cam->callback == NULL) {
cam->callback = callback;
diff --git a/src/grabbers/me4.c b/src/grabbers/me4.c
index 6d20a71..1c63f1a 100644
--- a/src/grabbers/me4.c
+++ b/src/grabbers/me4.c
@@ -50,7 +50,7 @@ static struct uca_sisofg_map_t uca_to_fg[] = {
#define GET_FG(grabber) (((struct fg_apc_data *) grabber->user)->fg)
#define GET_MEM(grabber) (((struct fg_apc_data *) grabber->user)->mem)
-uint32_t uca_me4_destroy(struct uca_grabber *grabber)
+static uint32_t uca_me4_destroy(struct uca_grabber *grabber)
{
if (grabber != NULL) {
Fg_FreeMemEx(GET_FG(grabber), GET_MEM(grabber));
@@ -83,7 +83,7 @@ static struct uca_sisofg_map_t *uca_me4_find_uca_property(int fg_id)
return NULL;
}
-uint32_t uca_me4_set_property(struct uca_grabber *grabber, int32_t property, void *data)
+static uint32_t uca_me4_set_property(struct uca_grabber *grabber, int32_t property, void *data)
{
/* Handle all properties not related specifically to the me4 */
union uca_value *v = (union uca_value *) data;
@@ -121,7 +121,7 @@ uint32_t uca_me4_set_property(struct uca_grabber *grabber, int32_t property, voi
UCA_NO_ERROR : err | UCA_ERR_INVALID;
}
-uint32_t uca_me4_get_property(struct uca_grabber *grabber, int32_t property, void *data)
+static uint32_t uca_me4_get_property(struct uca_grabber *grabber, int32_t property, void *data)
{
switch (property) {
case UCA_PROP_GRAB_SYNCHRONOUS:
@@ -155,7 +155,7 @@ uint32_t uca_me4_get_property(struct uca_grabber *grabber, int32_t property, voi
UCA_NO_ERROR : err | UCA_ERR_INVALID;
}
-uint32_t uca_me4_alloc(struct uca_grabber *grabber, uint32_t pixel_size, uint32_t n_buffers)
+static uint32_t uca_me4_alloc(struct uca_grabber *grabber, uint32_t pixel_size, uint32_t n_buffers)
{
dma_mem *mem = GET_MEM(grabber);
/* If buffers are already allocated, we are freeing every buffer and start
@@ -175,7 +175,7 @@ uint32_t uca_me4_alloc(struct uca_grabber *grabber, uint32_t pixel_size, uint32_
return UCA_ERR_GRABBER | UCA_ERR_NO_MEMORY;
}
-uint32_t uca_me4_acquire(struct uca_grabber *grabber, int32_t n_frames)
+static uint32_t uca_me4_acquire(struct uca_grabber *grabber, int32_t n_frames)
{
if (GET_MEM(grabber) == NULL)
return UCA_ERR_GRABBER | UCA_ERR_NO_MEMORY;
@@ -187,7 +187,7 @@ uint32_t uca_me4_acquire(struct uca_grabber *grabber, int32_t n_frames)
return UCA_ERR_GRABBER | UCA_ERR_ACQUIRE;
}
-uint32_t uca_me4_stop_acquire(struct uca_grabber *grabber)
+static uint32_t uca_me4_stop_acquire(struct uca_grabber *grabber)
{
if (GET_MEM(grabber) != NULL)
if (Fg_stopAcquireEx(GET_FG(grabber), 0, GET_MEM(grabber), STOP_SYNC) != FG_OK)
@@ -195,7 +195,7 @@ uint32_t uca_me4_stop_acquire(struct uca_grabber *grabber)
return UCA_NO_ERROR;
}
-uint32_t uca_me4_grab(struct uca_grabber *grabber, void **buffer, uint64_t *frame_number)
+static 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;
@@ -219,7 +219,7 @@ static int uca_me4_callback(frameindex_t frame, struct fg_apc_data *apc)
return 0;
}
-uint32_t uca_me4_register_callback(struct uca_grabber *grabber, uca_cam_grab_callback callback, void *meta_data, void *user)
+static uint32_t uca_me4_register_callback(struct uca_grabber *grabber, uca_cam_grab_callback callback, void *meta_data, void *user)
{
if (GET_MEM(grabber) == NULL)
return UCA_ERR_GRABBER | UCA_ERR_CALLBACK | UCA_ERR_NO_MEMORY;
diff --git a/src/uca-grabber.h b/src/uca-grabber.h
index f754a81..885e0b6 100644
--- a/src/uca-grabber.h
+++ b/src/uca-grabber.h
@@ -131,7 +131,7 @@ typedef struct uca_grabber {
/* Private */
uca_cam_grab_callback callback;
- bool synchronous;
+ bool synchronous; /**< if true uca_grabber_grab() blocks until image is transferred */
void *user;
} uca_grabber_t;
diff --git a/src/uca.h b/src/uca.h
index ac28183..4a2919c 100644
--- a/src/uca.h
+++ b/src/uca.h
@@ -302,8 +302,7 @@ const char* uca_get_property_name(enum uca_property_ids property_id);
*/
uca_property_t *uca_get_full_property(enum uca_property_ids property_id);
-
-
+#define uca_set_void(p, type, value) { *((type *) p) = (type) value; }
#ifdef __cplusplus
}