/alps/ipecamera

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/ipecamera
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
1
#ifndef _IPECAMERA_PRIVATE_H
2
#define _IPECAMERA_PRIVATE_H
3
245 by Suren A. Chilingaryan
First stand-alone ipecamera implementation
4
#include <pthread.h>
5
#include <pcilib/model.h>
251 by Suren A. Chilingaryan
Use pcitool debugging API
6
#include <pcilib/debug.h>
265 by Suren A. Chilingaryan
Use new locking subsystem to ensure integrity
7
#include <pcilib/locking.h>
275 by Suren A. Chilingaryan
Fix some warnings and add debugging information into the build
8
#include "base.h"
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
9
#include "ipecamera.h"
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
10
#include "env.h"
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
11
251 by Suren A. Chilingaryan
Use pcitool debugging API
12
#define IPECAMERA_DEBUG
13
#ifdef IPECAMERA_DEBUG
254 by Suren A. Chilingaryan
Report extra padding only if IPECAMERA_DEBUG_HARDWARE is set
14
//# define IPECAMERA_DEBUG_RAW_FRAMES		//**< Store all raw frames */
15
# define IPECAMERA_DEBUG_BROKEN_FRAMES		//**< Store broken frames in the specified directory */
16
# define IPECAMERA_DEBUG_RAW_PACKETS		//**< Store all raw packets read from DMA grouped in frames */
17
# define IPECAMERA_DEBUG_HARDWARE		//**< Produce various debugging information about ipecamera operation */
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
18
# define IPECAMERA_DEBUG_FRAME_HEADERS		//**< Print frame headers & footers */
262 by Suren A. Chilingaryan
Introduce API debugging
19
# define IPECAMERA_DEBUG_API			//**< Debug IPECamera API calls */
251 by Suren A. Chilingaryan
Use pcitool debugging API
20
#endif /* IPECAMERA_DEBUG */
21
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
22
#define IPECAMERA_BUG_MISSING_PAYLOAD		//**< CMOSIS fails to provide a first payload for each frame, therefore the frame is 32 bit shorter */
252 by Suren A. Chilingaryan
Cleanup
23
#define IPECAMERA_BUG_MULTIFRAME_PACKETS	//**< This is by design, start of packet comes directly after the end of last one in streaming mode */
267 by Suren A. Chilingaryan
Handle frame headers split between 2 packets
24
#define IPECAMERA_BUG_MULTIFRAME_HEADERS	//**< UFO Camera operates with 32-byte entities, but some times there is 16-byte padding before the data which may result in spliting the header between 2 DMA packets. We still need to define a minimal number of bytes which are always in the same DMA packet (CMOSIS_ENTITY_SIZE) */
263 by Suren A. Chilingaryan
Add handling of a bug when IPECamera producing a dublicate 16 bytes at 4096 offset
25
#define IPECAMERA_BUG_REPEATING_DATA		//**< 16 bytes repeated at frame offset 4096, the problem start/stop happenning on board restart */
274 by Suren A. Chilingaryan
Add another workaround to handle cameras stuck in busy (disabled and untested)
26
//#define IPECAMERA_BUG_STUCKED_BUSY		//**< DMA may stuck in busy. According to Michele, the work-around is to disable triggering and read all data out. Not checked */
252 by Suren A. Chilingaryan
Cleanup
27
//#define IPECAMERA_BUG_INCOMPLETE_PACKETS	//**< Support incomplete packets, i.e. check for frame magic even if full frame size is not reached yet (slow) */
28
//#define IPECAMERA_ANNOUNCE_READY		//**< Announce new event only after the reconstruction is done */
29
//#define IPECAMERA_CLEAN_ON_START		//**< Read all the data from DMA before starting of recording */
272 by Suren A. Chilingaryan
Adjust buffer sizes to reduce memory consumption with CMOSIS20 camera
30
//#define IPECAMERA_ADJUST_BUFFER_SIZE		//**< Adjust default buffer size based on the hardware capabilities (number of frames stored in the FPGA memory) */
245 by Suren A. Chilingaryan
First stand-alone ipecamera implementation
31
272 by Suren A. Chilingaryan
Adjust buffer sizes to reduce memory consumption with CMOSIS20 camera
32
#define IPECAMERA_DEFAULT_BUFFER_SIZE 256  	//**< number of buffers in a ring buffer, should be power of 2 */
33
#define IPECAMERA_DEFAULT_CMOSIS20_BUFFER_SIZE 64 //*< overrides number of buffers for CMOSIS20 sensor to reduce memory consumption */
34
#define IPECAMERA_RESERVE_BUFFERS 4		//**< Return Frame is Lost error, if requested frame will be overwritten after specified number of frames
252 by Suren A. Chilingaryan
Cleanup
35
36
#define IPECAMERA_DMA_TIMEOUT 50000		//**< Default DMA timeout */
37
#define IPECAMERA_TRIGGER_TIMEOUT 200000	//**< In trigger call allow specified timeout for camera to get out of busy state. Set 0 to fail immideatly */
38
#define IPECAMERA_CMOSIS_RESET_DELAY 250000 	//**< Michele thinks 250 should be enough, but reset failing in this case */
39
#define IPECAMERA_CMOSIS_REGISTER_DELAY 250000 	//**< Michele thinks 250 should be enough, but reset failing in this case */
40
#define IPECAMERA_SPI_REGISTER_DELAY 10000	//**< Delay between consequitive access to the registers */
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
41
#define IPECAMERA_NEXT_FRAME_DELAY 1000 	//**< Michele requires 30000 to sync between End Of Readout and next Frame Req */
252 by Suren A. Chilingaryan
Cleanup
42
#define IPECAMERA_TRIGGER_DELAY 0 		//**< Defines how long the trigger bits should be set */
240 by Suren A. Chilingaryan
Fix frame size computation in ipecamera and few debuging options
43
#define IPECAMERA_READ_STATUS_DELAY 1000	//**< According to Uros, 1ms delay needed before consequitive reads from status registers */
252 by Suren A. Chilingaryan
Cleanup
44
#define IPECAMERA_NOFRAME_SLEEP 100		//**< Sleep while polling for a new frame in reader */
45
#define IPECAMERA_NOFRAME_PREPROC_SLEEP 100	//**< Sleep while polling for a new frame in pre-processor */
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
46
175 by Suren A. Chilingaryan
Support both UFO4 and UFO5 frame formats
47
#define IPECAMERA_EXPECTED_STATUS_4 0x08409FFFF
171 by Suren A. Chilingaryan
Fix temperature register of ipecamera and prepend all cmosis registers with _cmosis prefix
48
#define IPECAMERA_EXPECTED_STATUS 0x08449FFFF
175 by Suren A. Chilingaryan
Support both UFO4 and UFO5 frame formats
49
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
50
#define IPECAMERA_END_OF_SEQUENCE 0x1F001001
51
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
52
267 by Suren A. Chilingaryan
Handle frame headers split between 2 packets
53
#define CMOSIS_FRAME_HEADER_SIZE	(8 * sizeof(ipecamera_payload_t))
54
#define CMOSIS_FRAME_TAIL_SIZE		(8 * sizeof(ipecamera_payload_t))
55
#ifdef IPECAMERA_BUG_MULTIFRAME_HEADERS
56
# define CMOSIS_ENTITY_SIZE		(4 * sizeof(ipecamera_payload_t))		//**< This normaly should be equal to 32 bytes like header and tail, but in fact is only 16 bytes */
57
#else /* IPECAMERA_BUG_MULTIFRAME_HEADERS */
58
# define CMOSIS_ENTITY_SIZE		(8 * sizeof(ipecamera_payload_t))		//**< This normaly should be equal to 32 bytes like header and tail, but in fact is only 16 bytes */
59
#endif /* IPECAMERA_BUG_MULTIFRAME_HEADERS */
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
60
61
#define CMOSIS_MAX_CHANNELS 16
62
#define CMOSIS_PIXELS_PER_CHANNEL 128
63
#define CMOSIS_WIDTH (CMOSIS_MAX_CHANNELS * CMOSIS_PIXELS_PER_CHANNEL)
64
//#define IPECAMERA_MAX_LINES 1088
65
#define CMOSIS_MAX_LINES 2048
282 by Suren A. Chilingaryan
Support HighFlex-based ipecamera
66
67
/*
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
68
#define CMOSIS20_MAX_CHANNELS 8
69
#define CMOSIS20_PIXELS_PER_CHANNEL 640
70
#define CMOSIS20_WIDTH (CMOSIS20_MAX_CHANNELS * CMOSIS20_PIXELS_PER_CHANNEL)
282 by Suren A. Chilingaryan
Support HighFlex-based ipecamera
71
*/
72
#define CMOSIS20_PIXELS_PER_CHANNEL 320
284 by Suren A. Chilingaryan
Fix estimation of size of UFO6 frame (works for Desy camera)
73
#define CMOSIS20_WIDTH (CMOSIS_MAX_CHANNELS * CMOSIS20_PIXELS_PER_CHANNEL)
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
74
#define CMOSIS20_MAX_LINES 3840
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
75
282 by Suren A. Chilingaryan
Support HighFlex-based ipecamera
76
#define IPECAMERA_FRAME_REQUEST 		0x209 // 0x80000209 // 0x1E9
77
#define IPECAMERA_IDLE 				0x201 // 0x80000201 // 0x1E1
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
78
#define IPECAMERA_START_INTERNAL_STIMULI 	0x1F1
79
168 by Suren A. Chilingaryan
Support 12-bit modes
80
#define IPECAMERA_MODE_16_CHAN_IO		0
81
#define IPECAMERA_MODE_4_CHAN_IO		2
82
83
#define IPECAMERA_MODE_12_BIT_ADC		2
84
#define IPECAMERA_MODE_11_BIT_ADC		1
85
#define IPECAMERA_MODE_10_BIT_ADC		0
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
86
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
87
252 by Suren A. Chilingaryan
Cleanup
88
#ifdef IPECAMERA_DEBUG_RAW_FRAMES
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
89
# define IPECAMERA_DEBUG_RAW_FRAMES_MESSAGE(function, ...)  if (ipecamera_getenv(function##_ENV, #function)) { pcilib_debug_message (#function, __FILE__, __LINE__, __VA_ARGS__); }
90
# define IPECAMERA_DEBUG_RAW_FRAMES_BUFFER(function, ...)  if (ipecamera_getenv(function##_ENV, #function)) { pcilib_debug_data_buffer (#function, __VA_ARGS__); }
252 by Suren A. Chilingaryan
Cleanup
91
#else /* IPECAMERA_DEBUG_RAW_FRAMES */
92
# define IPECAMERA_DEBUG_RAW_FRAMES_MESSAGE(function, ...)
93
# define IPECAMERA_DEBUG_RAW_FRAMES_BUFFER(function, ...)
94
#endif /* IPECAMERA_DEBUG_RAW_FRAMES */
95
251 by Suren A. Chilingaryan
Use pcitool debugging API
96
#ifdef IPECAMERA_DEBUG_BROKEN_FRAMES
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
97
# define IPECAMERA_DEBUG_BROKEN_FRAMES_MESSAGE(function, ...) if (ipecamera_getenv(function##_ENV, #function)) { pcilib_debug_message (#function, __FILE__, __LINE__, __VA_ARGS__); }
98
# define IPECAMERA_DEBUG_BROKEN_FRAMES_BUFFER(function, ...) if (ipecamera_getenv(function##_ENV, #function)) { pcilib_debug_data_buffer (#function, __VA_ARGS__); }
251 by Suren A. Chilingaryan
Use pcitool debugging API
99
#else /* IPECAMERA_DEBUG_BROKEN_FRAMES */
100
# define IPECAMERA_DEBUG_BROKEN_FRAMES_MESSAGE(function, ...)
101
# define IPECAMERA_DEBUG_BROKEN_FRAMES_BUFFER(function, ...)
102
#endif /* IPECAMERA_DEBUG_BROKEN_FRAMES */
103
254 by Suren A. Chilingaryan
Report extra padding only if IPECAMERA_DEBUG_HARDWARE is set
104
#ifdef IPECAMERA_DEBUG_RAW_PACKETS
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
105
# define IPECAMERA_DEBUG_RAW_PACKETS_MESSAGE(function, ...) if (ipecamera_getenv(function##_ENV, #function)) { pcilib_debug_message (#function, __FILE__, __LINE__, __VA_ARGS__); }
106
# define IPECAMERA_DEBUG_RAW_PACKETS_BUFFER(function, ...) if (ipecamera_getenv(function##_ENV, #function)) { pcilib_debug_data_buffer (#function, __VA_ARGS__); }
254 by Suren A. Chilingaryan
Report extra padding only if IPECAMERA_DEBUG_HARDWARE is set
107
#else /* IPECAMERA_DEBUG_RAW_PACKETS */
251 by Suren A. Chilingaryan
Use pcitool debugging API
108
# define IPECAMERA_DEBUG_RAW_PACKETS_MESSAGE(function, ...)
109
# define IPECAMERA_DEBUG_RAW_PACKETS_BUFFER(function, ...)
254 by Suren A. Chilingaryan
Report extra padding only if IPECAMERA_DEBUG_HARDWARE is set
110
#endif /* IPECAMERA_DEBUG_RAW_PACKETS */
111
112
#ifdef IPECAMERA_DEBUG_HARDWARE
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
113
# define IPECAMERA_DEBUG_HARDWARE_MESSAGE(function, ...) if (ipecamera_getenv(function##_ENV, #function)) { pcilib_debug_message (#function, __FILE__, __LINE__, __VA_ARGS__); }
114
# define IPECAMERA_DEBUG_HARDWARE_BUFFER(function, ...) if (ipecamera_getenv(function##_ENV, #function)) { pcilib_debug_data_buffer (#function, __VA_ARGS__); }
254 by Suren A. Chilingaryan
Report extra padding only if IPECAMERA_DEBUG_HARDWARE is set
115
#else /* IPECAMERA_DEBUG_HARDWARE */
116
# define IPECAMERA_DEBUG_HARDWARE_MESSAGE(function, ...)
117
# define IPECAMERA_DEBUG_HARDWARE_BUFFER(function, ...)
118
#endif /* IPECAMERA_DEBUG_HARDWARE */
119
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
120
#ifdef IPECAMERA_DEBUG_FRAME_HEADERS
121
# define IPECAMERA_DEBUG_FRAME_HEADERS_MESSAGE(function, ...)  if (ipecamera_getenv(function##_ENV, #function)) { pcilib_debug_message (#function, __FILE__, __LINE__, __VA_ARGS__); }
122
# define IPECAMERA_DEBUG_FRAME_HEADERS_BUFFER(function, ...)  if (ipecamera_getenv(function##_ENV, #function)) { pcilib_debug_data_buffer (#function, __VA_ARGS__); }
123
#else /* IPECAMERA_DEBUG_RAW_FRAMES */
124
# define IPECAMERA_DEBUG_FRAME_HEADERS_MESSAGE(function, ...)
125
# define IPECAMERA_DEBUG_FRAME_HEADERS_BUFFER(function, ...)
126
#endif /* IPECAMERA_DEBUG_RAW_FRAMES */
127
262 by Suren A. Chilingaryan
Introduce API debugging
128
#ifdef IPECAMERA_DEBUG_API
129
# define IPECAMERA_DEBUG_API_MESSAGE(function, ...)  if (ipecamera_getenv(function##_ENV, #function)) { pcilib_debug_message (#function, __FILE__, __LINE__, __VA_ARGS__); }
130
# define IPECAMERA_DEBUG_API_BUFFER(function, ...)  if (ipecamera_getenv(function##_ENV, #function)) { pcilib_debug_data_buffer (#function, __VA_ARGS__); }
131
#else /* IPECAMERA_DEBUG_API */
132
# define IPECAMERA_DEBUG_API_MESSAGE(function, ...)
133
# define IPECAMERA_DEBUG_API_BUFFER(function, ...)
134
#endif /* IPECAMERA_DEBUG_API */
135
251 by Suren A. Chilingaryan
Use pcitool debugging API
136
137
#define ipecamera_debug(function, ...) \
255 by Suren A. Chilingaryan
Fix logging to latest version of pcitool
138
    IPECAMERA_DEBUG_##function##_MESSAGE(IPECAMERA_DEBUG_##function, PCILIB_LOG_DEFAULT, __VA_ARGS__)
