From c392c9920f9baadc9267e726b46b9c64c82915c7 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Fri, 21 Aug 2015 04:20:46 +0200 Subject: Fix some warnings and add debugging information into the build --- CMakeLists.txt | 2 ++ cmosis.c | 1 - ipecamera.h | 8 ++++++++ model.c | 1 + private.h | 1 + reader.c | 9 +++++---- 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 788d9f6..7e38bd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ set(IPECAMERA_ABI_VERSION "0") cmake_minimum_required(VERSION 2.6) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") +add_definitions("-fPIC --std=gnu99 -Wall -O2 -gdwarf-2 -g3 -fno-omit-frame-pointer") + find_package(PkgConfig REQUIRED) find_package(Threads REQUIRED) pkg_check_modules(UFODECODE ufodecode>=0.3 REQUIRED) diff --git a/cmosis.c b/cmosis.c index b40e175..49bc1d5 100644 --- a/cmosis.c +++ b/cmosis.c @@ -46,7 +46,6 @@ void ipecamera_cmosis_close(pcilib_t *ctx, pcilib_register_bank_context_t *reg_b } pcilib_register_bank_context_t* ipecamera_cmosis_open(pcilib_t *ctx, pcilib_register_bank_t bank, const char* model, const void *args) { - int err; ipecamera_cmosis_context_t *bank_ctx; bank_ctx = calloc(1, sizeof(ipecamera_cmosis_context_t)); diff --git a/ipecamera.h b/ipecamera.h index 42994ba..d5e52d2 100644 --- a/ipecamera.h +++ b/ipecamera.h @@ -33,7 +33,15 @@ typedef struct { size_t raw_size; /**< Indicates the actual size of raw data */ } ipecamera_event_info_t; +#ifdef __cplusplus +extern "C" { +#endif + int ipecamera_set_buffer_size(ipecamera_t *ctx, int size); +#ifdef __cplusplus +} +#endif + #endif /* _IPECAMERA_H */ diff --git a/model.c b/model.c index 82cbe74..5b56522 100644 --- a/model.c +++ b/model.c @@ -1,4 +1,5 @@ #include +#include #include #include diff --git a/private.h b/private.h index 38d6dd0..2043d7a 100644 --- a/private.h +++ b/private.h @@ -5,6 +5,7 @@ #include #include #include +#include "base.h" #include "ipecamera.h" #include "env.h" diff --git a/reader.c b/reader.c index 3e2b444..ede5b62 100644 --- a/reader.c +++ b/reader.c @@ -38,8 +38,10 @@ } \ } -//#define CHECK_FRAME_MAGIC(buf) \ -// memcmp(buf, ((void*)frame_magic) + 1, sizeof(frame_magic) - 1) +/* +#define CHECK_FRAME_MAGIC(buf) \ + memcmp(buf, ((void*)frame_magic) + 1, sizeof(frame_magic) - 1) +*/ #define CHECK_FRAME_MAGIC(buf) \ memcmp(((ipecamera_payload_t*)(buf)) + 1, &frame_magic[1], sizeof(frame_magic) - sizeof(ipecamera_payload_t)) @@ -341,14 +343,13 @@ void *ipecamera_reader_thread(void *user) { } #ifdef IPECAMERA_BUG_STUCKED_BUSY GET_REG(status2_reg, value); - if (value&0x2FFFFFFF) { + if ((!err)&&(value&0x2FFFFFFF)) { pcilib_warning("Camera stuck in busy, trying to recover..."); GET_REG(control_reg, saved); SET_REG(control_reg, IPECAMERA_IDLE); while ((value&0x2FFFFFFF)&&(ctx->run_reader)) { usleep(IPECAMERA_NOFRAME_SLEEP); } - return 0; } #endif /* IPECAMERA_BUG_STUCKED_BUSY */ usleep(IPECAMERA_NOFRAME_SLEEP); -- cgit v1.2.3