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