251 by Suren A. Chilingaryan
Use pcitool debugging API
139
140
#define ipecamera_debug_buffer(function, ...) \
141
    IPECAMERA_DEBUG_##function##_BUFFER(IPECAMERA_DEBUG_##function, __VA_ARGS__)
142
143
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
144
typedef uint32_t ipecamera_payload_t;
145
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
146
typedef enum {
147
    IPECAMERA_FIRMWARE_UNKNOWN = 0,
148
    IPECAMERA_FIRMWARE_UFO5 = 5,
149
    IPECAMERA_FIRMWARE_CMOSIS20 = 6
150
} ipecamera_firmware_t;
151
152
typedef enum {
153
    IPECAMERA_FORMAT_CMOSIS = 5,
154
    IPECAMERA_FORMAT_CMOSIS20 = 6,
155
    IPECAMERA_FORMAT_POLARIS = 7
156
} ipecamera_format_t;
157
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
158
typedef struct {
159
    pcilib_event_id_t evid;
160
    struct timeval timestamp;
161
} ipecamera_autostop_t;
162
163
typedef struct {
164
    size_t i;
165
    pthread_t thread;
166
    ipecamera_t *ipecamera;
167
    
168
    int started;			/**< flag indicating that join & cleanup is required */
169
} ipecamera_preprocessor_t;
170
171
172
typedef struct {
173
    ipecamera_event_info_t event;	/**< this structure is overwritten by the reader thread, we need a copy */
174
    pthread_rwlock_t mutex;		/**< this mutex protects reconstructed buffers only, the raw data, event_info, etc. will be overwritten by reader thread anyway */
175
} ipecamera_frame_t;
176
177
struct ipecamera_s {
178
    pcilib_context_t event;
166 by Suren A. Chilingaryan
Support for new ufodecode and updated register model in ipecamera
179
    UfoDecoder *ipedec;
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
180
265 by Suren A. Chilingaryan
Use new locking subsystem to ensure integrity
181
    pcilib_lock_t *run_lock;		/**< Lock protecting global camera operation */
182
    pcilib_lock_t *stream_lock;		/**< Lock protecting stream/next_frame operations */
183
    pcilib_lock_t *trigger_lock;	/**< Lock protecting stream/next_frame operations */
184
    int run_locked;			/**< Flag indicating if camera is currently locked */
185
    int stream_locked;			/**< Flag indicating if camera is currently locked */
186
    int trigger_locked;			/**< Flag indicating if camera is currently locked */
187
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
188
    char *data;
189
    ipecamera_pixel_t *image;
190
    size_t size;
191
132 by Suren A. Chilingaryan
Minor fixes and improvements
192
    volatile pcilib_event_id_t event_id;
133 by Suren A. Chilingaryan
In preprocessing mode, announce the events only after reconstruction is done
193
    volatile pcilib_event_id_t preproc_id;
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
194
    pcilib_event_id_t reported_id;
257 by Suren A. Chilingaryan
Cleanup
195
196
    pcilib_dma_engine_t rdma;
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
197
198
    pcilib_register_t control_reg, status_reg;
240 by Suren A. Chilingaryan
Fix frame size computation in ipecamera and few debuging options
199
    pcilib_register_t status2_reg, status3_reg;
260 by Suren A. Chilingaryan
Support registers of CMOSIS20000 camera
200
//    pcilib_register_t n_lines_reg;
201
//    uint16_t line_reg;
202
//    pcilib_register_t exposure_reg;
203
//    pcilib_register_t flip_reg;
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
204
175 by Suren A. Chilingaryan
Support both UFO4 and UFO5 frame formats
205
    pcilib_register_t firmware_version_reg;
168 by Suren A. Chilingaryan
Support 12-bit modes
206
    pcilib_register_t adc_resolution_reg;
207
    pcilib_register_t output_mode_reg;
174 by Suren A. Chilingaryan
Check for free space in camera DDR buffer before triggering event
208
    
209
    pcilib_register_t max_frames_reg;
210
    pcilib_register_t num_frames_reg;
168 by Suren A. Chilingaryan
Support 12-bit modes
211
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
212
    int started;			/**< Camera is in grabbing mode (start function is called) */
213
    int streaming;			/**< Camera is in streaming mode (we are within stream call) */
214
    int parse_data;			/**< Indicates if some processing of the data is required, otherwise only rawdata_callback will be called */
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
215
130 by Suren A. Chilingaryan
Declare volatile differently
216
    volatile int run_reader;		/**< Instructs the reader thread to stop processing */
217
    volatile int run_streamer;		/**< Indicates request to stop streaming events and can be set by reader_thread upon exit or by user request */
218
    volatile int run_preprocessors;	/**< Instructs preprocessors to exit */
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
219
    
220
    ipecamera_autostop_t autostop;
221
222
    struct timeval autostop_time;
132 by Suren A. Chilingaryan
Minor fixes and improvements
223
    struct timeval next_trigger;	/**< The minimal delay between trigger signals is mandatory, this indicates time when next trigger is possible */
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
224
261 by Suren A. Chilingaryan
Support for new CMOSIS 20MPix camera
225
    size_t buffer_size;			/**< How many images to store */
226
    size_t buffer_pos;			/**< Current image offset in the buffer, due to synchronization reasons should not be used outside of reader_thread */
227
    size_t cur_size;			/**< Already written part of data in bytes */
228
    size_t raw_size;			/**< Expected maximum size of raw data in bytes */
229
    size_t padded_size;			/**< Expected maximum size of buffer for raw data, including additional padding */
230
    size_t roi_raw_size;		/**< Expected size (for currently configured ROI) of raw data in bytes */
231
    size_t roi_padded_size;		/**< Expected size (for currently configured ROI) of buffer for raw data, including additional padding */
232
    
233
    size_t image_size;			/**< Size of a single image in bytes */
234
    
235
    size_t max_frames;			/**< Maximal number of frames what may be buffered in camera DDR memory */
236
    ipecamera_firmware_t firmware;	/**< Firmware type */
237
    int cmosis_outputs;			/**< Number of active cmosis outputs: 4 or 16 */
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
238
    int width, height;
239
240
    
241
//    void *raw_buffer;
242
    void *buffer;
243
    ipecamera_change_mask_t *cmask;
244
    ipecamera_frame_t *frame;
267 by Suren A. Chilingaryan
Handle frame headers split between 2 packets
245
246
#ifdef IPECAMERA_BUG_MULTIFRAME_HEADERS
247
    size_t saved_header_size;				/**< If it happened that the frame header is split between 2 DMA packets, this variable holds the size of the part containing in the first packet */
248
    char saved_header[CMOSIS_FRAME_HEADER_SIZE];	/**< If it happened that the frame header is split between 2 DMA packets, this variable holds the part containing in the first packet */
249
#endif /* IPECAMERA_BUG_MULTIFRAME_HEADERS */
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
250
282 by Suren A. Chilingaryan
Support HighFlex-based ipecamera
251
    size_t data_line_size;
126 by Suren A. Chilingaryan
multithread preprocessing of ipecamera frames and code reorganization
252
    ipecamera_image_dimensions_t dim;
253
254
    pthread_t rthread;
255
    
256
    size_t n_preproc;
257
    ipecamera_preprocessor_t *preproc;
258
    pthread_mutex_t preproc_mutex;
259
    
260
    int preproc_mutex_destroy;
261
    int frame_mutex_destroy;
262
};
263
264
#endif /* _IPECAMERA_PRIVATE_H */