LibDriver OV2640
Loading...
Searching...
No Matches
driver_ov2640_register_test.c
Go to the documentation of this file.
1
36
38#include <stdlib.h>
39
40static ov2640_handle_t gs_handle;
41
50{
51 uint8_t res;
52 uint8_t reg8;
53 uint8_t reg8_check;
54 uint8_t high_threshold;
55 uint8_t low_threshold;
56 uint8_t high_threshold_check;
57 uint8_t low_threshold_check;
58 uint16_t reg16;
59 uint16_t reg16_check;
60 uint32_t reg32;
61 uint32_t reg32_check;
62 ov2640_info_t info;
63 ov2640_dummy_frame_t dummy_frame;
64 ov2640_bool_t enable;
65 ov2640_mode_t mode;
67 ov2640_band_t band;
69 ov2640_resolution_t resolution;
70 ov2640_control_t control;
71 ov2640_edge_t edge;
72 ov2640_polarity_t polarity;
74 ov2640_pclk_t pclk;
77 ov2640_byte_swap_t byte_swap;
78
79 /* link interface function */
93
94 /* get information */
95 res = ov2640_info(&info);
96 if (res != 0)
97 {
98 ov2640_interface_debug_print("ov2640: get info failed.\n");
99
100 return 1;
101 }
102 else
103 {
104 /* print chip info */
105 ov2640_interface_debug_print("ov2640: chip is %s.\n", info.chip_name);
106 ov2640_interface_debug_print("ov2640: manufacturer is %s.\n", info.manufacturer_name);
107 ov2640_interface_debug_print("ov2640: interface is %s.\n", info.interface);
108 ov2640_interface_debug_print("ov2640: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
109 ov2640_interface_debug_print("ov2640: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
110 ov2640_interface_debug_print("ov2640: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
111 ov2640_interface_debug_print("ov2640: max current is %0.2fmA.\n", info.max_current_ma);
112 ov2640_interface_debug_print("ov2640: max temperature is %0.1fC.\n", info.temperature_max);
113 ov2640_interface_debug_print("ov2640: min temperature is %0.1fC.\n", info.temperature_min);
114 }
115
116 /* start register test */
117 ov2640_interface_debug_print("ov2640: start register test.\n");
118
119 /* init */
120 res = ov2640_init(&gs_handle);
121 if (res != 0)
122 {
123 return 1;
124 }
125
126 /* ov2640_set_agc_gain/ov2640_get_agc_gain test */
127 ov2640_interface_debug_print("ov2640: ov2640_set_agc_gain/ov2640_get_agc_gain test.\n");
128
129 reg16 = rand() % 256 | 0x100;
130 res = ov2640_set_agc_gain(&gs_handle, reg16);
131 if (res != 0)
132 {
133 ov2640_interface_debug_print("ov2640: set agc gain failed.\n");
134 (void)ov2640_deinit(&gs_handle);
135
136 return 1;
137 }
138 ov2640_interface_debug_print("ov2640: set agc gain %d.\n", reg16);
139 res = ov2640_get_agc_gain(&gs_handle, &reg16_check);
140 if (res != 0)
141 {
142 ov2640_interface_debug_print("ov2640: get agc gain failed.\n");
143 (void)ov2640_deinit(&gs_handle);
144
145 return 1;
146 }
147 ov2640_interface_debug_print("ov2640: check agc gain %s.\n", reg16 == reg16_check ? "ok" : "error");
148
149 /* ov2640_set_dummy_frame/ov2640_get_dummy_frame test */
150 ov2640_interface_debug_print("ov2640: ov2640_set_dummy_frame/ov2640_get_dummy_frame test.\n");
151
152 /* set dummy frame 1 */
154 if (res != 0)
155 {
156 ov2640_interface_debug_print("ov2640: set dummy frame failed.\n");
157 (void)ov2640_deinit(&gs_handle);
158
159 return 1;
160 }
161 ov2640_interface_debug_print("ov2640: set dummy frame 1.\n");
162 res = ov2640_get_dummy_frame(&gs_handle, &dummy_frame);
163 if (res != 0)
164 {
165 ov2640_interface_debug_print("ov2640: get dummy frame failed.\n");
166 (void)ov2640_deinit(&gs_handle);
167
168 return 1;
169 }
170 ov2640_interface_debug_print("ov2640: check dummy frame %s.\n", dummy_frame == OV2640_DUMMY_FRAME_1 ? "ok" : "error");
171
172 /* set dummy frame 3 */
174 if (res != 0)
175 {
176 ov2640_interface_debug_print("ov2640: set dummy frame failed.\n");
177 (void)ov2640_deinit(&gs_handle);
178
179 return 1;
180 }
181 ov2640_interface_debug_print("ov2640: set dummy frame 3.\n");
182 res = ov2640_get_dummy_frame(&gs_handle, &dummy_frame);
183 if (res != 0)
184 {
185 ov2640_interface_debug_print("ov2640: get dummy frame failed.\n");
186 (void)ov2640_deinit(&gs_handle);
187
188 return 1;
189 }
190 ov2640_interface_debug_print("ov2640: check dummy frame %s.\n", dummy_frame == OV2640_DUMMY_FRAME_3 ? "ok" : "error");
191
192 /* set dummy frame 7 */
194 if (res != 0)
195 {
196 ov2640_interface_debug_print("ov2640: set dummy frame failed.\n");
197 (void)ov2640_deinit(&gs_handle);
198
199 return 1;
200 }
201 ov2640_interface_debug_print("ov2640: set dummy frame 7.\n");
202 res = ov2640_get_dummy_frame(&gs_handle, &dummy_frame);
203 if (res != 0)
204 {
205 ov2640_interface_debug_print("ov2640: get dummy frame failed.\n");
206 (void)ov2640_deinit(&gs_handle);
207
208 return 1;
209 }
210 ov2640_interface_debug_print("ov2640: check dummy frame %s.\n", dummy_frame == OV2640_DUMMY_FRAME_7 ? "ok" : "error");
211
212 /* ov2640_set_vertical_window_line_start/ov2640_get_vertical_window_line_start test */
213 ov2640_interface_debug_print("ov2640: ov2640_set_vertical_window_line_start/ov2640_get_vertical_window_line_start test.\n");
214
215 reg16 = (rand() % 256) | (uint16_t)((uint16_t)1 << 8);
216 res = ov2640_set_vertical_window_line_start(&gs_handle, reg16);
217 if (res != 0)
218 {
219 ov2640_interface_debug_print("ov2640: set vertical window line start failed.\n");
220 (void)ov2640_deinit(&gs_handle);
221
222 return 1;
223 }
224 ov2640_interface_debug_print("ov2640: set vertical window line start %d.\n", reg16);
225 res = ov2640_get_vertical_window_line_start(&gs_handle, &reg16_check);
226 if (res != 0)
227 {
228 ov2640_interface_debug_print("ov2640: get vertical window line start failed.\n");
229 (void)ov2640_deinit(&gs_handle);
230
231 return 1;
232 }
233 ov2640_interface_debug_print("ov2640: check vertical window line start %s.\n", reg16 == reg16_check ? "ok" : "error");
234
235 /* ov2640_set_vertical_window_line_end/ov2640_get_vertical_window_line_end test */
236 ov2640_interface_debug_print("ov2640: ov2640_set_vertical_window_line_end/ov2640_get_vertical_window_line_end test.\n");
237
238 reg16 = (rand() % 256) | (uint16_t)((uint16_t)2 << 8);
239 res = ov2640_set_vertical_window_line_end(&gs_handle, reg16);
240 if (res != 0)
241 {
242 ov2640_interface_debug_print("ov2640: set vertical window line end failed.\n");
243 (void)ov2640_deinit(&gs_handle);
244
245 return 1;
246 }
247 ov2640_interface_debug_print("ov2640: set vertical window line end %d.\n", reg16);
248 res = ov2640_get_vertical_window_line_end(&gs_handle, &reg16_check);
249 if (res != 0)
250 {
251 ov2640_interface_debug_print("ov2640: get vertical window line end failed.\n");
252 (void)ov2640_deinit(&gs_handle);
253
254 return 1;
255 }
256 ov2640_interface_debug_print("ov2640: check vertical window line end %s.\n", reg16 == reg16_check ? "ok" : "error");
257
258 /* ov2640_set_horizontal_mirror/ov2640_get_horizontal_mirror test */
259 ov2640_interface_debug_print("ov2640: ov2640_set_horizontal_mirror/ov2640_get_horizontal_mirror test.\n");
260
261 /* enable horizontal mirror */
263 if (res != 0)
264 {
265 ov2640_interface_debug_print("ov2640: set horizontal mirror failed.\n");
266 (void)ov2640_deinit(&gs_handle);
267
268 return 1;
269 }
270 ov2640_interface_debug_print("ov2640: enable horizontal mirror.\n");
271 res = ov2640_get_horizontal_mirror(&gs_handle, &enable);
272 if (res != 0)
273 {
274 ov2640_interface_debug_print("ov2640: get horizontal mirror failed.\n");
275 (void)ov2640_deinit(&gs_handle);
276
277 return 1;
278 }
279 ov2640_interface_debug_print("ov2640: check horizontal mirror %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
280
281 /* disable horizontal mirror */
283 if (res != 0)
284 {
285 ov2640_interface_debug_print("ov2640: set horizontal mirror failed.\n");
286 (void)ov2640_deinit(&gs_handle);
287
288 return 1;
289 }
290 ov2640_interface_debug_print("ov2640: disable horizontal mirror.\n");
291 res = ov2640_get_horizontal_mirror(&gs_handle, &enable);
292 if (res != 0)
293 {
294 ov2640_interface_debug_print("ov2640: get horizontal mirror failed.\n");
295 (void)ov2640_deinit(&gs_handle);
296
297 return 1;
298 }
299 ov2640_interface_debug_print("ov2640: check horizontal mirror %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
300
301 /* ov2640_set_vertical_flip/ov2640_get_vertical_flip test */
302 ov2640_interface_debug_print("ov2640: ov2640_set_vertical_flip/ov2640_get_vertical_flip test.\n");
303
304 /* enable vertical flip */
306 if (res != 0)
307 {
308 ov2640_interface_debug_print("ov2640: set vertical flip failed.\n");
309 (void)ov2640_deinit(&gs_handle);
310
311 return 1;
312 }
313 ov2640_interface_debug_print("ov2640: enable vertical flip.\n");
314 res = ov2640_get_vertical_flip(&gs_handle, &enable);
315 if (res != 0)
316 {
317 ov2640_interface_debug_print("ov2640: get vertical flip failed.\n");
318 (void)ov2640_deinit(&gs_handle);
319
320 return 1;
321 }
322 ov2640_interface_debug_print("ov2640: check vertical flip %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
323
324 /* disable vertical flip */
326 if (res != 0)
327 {
328 ov2640_interface_debug_print("ov2640: set vertical flip failed.\n");
329 (void)ov2640_deinit(&gs_handle);
330
331 return 1;
332 }
333 ov2640_interface_debug_print("ov2640: disable vertical flip.\n");
334 res = ov2640_get_vertical_flip(&gs_handle, &enable);
335 if (res != 0)
336 {
337 ov2640_interface_debug_print("ov2640: get vertical flip failed.\n");
338 (void)ov2640_deinit(&gs_handle);
339
340 return 1;
341 }
342 ov2640_interface_debug_print("ov2640: check vertical flip %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
343
344 /* ov2640_set_aec/ov2640_get_aec test */
345 ov2640_interface_debug_print("ov2640: ov2640_set_aec/ov2640_get_aec test.\n");
346
347 reg16 = rand() % 0xFFFFU;
348 res = ov2640_set_aec(&gs_handle, reg16);
349 if (res != 0)
350 {
351 ov2640_interface_debug_print("ov2640: set aec failed.\n");
352 (void)ov2640_deinit(&gs_handle);
353
354 return 1;
355 }
356 ov2640_interface_debug_print("ov2640: set aec %d.\n", reg16);
357 res = ov2640_get_aec(&gs_handle, &reg16_check);
358 if (res != 0)
359 {
360 ov2640_interface_debug_print("ov2640: get aec failed.\n");
361 (void)ov2640_deinit(&gs_handle);
362
363 return 1;
364 }
365 ov2640_interface_debug_print("ov2640: check aec %s.\n", reg16 == reg16_check ? "ok" : "error");
366
367 /* ov2640_set_frame_exposure_pre_charge_row_number/ov2640_get_frame_exposure_pre_charge_row_number test */
368 ov2640_interface_debug_print("ov2640: ov2640_set_frame_exposure_pre_charge_row_number/ov2640_get_frame_exposure_pre_charge_row_number test.\n");
369
370 reg8 = rand() % 256;
372 if (res != 0)
373 {
374 ov2640_interface_debug_print("ov2640: set frame exposure pre charge row number failed.\n");
375 (void)ov2640_deinit(&gs_handle);
376
377 return 1;
378 }
379 ov2640_interface_debug_print("ov2640: set frame exposure pre charge row number %d.\n", reg8);
380 res = ov2640_get_frame_exposure_pre_charge_row_number(&gs_handle, &reg8_check);
381 if (res != 0)
382 {
383 ov2640_interface_debug_print("ov2640: get frame exposure pre charge row number failed.\n");
384 (void)ov2640_deinit(&gs_handle);
385
386 return 1;
387 }
388 ov2640_interface_debug_print("ov2640: check frame exposure pre charge row number %s.\n", reg8 == reg8_check ? "ok" : "error");
389
390 /* ov2640_set_mode/ov2640_get_mode test */
391 ov2640_interface_debug_print("ov2640: ov2640_set_mode/ov2640_get_mode test.\n");
392
393 /* set standby mode */
394 res = ov2640_set_mode(&gs_handle, OV2640_MODE_STANDBY);
395 if (res != 0)
396 {
397 ov2640_interface_debug_print("ov2640: set mode failed.\n");
398 (void)ov2640_deinit(&gs_handle);
399
400 return 1;
401 }
402 ov2640_interface_debug_print("ov2640: set standby mode.\n");
403 res = ov2640_get_mode(&gs_handle, &mode);
404 if (res != 0)
405 {
406 ov2640_interface_debug_print("ov2640: get mode failed.\n");
407 (void)ov2640_deinit(&gs_handle);
408
409 return 1;
410 }
411 ov2640_interface_debug_print("ov2640: check mode %s.\n", mode == OV2640_MODE_STANDBY ? "ok" : "error");
412
413 /* set normal mode */
414 res = ov2640_set_mode(&gs_handle, OV2640_MODE_NORMAL);
415 if (res != 0)
416 {
417 ov2640_interface_debug_print("ov2640: set mode failed.\n");
418 (void)ov2640_deinit(&gs_handle);
419
420 return 1;
421 }
422 ov2640_interface_debug_print("ov2640: set normal mode.\n");
423 res = ov2640_get_mode(&gs_handle, &mode);
424 if (res != 0)
425 {
426 ov2640_interface_debug_print("ov2640: get mode failed.\n");
427 (void)ov2640_deinit(&gs_handle);
428
429 return 1;
430 }
431 ov2640_interface_debug_print("ov2640: check mode %s.\n", mode == OV2640_MODE_NORMAL ? "ok" : "error");
432
433 /* ov2640_set_power_reset_pin_remap/ov2640_get_power_reset_pin_remap test */
434 ov2640_interface_debug_print("ov2640: ov2640_set_power_reset_pin_remap/ov2640_get_power_reset_pin_remap test.\n");
435
436 /* enable power reset pin remap */
438 if (res != 0)
439 {
440 ov2640_interface_debug_print("ov2640: set power reset pin remap failed.\n");
441 (void)ov2640_deinit(&gs_handle);
442
443 return 1;
444 }
445 ov2640_interface_debug_print("ov2640: enable power reset pin remap.\n");
446 res = ov2640_get_power_reset_pin_remap(&gs_handle, &enable);
447 if (res != 0)
448 {
449 ov2640_interface_debug_print("ov2640: get power reset pin remap failed.\n");
450 (void)ov2640_deinit(&gs_handle);
451
452 return 1;
453 }
454 ov2640_interface_debug_print("ov2640: check power reset pin remap %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
455
456 /* disable power reset pin remap */
458 if (res != 0)
459 {
460 ov2640_interface_debug_print("ov2640: set power reset pin remap failed.\n");
461 (void)ov2640_deinit(&gs_handle);
462
463 return 1;
464 }
465 ov2640_interface_debug_print("ov2640: disable power reset pin remap.\n");
466 res = ov2640_get_power_reset_pin_remap(&gs_handle, &enable);
467 if (res != 0)
468 {
469 ov2640_interface_debug_print("ov2640: get power reset pin remap failed.\n");
470 (void)ov2640_deinit(&gs_handle);
471
472 return 1;
473 }
474 ov2640_interface_debug_print("ov2640: check power reset pin remap %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
475
476 /* ov2640_set_output_drive/ov2640_get_output_drive test */
477 ov2640_interface_debug_print("ov2640: ov2640_set_output_drive/ov2640_get_output_drive test.\n");
478
479 /* 1 capability */
481 if (res != 0)
482 {
483 ov2640_interface_debug_print("ov2640: set output drive failed.\n");
484 (void)ov2640_deinit(&gs_handle);
485
486 return 1;
487 }
488 ov2640_interface_debug_print("ov2640: set output drive 1 capability.\n");
489 res = ov2640_get_output_drive(&gs_handle, &drive);
490 if (res != 0)
491 {
492 ov2640_interface_debug_print("ov2640: get output drive failed.\n");
493 (void)ov2640_deinit(&gs_handle);
494
495 return 1;
496 }
497 ov2640_interface_debug_print("ov2640: check output drive %s.\n", drive == OV2640_OUTPUT_DRIVE_1_CAPABILITY ? "ok" : "error");
498
499 /* 2 capability */
501 if (res != 0)
502 {
503 ov2640_interface_debug_print("ov2640: set output drive failed.\n");
504 (void)ov2640_deinit(&gs_handle);
505
506 return 1;
507 }
508 ov2640_interface_debug_print("ov2640: set output drive 2 capability.\n");
509 res = ov2640_get_output_drive(&gs_handle, &drive);
510 if (res != 0)
511 {
512 ov2640_interface_debug_print("ov2640: get output drive failed.\n");
513 (void)ov2640_deinit(&gs_handle);
514
515 return 1;
516 }
517 ov2640_interface_debug_print("ov2640: check output drive %s.\n", drive == OV2640_OUTPUT_DRIVE_2_CAPABILITY ? "ok" : "error");
518
519 /* 3 capability */
521 if (res != 0)
522 {
523 ov2640_interface_debug_print("ov2640: set output drive failed.\n");
524 (void)ov2640_deinit(&gs_handle);
525
526 return 1;
527 }
528 ov2640_interface_debug_print("ov2640: set output drive 3 capability.\n");
529 res = ov2640_get_output_drive(&gs_handle, &drive);
530 if (res != 0)
531 {
532 ov2640_interface_debug_print("ov2640: get output drive failed.\n");
533 (void)ov2640_deinit(&gs_handle);
534
535 return 1;
536 }
537 ov2640_interface_debug_print("ov2640: check output drive %s.\n", drive == OV2640_OUTPUT_DRIVE_3_CAPABILITY ? "ok" : "error");
538
539 /* 4 capability */
541 if (res != 0)
542 {
543 ov2640_interface_debug_print("ov2640: set output drive failed.\n");
544 (void)ov2640_deinit(&gs_handle);
545
546 return 1;
547 }
548 ov2640_interface_debug_print("ov2640: set output drive 4 capability.\n");
549 res = ov2640_get_output_drive(&gs_handle, &drive);
550 if (res != 0)
551 {
552 ov2640_interface_debug_print("ov2640: get output drive failed.\n");
553 (void)ov2640_deinit(&gs_handle);
554
555 return 1;
556 }
557 ov2640_interface_debug_print("ov2640: check output drive %s.\n", drive == OV2640_OUTPUT_DRIVE_4_CAPABILITY ? "ok" : "error");
558
559 /* ov2640_set_band/ov2640_get_band test */
560 ov2640_interface_debug_print("ov2640: ov2640_set_band/ov2640_get_band test.\n");
561
562 /* set band 60Hz */
563 res = ov2640_set_band(&gs_handle, OV2640_BAND_60HZ);
564 if (res != 0)
565 {
566 ov2640_interface_debug_print("ov2640: set band failed.\n");
567 (void)ov2640_deinit(&gs_handle);
568
569 return 1;
570 }
571 ov2640_interface_debug_print("ov2640: set band 60Hz.\n");
572 res = ov2640_get_band(&gs_handle, &band);
573 if (res != 0)
574 {
575 ov2640_interface_debug_print("ov2640: get band failed.\n");
576 (void)ov2640_deinit(&gs_handle);
577
578 return 1;
579 }
580 ov2640_interface_debug_print("ov2640: check band %s.\n", band == OV2640_BAND_60HZ ? "ok" : "error");
581
582 /* set band 50Hz */
583 res = ov2640_set_band(&gs_handle, OV2640_BAND_50HZ);
584 if (res != 0)
585 {
586 ov2640_interface_debug_print("ov2640: set band failed.\n");
587 (void)ov2640_deinit(&gs_handle);
588
589 return 1;
590 }
591 ov2640_interface_debug_print("ov2640: set band 50Hz.\n");
592 res = ov2640_get_band(&gs_handle, &band);
593 if (res != 0)
594 {
595 ov2640_interface_debug_print("ov2640: get band failed.\n");
596 (void)ov2640_deinit(&gs_handle);
597
598 return 1;
599 }
600 ov2640_interface_debug_print("ov2640: check band %s.\n", band == OV2640_BAND_50HZ ? "ok" : "error");
601
602 /* ov2640_set_auto_band/ov2640_get_auto_band test */
603 ov2640_interface_debug_print("ov2640: ov2640_set_auto_band/ov2640_get_auto_band test.\n");
604
605 /* disable auto band */
606 res = ov2640_set_auto_band(&gs_handle, OV2640_BOOL_FALSE);
607 if (res != 0)
608 {
609 ov2640_interface_debug_print("ov2640: set auto band failed.\n");
610 (void)ov2640_deinit(&gs_handle);
611
612 return 1;
613 }
614 ov2640_interface_debug_print("ov2640: disable auto band.\n");
615 res = ov2640_get_auto_band(&gs_handle, &enable);
616 if (res != 0)
617 {
618 ov2640_interface_debug_print("ov2640: get auto band failed.\n");
619 (void)ov2640_deinit(&gs_handle);
620
621 return 1;
622 }
623 ov2640_interface_debug_print("ov2640: check auto band %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
624
625 /* enable auto band */
626 res = ov2640_set_auto_band(&gs_handle, OV2640_BOOL_TRUE);
627 if (res != 0)
628 {
629 ov2640_interface_debug_print("ov2640: set auto band failed.\n");
630 (void)ov2640_deinit(&gs_handle);
631
632 return 1;
633 }
634 ov2640_interface_debug_print("ov2640: enable auto band.\n");
635 res = ov2640_get_auto_band(&gs_handle, &enable);
636 if (res != 0)
637 {
638 ov2640_interface_debug_print("ov2640: get auto band failed.\n");
639 (void)ov2640_deinit(&gs_handle);
640
641 return 1;
642 }
643 ov2640_interface_debug_print("ov2640: check auto band %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
644
645 /* ov2640_set_live_video_after_snapshot/ov2640_get_live_video_after_snapshot test */
646 ov2640_interface_debug_print("ov2640: ov2640_set_live_video_after_snapshot/ov2640_get_live_video_after_snapshot test.\n");
647
648 /* enable live video after snapshot */
650 if (res != 0)
651 {
652 ov2640_interface_debug_print("ov2640: set live video after snapshot failed.\n");
653 (void)ov2640_deinit(&gs_handle);
654
655 return 1;
656 }
657 ov2640_interface_debug_print("ov2640: enable live video after snapshot.\n");
658 res = ov2640_get_live_video_after_snapshot(&gs_handle, &enable);
659 if (res != 0)
660 {
661 ov2640_interface_debug_print("ov2640: get live video after snapshot failed.\n");
662 (void)ov2640_deinit(&gs_handle);
663
664 return 1;
665 }
666 ov2640_interface_debug_print("ov2640: check live video after snapshot %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
667
668 /* disable live video after snapshot */
670 if (res != 0)
671 {
672 ov2640_interface_debug_print("ov2640: set live video after snapshot failed.\n");
673 (void)ov2640_deinit(&gs_handle);
674
675 return 1;
676 }
677 ov2640_interface_debug_print("ov2640: disable live video after snapshot.\n");
678 res = ov2640_get_live_video_after_snapshot(&gs_handle, &enable);
679 if (res != 0)
680 {
681 ov2640_interface_debug_print("ov2640: get live video after snapshot failed.\n");
682 (void)ov2640_deinit(&gs_handle);
683
684 return 1;
685 }
686 ov2640_interface_debug_print("ov2640: check live video after snapshot %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
687
688 /* ov2640_set_clock_output_power_down_pin_status/ov2640_get_clock_output_power_down_pin_status test */
689 ov2640_interface_debug_print("ov2640: ov2640_set_clock_output_power_down_pin_status/ov2640_get_clock_output_power_down_pin_status test.\n");
690
691 /* set clock output power down pin last state */
693 if (res != 0)
694 {
695 ov2640_interface_debug_print("ov2640: set clock output power down pin status failed.\n");
696 (void)ov2640_deinit(&gs_handle);
697
698 return 1;
699 }
700 ov2640_interface_debug_print("ov2640: set clock output power down pin last state.\n");
701 res = ov2640_get_clock_output_power_down_pin_status(&gs_handle, &status);
702 if (res != 0)
703 {
704 ov2640_interface_debug_print("ov2640: get clock output power down pin status failed.\n");
705 (void)ov2640_deinit(&gs_handle);
706
707 return 1;
708 }
709 ov2640_interface_debug_print("ov2640: check clock output power down pin status %s.\n", status == OV2640_PIN_STATUS_LAST_STATE ? "ok" : "error");
710
711 /* set clock output power down pin tri state */
713 if (res != 0)
714 {
715 ov2640_interface_debug_print("ov2640: set clock output power down pin status failed.\n");
716 (void)ov2640_deinit(&gs_handle);
717
718 return 1;
719 }
720 ov2640_interface_debug_print("ov2640: set clock output power down pin tri state.\n");
721 res = ov2640_get_clock_output_power_down_pin_status(&gs_handle, &status);
722 if (res != 0)
723 {
724 ov2640_interface_debug_print("ov2640: get clock output power down pin status failed.\n");
725 (void)ov2640_deinit(&gs_handle);
726
727 return 1;
728 }
729 ov2640_interface_debug_print("ov2640: check clock output power down pin status %s.\n", status == OV2640_PIN_STATUS_TRI_STATE ? "ok" : "error");
730
731 /* ov2640_set_clock_rate_double/ov2640_get_clock_rate_double test */
732 ov2640_interface_debug_print("ov2640: ov2640_set_clock_rate_double/ov2640_get_clock_rate_double test.\n");
733
734 /* enable clock rate double */
736 if (res != 0)
737 {
738 ov2640_interface_debug_print("ov2640: set clock rate double failed.\n");
739 (void)ov2640_deinit(&gs_handle);
740
741 return 1;
742 }
743 ov2640_interface_debug_print("ov2640: enable clock rate double.\n");
744 res = ov2640_get_clock_rate_double(&gs_handle, &enable);
745 if (res != 0)
746 {
747 ov2640_interface_debug_print("ov2640: get clock rate double failed.\n");
748 (void)ov2640_deinit(&gs_handle);
749
750 return 1;
751 }
752 ov2640_interface_debug_print("ov2640: check clock rate double %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
753
754 /* disable clock rate double */
756 if (res != 0)
757 {
758 ov2640_interface_debug_print("ov2640: set clock rate double failed.\n");
759 (void)ov2640_deinit(&gs_handle);
760
761 return 1;
762 }
763 ov2640_interface_debug_print("ov2640: disable clock rate double.\n");
764 res = ov2640_get_clock_rate_double(&gs_handle, &enable);
765 if (res != 0)
766 {
767 ov2640_interface_debug_print("ov2640: get clock rate double failed.\n");
768 (void)ov2640_deinit(&gs_handle);
769
770 return 1;
771 }
772 ov2640_interface_debug_print("ov2640: check clock rate double %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
773
774 /* ov2640_set_clock_divider/ov2640_get_clock_divider test */
775 ov2640_interface_debug_print("ov2640: ov2640_set_clock_divider/ov2640_get_clock_divider test.\n");
776
777 reg8 = rand() % 0x3F;
778 res = ov2640_set_clock_divider(&gs_handle, reg8);
779 if (res != 0)
780 {
781 ov2640_interface_debug_print("ov2640: set clock divider failed.\n");
782 (void)ov2640_deinit(&gs_handle);
783
784 return 1;
785 }
786 ov2640_interface_debug_print("ov2640: set clock divider %d.\n", reg8);
787 res = ov2640_get_clock_divider(&gs_handle, &reg8_check);
788 if (res != 0)
789 {
790 ov2640_interface_debug_print("ov2640: get clock divider failed.\n");
791 (void)ov2640_deinit(&gs_handle);
792
793 return 1;
794 }
795 ov2640_interface_debug_print("ov2640: check clock divider %s.\n", reg8 == reg8_check ? "ok" : "error");
796
797 /* ov2640_soft_reset test */
798 ov2640_interface_debug_print("ov2640: ov2640_soft_reset test.\n");
799
800 /* soft reset */
801 res = ov2640_soft_reset(&gs_handle);
802 if (res != 0)
803 {
804 ov2640_interface_debug_print("ov2640: soft reset failed.\n");
805 (void)ov2640_deinit(&gs_handle);
806
807 return 1;
808 }
809 ov2640_interface_debug_print("ov2640: check soft reset %s.\n", res == 0 ? "ok" : "error");
810
811 /* ov2640_set_resolution/ov2640_get_resolution test */
812 ov2640_interface_debug_print("ov2640: ov2640_set_resolution/ov2640_get_resolution test.\n");
813
814 /* set resolution uxga */
816 if (res != 0)
817 {
818 ov2640_interface_debug_print("ov2640: set resolution failed.\n");
819 (void)ov2640_deinit(&gs_handle);
820
821 return 1;
822 }
823 ov2640_interface_debug_print("ov2640: set resolution uxga.\n");
824 res = ov2640_get_resolution(&gs_handle, &resolution);
825 if (res != 0)
826 {
827 ov2640_interface_debug_print("ov2640: get resolution failed.\n");
828 (void)ov2640_deinit(&gs_handle);
829
830 return 1;
831 }
832 ov2640_interface_debug_print("ov2640: check resolution %s.\n", resolution == OV2640_RESOLUTION_UXGA ? "ok" : "error");
833
834 /* set resolution cif */
836 if (res != 0)
837 {
838 ov2640_interface_debug_print("ov2640: set resolution failed.\n");
839 (void)ov2640_deinit(&gs_handle);
840
841 return 1;
842 }
843 ov2640_interface_debug_print("ov2640: set resolution cif.\n");
844 res = ov2640_get_resolution(&gs_handle, &resolution);
845 if (res != 0)
846 {
847 ov2640_interface_debug_print("ov2640: get resolution failed.\n");
848 (void)ov2640_deinit(&gs_handle);
849
850 return 1;
851 }
852 ov2640_interface_debug_print("ov2640: check resolution %s.\n", resolution == OV2640_RESOLUTION_CIF ? "ok" : "error");
853
854 /* set resolution svga */
856 if (res != 0)
857 {
858 ov2640_interface_debug_print("ov2640: set resolution failed.\n");
859 (void)ov2640_deinit(&gs_handle);
860
861 return 1;
862 }
863 ov2640_interface_debug_print("ov2640: set resolution svga.\n");
864 res = ov2640_get_resolution(&gs_handle, &resolution);
865 if (res != 0)
866 {
867 ov2640_interface_debug_print("ov2640: get resolution failed.\n");
868 (void)ov2640_deinit(&gs_handle);
869
870 return 1;
871 }
872 ov2640_interface_debug_print("ov2640: check resolution %s.\n", resolution == OV2640_RESOLUTION_SVGA ? "ok" : "error");
873
874 /* ov2640_set_zoom/ov2640_get_zoom test */
875 ov2640_interface_debug_print("ov2640: ov2640_set_zoom/ov2640_get_zoom test.\n");
876
877 /* enable zoom */
878 res = ov2640_set_zoom(&gs_handle, OV2640_BOOL_TRUE);
879 if (res != 0)
880 {
881 ov2640_interface_debug_print("ov2640: set zoom failed.\n");
882 (void)ov2640_deinit(&gs_handle);
883
884 return 1;
885 }
886 ov2640_interface_debug_print("ov2640: enable zoom.\n");
887 res = ov2640_get_zoom(&gs_handle, &enable);
888 if (res != 0)
889 {
890 ov2640_interface_debug_print("ov2640: get zoom failed.\n");
891 (void)ov2640_deinit(&gs_handle);
892
893 return 1;
894 }
895 ov2640_interface_debug_print("ov2640: check zoom %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
896
897 /* disable zoom */
898 res = ov2640_set_zoom(&gs_handle, OV2640_BOOL_FALSE);
899 if (res != 0)
900 {
901 ov2640_interface_debug_print("ov2640: set zoom failed.\n");
902 (void)ov2640_deinit(&gs_handle);
903
904 return 1;
905 }
906 ov2640_interface_debug_print("ov2640: disable zoom.\n");
907 res = ov2640_get_zoom(&gs_handle, &enable);
908 if (res != 0)
909 {
910 ov2640_interface_debug_print("ov2640: get zoom failed.\n");
911 (void)ov2640_deinit(&gs_handle);
912
913 return 1;
914 }
915 ov2640_interface_debug_print("ov2640: check zoom %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
916
917 /* ov2640_set_color_bar_test/ov2640_get_color_bar_test test */
918 ov2640_interface_debug_print("ov2640: ov2640_set_color_bar_test/ov2640_get_color_bar_test test.\n");
919
920 /* enable color bar test */
922 if (res != 0)
923 {
924 ov2640_interface_debug_print("ov2640: set color bar test failed.\n");
925 (void)ov2640_deinit(&gs_handle);
926
927 return 1;
928 }
929 ov2640_interface_debug_print("ov2640: enable color bar test.\n");
930 res = ov2640_get_color_bar_test(&gs_handle, &enable);
931 if (res != 0)
932 {
933 ov2640_interface_debug_print("ov2640: get color bar test failed.\n");
934 (void)ov2640_deinit(&gs_handle);
935
936 return 1;
937 }
938 ov2640_interface_debug_print("ov2640: check color bar test %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
939
940 /* disable color bar test */
942 if (res != 0)
943 {
944 ov2640_interface_debug_print("ov2640: set color bar test failed.\n");
945 (void)ov2640_deinit(&gs_handle);
946
947 return 1;
948 }
949 ov2640_interface_debug_print("ov2640: disable color bar test.\n");
950 res = ov2640_get_color_bar_test(&gs_handle, &enable);
951 if (res != 0)
952 {
953 ov2640_interface_debug_print("ov2640: get color bar test failed.\n");
954 (void)ov2640_deinit(&gs_handle);
955
956 return 1;
957 }
958 ov2640_interface_debug_print("ov2640: check color bar test %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
959
960 /* ov2640_set_band_filter/ov2640_get_band_filter test */
961 ov2640_interface_debug_print("ov2640: ov2640_set_band_filter/ov2640_get_band_filter test.\n");
962
963 /* enable band filter */
964 res = ov2640_set_band_filter(&gs_handle, OV2640_BOOL_TRUE);
965 if (res != 0)
966 {
967 ov2640_interface_debug_print("ov2640: set band filter failed.\n");
968 (void)ov2640_deinit(&gs_handle);
969
970 return 1;
971 }
972 ov2640_interface_debug_print("ov2640: enable band filter.\n");
973 res = ov2640_get_band_filter(&gs_handle, &enable);
974 if (res != 0)
975 {
976 ov2640_interface_debug_print("ov2640: get band filter failed.\n");
977 (void)ov2640_deinit(&gs_handle);
978
979 return 1;
980 }
981 ov2640_interface_debug_print("ov2640: check band filter %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
982
983 /* disable band filter */
984 res = ov2640_set_band_filter(&gs_handle, OV2640_BOOL_FALSE);
985 if (res != 0)
986 {
987 ov2640_interface_debug_print("ov2640: set band filter failed.\n");
988 (void)ov2640_deinit(&gs_handle);
989
990 return 1;
991 }
992 ov2640_interface_debug_print("ov2640: disable band filter.\n");
993 res = ov2640_get_band_filter(&gs_handle, &enable);
994 if (res != 0)
995 {
996 ov2640_interface_debug_print("ov2640: get band filter failed.\n");
997 (void)ov2640_deinit(&gs_handle);
998
999 return 1;
1000 }
1001 ov2640_interface_debug_print("ov2640: check band filter %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
1002
1003 /* ov2640_set_agc_control/ov2640_get_agc_control test */
1004 ov2640_interface_debug_print("ov2640: ov2640_set_agc_control/ov2640_get_agc_control test.\n");
1005
1006 /* set agc control manual */
1008 if (res != 0)
1009 {
1010 ov2640_interface_debug_print("ov2640: set agc control failed.\n");
1011 (void)ov2640_deinit(&gs_handle);
1012
1013 return 1;
1014 }
1015 ov2640_interface_debug_print("ov2640: set agc control manual.\n");
1016 res = ov2640_get_agc_control(&gs_handle, &control);
1017 if (res != 0)
1018 {
1019 ov2640_interface_debug_print("ov2640: get agc control failed.\n");
1020 (void)ov2640_deinit(&gs_handle);
1021
1022 return 1;
1023 }
1024 ov2640_interface_debug_print("ov2640: check agc control %s.\n", control == OV2640_CONTROL_MANUAL ? "ok" : "error");
1025
1026 /* set agc control auto */
1028 if (res != 0)
1029 {
1030 ov2640_interface_debug_print("ov2640: set agc control failed.\n");
1031 (void)ov2640_deinit(&gs_handle);
1032
1033 return 1;
1034 }
1035 ov2640_interface_debug_print("ov2640: set agc control auto.\n");
1036 res = ov2640_get_agc_control(&gs_handle, &control);
1037 if (res != 0)
1038 {
1039 ov2640_interface_debug_print("ov2640: get agc control failed.\n");
1040 (void)ov2640_deinit(&gs_handle);
1041
1042 return 1;
1043 }
1044 ov2640_interface_debug_print("ov2640: check agc control %s.\n", control == OV2640_CONTROL_AUTO ? "ok" : "error");
1045
1046 /* ov2640_set_exposure_control/ov2640_get_exposure_control test */
1047 ov2640_interface_debug_print("ov2640: ov2640_set_exposure_control/ov2640_get_exposure_control test.\n");
1048
1049 /* set exposure control manual */
1051 if (res != 0)
1052 {
1053 ov2640_interface_debug_print("ov2640: set exposure control failed.\n");
1054 (void)ov2640_deinit(&gs_handle);
1055
1056 return 1;
1057 }
1058 ov2640_interface_debug_print("ov2640: set exposure control manual.\n");
1059 res = ov2640_get_exposure_control(&gs_handle, &control);
1060 if (res != 0)
1061 {
1062 ov2640_interface_debug_print("ov2640: get exposure control failed.\n");
1063 (void)ov2640_deinit(&gs_handle);
1064
1065 return 1;
1066 }
1067 ov2640_interface_debug_print("ov2640: check exposure control %s.\n", control == OV2640_CONTROL_MANUAL ? "ok" : "error");
1068
1069 /* set exposure control auto */
1071 if (res != 0)
1072 {
1073 ov2640_interface_debug_print("ov2640: set exposure control failed.\n");
1074 (void)ov2640_deinit(&gs_handle);
1075
1076 return 1;
1077 }
1078 ov2640_interface_debug_print("ov2640: set exposure control auto.\n");
1079 res = ov2640_get_exposure_control(&gs_handle, &control);
1080 if (res != 0)
1081 {
1082 ov2640_interface_debug_print("ov2640: get exposure control failed.\n");
1083 (void)ov2640_deinit(&gs_handle);
1084
1085 return 1;
1086 }
1087 ov2640_interface_debug_print("ov2640: check exposure control %s.\n", control == OV2640_CONTROL_AUTO ? "ok" : "error");
1088
1089 /* ov2640_set_agc/ov2640_get_agc test */
1090 ov2640_interface_debug_print("ov2640: ov2640_set_agc/ov2640_get_agc test.\n");
1091
1092 /* 2x */
1093 res = ov2640_set_agc_gain_ceiling(&gs_handle, OV2640_AGC_2X);
1094 if (res != 0)
1095 {
1096 ov2640_interface_debug_print("ov2640: set agc gain ceiling failed.\n");
1097 (void)ov2640_deinit(&gs_handle);
1098
1099 return 1;
1100 }
1101 ov2640_interface_debug_print("ov2640: set agc gain ceiling 2x.\n");
1102 res = ov2640_get_agc_gain_ceiling(&gs_handle, &agc);
1103 if (res != 0)
1104 {
1105 ov2640_interface_debug_print("ov2640: get agc gain ceiling failed.\n");
1106 (void)ov2640_deinit(&gs_handle);
1107
1108 return 1;
1109 }
1110 ov2640_interface_debug_print("ov2640: check agc gain ceiling %s.\n", OV2640_AGC_2X == agc ? "ok" : "error");
1111
1112 /* 4x */
1113 res = ov2640_set_agc_gain_ceiling(&gs_handle, OV2640_AGC_4X);
1114 if (res != 0)
1115 {
1116 ov2640_interface_debug_print("ov2640: set agc gain ceiling failed.\n");
1117 (void)ov2640_deinit(&gs_handle);
1118
1119 return 1;
1120 }
1121 ov2640_interface_debug_print("ov2640: set agc gain ceiling 4x.\n");
1122 res = ov2640_get_agc_gain_ceiling(&gs_handle, &agc);
1123 if (res != 0)
1124 {
1125 ov2640_interface_debug_print("ov2640: get agc gain ceiling failed.\n");
1126 (void)ov2640_deinit(&gs_handle);
1127
1128 return 1;
1129 }
1130 ov2640_interface_debug_print("ov2640: check agc gain ceiling %s.\n", OV2640_AGC_4X == agc ? "ok" : "error");
1131
1132 /* 8x */
1133 res = ov2640_set_agc_gain_ceiling(&gs_handle, OV2640_AGC_8X);
1134 if (res != 0)
1135 {
1136 ov2640_interface_debug_print("ov2640: set agc gain ceiling failed.\n");
1137 (void)ov2640_deinit(&gs_handle);
1138
1139 return 1;
1140 }
1141 ov2640_interface_debug_print("ov2640: set agc gain ceiling 8x.\n");
1142 res = ov2640_get_agc_gain_ceiling(&gs_handle, &agc);
1143 if (res != 0)
1144 {
1145 ov2640_interface_debug_print("ov2640: get agc gain ceiling failed.\n");
1146 (void)ov2640_deinit(&gs_handle);
1147
1148 return 1;
1149 }
1150 ov2640_interface_debug_print("ov2640: check agc gain ceiling %s.\n", OV2640_AGC_8X == agc ? "ok" : "error");
1151
1152 /* 16x */
1154 if (res != 0)
1155 {
1156 ov2640_interface_debug_print("ov2640: set agc gain ceiling failed.\n");
1157 (void)ov2640_deinit(&gs_handle);
1158
1159 return 1;
1160 }
1161 ov2640_interface_debug_print("ov2640: set agc gain ceiling 16x.\n");
1162 res = ov2640_get_agc_gain_ceiling(&gs_handle, &agc);
1163 if (res != 0)
1164 {
1165 ov2640_interface_debug_print("ov2640: get agc gain ceiling failed.\n");
1166 (void)ov2640_deinit(&gs_handle);
1167
1168 return 1;
1169 }
1170 ov2640_interface_debug_print("ov2640: check agc gain ceiling %s.\n", OV2640_AGC_16X == agc ? "ok" : "error");
1171
1172 /* 32x */
1174 if (res != 0)
1175 {
1176 ov2640_interface_debug_print("ov2640: set agc gain ceiling failed.\n");
1177 (void)ov2640_deinit(&gs_handle);
1178
1179 return 1;
1180 }
1181 ov2640_interface_debug_print("ov2640: set agc gain ceiling 32x.\n");
1182 res = ov2640_get_agc_gain_ceiling(&gs_handle, &agc);
1183 if (res != 0)
1184 {
1185 ov2640_interface_debug_print("ov2640: get agc gain ceiling failed.\n");
1186 (void)ov2640_deinit(&gs_handle);
1187
1188 return 1;
1189 }
1190 ov2640_interface_debug_print("ov2640: check agc gain ceiling %s.\n", OV2640_AGC_32X == agc ? "ok" : "error");
1191
1192 /* 64x */
1194 if (res != 0)
1195 {
1196 ov2640_interface_debug_print("ov2640: set agc gain ceiling failed.\n");
1197 (void)ov2640_deinit(&gs_handle);
1198
1199 return 1;
1200 }
1201 ov2640_interface_debug_print("ov2640: set agc gain ceiling 64x.\n");
1202 res = ov2640_get_agc_gain_ceiling(&gs_handle, &agc);
1203 if (res != 0)
1204 {
1205 ov2640_interface_debug_print("ov2640: get agc gain ceiling failed.\n");
1206 (void)ov2640_deinit(&gs_handle);
1207
1208 return 1;
1209 }
1210 ov2640_interface_debug_print("ov2640: check agc gain ceiling %s.\n", OV2640_AGC_64X == agc ? "ok" : "error");
1211
1212 /* 128x */
1214 if (res != 0)
1215 {
1216 ov2640_interface_debug_print("ov2640: set agc gain ceiling failed.\n");
1217 (void)ov2640_deinit(&gs_handle);
1218
1219 return 1;
1220 }
1221 ov2640_interface_debug_print("ov2640: set agc gain ceiling 128x.\n");
1222 res = ov2640_get_agc_gain_ceiling(&gs_handle, &agc);
1223 if (res != 0)
1224 {
1225 ov2640_interface_debug_print("ov2640: get agc gain ceiling failed.\n");
1226 (void)ov2640_deinit(&gs_handle);
1227
1228 return 1;
1229 }
1230 ov2640_interface_debug_print("ov2640: check agc gain ceiling %s.\n", OV2640_AGC_128X == agc ? "ok" : "error");
1231
1232 /* ov2640_set_chsync_href_swap/ov2640_get_chsync_href_swap test */
1233 ov2640_interface_debug_print("ov2640: ov2640_set_chsync_href_swap/ov2640_get_chsync_href_swap test.\n");
1234
1235 /* enable chsync href swap */
1237 if (res != 0)
1238 {
1239 ov2640_interface_debug_print("ov2640: set chsync href swap failed.\n");
1240 (void)ov2640_deinit(&gs_handle);
1241
1242 return 1;
1243 }
1244 ov2640_interface_debug_print("ov2640: enable chsync href swap.\n");
1245 res = ov2640_get_chsync_href_swap(&gs_handle, &enable);
1246 if (res != 0)
1247 {
1248 ov2640_interface_debug_print("ov2640: get chsync href swap failed.\n");
1249 (void)ov2640_deinit(&gs_handle);
1250
1251 return 1;
1252 }
1253 ov2640_interface_debug_print("ov2640: check chsync href swap %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
1254
1255 /* disable chsync href swap */
1257 if (res != 0)
1258 {
1259 ov2640_interface_debug_print("ov2640: set chsync href swap failed.\n");
1260 (void)ov2640_deinit(&gs_handle);
1261
1262 return 1;
1263 }
1264 ov2640_interface_debug_print("ov2640: disable chsync href swap.\n");
1265 res = ov2640_get_chsync_href_swap(&gs_handle, &enable);
1266 if (res != 0)
1267 {
1268 ov2640_interface_debug_print("ov2640: get chsync href swap failed.\n");
1269 (void)ov2640_deinit(&gs_handle);
1270
1271 return 1;
1272 }
1273 ov2640_interface_debug_print("ov2640: check chsync href swap %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
1274
1275 /* ov2640_set_href_chsync_swap/ov2640_get_href_chsync_swap test */
1276 ov2640_interface_debug_print("ov2640: ov2640_set_href_chsync_swap/ov2640_get_href_chsync_swap test.\n");
1277
1278 /* enable href chsync swap */
1280 if (res != 0)
1281 {
1282 ov2640_interface_debug_print("ov2640: set href chsync swap failed.\n");
1283 (void)ov2640_deinit(&gs_handle);
1284
1285 return 1;
1286 }
1287 ov2640_interface_debug_print("ov2640: enable href chsync swap.\n");
1288 res = ov2640_get_href_chsync_swap(&gs_handle, &enable);
1289 if (res != 0)
1290 {
1291 ov2640_interface_debug_print("ov2640: get href chsync swap failed.\n");
1292 (void)ov2640_deinit(&gs_handle);
1293
1294 return 1;
1295 }
1296 ov2640_interface_debug_print("ov2640: check href chsync swap %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
1297
1298 /* disable href chsync swap */
1300 if (res != 0)
1301 {
1302 ov2640_interface_debug_print("ov2640: set href chsync swap failed.\n");
1303 (void)ov2640_deinit(&gs_handle);
1304
1305 return 1;
1306 }
1307 ov2640_interface_debug_print("ov2640: disable href chsync swap.\n");
1308 res = ov2640_get_href_chsync_swap(&gs_handle, &enable);
1309 if (res != 0)
1310 {
1311 ov2640_interface_debug_print("ov2640: get href chsync swap failed.\n");
1312 (void)ov2640_deinit(&gs_handle);
1313
1314 return 1;
1315 }
1316 ov2640_interface_debug_print("ov2640: check href chsync swap %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
1317
1318 /* ov2640_set_pclk_output_qualified_by_href/ov2640_get_pclk_output_qualified_by_href test */
1319 ov2640_interface_debug_print("ov2640: ov2640_set_pclk_output_qualified_by_href/ov2640_get_pclk_output_qualified_by_href test.\n");
1320
1321 /* enable pclk output qualified by href */
1323 if (res != 0)
1324 {
1325 ov2640_interface_debug_print("ov2640: set pclk output qualified by href failed.\n");
1326 (void)ov2640_deinit(&gs_handle);
1327
1328 return 1;
1329 }
1330 ov2640_interface_debug_print("ov2640: enable pclk output qualified by href.\n");
1331 res = ov2640_get_pclk_output_qualified_by_href(&gs_handle, &enable);
1332 if (res != 0)
1333 {
1334 ov2640_interface_debug_print("ov2640: get pclk output qualified by href failed.\n");
1335 (void)ov2640_deinit(&gs_handle);
1336
1337 return 1;
1338 }
1339 ov2640_interface_debug_print("ov2640: check pclk output qualified by href %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
1340
1341 /* disable pclk output qualified by href */
1343 if (res != 0)
1344 {
1345 ov2640_interface_debug_print("ov2640: set pclk output qualified by href failed.\n");
1346 (void)ov2640_deinit(&gs_handle);
1347
1348 return 1;
1349 }
1350 ov2640_interface_debug_print("ov2640: disable pclk output qualified by href.\n");
1351 res = ov2640_get_pclk_output_qualified_by_href(&gs_handle, &enable);
1352 if (res != 0)
1353 {
1354 ov2640_interface_debug_print("ov2640: get pclk output qualified by href failed.\n");
1355 (void)ov2640_deinit(&gs_handle);
1356
1357 return 1;
1358 }
1359 ov2640_interface_debug_print("ov2640: check pclk output qualified by href %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
1360
1361 /* ov2640_set_pclk_output_qualified_by_href/ov2640_get_pclk_output_qualified_by_href test */
1362 ov2640_interface_debug_print("ov2640: ov2640_set_pclk_output_qualified_by_href/ov2640_get_pclk_output_qualified_by_href test.\n");
1363
1364 /* set pclk edge falling */
1365 res = ov2640_set_pclk_edge(&gs_handle, OV2640_EDGE_FALLING);
1366 if (res != 0)
1367 {
1368 ov2640_interface_debug_print("ov2640: set pclk edge failed.\n");
1369 (void)ov2640_deinit(&gs_handle);
1370
1371 return 1;
1372 }
1373 ov2640_interface_debug_print("ov2640: set pclk edge falling.\n");
1374 res = ov2640_get_pclk_edge(&gs_handle, &edge);
1375 if (res != 0)
1376 {
1377 ov2640_interface_debug_print("ov2640: get pclk edge failed.\n");
1378 (void)ov2640_deinit(&gs_handle);
1379
1380 return 1;
1381 }
1382 ov2640_interface_debug_print("ov2640: check pclk edge %s.\n", edge == OV2640_EDGE_FALLING ? "ok" : "error");
1383
1384 /* set pclk edge rising */
1385 res = ov2640_set_pclk_edge(&gs_handle, OV2640_EDGE_RISING);
1386 if (res != 0)
1387 {
1388 ov2640_interface_debug_print("ov2640: set pclk edge failed.\n");
1389 (void)ov2640_deinit(&gs_handle);
1390
1391 return 1;
1392 }
1393 ov2640_interface_debug_print("ov2640: set pclk edge rising.\n");
1394 res = ov2640_get_pclk_edge(&gs_handle, &edge);
1395 if (res != 0)
1396 {
1397 ov2640_interface_debug_print("ov2640: get pclk edge failed.\n");
1398 (void)ov2640_deinit(&gs_handle);
1399
1400 return 1;
1401 }
1402 ov2640_interface_debug_print("ov2640: check pclk edge %s.\n", edge == OV2640_EDGE_RISING ? "ok" : "error");
1403
1404 /* ov2640_set_href_polarity/ov2640_get_href_polarity test */
1405 ov2640_interface_debug_print("ov2640: ov2640_set_href_polarity/ov2640_get_href_polarity test.\n");
1406
1407 /* set href polarity positive */
1409 if (res != 0)
1410 {
1411 ov2640_interface_debug_print("ov2640: set href polarity failed.\n");
1412 (void)ov2640_deinit(&gs_handle);
1413
1414 return 1;
1415 }
1416 ov2640_interface_debug_print("ov2640: set href polarity positive.\n");
1417 res = ov2640_get_href_polarity(&gs_handle, &polarity);
1418 if (res != 0)
1419 {
1420 ov2640_interface_debug_print("ov2640: get href polarity failed.\n");
1421 (void)ov2640_deinit(&gs_handle);
1422
1423 return 1;
1424 }
1425 ov2640_interface_debug_print("ov2640: check href polarity %s.\n", polarity == OV2640_POLARITY_POSITIVE ? "ok" : "error");
1426
1427 /* set href polarity negative */
1429 if (res != 0)
1430 {
1431 ov2640_interface_debug_print("ov2640: set href polarity failed.\n");
1432 (void)ov2640_deinit(&gs_handle);
1433
1434 return 1;
1435 }
1436 ov2640_interface_debug_print("ov2640: set href polarity negative.\n");
1437 res = ov2640_get_href_polarity(&gs_handle, &polarity);
1438 if (res != 0)
1439 {
1440 ov2640_interface_debug_print("ov2640: get href polarity failed.\n");
1441 (void)ov2640_deinit(&gs_handle);
1442
1443 return 1;
1444 }
1445 ov2640_interface_debug_print("ov2640: check href polarity %s.\n", polarity == OV2640_POLARITY_NEGATIVE ? "ok" : "error");
1446
1447 /* ov2640_set_vsync_polarity/ov2640_get_vsync_polarity test */
1448 ov2640_interface_debug_print("ov2640: ov2640_set_vsync_polarity/ov2640_get_vsync_polarity test.\n");
1449
1450 /* set vsync polarity positive */
1452 if (res != 0)
1453 {
1454 ov2640_interface_debug_print("ov2640: set vsync polarity failed.\n");
1455 (void)ov2640_deinit(&gs_handle);
1456
1457 return 1;
1458 }
1459 ov2640_interface_debug_print("ov2640: set vsync polarity positive.\n");
1460 res = ov2640_get_vsync_polarity(&gs_handle, &polarity);
1461 if (res != 0)
1462 {
1463 ov2640_interface_debug_print("ov2640: get vsync polarity failed.\n");
1464 (void)ov2640_deinit(&gs_handle);
1465
1466 return 1;
1467 }
1468 ov2640_interface_debug_print("ov2640: check vsync polarity %s.\n", polarity == OV2640_POLARITY_POSITIVE ? "ok" : "error");
1469
1470 /* set vsync polarity negative */
1472 if (res != 0)
1473 {
1474 ov2640_interface_debug_print("ov2640: set vsync polarity failed.\n");
1475 (void)ov2640_deinit(&gs_handle);
1476
1477 return 1;
1478 }
1479 ov2640_interface_debug_print("ov2640: set vsync polarity negative.\n");
1480 res = ov2640_get_vsync_polarity(&gs_handle, &polarity);
1481 if (res != 0)
1482 {
1483 ov2640_interface_debug_print("ov2640: get vsync polarity failed.\n");
1484 (void)ov2640_deinit(&gs_handle);
1485
1486 return 1;
1487 }
1488 ov2640_interface_debug_print("ov2640: check vsync polarity %s.\n", polarity == OV2640_POLARITY_NEGATIVE ? "ok" : "error");
1489
1490 /* ov2640_set_hsync_polarity/ov2640_get_hsync_polarity test */
1491 ov2640_interface_debug_print("ov2640: ov2640_set_hsync_polarity/ov2640_get_hsync_polarity test.\n");
1492
1493 /* set hsync polarity positive */
1495 if (res != 0)
1496 {
1497 ov2640_interface_debug_print("ov2640: set hsync polarity failed.\n");
1498 (void)ov2640_deinit(&gs_handle);
1499
1500 return 1;
1501 }
1502 ov2640_interface_debug_print("ov2640: set hsync polarity positive.\n");
1503 res = ov2640_get_hsync_polarity(&gs_handle, &polarity);
1504 if (res != 0)
1505 {
1506 ov2640_interface_debug_print("ov2640: get hsync polarity failed.\n");
1507 (void)ov2640_deinit(&gs_handle);
1508
1509 return 1;
1510 }
1511 ov2640_interface_debug_print("ov2640: check hsync polarity %s.\n", polarity == OV2640_POLARITY_POSITIVE ? "ok" : "error");
1512
1513 /* set hsync polarity negative */
1515 if (res != 0)
1516 {
1517 ov2640_interface_debug_print("ov2640: set hsync polarity failed.\n");
1518 (void)ov2640_deinit(&gs_handle);
1519
1520 return 1;
1521 }
1522 ov2640_interface_debug_print("ov2640: set hsync polarity negative.\n");
1523 res = ov2640_get_hsync_polarity(&gs_handle, &polarity);
1524 if (res != 0)
1525 {
1526 ov2640_interface_debug_print("ov2640: get hsync polarity failed.\n");
1527 (void)ov2640_deinit(&gs_handle);
1528
1529 return 1;
1530 }
1531 ov2640_interface_debug_print("ov2640: check hsync polarity %s.\n", polarity == OV2640_POLARITY_NEGATIVE ? "ok" : "error");
1532
1533 /* ov2640_set_luminance_signal_high_range/ov2640_get_luminance_signal_high_range test */
1534 ov2640_interface_debug_print("ov2640: ov2640_set_luminance_signal_high_range/ov2640_get_luminance_signal_high_range test.\n");
1535
1536 reg8 = rand() % 256;
1537 res = ov2640_set_luminance_signal_high_range(&gs_handle, reg8);
1538 if (res != 0)
1539 {
1540 ov2640_interface_debug_print("ov2640: set luminance signal high range failed.\n");
1541 (void)ov2640_deinit(&gs_handle);
1542
1543 return 1;
1544 }
1545 ov2640_interface_debug_print("ov2640: set luminance signal high range %d.\n", reg8);
1546 res = ov2640_get_luminance_signal_high_range(&gs_handle, &reg8_check);
1547 if (res != 0)
1548 {
1549 ov2640_interface_debug_print("ov2640: get luminance signal high range failed.\n");
1550 (void)ov2640_deinit(&gs_handle);
1551
1552 return 1;
1553 }
1554 ov2640_interface_debug_print("ov2640: check luminance signal high range %s.\n", reg8_check == reg8 ? "ok" : "error");
1555
1556 /* ov2640_set_luminance_signal_low_range/ov2640_get_luminance_signal_low_range test */
1557 ov2640_interface_debug_print("ov2640: ov2640_set_luminance_signal_low_range/ov2640_get_luminance_signal_low_range test.\n");
1558
1559 reg8 = rand() % 256;
1560 res = ov2640_set_luminance_signal_low_range(&gs_handle, reg8);
1561 if (res != 0)
1562 {
1563 ov2640_interface_debug_print("ov2640: set luminance signal low range failed.\n");
1564 (void)ov2640_deinit(&gs_handle);
1565
1566 return 1;
1567 }
1568 ov2640_interface_debug_print("ov2640: set luminance signal low range %d.\n", reg8);
1569 res = ov2640_get_luminance_signal_low_range(&gs_handle, &reg8_check);
1570 if (res != 0)
1571 {
1572 ov2640_interface_debug_print("ov2640: get luminance signal low range failed.\n");
1573 (void)ov2640_deinit(&gs_handle);
1574
1575 return 1;
1576 }
1577 ov2640_interface_debug_print("ov2640: check luminance signal low range %s.\n", reg8_check == reg8 ? "ok" : "error");
1578
1579 /* ov2640_set_luminance_signal_low_range/ov2640_get_luminance_signal_low_range test */
1580 ov2640_interface_debug_print("ov2640: ov2640_set_luminance_signal_low_range/ov2640_get_luminance_signal_low_range test.\n");
1581
1582 high_threshold = rand() % 0xF;
1583 low_threshold = rand() % 0xF;
1584 res = ov2640_set_fast_mode_large_step_range(&gs_handle, high_threshold, low_threshold);
1585 if (res != 0)
1586 {
1587 ov2640_interface_debug_print("ov2640: set fast mode large step range failed.\n");
1588 (void)ov2640_deinit(&gs_handle);
1589
1590 return 1;
1591 }
1592 ov2640_interface_debug_print("ov2640: set fast mode large step range high threshold %d.\n", high_threshold);
1593 ov2640_interface_debug_print("ov2640: set fast mode large step range low threshold %d.\n", low_threshold);
1594 res = ov2640_get_fast_mode_large_step_range(&gs_handle, &high_threshold_check, &low_threshold_check);
1595 if (res != 0)
1596 {
1597 ov2640_interface_debug_print("ov2640: get fast mode large step range failed.\n");
1598 (void)ov2640_deinit(&gs_handle);
1599
1600 return 1;
1601 }
1602 ov2640_interface_debug_print("ov2640: check fast mode large step range high threshold %s.\n", high_threshold == high_threshold_check ? "ok" : "error");
1603 ov2640_interface_debug_print("ov2640: check fast mode large step range low threshold %s.\n", low_threshold == low_threshold_check ? "ok" : "error");
1604
1605 /* ov2640_set_line_interval_adjust/ov2640_get_line_interval_adjust test */
1606 ov2640_interface_debug_print("ov2640: ov2640_set_line_interval_adjust/ov2640_get_line_interval_adjust test.\n");
1607
1608 reg16 = rand() % 0xFFF;
1609 res = ov2640_set_line_interval_adjust(&gs_handle, reg16);
1610 if (res != 0)
1611 {
1612 ov2640_interface_debug_print("ov2640: set line interval adjust failed.\n");
1613 (void)ov2640_deinit(&gs_handle);
1614
1615 return 1;
1616 }
1617 ov2640_interface_debug_print("ov2640: set line interval adjust %d.\n", reg16);
1618 res = ov2640_get_line_interval_adjust(&gs_handle, &reg16_check);
1619 if (res != 0)
1620 {
1621 ov2640_interface_debug_print("ov2640: get line interval adjust failed.\n");
1622 (void)ov2640_deinit(&gs_handle);
1623
1624 return 1;
1625 }
1626 ov2640_interface_debug_print("ov2640: check line interval adjust %s.\n", reg16_check == reg16 ? "ok" : "error");
1627
1628 /* ov2640_set_hsync_position_and_width_end_point/ov2640_get_hsync_position_and_width_end_point test */
1629 ov2640_interface_debug_print("ov2640: ov2640_set_hsync_position_and_width_end_point/ov2640_get_hsync_position_and_width_end_point test.\n");
1630
1631 reg16 = rand() % 0x3FF;
1632 res = ov2640_set_hsync_position_and_width_end_point(&gs_handle, reg16);
1633 if (res != 0)
1634 {
1635 ov2640_interface_debug_print("ov2640: set hsync position and width end point failed.\n");
1636 (void)ov2640_deinit(&gs_handle);
1637
1638 return 1;
1639 }
1640 ov2640_interface_debug_print("ov2640: set hsync position and width end point %d.\n", reg16);
1641 res = ov2640_get_hsync_position_and_width_end_point(&gs_handle, &reg16_check);
1642 if (res != 0)
1643 {
1644 ov2640_interface_debug_print("ov2640: get hsync position and width end point failed.\n");
1645 (void)ov2640_deinit(&gs_handle);
1646
1647 return 1;
1648 }
1649 ov2640_interface_debug_print("ov2640: check hsync position and width end point %s.\n", reg16_check == reg16 ? "ok" : "error");
1650
1651 /* ov2640_set_hsync_position_and_width_start_point/ov2640_get_hsync_position_and_width_start_point test */
1652 ov2640_interface_debug_print("ov2640: ov2640_set_hsync_position_and_width_start_point/ov2640_get_hsync_position_and_width_start_point test.\n");
1653
1654 reg16 = rand() % 0x3FF;
1655 res = ov2640_set_hsync_position_and_width_start_point(&gs_handle, reg16);
1656 if (res != 0)
1657 {
1658 ov2640_interface_debug_print("ov2640: set hsync position and width start point failed.\n");
1659 (void)ov2640_deinit(&gs_handle);
1660
1661 return 1;
1662 }
1663 ov2640_interface_debug_print("ov2640: set hsync position and width start point %d.\n", reg16);
1664 res = ov2640_get_hsync_position_and_width_start_point(&gs_handle, &reg16_check);
1665 if (res != 0)
1666 {
1667 ov2640_interface_debug_print("ov2640: get hsync position and width start point failed.\n");
1668 (void)ov2640_deinit(&gs_handle);
1669
1670 return 1;
1671 }
1672 ov2640_interface_debug_print("ov2640: check hsync position and width start point %s.\n", reg16_check == reg16 ? "ok" : "error");
1673
1674 /* ov2640_set_vsync_pulse_width/ov2640_get_vsync_pulse_width test */
1675 ov2640_interface_debug_print("ov2640: ov2640_set_vsync_pulse_width/ov2640_get_vsync_pulse_width test.\n");
1676
1677 reg16 = rand() % 0xFFF;
1678 res = ov2640_set_vsync_pulse_width(&gs_handle, reg16);
1679 if (res != 0)
1680 {
1681 ov2640_interface_debug_print("ov2640: set vsync pulse width failed.\n");
1682 (void)ov2640_deinit(&gs_handle);
1683
1684 return 1;
1685 }
1686 ov2640_interface_debug_print("ov2640: set vsync pulse width %d.\n", reg16);
1687 res = ov2640_get_vsync_pulse_width(&gs_handle, &reg16_check);
1688 if (res != 0)
1689 {
1690 ov2640_interface_debug_print("ov2640: get vsync pulse width failed.\n");
1691 (void)ov2640_deinit(&gs_handle);
1692
1693 return 1;
1694 }
1695 ov2640_interface_debug_print("ov2640: check vsync pulse width %s.\n", reg16_check == reg16 ? "ok" : "error");
1696
1697 /* ov2640_set_luminance_average/ov2640_get_luminance_average test */
1698 ov2640_interface_debug_print("ov2640: ov2640_set_luminance_average/ov2640_get_luminance_average test.\n");
1699
1700 reg8 = rand() % 256;
1701 res = ov2640_set_luminance_average(&gs_handle, reg8);
1702 if (res != 0)
1703 {
1704 ov2640_interface_debug_print("ov2640: set luminance average failed.\n");
1705 (void)ov2640_deinit(&gs_handle);
1706
1707 return 1;
1708 }
1709 ov2640_interface_debug_print("ov2640: set luminance average %d.\n", reg8);
1710 res = ov2640_get_luminance_average(&gs_handle, &reg8_check);
1711 if (res != 0)
1712 {
1713 ov2640_interface_debug_print("ov2640: get luminance average failed.\n");
1714 (void)ov2640_deinit(&gs_handle);
1715
1716 return 1;
1717 }
1718 ov2640_interface_debug_print("ov2640: check luminance average %s.\n", reg8_check == reg8 ? "ok" : "error");
1719
1720 /* ov2640_set_horizontal_window_start/ov2640_get_horizontal_window_start test */
1721 ov2640_interface_debug_print("ov2640: ov2640_set_horizontal_window_start/ov2640_get_horizontal_window_start test.\n");
1722
1723 reg16 = rand() % 0x7FF;
1724 res = ov2640_set_horizontal_window_start(&gs_handle, reg16);
1725 if (res != 0)
1726 {
1727 ov2640_interface_debug_print("ov2640: set horizontal window start failed.\n");
1728 (void)ov2640_deinit(&gs_handle);
1729
1730 return 1;
1731 }
1732 ov2640_interface_debug_print("ov2640: set horizontal window start %d.\n", reg16);
1733 res = ov2640_get_horizontal_window_start(&gs_handle, &reg16_check);
1734 if (res != 0)
1735 {
1736 ov2640_interface_debug_print("ov2640: get horizontal window start failed.\n");
1737 (void)ov2640_deinit(&gs_handle);
1738
1739 return 1;
1740 }
1741 ov2640_interface_debug_print("ov2640: check horizontal window start %s.\n", reg16_check == reg16 ? "ok" : "error");
1742
1743 /* ov2640_set_horizontal_window_end/ov2640_get_horizontal_window_end test */
1744 ov2640_interface_debug_print("ov2640: ov2640_set_horizontal_window_end/ov2640_get_horizontal_window_end test.\n");
1745
1746 reg16 = rand() % 0x7FF;
1747 res = ov2640_set_horizontal_window_end(&gs_handle, reg16);
1748 if (res != 0)
1749 {
1750 ov2640_interface_debug_print("ov2640: set horizontal window end failed.\n");
1751 (void)ov2640_deinit(&gs_handle);
1752
1753 return 1;
1754 }
1755 ov2640_interface_debug_print("ov2640: set horizontal window end %d.\n", reg16);
1756 res = ov2640_get_horizontal_window_end(&gs_handle, &reg16_check);
1757 if (res != 0)
1758 {
1759 ov2640_interface_debug_print("ov2640: get horizontal window end failed.\n");
1760 (void)ov2640_deinit(&gs_handle);
1761
1762 return 1;
1763 }
1764 ov2640_interface_debug_print("ov2640: check horizontal window end %s.\n", reg16_check == reg16 ? "ok" : "error");
1765
1766 /* ov2640_set_pclk/ov2640_get_pclk test */
1767 ov2640_interface_debug_print("ov2640: ov2640_set_pclk/ov2640_get_pclk test.\n");
1768
1769 /* set pclk no effect */
1770 res = ov2640_set_pclk(&gs_handle, OV2640_PCLK_NO_EFFECT);
1771 if (res != 0)
1772 {
1773 ov2640_interface_debug_print("ov2640: set pclk failed.\n");
1774 (void)ov2640_deinit(&gs_handle);
1775
1776 return 1;
1777 }
1778 ov2640_interface_debug_print("ov2640: set pclk no effect.\n");
1779 res = ov2640_get_pclk(&gs_handle, &pclk);
1780 if (res != 0)
1781 {
1782 ov2640_interface_debug_print("ov2640: get pclk failed.\n");
1783 (void)ov2640_deinit(&gs_handle);
1784
1785 return 1;
1786 }
1787 ov2640_interface_debug_print("ov2640: check pclk %s.\n", pclk == OV2640_PCLK_NO_EFFECT ? "ok" : "error");
1788
1789 /* set pclk divide by 2 */
1790 res = ov2640_set_pclk(&gs_handle, OV2640_PCLK_DIVIDE_2);
1791 if (res != 0)
1792 {
1793 ov2640_interface_debug_print("ov2640: set pclk failed.\n");
1794 (void)ov2640_deinit(&gs_handle);
1795
1796 return 1;
1797 }
1798 ov2640_interface_debug_print("ov2640: set pclk divide by 2.\n");
1799 res = ov2640_get_pclk(&gs_handle, &pclk);
1800 if (res != 0)
1801 {
1802 ov2640_interface_debug_print("ov2640: get pclk failed.\n");
1803 (void)ov2640_deinit(&gs_handle);
1804
1805 return 1;
1806 }
1807 ov2640_interface_debug_print("ov2640: check pclk %s.\n", pclk == OV2640_PCLK_DIVIDE_2 ? "ok" : "error");
1808
1809 /* set pclk divide by 4 */
1810 res = ov2640_set_pclk(&gs_handle, OV2640_PCLK_DIVIDE_4);
1811 if (res != 0)
1812 {
1813 ov2640_interface_debug_print("ov2640: set pclk failed.\n");
1814 (void)ov2640_deinit(&gs_handle);
1815
1816 return 1;
1817 }
1818 ov2640_interface_debug_print("ov2640: set pclk divide by 4.\n");
1819 res = ov2640_get_pclk(&gs_handle, &pclk);
1820 if (res != 0)
1821 {
1822 ov2640_interface_debug_print("ov2640: get pclk failed.\n");
1823 (void)ov2640_deinit(&gs_handle);
1824
1825 return 1;
1826 }
1827 ov2640_interface_debug_print("ov2640: check pclk %s.\n", pclk == OV2640_PCLK_DIVIDE_4 ? "ok" : "error");
1828
1829 /* ov2640_set_zoom_window_horizontal_start_point/ov2640_get_zoom_window_horizontal_start_point test */
1830 ov2640_interface_debug_print("ov2640: ov2640_set_zoom_window_horizontal_start_point/ov2640_get_zoom_window_horizontal_start_point test.\n");
1831
1832 /* enable zoom window horizontal start point */
1834 if (res != 0)
1835 {
1836 ov2640_interface_debug_print("ov2640: set zoom window horizontal start point failed.\n");
1837 (void)ov2640_deinit(&gs_handle);
1838
1839 return 1;
1840 }
1841 ov2640_interface_debug_print("ov2640: enable zoom window horizontal start point.\n");
1842 res = ov2640_get_zoom_window_horizontal_start_point(&gs_handle, &enable);
1843 if (res != 0)
1844 {
1845 ov2640_interface_debug_print("ov2640: get zoom window horizontal start point failed.\n");
1846 (void)ov2640_deinit(&gs_handle);
1847
1848 return 1;
1849 }
1850 ov2640_interface_debug_print("ov2640: check zoom window horizontal start point %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
1851
1852 /* disable zoom window horizontal start point */
1854 if (res != 0)
1855 {
1856 ov2640_interface_debug_print("ov2640: set zoom window horizontal start point failed.\n");
1857 (void)ov2640_deinit(&gs_handle);
1858
1859 return 1;
1860 }
1861 ov2640_interface_debug_print("ov2640: disable zoom window horizontal start point.\n");
1862 res = ov2640_get_zoom_window_horizontal_start_point(&gs_handle, &enable);
1863 if (res != 0)
1864 {
1865 ov2640_interface_debug_print("ov2640: get zoom window horizontal start point failed.\n");
1866 (void)ov2640_deinit(&gs_handle);
1867
1868 return 1;
1869 }
1870 ov2640_interface_debug_print("ov2640: check zoom window horizontal start point %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
1871
1872 /* ov2640_set_frame_length_adjustment/ov2640_get_frame_length_adjustment test */
1873 ov2640_interface_debug_print("ov2640: ov2640_set_frame_length_adjustment/ov2640_get_frame_length_adjustment test.\n");
1874
1875 reg16 = rand() % 0x3FF;
1876 res = ov2640_set_frame_length_adjustment(&gs_handle, reg16);
1877 if (res != 0)
1878 {
1879 ov2640_interface_debug_print("ov2640: set frame length adjustment failed.\n");
1880 (void)ov2640_deinit(&gs_handle);
1881
1882 return 1;
1883 }
1884 ov2640_interface_debug_print("ov2640: set frame length adjustment %d.\n", reg16);
1885 res = ov2640_get_frame_length_adjustment(&gs_handle, &reg16_check);
1886 if (res != 0)
1887 {
1888 ov2640_interface_debug_print("ov2640: get frame length adjustment failed.\n");
1889 (void)ov2640_deinit(&gs_handle);
1890
1891 return 1;
1892 }
1893 ov2640_interface_debug_print("ov2640: check frame length adjustment %s.\n", reg16_check == reg16 ? "ok" : "error");
1894
1895 /* ov2640_set_zoom_mode_vertical_window_start_point/ov2640_get_zoom_mode_vertical_window_start_point test */
1896 ov2640_interface_debug_print("ov2640: ov2640_set_zoom_mode_vertical_window_start_point/ov2640_get_zoom_mode_vertical_window_start_point test.\n");
1897
1898 reg16 = rand() % 0x3FF;
1899 res = ov2640_set_zoom_mode_vertical_window_start_point(&gs_handle, reg16);
1900 if (res != 0)
1901 {
1902 ov2640_interface_debug_print("ov2640: set zoom mode vertical window start point failed.\n");
1903 (void)ov2640_deinit(&gs_handle);
1904
1905 return 1;
1906 }
1907 ov2640_interface_debug_print("ov2640: set zoom mode vertical window start point %d.\n", reg16);
1908 res = ov2640_get_zoom_mode_vertical_window_start_point(&gs_handle, &reg16_check);
1909 if (res != 0)
1910 {
1911 ov2640_interface_debug_print("ov2640: get zoom mode vertical window start point failed.\n");
1912 (void)ov2640_deinit(&gs_handle);
1913
1914 return 1;
1915 }
1916 ov2640_interface_debug_print("ov2640: check zoom mode vertical window start point %s.\n", reg16_check == reg16 ? "ok" : "error");
1917
1918 /* ov2640_set_flash_light/ov2640_get_flash_light test */
1919 ov2640_interface_debug_print("ov2640: ov2640_set_flash_light/ov2640_get_flash_light test.\n");
1920
1921 reg8 = rand() % 256;
1922 res = ov2640_set_flash_light(&gs_handle, reg8);
1923 if (res != 0)
1924 {
1925 ov2640_interface_debug_print("ov2640: set flash light failed.\n");
1926 (void)ov2640_deinit(&gs_handle);
1927
1928 return 1;
1929 }
1930 ov2640_interface_debug_print("ov2640: set flash light %d.\n", reg8);
1931 res = ov2640_get_flash_light(&gs_handle, &reg8_check);
1932 if (res != 0)
1933 {
1934 ov2640_interface_debug_print("ov2640: get flash light failed.\n");
1935 (void)ov2640_deinit(&gs_handle);
1936
1937 return 1;
1938 }
1939 ov2640_interface_debug_print("ov2640: check flash light %s.\n", reg8_check == reg8 ? "ok" : "error");
1940
1941 /* ov2640_set_50hz_banding_aec/ov2640_get_50hz_banding_aec test */
1942 ov2640_interface_debug_print("ov2640: ov2640_set_50hz_banding_aec/ov2640_get_50hz_banding_aec test.\n");
1943
1944 reg16 = rand() % 0x3FF;
1945 res = ov2640_set_50hz_banding_aec(&gs_handle, reg16);
1946 if (res != 0)
1947 {
1948 ov2640_interface_debug_print("ov2640: set 50hz banding aec failed.\n");
1949 (void)ov2640_deinit(&gs_handle);
1950
1951 return 1;
1952 }
1953 ov2640_interface_debug_print("ov2640: set 50hz banding aec %d.\n", reg16);
1954 res = ov2640_get_50hz_banding_aec(&gs_handle, &reg16_check);
1955 if (res != 0)
1956 {
1957 ov2640_interface_debug_print("ov2640: get 50hz banding aec failed.\n");
1958 (void)ov2640_deinit(&gs_handle);
1959
1960 return 1;
1961 }
1962 ov2640_interface_debug_print("ov2640: check 50hz banding aec %s.\n", reg16_check == reg16 ? "ok" : "error");
1963
1964 /* ov2640_set_60hz_banding_aec/ov2640_get_60hz_banding_aec test */
1965 ov2640_interface_debug_print("ov2640: ov2640_set_60hz_banding_aec/ov2640_get_60hz_banding_aec test.\n");
1966
1967 reg16 = rand() % 0x3FF;
1968 res = ov2640_set_60hz_banding_aec(&gs_handle, reg16);
1969 if (res != 0)
1970 {
1971 ov2640_interface_debug_print("ov2640: set 60hz banding aec failed.\n");
1972 (void)ov2640_deinit(&gs_handle);
1973
1974 return 1;
1975 }
1976 ov2640_interface_debug_print("ov2640: set 60hz banding aec %d.\n", reg16);
1977 res = ov2640_get_60hz_banding_aec(&gs_handle, &reg16_check);
1978 if (res != 0)
1979 {
1980 ov2640_interface_debug_print("ov2640: get 60hz banding aec failed.\n");
1981 (void)ov2640_deinit(&gs_handle);
1982
1983 return 1;
1984 }
1985 ov2640_interface_debug_print("ov2640: check 60hz banding aec %s.\n", reg16_check == reg16 ? "ok" : "error");
1986
1987 /* ov2640_set_16_zone_average_weight_option/ov2640_get_16_zone_average_weight_option test */
1988 ov2640_interface_debug_print("ov2640: ov2640_set_16_zone_average_weight_option/ov2640_get_16_zone_average_weight_option test.\n");
1989
1990 reg32 = rand() % 0xFFFFFFF;
1991 res = ov2640_set_16_zone_average_weight_option(&gs_handle, reg32);
1992 if (res != 0)
1993 {
1994 ov2640_interface_debug_print("ov2640: set 16 zone average weight option failed.\n");
1995 (void)ov2640_deinit(&gs_handle);
1996
1997 return 1;
1998 }
1999 ov2640_interface_debug_print("ov2640: set 16 zone average weight option %d.\n", reg32);
2000 res = ov2640_get_16_zone_average_weight_option(&gs_handle, &reg32_check);
2001 if (res != 0)
2002 {
2003 ov2640_interface_debug_print("ov2640: get 16 zone average weight option failed.\n");
2004 (void)ov2640_deinit(&gs_handle);
2005
2006 return 1;
2007 }
2008 ov2640_interface_debug_print("ov2640: check 16 zone average weight option %s.\n", reg32_check == reg32 ? "ok" : "error");
2009
2010 /* ov2640_set_histogram_algorithm_low_level/ov2640_get_histogram_algorithm_low_level test */
2011 ov2640_interface_debug_print("ov2640: ov2640_set_histogram_algorithm_low_level/ov2640_get_histogram_algorithm_low_level test.\n");
2012
2013 reg8 = rand() % 256;
2014 res = ov2640_set_histogram_algorithm_low_level(&gs_handle, reg8);
2015 if (res != 0)
2016 {
2017 ov2640_interface_debug_print("ov2640: set histogram algorithm low level failed.\n");
2018 (void)ov2640_deinit(&gs_handle);
2019
2020 return 1;
2021 }
2022 ov2640_interface_debug_print("ov2640: set histogram algorithm low level %d.\n", reg8);
2023 res = ov2640_get_histogram_algorithm_low_level(&gs_handle, &reg8_check);
2024 if (res != 0)
2025 {
2026 ov2640_interface_debug_print("ov2640: get histogram algorithm low level failed.\n");
2027 (void)ov2640_deinit(&gs_handle);
2028
2029 return 1;
2030 }
2031 ov2640_interface_debug_print("ov2640: check histogram algorithm low level %s.\n", reg8_check == reg8 ? "ok" : "error");
2032
2033 /* ov2640_set_histogram_algorithm_high_level/ov2640_get_histogram_algorithm_high_level test */
2034 ov2640_interface_debug_print("ov2640: ov2640_set_histogram_algorithm_high_level/ov2640_get_histogram_algorithm_high_level test.\n");
2035
2036 reg8 = rand() % 256;
2037 res = ov2640_set_histogram_algorithm_high_level(&gs_handle, reg8);
2038 if (res != 0)
2039 {
2040 ov2640_interface_debug_print("ov2640: set histogram algorithm high level failed.\n");
2041 (void)ov2640_deinit(&gs_handle);
2042
2043 return 1;
2044 }
2045 ov2640_interface_debug_print("ov2640: set histogram algorithm high level %d.\n", reg8);
2046 res = ov2640_get_histogram_algorithm_high_level(&gs_handle, &reg8_check);
2047 if (res != 0)
2048 {
2049 ov2640_interface_debug_print("ov2640: get histogram algorithm high level failed.\n");
2050 (void)ov2640_deinit(&gs_handle);
2051
2052 return 1;
2053 }
2054 ov2640_interface_debug_print("ov2640: check histogram algorithm high level %s.\n", reg8_check == reg8 ? "ok" : "error");
2055
2056 /* ov2640_set_dsp_bypass/ov2640_get_dsp_bypass test */
2057 ov2640_interface_debug_print("ov2640: ov2640_set_dsp_bypass/ov2640_get_dsp_bypass test.\n");
2058
2059 /* disable dsp bypass */
2060 res = ov2640_set_dsp_bypass(&gs_handle, OV2640_BOOL_FALSE);
2061 if (res != 0)
2062 {
2063 ov2640_interface_debug_print("ov2640: set dsp bypass failed.\n");
2064 (void)ov2640_deinit(&gs_handle);
2065
2066 return 1;
2067 }
2068 ov2640_interface_debug_print("ov2640: disable dsp bypass.\n");
2069 res = ov2640_get_dsp_bypass(&gs_handle, &enable);
2070 if (res != 0)
2071 {
2072 ov2640_interface_debug_print("ov2640: get dsp bypass failed.\n");
2073 (void)ov2640_deinit(&gs_handle);
2074
2075 return 1;
2076 }
2077 ov2640_interface_debug_print("ov2640: check dsp bypass %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
2078
2079 /* enable dsp bypass */
2080 res = ov2640_set_dsp_bypass(&gs_handle, OV2640_BOOL_TRUE);
2081 if (res != 0)
2082 {
2083 ov2640_interface_debug_print("ov2640: set dsp bypass failed.\n");
2084 (void)ov2640_deinit(&gs_handle);
2085
2086 return 1;
2087 }
2088 ov2640_interface_debug_print("ov2640: enable dsp bypass.\n");
2089 res = ov2640_get_dsp_bypass(&gs_handle, &enable);
2090 if (res != 0)
2091 {
2092 ov2640_interface_debug_print("ov2640: get dsp bypass failed.\n");
2093 (void)ov2640_deinit(&gs_handle);
2094
2095 return 1;
2096 }
2097 ov2640_interface_debug_print("ov2640: check dsp bypass %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
2098
2099 /* ov2640_set_auto_mode/ov2640_get_auto_mode test */
2100 ov2640_interface_debug_print("ov2640: ov2640_set_auto_mode/ov2640_get_auto_mode test.\n");
2101
2102 /* enable auto mode */
2103 res = ov2640_set_auto_mode(&gs_handle, OV2640_BOOL_TRUE);
2104 if (res != 0)
2105 {
2106 ov2640_interface_debug_print("ov2640: set auto mode failed.\n");
2107 (void)ov2640_deinit(&gs_handle);
2108
2109 return 1;
2110 }
2111 ov2640_interface_debug_print("ov2640: enable auto mode.\n");
2112 res = ov2640_get_auto_mode(&gs_handle, &enable);
2113 if (res != 0)
2114 {
2115 ov2640_interface_debug_print("ov2640: get auto mode failed.\n");
2116 (void)ov2640_deinit(&gs_handle);
2117
2118 return 1;
2119 }
2120 ov2640_interface_debug_print("ov2640: check auto mode %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
2121
2122 /* disable auto mode */
2123 res = ov2640_set_auto_mode(&gs_handle, OV2640_BOOL_FALSE);
2124 if (res != 0)
2125 {
2126 ov2640_interface_debug_print("ov2640: set auto mode failed.\n");
2127 (void)ov2640_deinit(&gs_handle);
2128
2129 return 1;
2130 }
2131 ov2640_interface_debug_print("ov2640: disable auto mode.\n");
2132 res = ov2640_get_auto_mode(&gs_handle, &enable);
2133 if (res != 0)
2134 {
2135 ov2640_interface_debug_print("ov2640: get auto mode failed.\n");
2136 (void)ov2640_deinit(&gs_handle);
2137
2138 return 1;
2139 }
2140 ov2640_interface_debug_print("ov2640: check auto mode %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
2141
2142 /* ov2640_set_dvp_pclk/ov2640_get_dvp_pclk test */
2143 ov2640_interface_debug_print("ov2640: ov2640_set_dvp_pclk/ov2640_get_dvp_pclk test.\n");
2144
2145 reg8 = rand() % 0x7F;
2146 res = ov2640_set_dvp_pclk(&gs_handle, reg8);
2147 if (res != 0)
2148 {
2149 ov2640_interface_debug_print("ov2640: set dvp pclk failed.\n");
2150 (void)ov2640_deinit(&gs_handle);
2151
2152 return 1;
2153 }
2154 ov2640_interface_debug_print("ov2640: set dvp pclk %d.\n", reg8);
2155 res = ov2640_get_dvp_pclk(&gs_handle, &reg8_check);
2156 if (res != 0)
2157 {
2158 ov2640_interface_debug_print("ov2640: get dvp pclk failed.\n");
2159 (void)ov2640_deinit(&gs_handle);
2160
2161 return 1;
2162 }
2163 ov2640_interface_debug_print("ov2640: check dvp pclk %s.\n", reg8 == reg8_check ? "ok" : "error");
2164
2165 /* ov2640_set_dvp_y8/ov2640_get_dvp_y8 test */
2166 ov2640_interface_debug_print("ov2640: ov2640_set_dvp_y8/ov2640_get_dvp_y8 test.\n");
2167
2168 /* disable dvp y8 */
2169 res = ov2640_set_dvp_y8(&gs_handle, OV2640_BOOL_FALSE);
2170 if (res != 0)
2171 {
2172 ov2640_interface_debug_print("ov2640: set dvp y8 failed.\n");
2173 (void)ov2640_deinit(&gs_handle);
2174
2175 return 1;
2176 }
2177 ov2640_interface_debug_print("ov2640: disable dvp y8.\n");
2178 res = ov2640_get_dvp_y8(&gs_handle, &enable);
2179 if (res != 0)
2180 {
2181 ov2640_interface_debug_print("ov2640: get dvp y8 failed.\n");
2182 (void)ov2640_deinit(&gs_handle);
2183
2184 return 1;
2185 }
2186 ov2640_interface_debug_print("ov2640: check dvp y8 %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
2187
2188 /* enable dvp y8 */
2189 res = ov2640_set_dvp_y8(&gs_handle, OV2640_BOOL_TRUE);
2190 if (res != 0)
2191 {
2192 ov2640_interface_debug_print("ov2640: set dvp y8 failed.\n");
2193 (void)ov2640_deinit(&gs_handle);
2194
2195 return 1;
2196 }
2197 ov2640_interface_debug_print("ov2640: enable dvp y8.\n");
2198 res = ov2640_get_dvp_y8(&gs_handle, &enable);
2199 if (res != 0)
2200 {
2201 ov2640_interface_debug_print("ov2640: get dvp y8 failed.\n");
2202 (void)ov2640_deinit(&gs_handle);
2203
2204 return 1;
2205 }
2206 ov2640_interface_debug_print("ov2640: check dvp y8 %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
2207
2208 /* ov2640_set_jpeg_output/ov2640_get_jpeg_output test */
2209 ov2640_interface_debug_print("ov2640: ov2640_set_jpeg_output/ov2640_get_jpeg_output test.\n");
2210
2211 /* disable jpeg output */
2212 res = ov2640_set_jpeg_output(&gs_handle, OV2640_BOOL_FALSE);
2213 if (res != 0)
2214 {
2215 ov2640_interface_debug_print("ov2640: set jpeg output failed.\n");
2216 (void)ov2640_deinit(&gs_handle);
2217
2218 return 1;
2219 }
2220 ov2640_interface_debug_print("ov2640: disable jpeg output.\n");
2221 res = ov2640_get_jpeg_output(&gs_handle, &enable);
2222 if (res != 0)
2223 {
2224 ov2640_interface_debug_print("ov2640: get jpeg output failed.\n");
2225 (void)ov2640_deinit(&gs_handle);
2226
2227 return 1;
2228 }
2229 ov2640_interface_debug_print("ov2640: check jpeg output %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
2230
2231 /* enable jpeg output */
2232 res = ov2640_set_jpeg_output(&gs_handle, OV2640_BOOL_TRUE);
2233 if (res != 0)
2234 {
2235 ov2640_interface_debug_print("ov2640: set jpeg output failed.\n");
2236 (void)ov2640_deinit(&gs_handle);
2237
2238 return 1;
2239 }
2240 ov2640_interface_debug_print("ov2640: enable jpeg output.\n");
2241 res = ov2640_get_jpeg_output(&gs_handle, &enable);
2242 if (res != 0)
2243 {
2244 ov2640_interface_debug_print("ov2640: get jpeg output failed.\n");
2245 (void)ov2640_deinit(&gs_handle);
2246
2247 return 1;
2248 }
2249 ov2640_interface_debug_print("ov2640: check jpeg output %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
2250
2251 /* ov2640_set_dvp_output_format/ov2640_get_dvp_output_format test */
2252 ov2640_interface_debug_print("ov2640: ov2640_set_dvp_output_format/ov2640_get_dvp_output_format test.\n");
2253
2254 /* set dvp output format yuv422 */
2256 if (res != 0)
2257 {
2258 ov2640_interface_debug_print("ov2640: set dvp output format failed.\n");
2259 (void)ov2640_deinit(&gs_handle);
2260
2261 return 1;
2262 }
2263 ov2640_interface_debug_print("ov2640: set dvp output format yuv422.\n");
2264 res = ov2640_get_dvp_output_format(&gs_handle, &format);
2265 if (res != 0)
2266 {
2267 ov2640_interface_debug_print("ov2640: get dvp output format failed.\n");
2268 (void)ov2640_deinit(&gs_handle);
2269
2270 return 1;
2271 }
2272 ov2640_interface_debug_print("ov2640: check dvp output format %s.\n", format == OV2640_DVP_OUTPUT_FORMAT_YUV422 ? "ok" : "error");
2273
2274 /* set dvp output format dvp raw10 */
2276 if (res != 0)
2277 {
2278 ov2640_interface_debug_print("ov2640: set dvp output format failed.\n");
2279 (void)ov2640_deinit(&gs_handle);
2280
2281 return 1;
2282 }
2283 ov2640_interface_debug_print("ov2640: set dvp output format dvp raw10.\n");
2284 res = ov2640_get_dvp_output_format(&gs_handle, &format);
2285 if (res != 0)
2286 {
2287 ov2640_interface_debug_print("ov2640: get dvp output format failed.\n");
2288 (void)ov2640_deinit(&gs_handle);
2289
2290 return 1;
2291 }
2292 ov2640_interface_debug_print("ov2640: check dvp output format %s.\n", format == OV2640_DVP_OUTPUT_FORMAT_RAW10 ? "ok" : "error");
2293
2294 /* set dvp output format rgb565 */
2296 if (res != 0)
2297 {
2298 ov2640_interface_debug_print("ov2640: set dvp output format failed.\n");
2299 (void)ov2640_deinit(&gs_handle);
2300
2301 return 1;
2302 }
2303 ov2640_interface_debug_print("ov2640: set dvp output format rgb565.\n");
2304 res = ov2640_get_dvp_output_format(&gs_handle, &format);
2305 if (res != 0)
2306 {
2307 ov2640_interface_debug_print("ov2640: get dvp output format failed.\n");
2308 (void)ov2640_deinit(&gs_handle);
2309
2310 return 1;
2311 }
2312 ov2640_interface_debug_print("ov2640: check dvp output format %s.\n", format == OV2640_DVP_OUTPUT_FORMAT_RGB565 ? "ok" : "error");
2313
2314 /* ov2640_set_dvp_jpeg_output_href_timing/ov2640_get_dvp_jpeg_output_href_timing test */
2315 ov2640_interface_debug_print("ov2640: ov2640_set_dvp_jpeg_output_href_timing/ov2640_get_dvp_jpeg_output_href_timing test.\n");
2316
2317 /* set href is same as sensor */
2319 if (res != 0)
2320 {
2321 ov2640_interface_debug_print("ov2640: set dvp jpeg output href timing failed.\n");
2322 (void)ov2640_deinit(&gs_handle);
2323
2324 return 1;
2325 }
2326 ov2640_interface_debug_print("ov2640: set href is same as sensor.\n");
2327 res = ov2640_get_dvp_jpeg_output_href_timing(&gs_handle, &timing);
2328 if (res != 0)
2329 {
2330 ov2640_interface_debug_print("ov2640: get dvp jpeg output href timing failed.\n");
2331 (void)ov2640_deinit(&gs_handle);
2332
2333 return 1;
2334 }
2335 ov2640_interface_debug_print("ov2640: check dvp jpeg output href timing %s.\n", timing == OV2640_HREF_TIMING_SENSOR ? "ok" : "error");
2336
2337 /* set href vsync */
2339 if (res != 0)
2340 {
2341 ov2640_interface_debug_print("ov2640: set dvp jpeg output href timing failed.\n");
2342 (void)ov2640_deinit(&gs_handle);
2343
2344 return 1;
2345 }
2346 ov2640_interface_debug_print("ov2640: set href vsync.\n");
2347 res = ov2640_get_dvp_jpeg_output_href_timing(&gs_handle, &timing);
2348 if (res != 0)
2349 {
2350 ov2640_interface_debug_print("ov2640: get dvp jpeg output href timing failed.\n");
2351 (void)ov2640_deinit(&gs_handle);
2352
2353 return 1;
2354 }
2355 ov2640_interface_debug_print("ov2640: check dvp jpeg output href timing %s.\n", timing == OV2640_HREF_TIMING_VSYNC ? "ok" : "error");
2356
2357 /* ov2640_set_byte_swap/ov2640_get_byte_swap test */
2358 ov2640_interface_debug_print("ov2640: ov2640_set_byte_swap/ov2640_get_byte_swap test.\n");
2359
2360 /* set high byte first */
2362 if (res != 0)
2363 {
2364 ov2640_interface_debug_print("ov2640: set byte swap failed.\n");
2365 (void)ov2640_deinit(&gs_handle);
2366
2367 return 1;
2368 }
2369 ov2640_interface_debug_print("ov2640: set high byte first.\n");
2370 res = ov2640_get_byte_swap(&gs_handle, &byte_swap);
2371 if (res != 0)
2372 {
2373 ov2640_interface_debug_print("ov2640: get byte swap failed.\n");
2374 (void)ov2640_deinit(&gs_handle);
2375
2376 return 1;
2377 }
2378 ov2640_interface_debug_print("ov2640: check byte swap %s.\n", byte_swap == OV2640_BYTE_SWAP_YUYV ? "ok" : "error");
2379
2380 /* set low byte first */
2382 if (res != 0)
2383 {
2384 ov2640_interface_debug_print("ov2640: set byte swap failed.\n");
2385 (void)ov2640_deinit(&gs_handle);
2386
2387 return 1;
2388 }
2389 ov2640_interface_debug_print("ov2640: set low byte first.\n");
2390 res = ov2640_get_byte_swap(&gs_handle, &byte_swap);
2391 if (res != 0)
2392 {
2393 ov2640_interface_debug_print("ov2640: get byte swap failed.\n");
2394 (void)ov2640_deinit(&gs_handle);
2395
2396 return 1;
2397 }
2398 ov2640_interface_debug_print("ov2640: check byte swap %s.\n", byte_swap == OV2640_BYTE_SWAP_UVUV ? "ok" : "error");
2399
2400 /* ov2640_set_reset/ov2640_get_reset test */
2401 ov2640_interface_debug_print("ov2640: ov2640_set_reset/ov2640_get_reset test.\n");
2402
2403 /* microcontroller reset */
2405 if (res != 0)
2406 {
2407 ov2640_interface_debug_print("ov2640: set reset failed.\n");
2408 (void)ov2640_deinit(&gs_handle);
2409
2410 return 1;
2411 }
2412 ov2640_interface_debug_print("ov2640: microcontroller reset.\n");
2413 res = ov2640_get_reset(&gs_handle, OV2640_RESET_MICROCONTROLLER, &enable);
2414 if (res != 0)
2415 {
2416 ov2640_interface_debug_print("ov2640: get reset failed.\n");
2417 (void)ov2640_deinit(&gs_handle);
2418
2419 return 1;
2420 }
2421 ov2640_interface_debug_print("ov2640: check microcontroller reset %s.\n", res == 0 ? "ok" : "error");
2422
2423 /* sccb reset */
2425 if (res != 0)
2426 {
2427 ov2640_interface_debug_print("ov2640: set reset failed.\n");
2428 (void)ov2640_deinit(&gs_handle);
2429
2430 return 1;
2431 }
2432 ov2640_interface_debug_print("ov2640: sccb reset.\n");
2433 res = ov2640_get_reset(&gs_handle, OV2640_RESET_SCCB, &enable);
2434 if (res != 0)
2435 {
2436 ov2640_interface_debug_print("ov2640: get reset failed.\n");
2437 (void)ov2640_deinit(&gs_handle);
2438
2439 return 1;
2440 }
2441 ov2640_interface_debug_print("ov2640: check sccb reset %s.\n", res == 0 ? "ok" : "error");
2442
2443 /* jpeg reset */
2445 if (res != 0)
2446 {
2447 ov2640_interface_debug_print("ov2640: set reset failed.\n");
2448 (void)ov2640_deinit(&gs_handle);
2449
2450 return 1;
2451 }
2452 ov2640_interface_debug_print("ov2640: jpeg reset.\n");
2453 res = ov2640_get_reset(&gs_handle, OV2640_RESET_JPEG, &enable);
2454 if (res != 0)
2455 {
2456 ov2640_interface_debug_print("ov2640: get reset failed.\n");
2457 (void)ov2640_deinit(&gs_handle);
2458
2459 return 1;
2460 }
2461 ov2640_interface_debug_print("ov2640: check jpeg reset %s.\n", res == 0 ? "ok" : "error");
2462
2463 /* dvp reset */
2465 if (res != 0)
2466 {
2467 ov2640_interface_debug_print("ov2640: set reset failed.\n");
2468 (void)ov2640_deinit(&gs_handle);
2469
2470 return 1;
2471 }
2472 ov2640_interface_debug_print("ov2640: dvp reset.\n");
2473 res = ov2640_get_reset(&gs_handle, OV2640_RESET_DVP, &enable);
2474 if (res != 0)
2475 {
2476 ov2640_interface_debug_print("ov2640: get reset failed.\n");
2477 (void)ov2640_deinit(&gs_handle);
2478
2479 return 1;
2480 }
2481 ov2640_interface_debug_print("ov2640: check dvp reset %s.\n", res == 0 ? "ok" : "error");
2482
2483 /* ipu reset */
2485 if (res != 0)
2486 {
2487 ov2640_interface_debug_print("ov2640: set reset failed.\n");
2488 (void)ov2640_deinit(&gs_handle);
2489
2490 return 1;
2491 }
2492 ov2640_interface_debug_print("ov2640: ipu reset.\n");
2493 res = ov2640_get_reset(&gs_handle, OV2640_RESET_IPU, &enable);
2494 if (res != 0)
2495 {
2496 ov2640_interface_debug_print("ov2640: get reset failed.\n");
2497 (void)ov2640_deinit(&gs_handle);
2498
2499 return 1;
2500 }
2501 ov2640_interface_debug_print("ov2640: check ipu reset %s.\n", res == 0 ? "ok" : "error");
2502
2503 /* ov2640_set_sccb_master_speed/ov2640_get_sccb_master_speed test */
2504 ov2640_interface_debug_print("ov2640: ov2640_set_sccb_master_speed/ov2640_get_sccb_master_speed test.\n");
2505
2506 reg8 = rand() % 256;
2507 res = ov2640_set_sccb_master_speed(&gs_handle, reg8);
2508 if (res != 0)
2509 {
2510 ov2640_interface_debug_print("ov2640: set sccb master speed failed.\n");
2511 (void)ov2640_deinit(&gs_handle);
2512
2513 return 1;
2514 }
2515 ov2640_interface_debug_print("ov2640: set sccb master speed %d.\n", reg8);
2516 res = ov2640_get_sccb_master_speed(&gs_handle, &reg8_check);
2517 if (res != 0)
2518 {
2519 ov2640_interface_debug_print("ov2640: get sccb master speed failed.\n");
2520 (void)ov2640_deinit(&gs_handle);
2521
2522 return 1;
2523 }
2524 ov2640_interface_debug_print("ov2640: check sccb master speed %s.\n", reg8 == reg8_check ? "ok" : "error");
2525
2526 /* ov2640_set_sccb_slave_id/ov2640_get_sccb_slave_id test */
2527 ov2640_interface_debug_print("ov2640: ov2640_set_sccb_slave_id/ov2640_get_sccb_slave_id test.\n");
2528
2529 reg8 = 0x60;
2530 res = ov2640_set_sccb_slave_id(&gs_handle, reg8);
2531 if (res != 0)
2532 {
2533 ov2640_interface_debug_print("ov2640: set sccb slave id failed.\n");
2534 (void)ov2640_deinit(&gs_handle);
2535
2536 return 1;
2537 }
2538 ov2640_interface_debug_print("ov2640: set sccb slave id %d.\n", reg8);
2539 res = ov2640_get_sccb_slave_id(&gs_handle, &reg8_check);
2540 if (res != 0)
2541 {
2542 ov2640_interface_debug_print("ov2640: get sccb slave id failed.\n");
2543 (void)ov2640_deinit(&gs_handle);
2544
2545 return 1;
2546 }
2547 ov2640_interface_debug_print("ov2640: check sccb slave id %s.\n", reg8 == reg8_check ? "ok" : "error");
2548
2549 /* ov2640_set_address_auto_increase/ov2640_get_address_auto_increase test */
2550 ov2640_interface_debug_print("ov2640: ov2640_set_address_auto_increase/ov2640_get_address_auto_increase test.\n");
2551
2552 /* disable address auto increase */
2554 if (res != 0)
2555 {
2556 ov2640_interface_debug_print("ov2640: set address auto increase failed.\n");
2557 (void)ov2640_deinit(&gs_handle);
2558
2559 return 1;
2560 }
2561 ov2640_interface_debug_print("ov2640: disable address auto increase.\n");
2562 res = ov2640_get_address_auto_increase(&gs_handle, &enable);
2563 if (res != 0)
2564 {
2565 ov2640_interface_debug_print("ov2640: get address auto increase failed.\n");
2566 (void)ov2640_deinit(&gs_handle);
2567
2568 return 1;
2569 }
2570 ov2640_interface_debug_print("ov2640: check address auto increase %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
2571
2572 /* enable address auto increase */
2574 if (res != 0)
2575 {
2576 ov2640_interface_debug_print("ov2640: set address auto increase failed.\n");
2577 (void)ov2640_deinit(&gs_handle);
2578
2579 return 1;
2580 }
2581 ov2640_interface_debug_print("ov2640: enable address auto increase.\n");
2582 res = ov2640_get_address_auto_increase(&gs_handle, &enable);
2583 if (res != 0)
2584 {
2585 ov2640_interface_debug_print("ov2640: get address auto increase failed.\n");
2586 (void)ov2640_deinit(&gs_handle);
2587
2588 return 1;
2589 }
2590 ov2640_interface_debug_print("ov2640: check address auto increase %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
2591
2592 /* ov2640_set_sccb/ov2640_get_sccb test */
2593 ov2640_interface_debug_print("ov2640: ov2640_set_sccb/ov2640_get_sccb test.\n");
2594
2595 /* enable sccb */
2596 res = ov2640_set_sccb(&gs_handle, OV2640_BOOL_TRUE);
2597 if (res != 0)
2598 {
2599 ov2640_interface_debug_print("ov2640: set sccb failed.\n");
2600 (void)ov2640_deinit(&gs_handle);
2601
2602 return 1;
2603 }
2604 ov2640_interface_debug_print("ov2640: enable sccb.\n");
2605 res = ov2640_get_sccb(&gs_handle, &enable);
2606 if (res != 0)
2607 {
2608 ov2640_interface_debug_print("ov2640: get sccb failed.\n");
2609 (void)ov2640_deinit(&gs_handle);
2610
2611 return 1;
2612 }
2613 ov2640_interface_debug_print("ov2640: check sccb %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
2614
2615 /* ov2640_set_sccb_master_clock_delay/ov2640_get_sccb_master_clock_delay test */
2616 ov2640_interface_debug_print("ov2640: ov2640_set_sccb_master_clock_delay/ov2640_get_sccb_master_clock_delay test.\n");
2617
2618 /* enable sccb master clock delay */
2620 if (res != 0)
2621 {
2622 ov2640_interface_debug_print("ov2640: set sccb master clock delay failed.\n");
2623 (void)ov2640_deinit(&gs_handle);
2624
2625 return 1;
2626 }
2627 ov2640_interface_debug_print("ov2640: enable sccb master clock delay.\n");
2628 res = ov2640_get_sccb_master_clock_delay(&gs_handle, &enable);
2629 if (res != 0)
2630 {
2631 ov2640_interface_debug_print("ov2640: get sccb master clock delay failed.\n");
2632 (void)ov2640_deinit(&gs_handle);
2633
2634 return 1;
2635 }
2636 ov2640_interface_debug_print("ov2640: check sccb master clock delay %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
2637
2638 /* disable sccb master clock delay */
2640 if (res != 0)
2641 {
2642 ov2640_interface_debug_print("ov2640: set sccb master clock delay failed.\n");
2643 (void)ov2640_deinit(&gs_handle);
2644
2645 return 1;
2646 }
2647 ov2640_interface_debug_print("ov2640: disable sccb master clock delay.\n");
2648 res = ov2640_get_sccb_master_clock_delay(&gs_handle, &enable);
2649 if (res != 0)
2650 {
2651 ov2640_interface_debug_print("ov2640: get sccb master clock delay failed.\n");
2652 (void)ov2640_deinit(&gs_handle);
2653
2654 return 1;
2655 }
2656 ov2640_interface_debug_print("ov2640: check sccb master clock delay %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
2657
2658 /* ov2640_set_sccb_master_access/ov2640_get_sccb_master_access test */
2659 ov2640_interface_debug_print("ov2640: ov2640_set_sccb_master_access/ov2640_get_sccb_master_access test.\n");
2660
2661 /* enable sccb master access */
2663 if (res != 0)
2664 {
2665 ov2640_interface_debug_print("ov2640: set sccb master access failed.\n");
2666 (void)ov2640_deinit(&gs_handle);
2667
2668 return 1;
2669 }
2670 ov2640_interface_debug_print("ov2640: enable sccb master access.\n");
2671 res = ov2640_get_sccb_master_access(&gs_handle, &enable);
2672 if (res != 0)
2673 {
2674 ov2640_interface_debug_print("ov2640: get sccb master access failed.\n");
2675 (void)ov2640_deinit(&gs_handle);
2676
2677 return 1;
2678 }
2679 ov2640_interface_debug_print("ov2640: check sccb master access %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
2680
2681 /* disable sccb master access */
2683 if (res != 0)
2684 {
2685 ov2640_interface_debug_print("ov2640: set sccb master access failed.\n");
2686 (void)ov2640_deinit(&gs_handle);
2687
2688 return 1;
2689 }
2690 ov2640_interface_debug_print("ov2640: disable sccb master access.\n");
2691 res = ov2640_get_sccb_master_access(&gs_handle, &enable);
2692 if (res != 0)
2693 {
2694 ov2640_interface_debug_print("ov2640: get sccb master access failed.\n");
2695 (void)ov2640_deinit(&gs_handle);
2696
2697 return 1;
2698 }
2699 ov2640_interface_debug_print("ov2640: check sccb master access %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
2700
2701 /* ov2640_set_sensor_pass_through_access/ov2640_get_sensor_pass_through_access test */
2702 ov2640_interface_debug_print("ov2640: ov2640_set_sensor_pass_through_access/ov2640_get_sensor_pass_through_access test.\n");
2703
2704 /* enable sensor pass through access */
2706 if (res != 0)
2707 {
2708 ov2640_interface_debug_print("ov2640: set sensor pass through access failed.\n");
2709 (void)ov2640_deinit(&gs_handle);
2710
2711 return 1;
2712 }
2713 ov2640_interface_debug_print("ov2640: enable sensor pass through access.\n");
2714 res = ov2640_get_sensor_pass_through_access(&gs_handle, &enable);
2715 if (res != 0)
2716 {
2717 ov2640_interface_debug_print("ov2640: get sensor pass through access failed.\n");
2718 (void)ov2640_deinit(&gs_handle);
2719
2720 return 1;
2721 }
2722 ov2640_interface_debug_print("ov2640: check sensor pass through access %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
2723
2724 /* disable sensor pass through access */
2726 if (res != 0)
2727 {
2728 ov2640_interface_debug_print("ov2640: set sensor pass through access failed.\n");
2729 (void)ov2640_deinit(&gs_handle);
2730
2731 return 1;
2732 }
2733 ov2640_interface_debug_print("ov2640: disable sensor pass through access.\n");
2734 res = ov2640_get_sensor_pass_through_access(&gs_handle, &enable);
2735 if (res != 0)
2736 {
2737 ov2640_interface_debug_print("ov2640: get sensor pass through access failed.\n");
2738 (void)ov2640_deinit(&gs_handle);
2739
2740 return 1;
2741 }
2742 ov2640_interface_debug_print("ov2640: check sensor pass through access %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
2743
2744 /* ov2640_set_bist/ov2640_get_bist test */
2745 ov2640_interface_debug_print("ov2640: ov2640_set_bist/ov2640_get_bist test.\n");
2746
2747 /* enable microcontroller reset */
2749 if (res != 0)
2750 {
2751 ov2640_interface_debug_print("ov2640: set bist failed.\n");
2752 (void)ov2640_deinit(&gs_handle);
2753
2754 return 1;
2755 }
2756 ov2640_interface_debug_print("ov2640: enable microcontroller reset.\n");
2757 res = ov2640_get_bist(&gs_handle, OV2640_BIST_MICROCONTROLLER_RESET, &enable);
2758 if (res != 0)
2759 {
2760 ov2640_interface_debug_print("ov2640: get bist failed.\n");
2761 (void)ov2640_deinit(&gs_handle);
2762
2763 return 1;
2764 }
2765 ov2640_interface_debug_print("ov2640: check bist %s.\n", res == 0 ? "ok" : "error");
2766
2767 /* disable microcontroller reset */
2769 if (res != 0)
2770 {
2771 ov2640_interface_debug_print("ov2640: set bist failed.\n");
2772 (void)ov2640_deinit(&gs_handle);
2773
2774 return 1;
2775 }
2776 ov2640_interface_debug_print("ov2640: disable microcontroller reset.\n");
2777 res = ov2640_get_bist(&gs_handle, OV2640_BIST_MICROCONTROLLER_RESET, &enable);
2778 if (res != 0)
2779 {
2780 ov2640_interface_debug_print("ov2640: get bist failed.\n");
2781 (void)ov2640_deinit(&gs_handle);
2782
2783 return 1;
2784 }
2785 ov2640_interface_debug_print("ov2640: check bist %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
2786
2787 /* enable boot rom select */
2789 if (res != 0)
2790 {
2791 ov2640_interface_debug_print("ov2640: set bist failed.\n");
2792 (void)ov2640_deinit(&gs_handle);
2793
2794 return 1;
2795 }
2796 ov2640_interface_debug_print("ov2640: enable boot rom select.\n");
2797 res = ov2640_get_bist(&gs_handle, OV2640_BIST_BOOT_ROM, &enable);
2798 if (res != 0)
2799 {
2800 ov2640_interface_debug_print("ov2640: get bist failed.\n");
2801 (void)ov2640_deinit(&gs_handle);
2802
2803 return 1;
2804 }
2805 ov2640_interface_debug_print("ov2640: check bist %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
2806
2807 /* disable boot rom select */
2809 if (res != 0)
2810 {
2811 ov2640_interface_debug_print("ov2640: set bist failed.\n");
2812 (void)ov2640_deinit(&gs_handle);
2813
2814 return 1;
2815 }
2816 ov2640_interface_debug_print("ov2640: disable boot rom select.\n");
2817 res = ov2640_get_bist(&gs_handle, OV2640_BIST_BOOT_ROM, &enable);
2818 if (res != 0)
2819 {
2820 ov2640_interface_debug_print("ov2640: get bist failed.\n");
2821 (void)ov2640_deinit(&gs_handle);
2822
2823 return 1;
2824 }
2825 ov2640_interface_debug_print("ov2640: check bist %s.\n", res == 0 ? "ok" : "error");
2826
2827 /* enable r/w 1 error for 12k - byte memory */
2829 if (res != 0)
2830 {
2831 ov2640_interface_debug_print("ov2640: set bist failed.\n");
2832 (void)ov2640_deinit(&gs_handle);
2833
2834 return 1;
2835 }
2836 ov2640_interface_debug_print("ov2640: enable r/w 1 error for 12k - byte memory.\n");
2837 res = ov2640_get_bist(&gs_handle, OV2640_BIST_RW_1_ERROR_12K_BYTE, &enable);
2838 if (res != 0)
2839 {
2840 ov2640_interface_debug_print("ov2640: get bist failed.\n");
2841 (void)ov2640_deinit(&gs_handle);
2842
2843 return 1;
2844 }
2845 ov2640_interface_debug_print("ov2640: check bist %s.\n", res == 0 ? "ok" : "error");
2846
2847 /* disable r/w 1 error for 12k - byte memory */
2849 if (res != 0)
2850 {
2851 ov2640_interface_debug_print("ov2640: set bist failed.\n");
2852 (void)ov2640_deinit(&gs_handle);
2853
2854 return 1;
2855 }
2856 ov2640_interface_debug_print("ov2640: disable r/w 1 error for 12k - byte memory.\n");
2857 res = ov2640_get_bist(&gs_handle, OV2640_BIST_RW_1_ERROR_12K_BYTE, &enable);
2858 if (res != 0)
2859 {
2860 ov2640_interface_debug_print("ov2640: get bist failed.\n");
2861 (void)ov2640_deinit(&gs_handle);
2862
2863 return 1;
2864 }
2865 ov2640_interface_debug_print("ov2640: check bist %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
2866
2867 /* enable r/w 0 error for 12k - byte memory */
2869 if (res != 0)
2870 {
2871 ov2640_interface_debug_print("ov2640: set bist failed.\n");
2872 (void)ov2640_deinit(&gs_handle);
2873
2874 return 1;
2875 }
2876 ov2640_interface_debug_print("ov2640: enable r/w 0 error for 12k - byte memory.\n");
2877 res = ov2640_get_bist(&gs_handle, OV2640_BIST_RW_0_ERROR_12K_BYTE, &enable);
2878 if (res != 0)
2879 {
2880 ov2640_interface_debug_print("ov2640: get bist failed.\n");
2881 (void)ov2640_deinit(&gs_handle);
2882
2883 return 1;
2884 }
2885 ov2640_interface_debug_print("ov2640: check bist %s.\n", res == 0 ? "ok" : "error");
2886
2887 /* disable r/w 0 error for 12k - byte memory */
2889 if (res != 0)
2890 {
2891 ov2640_interface_debug_print("ov2640: set bist failed.\n");
2892 (void)ov2640_deinit(&gs_handle);
2893
2894 return 1;
2895 }
2896 ov2640_interface_debug_print("ov2640: disable r/w 0 error for 12k - byte memory.\n");
2897 res = ov2640_get_bist(&gs_handle, OV2640_BIST_RW_0_ERROR_12K_BYTE, &enable);
2898 if (res != 0)
2899 {
2900 ov2640_interface_debug_print("ov2640: get bist failed.\n");
2901 (void)ov2640_deinit(&gs_handle);
2902
2903 return 1;
2904 }
2905 ov2640_interface_debug_print("ov2640: check bist %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
2906
2907 /* enable r/w 1 error for 512 - byte memory */
2909 if (res != 0)
2910 {
2911 ov2640_interface_debug_print("ov2640: set bist failed.\n");
2912 (void)ov2640_deinit(&gs_handle);
2913
2914 return 1;
2915 }
2916 ov2640_interface_debug_print("ov2640: enable r/w 1 error for 512 - byte memory.\n");
2917 res = ov2640_get_bist(&gs_handle, OV2640_BIST_RW_1_ERROR_512_BYTE, &enable);
2918 if (res != 0)
2919 {
2920 ov2640_interface_debug_print("ov2640: get bist failed.\n");
2921 (void)ov2640_deinit(&gs_handle);
2922
2923 return 1;
2924 }
2925 ov2640_interface_debug_print("ov2640: check bist %s.\n", res == 0 ? "ok" : "error");
2926
2927 /* disable r/w 1 error for 512 - byte memory */
2929 if (res != 0)
2930 {
2931 ov2640_interface_debug_print("ov2640: set bist failed.\n");
2932 (void)ov2640_deinit(&gs_handle);
2933
2934 return 1;
2935 }
2936 ov2640_interface_debug_print("ov2640: disable r/w 1 error for 512 - byte memory.\n");
2937 res = ov2640_get_bist(&gs_handle, OV2640_BIST_RW_1_ERROR_512_BYTE, &enable);
2938 if (res != 0)
2939 {
2940 ov2640_interface_debug_print("ov2640: get bist failed.\n");
2941 (void)ov2640_deinit(&gs_handle);
2942
2943 return 1;
2944 }
2945 ov2640_interface_debug_print("ov2640: check bist %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
2946
2947 /* enable r/w 0 error for 512 - byte memory */
2949 if (res != 0)
2950 {
2951 ov2640_interface_debug_print("ov2640: set bist failed.\n");
2952 (void)ov2640_deinit(&gs_handle);
2953
2954 return 1;
2955 }
2956 ov2640_interface_debug_print("ov2640: enable r/w 0 error for 512 - byte memory.\n");
2957 res = ov2640_get_bist(&gs_handle, OV2640_BIST_RW_0_ERROR_512_BYTE, &enable);
2958 if (res != 0)
2959 {
2960 ov2640_interface_debug_print("ov2640: get bist failed.\n");
2961 (void)ov2640_deinit(&gs_handle);
2962
2963 return 1;
2964 }
2965 ov2640_interface_debug_print("ov2640: check bist %s.\n", res == 0 ? "ok" : "error");
2966
2967 /* disable r/w 0 error for 512 - byte memory */
2969 if (res != 0)
2970 {
2971 ov2640_interface_debug_print("ov2640: set bist failed.\n");
2972 (void)ov2640_deinit(&gs_handle);
2973
2974 return 1;
2975 }
2976 ov2640_interface_debug_print("ov2640: disable r/w 0 error for 512 - byte memory.\n");
2977 res = ov2640_get_bist(&gs_handle, OV2640_BIST_RW_0_ERROR_512_BYTE, &enable);
2978 if (res != 0)
2979 {
2980 ov2640_interface_debug_print("ov2640: get bist failed.\n");
2981 (void)ov2640_deinit(&gs_handle);
2982
2983 return 1;
2984 }
2985 ov2640_interface_debug_print("ov2640: check bist %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
2986
2987 /* enable busy or one shot reset */
2989 if (res != 0)
2990 {
2991 ov2640_interface_debug_print("ov2640: set bist failed.\n");
2992 (void)ov2640_deinit(&gs_handle);
2993
2994 return 1;
2995 }
2996 ov2640_interface_debug_print("ov2640: enable busy or one shot reset.\n");
2997 res = ov2640_get_bist(&gs_handle, OV2640_BIST_BUSY_OR_SHOT_RESET, &enable);
2998 if (res != 0)
2999 {
3000 ov2640_interface_debug_print("ov2640: get bist failed.\n");
3001 (void)ov2640_deinit(&gs_handle);
3002
3003 return 1;
3004 }
3005 ov2640_interface_debug_print("ov2640: check bist %s.\n", res == 0 ? "ok" : "error");
3006
3007 /* disable busy or one shot reset */
3009 if (res != 0)
3010 {
3011 ov2640_interface_debug_print("ov2640: set bist failed.\n");
3012 (void)ov2640_deinit(&gs_handle);
3013
3014 return 1;
3015 }
3016 ov2640_interface_debug_print("ov2640: disable busy or one shot reset.\n");
3017 res = ov2640_get_bist(&gs_handle, OV2640_BIST_BUSY_OR_SHOT_RESET, &enable);
3018 if (res != 0)
3019 {
3020 ov2640_interface_debug_print("ov2640: get bist failed.\n");
3021 (void)ov2640_deinit(&gs_handle);
3022
3023 return 1;
3024 }
3025 ov2640_interface_debug_print("ov2640: check bist %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3026
3027 /* enable launch bist */
3029 if (res != 0)
3030 {
3031 ov2640_interface_debug_print("ov2640: set bist failed.\n");
3032 (void)ov2640_deinit(&gs_handle);
3033
3034 return 1;
3035 }
3036 ov2640_interface_debug_print("ov2640: enable launch bist.\n");
3037 res = ov2640_get_bist(&gs_handle, OV2640_BIST_LAUNCH, &enable);
3038 if (res != 0)
3039 {
3040 ov2640_interface_debug_print("ov2640: get bist failed.\n");
3041 (void)ov2640_deinit(&gs_handle);
3042
3043 return 1;
3044 }
3045 ov2640_interface_debug_print("ov2640: check bist %s.\n", res == 0 ? "ok" : "error");
3046
3047 /* disable launch bist */
3049 if (res != 0)
3050 {
3051 ov2640_interface_debug_print("ov2640: set bist failed.\n");
3052 (void)ov2640_deinit(&gs_handle);
3053
3054 return 1;
3055 }
3056 ov2640_interface_debug_print("ov2640: disable launch bist.\n");
3057 res = ov2640_get_bist(&gs_handle, OV2640_BIST_LAUNCH, &enable);
3058 if (res != 0)
3059 {
3060 ov2640_interface_debug_print("ov2640: get bist failed.\n");
3061 (void)ov2640_deinit(&gs_handle);
3062
3063 return 1;
3064 }
3065 ov2640_interface_debug_print("ov2640: check bist %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3066
3067 /* ov2640_set_program_memory_pointer_address/ov2640_get_program_memory_pointer_address test */
3068 ov2640_interface_debug_print("ov2640: ov2640_set_program_memory_pointer_address/ov2640_get_program_memory_pointer_address test.\n");
3069
3070 /* set program memory pointer address */
3071 reg16 = 0;
3072 res = ov2640_set_program_memory_pointer_address(&gs_handle, reg16);
3073 if (res != 0)
3074 {
3075 ov2640_interface_debug_print("ov2640: set program memory pointer address failed.\n");
3076 (void)ov2640_deinit(&gs_handle);
3077
3078 return 1;
3079 }
3080 ov2640_interface_debug_print("ov2640: set program memory pointer address %d.\n", reg16);
3081 res = ov2640_get_program_memory_pointer_address(&gs_handle, &reg16_check);
3082 if (res != 0)
3083 {
3084 ov2640_interface_debug_print("ov2640: get program memory pointer address failed.\n");
3085 (void)ov2640_deinit(&gs_handle);
3086
3087 return 1;
3088 }
3089 ov2640_interface_debug_print("ov2640: check program memory pointer address %s.\n", reg16 == reg16_check ? "ok" : "error");
3090
3091 /* ov2640_set_program_memory_pointer_access_address/ov2640_get_program_memory_pointer_access_address test */
3092 ov2640_interface_debug_print("ov2640: ov2640_set_program_memory_pointer_access_address/ov2640_get_program_memory_pointer_access_address test.\n");
3093
3094 reg8 = 0;
3096 if (res != 0)
3097 {
3098 ov2640_interface_debug_print("ov2640: set program memory pointer access address failed.\n");
3099 (void)ov2640_deinit(&gs_handle);
3100
3101 return 1;
3102 }
3103 ov2640_interface_debug_print("ov2640: set program memory pointer access address %d.\n", reg8);
3104 res = ov2640_get_program_memory_pointer_access_address(&gs_handle, &reg8_check);
3105 if (res != 0)
3106 {
3107 ov2640_interface_debug_print("ov2640: get program memory pointer access address failed.\n");
3108 (void)ov2640_deinit(&gs_handle);
3109
3110 return 1;
3111 }
3112 ov2640_interface_debug_print("ov2640: check program memory pointer access address %s.\n", reg8 == reg8_check ? "ok" : "error");
3113
3114 /* ov2640_set_sccb_protocol_command/ov2640_get_sccb_protocol_command test */
3115 ov2640_interface_debug_print("ov2640: ov2640_set_sccb_protocol_command/ov2640_get_sccb_protocol_command test.\n");
3116
3117 reg8 = 0;
3118 res = ov2640_set_sccb_protocol_command(&gs_handle, reg8);
3119 if (res != 0)
3120 {
3121 ov2640_interface_debug_print("ov2640: set sccb protocol command failed.\n");
3122 (void)ov2640_deinit(&gs_handle);
3123
3124 return 1;
3125 }
3126 ov2640_interface_debug_print("ov2640: set sccb protocol command %d.\n", reg8);
3127 res = ov2640_get_sccb_protocol_command(&gs_handle, &reg8_check);
3128 if (res != 0)
3129 {
3130 ov2640_interface_debug_print("ov2640: get sccb protocol command failed.\n");
3131 (void)ov2640_deinit(&gs_handle);
3132
3133 return 1;
3134 }
3135 ov2640_interface_debug_print("ov2640: check sccb protocol command %s.\n", reg8 == reg8_check ? "ok" : "error");
3136
3137 /* ov2640_set_sccb_protocol_status/ov2640_get_sccb_protocol_status test */
3138 ov2640_interface_debug_print("ov2640: ov2640_set_sccb_protocol_status/ov2640_get_sccb_protocol_status test.\n");
3139
3140 /* set sccb protocol status */
3141 reg8 = 0xD9;
3142 res = ov2640_set_sccb_protocol_status(&gs_handle, reg8);
3143 if (res != 0)
3144 {
3145 ov2640_interface_debug_print("ov2640: set sccb protocol status failed.\n");
3146 (void)ov2640_deinit(&gs_handle);
3147
3148 return 1;
3149 }
3150 ov2640_interface_debug_print("ov2640: set sccb protocol status %d.\n", reg8);
3151 res = ov2640_get_sccb_protocol_status(&gs_handle, &reg8_check);
3152 if (res != 0)
3153 {
3154 ov2640_interface_debug_print("ov2640: get sccb protocol status failed.\n");
3155 (void)ov2640_deinit(&gs_handle);
3156
3157 return 1;
3158 }
3159 ov2640_interface_debug_print("ov2640: check sccb protocol status %s.\n", res == 0 ? "ok" : "error");
3160
3161 /* ov2640_set_cip/ov2640_get_cip test */
3162 ov2640_interface_debug_print("ov2640: ov2640_set_cip/ov2640_get_cip test.\n");
3163
3164 /* disable cip */
3165 res = ov2640_set_cip(&gs_handle, OV2640_BOOL_FALSE);
3166 if (res != 0)
3167 {
3168 ov2640_interface_debug_print("ov2640: set cip failed.\n");
3169 (void)ov2640_deinit(&gs_handle);
3170
3171 return 1;
3172 }
3173 ov2640_interface_debug_print("ov2640: disable cip.\n");
3174 res = ov2640_get_cip(&gs_handle, &enable);
3175 if (res != 0)
3176 {
3177 ov2640_interface_debug_print("ov2640: get cip failed.\n");
3178 (void)ov2640_deinit(&gs_handle);
3179
3180 return 1;
3181 }
3182 ov2640_interface_debug_print("ov2640: check cip %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3183
3184 /* enable cip */
3185 res = ov2640_set_cip(&gs_handle, OV2640_BOOL_TRUE);
3186 if (res != 0)
3187 {
3188 ov2640_interface_debug_print("ov2640: set cip failed.\n");
3189 (void)ov2640_deinit(&gs_handle);
3190
3191 return 1;
3192 }
3193 ov2640_interface_debug_print("ov2640: enable cip.\n");
3194 res = ov2640_get_cip(&gs_handle, &enable);
3195 if (res != 0)
3196 {
3197 ov2640_interface_debug_print("ov2640: get cip failed.\n");
3198 (void)ov2640_deinit(&gs_handle);
3199
3200 return 1;
3201 }
3202 ov2640_interface_debug_print("ov2640: check cip %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3203
3204 /* ov2640_set_dmy/ov2640_get_dmy test */
3205 ov2640_interface_debug_print("ov2640: ov2640_set_dmy/ov2640_get_dmy test.\n");
3206
3207 /* enable dmy */
3208 res = ov2640_set_dmy(&gs_handle, OV2640_BOOL_TRUE);
3209 if (res != 0)
3210 {
3211 ov2640_interface_debug_print("ov2640: set dmy failed.\n");
3212 (void)ov2640_deinit(&gs_handle);
3213
3214 return 1;
3215 }
3216 ov2640_interface_debug_print("ov2640: enable dmy.\n");
3217 res = ov2640_get_dmy(&gs_handle, &enable);
3218 if (res != 0)
3219 {
3220 ov2640_interface_debug_print("ov2640: get dmy failed.\n");
3221 (void)ov2640_deinit(&gs_handle);
3222
3223 return 1;
3224 }
3225 ov2640_interface_debug_print("ov2640: check dmy %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3226
3227 /* disable dmy */
3228 res = ov2640_set_dmy(&gs_handle, OV2640_BOOL_FALSE);
3229 if (res != 0)
3230 {
3231 ov2640_interface_debug_print("ov2640: set dmy failed.\n");
3232 (void)ov2640_deinit(&gs_handle);
3233
3234 return 1;
3235 }
3236 ov2640_interface_debug_print("ov2640: disable dmy.\n");
3237 res = ov2640_get_dmy(&gs_handle, &enable);
3238 if (res != 0)
3239 {
3240 ov2640_interface_debug_print("ov2640: get dmy failed.\n");
3241 (void)ov2640_deinit(&gs_handle);
3242
3243 return 1;
3244 }
3245 ov2640_interface_debug_print("ov2640: check dmy %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3246
3247 /* ov2640_set_raw_gma/ov2640_get_raw_gma test */
3248 ov2640_interface_debug_print("ov2640: ov2640_set_raw_gma/ov2640_get_raw_gma test.\n");
3249
3250 /* enable raw gma */
3251 res = ov2640_set_raw_gma(&gs_handle, OV2640_BOOL_TRUE);
3252 if (res != 0)
3253 {
3254 ov2640_interface_debug_print("ov2640: set raw gma failed.\n");
3255 (void)ov2640_deinit(&gs_handle);
3256
3257 return 1;
3258 }
3259 ov2640_interface_debug_print("ov2640: enable raw gma.\n");
3260 res = ov2640_get_raw_gma(&gs_handle, &enable);
3261 if (res != 0)
3262 {
3263 ov2640_interface_debug_print("ov2640: get raw gma failed.\n");
3264 (void)ov2640_deinit(&gs_handle);
3265
3266 return 1;
3267 }
3268 ov2640_interface_debug_print("ov2640: check raw gma %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3269
3270 /* disable raw gma */
3271 res = ov2640_set_raw_gma(&gs_handle, OV2640_BOOL_FALSE);
3272 if (res != 0)
3273 {
3274 ov2640_interface_debug_print("ov2640: set raw gma failed.\n");
3275 (void)ov2640_deinit(&gs_handle);
3276
3277 return 1;
3278 }
3279 ov2640_interface_debug_print("ov2640: disable raw gma.\n");
3280 res = ov2640_get_raw_gma(&gs_handle, &enable);
3281 if (res != 0)
3282 {
3283 ov2640_interface_debug_print("ov2640: get raw gma failed.\n");
3284 (void)ov2640_deinit(&gs_handle);
3285
3286 return 1;
3287 }
3288 ov2640_interface_debug_print("ov2640: check raw gma %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3289
3290 /* ov2640_set_dg/ov2640_get_dg test */
3291 ov2640_interface_debug_print("ov2640: ov2640_set_dg/ov2640_get_dg test.\n");
3292
3293 /* enable dg */
3294 res = ov2640_set_dg(&gs_handle, OV2640_BOOL_TRUE);
3295 if (res != 0)
3296 {
3297 ov2640_interface_debug_print("ov2640: set dg failed.\n");
3298 (void)ov2640_deinit(&gs_handle);
3299
3300 return 1;
3301 }
3302 ov2640_interface_debug_print("ov2640: enable dg.\n");
3303 res = ov2640_get_dg(&gs_handle, &enable);
3304 if (res != 0)
3305 {
3306 ov2640_interface_debug_print("ov2640: get dg failed.\n");
3307 (void)ov2640_deinit(&gs_handle);
3308
3309 return 1;
3310 }
3311 ov2640_interface_debug_print("ov2640: check dg %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3312
3313 /* disable dg */
3314 res = ov2640_set_dg(&gs_handle, OV2640_BOOL_FALSE);
3315 if (res != 0)
3316 {
3317 ov2640_interface_debug_print("ov2640: set dg failed.\n");
3318 (void)ov2640_deinit(&gs_handle);
3319
3320 return 1;
3321 }
3322 ov2640_interface_debug_print("ov2640: disable dg.\n");
3323 res = ov2640_get_dg(&gs_handle, &enable);
3324 if (res != 0)
3325 {
3326 ov2640_interface_debug_print("ov2640: get dg failed.\n");
3327 (void)ov2640_deinit(&gs_handle);
3328
3329 return 1;
3330 }
3331 ov2640_interface_debug_print("ov2640: check dg %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3332
3333 /* ov2640_set_awb/ov2640_get_awb test */
3334 ov2640_interface_debug_print("ov2640: ov2640_set_awb/ov2640_get_awb test.\n");
3335
3336 /* enable awb */
3337 res = ov2640_set_awb(&gs_handle, OV2640_BOOL_TRUE);
3338 if (res != 0)
3339 {
3340 ov2640_interface_debug_print("ov2640: set awb failed.\n");
3341 (void)ov2640_deinit(&gs_handle);
3342
3343 return 1;
3344 }
3345 ov2640_interface_debug_print("ov2640: enable awb.\n");
3346 res = ov2640_get_awb(&gs_handle, &enable);
3347 if (res != 0)
3348 {
3349 ov2640_interface_debug_print("ov2640: get awb failed.\n");
3350 (void)ov2640_deinit(&gs_handle);
3351
3352 return 1;
3353 }
3354 ov2640_interface_debug_print("ov2640: check awb %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3355
3356 /* disable awb */
3357 res = ov2640_set_awb(&gs_handle, OV2640_BOOL_FALSE);
3358 if (res != 0)
3359 {
3360 ov2640_interface_debug_print("ov2640: set awb failed.\n");
3361 (void)ov2640_deinit(&gs_handle);
3362
3363 return 1;
3364 }
3365 ov2640_interface_debug_print("ov2640: disable awb.\n");
3366 res = ov2640_get_awb(&gs_handle, &enable);
3367 if (res != 0)
3368 {
3369 ov2640_interface_debug_print("ov2640: get awb failed.\n");
3370 (void)ov2640_deinit(&gs_handle);
3371
3372 return 1;
3373 }
3374 ov2640_interface_debug_print("ov2640: check awb %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3375
3376 /* ov2640_set_awb_gain/ov2640_get_awb_gain test */
3377 ov2640_interface_debug_print("ov2640: ov2640_set_awb_gain/ov2640_get_awb_gain test.\n");
3378
3379 /* enable awb gain */
3380 res = ov2640_set_awb_gain(&gs_handle, OV2640_BOOL_TRUE);
3381 if (res != 0)
3382 {
3383 ov2640_interface_debug_print("ov2640: set awb gain failed.\n");
3384 (void)ov2640_deinit(&gs_handle);
3385
3386 return 1;
3387 }
3388 ov2640_interface_debug_print("ov2640: enable awb gain.\n");
3389 res = ov2640_get_awb_gain(&gs_handle, &enable);
3390 if (res != 0)
3391 {
3392 ov2640_interface_debug_print("ov2640: get awb gain failed.\n");
3393 (void)ov2640_deinit(&gs_handle);
3394
3395 return 1;
3396 }
3397 ov2640_interface_debug_print("ov2640: check awb gain %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3398
3399 /* disable awb gain */
3400 res = ov2640_set_awb_gain(&gs_handle, OV2640_BOOL_FALSE);
3401 if (res != 0)
3402 {
3403 ov2640_interface_debug_print("ov2640: set awb gain failed.\n");
3404 (void)ov2640_deinit(&gs_handle);
3405
3406 return 1;
3407 }
3408 ov2640_interface_debug_print("ov2640: disable awb gain.\n");
3409 res = ov2640_get_awb_gain(&gs_handle, &enable);
3410 if (res != 0)
3411 {
3412 ov2640_interface_debug_print("ov2640: get awb gain failed.\n");
3413 (void)ov2640_deinit(&gs_handle);
3414
3415 return 1;
3416 }
3417 ov2640_interface_debug_print("ov2640: check awb gain %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3418
3419 /* ov2640_set_lenc/ov2640_get_lenc test */
3420 ov2640_interface_debug_print("ov2640: ov2640_set_lenc/ov2640_get_lenc test.\n");
3421
3422 /* enable lenc */
3423 res = ov2640_set_lenc(&gs_handle, OV2640_BOOL_TRUE);
3424 if (res != 0)
3425 {
3426 ov2640_interface_debug_print("ov2640: set lenc failed.\n");
3427 (void)ov2640_deinit(&gs_handle);
3428
3429 return 1;
3430 }
3431 ov2640_interface_debug_print("ov2640: enable lenc.\n");
3432 res = ov2640_get_lenc(&gs_handle, &enable);
3433 if (res != 0)
3434 {
3435 ov2640_interface_debug_print("ov2640: get lenc failed.\n");
3436 (void)ov2640_deinit(&gs_handle);
3437
3438 return 1;
3439 }
3440 ov2640_interface_debug_print("ov2640: check lenc %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3441
3442 /* disable lenc */
3443 res = ov2640_set_lenc(&gs_handle, OV2640_BOOL_FALSE);
3444 if (res != 0)
3445 {
3446 ov2640_interface_debug_print("ov2640: set lenc failed.\n");
3447 (void)ov2640_deinit(&gs_handle);
3448
3449 return 1;
3450 }
3451 ov2640_interface_debug_print("ov2640: disable lenc.\n");
3452 res = ov2640_get_lenc(&gs_handle, &enable);
3453 if (res != 0)
3454 {
3455 ov2640_interface_debug_print("ov2640: get lenc failed.\n");
3456 (void)ov2640_deinit(&gs_handle);
3457
3458 return 1;
3459 }
3460 ov2640_interface_debug_print("ov2640: check lenc %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3461
3462 /* ov2640_set_pre/ov2640_get_pre test */
3463 ov2640_interface_debug_print("ov2640: ov2640_set_pre/ov2640_get_pre test.\n");
3464
3465 /* enable pre */
3466 res = ov2640_set_pre(&gs_handle, OV2640_BOOL_TRUE);
3467 if (res != 0)
3468 {
3469 ov2640_interface_debug_print("ov2640: set pre failed.\n");
3470 (void)ov2640_deinit(&gs_handle);
3471
3472 return 1;
3473 }
3474 ov2640_interface_debug_print("ov2640: enable pre.\n");
3475 res = ov2640_get_pre(&gs_handle, &enable);
3476 if (res != 0)
3477 {
3478 ov2640_interface_debug_print("ov2640: get pre failed.\n");
3479 (void)ov2640_deinit(&gs_handle);
3480
3481 return 1;
3482 }
3483 ov2640_interface_debug_print("ov2640: check pre %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3484
3485 /* disable pre */
3486 res = ov2640_set_pre(&gs_handle, OV2640_BOOL_FALSE);
3487 if (res != 0)
3488 {
3489 ov2640_interface_debug_print("ov2640: set pre failed.\n");
3490 (void)ov2640_deinit(&gs_handle);
3491
3492 return 1;
3493 }
3494 ov2640_interface_debug_print("ov2640: disable pre.\n");
3495 res = ov2640_get_pre(&gs_handle, &enable);
3496 if (res != 0)
3497 {
3498 ov2640_interface_debug_print("ov2640: get pre failed.\n");
3499 (void)ov2640_deinit(&gs_handle);
3500
3501 return 1;
3502 }
3503 ov2640_interface_debug_print("ov2640: check pre %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3504
3505 /* ov2640_set_aec_enable/ov2640_get_aec_enable test */
3506 ov2640_interface_debug_print("ov2640: ov2640_set_aec_enable/ov2640_get_aec_enable test.\n");
3507
3508 /* enable aec enable */
3509 res = ov2640_set_aec_enable(&gs_handle, OV2640_BOOL_TRUE);
3510 if (res != 0)
3511 {
3512 ov2640_interface_debug_print("ov2640: set aec enable failed.\n");
3513 (void)ov2640_deinit(&gs_handle);
3514
3515 return 1;
3516 }
3517 ov2640_interface_debug_print("ov2640: enable aec enable.\n");
3518 res = ov2640_get_aec_enable(&gs_handle, &enable);
3519 if (res != 0)
3520 {
3521 ov2640_interface_debug_print("ov2640: get aec enable failed.\n");
3522 (void)ov2640_deinit(&gs_handle);
3523
3524 return 1;
3525 }
3526 ov2640_interface_debug_print("ov2640: check aec enable %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3527
3528 /* disable aec enable */
3529 res = ov2640_set_aec_enable(&gs_handle, OV2640_BOOL_FALSE);
3530 if (res != 0)
3531 {
3532 ov2640_interface_debug_print("ov2640: set aec enable failed.\n");
3533 (void)ov2640_deinit(&gs_handle);
3534
3535 return 1;
3536 }
3537 ov2640_interface_debug_print("ov2640: disable aec enable.\n");
3538 res = ov2640_get_aec_enable(&gs_handle, &enable);
3539 if (res != 0)
3540 {
3541 ov2640_interface_debug_print("ov2640: get aec enable failed.\n");
3542 (void)ov2640_deinit(&gs_handle);
3543
3544 return 1;
3545 }
3546 ov2640_interface_debug_print("ov2640: check aec enable %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3547
3548 /* ov2640_set_aec_sel/ov2640_get_aec_sel test */
3549 ov2640_interface_debug_print("ov2640: ov2640_set_aec_sel/ov2640_get_aec_sel test.\n");
3550
3551 /* enable aec sel */
3552 res = ov2640_set_aec_sel(&gs_handle, OV2640_BOOL_TRUE);
3553 if (res != 0)
3554 {
3555 ov2640_interface_debug_print("ov2640: set aec sel failed.\n");
3556 (void)ov2640_deinit(&gs_handle);
3557
3558 return 1;
3559 }
3560 ov2640_interface_debug_print("ov2640: enable aec sel.\n");
3561 res = ov2640_get_aec_sel(&gs_handle, &enable);
3562 if (res != 0)
3563 {
3564 ov2640_interface_debug_print("ov2640: get aec sel failed.\n");
3565 (void)ov2640_deinit(&gs_handle);
3566
3567 return 1;
3568 }
3569 ov2640_interface_debug_print("ov2640: check aec sel %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3570
3571 /* disable aec sel */
3572 res = ov2640_set_aec_sel(&gs_handle, OV2640_BOOL_FALSE);
3573 if (res != 0)
3574 {
3575 ov2640_interface_debug_print("ov2640: set aec sel failed.\n");
3576 (void)ov2640_deinit(&gs_handle);
3577
3578 return 1;
3579 }
3580 ov2640_interface_debug_print("ov2640: disable aec sel.\n");
3581 res = ov2640_get_aec_sel(&gs_handle, &enable);
3582 if (res != 0)
3583 {
3584 ov2640_interface_debug_print("ov2640: get aec sel failed.\n");
3585 (void)ov2640_deinit(&gs_handle);
3586
3587 return 1;
3588 }
3589 ov2640_interface_debug_print("ov2640: check aec sel %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3590
3591 /* ov2640_set_stat_sel/ov2640_get_stat_sel test */
3592 ov2640_interface_debug_print("ov2640: ov2640_set_stat_sel/ov2640_get_stat_sel test.\n");
3593
3594 /* enable stat sel */
3595 res = ov2640_set_stat_sel(&gs_handle, OV2640_BOOL_TRUE);
3596 if (res != 0)
3597 {
3598 ov2640_interface_debug_print("ov2640: set stat sel failed.\n");
3599 (void)ov2640_deinit(&gs_handle);
3600
3601 return 1;
3602 }
3603 ov2640_interface_debug_print("ov2640: enable stat sel.\n");
3604 res = ov2640_get_stat_sel(&gs_handle, &enable);
3605 if (res != 0)
3606 {
3607 ov2640_interface_debug_print("ov2640: get stat sel failed.\n");
3608 (void)ov2640_deinit(&gs_handle);
3609
3610 return 1;
3611 }
3612 ov2640_interface_debug_print("ov2640: check stat sel %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3613
3614 /* disable stat sel */
3615 res = ov2640_set_stat_sel(&gs_handle, OV2640_BOOL_FALSE);
3616 if (res != 0)
3617 {
3618 ov2640_interface_debug_print("ov2640: set stat sel failed.\n");
3619 (void)ov2640_deinit(&gs_handle);
3620
3621 return 1;
3622 }
3623 ov2640_interface_debug_print("ov2640: disable stat sel.\n");
3624 res = ov2640_get_stat_sel(&gs_handle, &enable);
3625 if (res != 0)
3626 {
3627 ov2640_interface_debug_print("ov2640: get stat sel failed.\n");
3628 (void)ov2640_deinit(&gs_handle);
3629
3630 return 1;
3631 }
3632 ov2640_interface_debug_print("ov2640: check stat sel %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3633
3634 /* ov2640_set_vfirst/ov2640_get_vfirst test */
3635 ov2640_interface_debug_print("ov2640: ov2640_set_vfirst/ov2640_get_vfirst test.\n");
3636
3637 /* enable vfirst */
3638 res = ov2640_set_vfirst(&gs_handle, OV2640_BOOL_TRUE);
3639 if (res != 0)
3640 {
3641 ov2640_interface_debug_print("ov2640: set vfirst failed.\n");
3642 (void)ov2640_deinit(&gs_handle);
3643
3644 return 1;
3645 }
3646 ov2640_interface_debug_print("ov2640: enable vfirst.\n");
3647 res = ov2640_get_vfirst(&gs_handle, &enable);
3648 if (res != 0)
3649 {
3650 ov2640_interface_debug_print("ov2640: get vfirst failed.\n");
3651 (void)ov2640_deinit(&gs_handle);
3652
3653 return 1;
3654 }
3655 ov2640_interface_debug_print("ov2640: check vfirst %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3656
3657 /* disable vfirst */
3658 res = ov2640_set_vfirst(&gs_handle, OV2640_BOOL_FALSE);
3659 if (res != 0)
3660 {
3661 ov2640_interface_debug_print("ov2640: set vfirst failed.\n");
3662 (void)ov2640_deinit(&gs_handle);
3663
3664 return 1;
3665 }
3666 ov2640_interface_debug_print("ov2640: disable vfirst.\n");
3667 res = ov2640_get_vfirst(&gs_handle, &enable);
3668 if (res != 0)
3669 {
3670 ov2640_interface_debug_print("ov2640: get vfirst failed.\n");
3671 (void)ov2640_deinit(&gs_handle);
3672
3673 return 1;
3674 }
3675 ov2640_interface_debug_print("ov2640: check vfirst %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3676
3677 /* ov2640_set_yuv422/ov2640_get_yuv422 test */
3678 ov2640_interface_debug_print("ov2640: ov2640_set_yuv422/ov2640_get_yuv422 test.\n");
3679
3680 /* enable yuv422 */
3681 res = ov2640_set_yuv422(&gs_handle, OV2640_BOOL_TRUE);
3682 if (res != 0)
3683 {
3684 ov2640_interface_debug_print("ov2640: set yuv422 failed.\n");
3685 (void)ov2640_deinit(&gs_handle);
3686
3687 return 1;
3688 }
3689 ov2640_interface_debug_print("ov2640: enable yuv422.\n");
3690 res = ov2640_get_yuv422(&gs_handle, &enable);
3691 if (res != 0)
3692 {
3693 ov2640_interface_debug_print("ov2640: get yuv422 failed.\n");
3694 (void)ov2640_deinit(&gs_handle);
3695
3696 return 1;
3697 }
3698 ov2640_interface_debug_print("ov2640: check yuv422 %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3699
3700 /* disable yuv422 */
3701 res = ov2640_set_yuv422(&gs_handle, OV2640_BOOL_FALSE);
3702 if (res != 0)
3703 {
3704 ov2640_interface_debug_print("ov2640: set yuv422 failed.\n");
3705 (void)ov2640_deinit(&gs_handle);
3706
3707 return 1;
3708 }
3709 ov2640_interface_debug_print("ov2640: disable yuv422.\n");
3710 res = ov2640_get_yuv422(&gs_handle, &enable);
3711 if (res != 0)
3712 {
3713 ov2640_interface_debug_print("ov2640: get yuv422 failed.\n");
3714 (void)ov2640_deinit(&gs_handle);
3715
3716 return 1;
3717 }
3718 ov2640_interface_debug_print("ov2640: check yuv422 %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3719
3720 /* ov2640_set_yuv/ov2640_get_yuv test */
3721 ov2640_interface_debug_print("ov2640: ov2640_set_yuv/ov2640_get_yuv test.\n");
3722
3723 /* enable yuv */
3724 res = ov2640_set_yuv(&gs_handle, OV2640_BOOL_TRUE);
3725 if (res != 0)
3726 {
3727 ov2640_interface_debug_print("ov2640: set yuv failed.\n");
3728 (void)ov2640_deinit(&gs_handle);
3729
3730 return 1;
3731 }
3732 ov2640_interface_debug_print("ov2640: enable yuv.\n");
3733 res = ov2640_get_yuv(&gs_handle, &enable);
3734 if (res != 0)
3735 {
3736 ov2640_interface_debug_print("ov2640: get yuv failed.\n");
3737 (void)ov2640_deinit(&gs_handle);
3738
3739 return 1;
3740 }
3741 ov2640_interface_debug_print("ov2640: check yuv %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3742
3743 /* disable yuv */
3744 res = ov2640_set_yuv(&gs_handle, OV2640_BOOL_FALSE);
3745 if (res != 0)
3746 {
3747 ov2640_interface_debug_print("ov2640: set yuv failed.\n");
3748 (void)ov2640_deinit(&gs_handle);
3749
3750 return 1;
3751 }
3752 ov2640_interface_debug_print("ov2640: disable yuv.\n");
3753 res = ov2640_get_yuv(&gs_handle, &enable);
3754 if (res != 0)
3755 {
3756 ov2640_interface_debug_print("ov2640: get yuv failed.\n");
3757 (void)ov2640_deinit(&gs_handle);
3758
3759 return 1;
3760 }
3761 ov2640_interface_debug_print("ov2640: check yuv %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3762
3763 /* ov2640_set_rgb/ov2640_get_rgb test */
3764 ov2640_interface_debug_print("ov2640: ov2640_set_rgb/ov2640_get_rgb test.\n");
3765
3766 /* enable rgb */
3767 res = ov2640_set_rgb(&gs_handle, OV2640_BOOL_TRUE);
3768 if (res != 0)
3769 {
3770 ov2640_interface_debug_print("ov2640: set rgb failed.\n");
3771 (void)ov2640_deinit(&gs_handle);
3772
3773 return 1;
3774 }
3775 ov2640_interface_debug_print("ov2640: enable rgb.\n");
3776 res = ov2640_get_rgb(&gs_handle, &enable);
3777 if (res != 0)
3778 {
3779 ov2640_interface_debug_print("ov2640: get rgb failed.\n");
3780 (void)ov2640_deinit(&gs_handle);
3781
3782 return 1;
3783 }
3784 ov2640_interface_debug_print("ov2640: check rgb %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3785
3786 /* disable rgb */
3787 res = ov2640_set_rgb(&gs_handle, OV2640_BOOL_FALSE);
3788 if (res != 0)
3789 {
3790 ov2640_interface_debug_print("ov2640: set rgb failed.\n");
3791 (void)ov2640_deinit(&gs_handle);
3792
3793 return 1;
3794 }
3795 ov2640_interface_debug_print("ov2640: disable rgb.\n");
3796 res = ov2640_get_rgb(&gs_handle, &enable);
3797 if (res != 0)
3798 {
3799 ov2640_interface_debug_print("ov2640: get rgb failed.\n");
3800 (void)ov2640_deinit(&gs_handle);
3801
3802 return 1;
3803 }
3804 ov2640_interface_debug_print("ov2640: check rgb %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3805
3806 /* ov2640_set_raw/ov2640_get_raw test */
3807 ov2640_interface_debug_print("ov2640: ov2640_set_raw/ov2640_get_raw test.\n");
3808
3809 /* enable raw */
3810 res = ov2640_set_raw(&gs_handle, OV2640_BOOL_TRUE);
3811 if (res != 0)
3812 {
3813 ov2640_interface_debug_print("ov2640: set raw failed.\n");
3814 (void)ov2640_deinit(&gs_handle);
3815
3816 return 1;
3817 }
3818 ov2640_interface_debug_print("ov2640: enable raw.\n");
3819 res = ov2640_get_raw(&gs_handle, &enable);
3820 if (res != 0)
3821 {
3822 ov2640_interface_debug_print("ov2640: get raw failed.\n");
3823 (void)ov2640_deinit(&gs_handle);
3824
3825 return 1;
3826 }
3827 ov2640_interface_debug_print("ov2640: check raw %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3828
3829 /* disable raw */
3830 res = ov2640_set_raw(&gs_handle, OV2640_BOOL_FALSE);
3831 if (res != 0)
3832 {
3833 ov2640_interface_debug_print("ov2640: set raw failed.\n");
3834 (void)ov2640_deinit(&gs_handle);
3835
3836 return 1;
3837 }
3838 ov2640_interface_debug_print("ov2640: disable raw.\n");
3839 res = ov2640_get_raw(&gs_handle, &enable);
3840 if (res != 0)
3841 {
3842 ov2640_interface_debug_print("ov2640: get raw failed.\n");
3843 (void)ov2640_deinit(&gs_handle);
3844
3845 return 1;
3846 }
3847 ov2640_interface_debug_print("ov2640: check raw %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3848
3849 /* ov2640_set_dcw/ov2640_get_dcw test */
3850 ov2640_interface_debug_print("ov2640: ov2640_set_dcw/ov2640_get_dcw test.\n");
3851
3852 /* enable dcw */
3853 res = ov2640_set_dcw(&gs_handle, OV2640_BOOL_TRUE);
3854 if (res != 0)
3855 {
3856 ov2640_interface_debug_print("ov2640: set dcw failed.\n");
3857 (void)ov2640_deinit(&gs_handle);
3858
3859 return 1;
3860 }
3861 ov2640_interface_debug_print("ov2640: enable dcw.\n");
3862 res = ov2640_get_dcw(&gs_handle, &enable);
3863 if (res != 0)
3864 {
3865 ov2640_interface_debug_print("ov2640: get dcw failed.\n");
3866 (void)ov2640_deinit(&gs_handle);
3867
3868 return 1;
3869 }
3870 ov2640_interface_debug_print("ov2640: check dcw %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3871
3872 /* disable dcw */
3873 res = ov2640_set_dcw(&gs_handle, OV2640_BOOL_FALSE);
3874 if (res != 0)
3875 {
3876 ov2640_interface_debug_print("ov2640: set dcw failed.\n");
3877 (void)ov2640_deinit(&gs_handle);
3878
3879 return 1;
3880 }
3881 ov2640_interface_debug_print("ov2640: disable dcw.\n");
3882 res = ov2640_get_dcw(&gs_handle, &enable);
3883 if (res != 0)
3884 {
3885 ov2640_interface_debug_print("ov2640: get dcw failed.\n");
3886 (void)ov2640_deinit(&gs_handle);
3887
3888 return 1;
3889 }
3890 ov2640_interface_debug_print("ov2640: check dcw %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3891
3892 /* ov2640_set_sde/ov2640_get_sde test */
3893 ov2640_interface_debug_print("ov2640: ov2640_set_sde/ov2640_get_sde test.\n");
3894
3895 /* enable sde */
3896 res = ov2640_set_sde(&gs_handle, OV2640_BOOL_TRUE);
3897 if (res != 0)
3898 {
3899 ov2640_interface_debug_print("ov2640: set sde failed.\n");
3900 (void)ov2640_deinit(&gs_handle);
3901
3902 return 1;
3903 }
3904 ov2640_interface_debug_print("ov2640: enable sde.\n");
3905 res = ov2640_get_sde(&gs_handle, &enable);
3906 if (res != 0)
3907 {
3908 ov2640_interface_debug_print("ov2640: get sde failed.\n");
3909 (void)ov2640_deinit(&gs_handle);
3910
3911 return 1;
3912 }
3913 ov2640_interface_debug_print("ov2640: check sde %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3914
3915 /* disable sde */
3916 res = ov2640_set_sde(&gs_handle, OV2640_BOOL_FALSE);
3917 if (res != 0)
3918 {
3919 ov2640_interface_debug_print("ov2640: set sde failed.\n");
3920 (void)ov2640_deinit(&gs_handle);
3921
3922 return 1;
3923 }
3924 ov2640_interface_debug_print("ov2640: disable sde.\n");
3925 res = ov2640_get_sde(&gs_handle, &enable);
3926 if (res != 0)
3927 {
3928 ov2640_interface_debug_print("ov2640: get sde failed.\n");
3929 (void)ov2640_deinit(&gs_handle);
3930
3931 return 1;
3932 }
3933 ov2640_interface_debug_print("ov2640: check sde %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3934
3935 /* ov2640_set_uv_adj/ov2640_get_uv_adj test */
3936 ov2640_interface_debug_print("ov2640: ov2640_set_uv_adj/ov2640_get_uv_adj test.\n");
3937
3938 /* enable uv adj */
3939 res = ov2640_set_uv_adj(&gs_handle, OV2640_BOOL_TRUE);
3940 if (res != 0)
3941 {
3942 ov2640_interface_debug_print("ov2640: set uv adj failed.\n");
3943 (void)ov2640_deinit(&gs_handle);
3944
3945 return 1;
3946 }
3947 ov2640_interface_debug_print("ov2640: enable uv adj.\n");
3948 res = ov2640_get_uv_adj(&gs_handle, &enable);
3949 if (res != 0)
3950 {
3951 ov2640_interface_debug_print("ov2640: get uv adj failed.\n");
3952 (void)ov2640_deinit(&gs_handle);
3953
3954 return 1;
3955 }
3956 ov2640_interface_debug_print("ov2640: check uv adj %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
3957
3958 /* disable uv adj */
3959 res = ov2640_set_uv_adj(&gs_handle, OV2640_BOOL_FALSE);
3960 if (res != 0)
3961 {
3962 ov2640_interface_debug_print("ov2640: set uv adj failed.\n");
3963 (void)ov2640_deinit(&gs_handle);
3964
3965 return 1;
3966 }
3967 ov2640_interface_debug_print("ov2640: disable uv adj.\n");
3968 res = ov2640_get_uv_adj(&gs_handle, &enable);
3969 if (res != 0)
3970 {
3971 ov2640_interface_debug_print("ov2640: get uv adj failed.\n");
3972 (void)ov2640_deinit(&gs_handle);
3973
3974 return 1;
3975 }
3976 ov2640_interface_debug_print("ov2640: check uv adj %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
3977
3978 /* ov2640_set_uv_avg/ov2640_get_uv_avg test */
3979 ov2640_interface_debug_print("ov2640: ov2640_set_uv_avg/ov2640_get_uv_avg test.\n");
3980
3981 /* enable uv avg */
3982 res = ov2640_set_uv_avg(&gs_handle, OV2640_BOOL_TRUE);
3983 if (res != 0)
3984 {
3985 ov2640_interface_debug_print("ov2640: set uv avg failed.\n");
3986 (void)ov2640_deinit(&gs_handle);
3987
3988 return 1;
3989 }
3990 ov2640_interface_debug_print("ov2640: enable uv avg.\n");
3991 res = ov2640_get_uv_avg(&gs_handle, &enable);
3992 if (res != 0)
3993 {
3994 ov2640_interface_debug_print("ov2640: get uv avg failed.\n");
3995 (void)ov2640_deinit(&gs_handle);
3996
3997 return 1;
3998 }
3999 ov2640_interface_debug_print("ov2640: check uv avg %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
4000
4001 /* disable uv avg */
4002 res = ov2640_set_uv_avg(&gs_handle, OV2640_BOOL_FALSE);
4003 if (res != 0)
4004 {
4005 ov2640_interface_debug_print("ov2640: set uv avg failed.\n");
4006 (void)ov2640_deinit(&gs_handle);
4007
4008 return 1;
4009 }
4010 ov2640_interface_debug_print("ov2640: disable uv avg.\n");
4011 res = ov2640_get_uv_avg(&gs_handle, &enable);
4012 if (res != 0)
4013 {
4014 ov2640_interface_debug_print("ov2640: get uv avg failed.\n");
4015 (void)ov2640_deinit(&gs_handle);
4016
4017 return 1;
4018 }
4019 ov2640_interface_debug_print("ov2640: check uv avg %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
4020
4021 /* ov2640_set_cmx/ov2640_get_cmx test */
4022 ov2640_interface_debug_print("ov2640: ov2640_set_cmx/ov2640_get_cmx test.\n");
4023
4024 /* enable cmx */
4025 res = ov2640_set_cmx(&gs_handle, OV2640_BOOL_TRUE);
4026 if (res != 0)
4027 {
4028 ov2640_interface_debug_print("ov2640: set cmx failed.\n");
4029 (void)ov2640_deinit(&gs_handle);
4030
4031 return 1;
4032 }
4033 ov2640_interface_debug_print("ov2640: enable cmx.\n");
4034 res = ov2640_get_cmx(&gs_handle, &enable);
4035 if (res != 0)
4036 {
4037 ov2640_interface_debug_print("ov2640: get cmx failed.\n");
4038 (void)ov2640_deinit(&gs_handle);
4039
4040 return 1;
4041 }
4042 ov2640_interface_debug_print("ov2640: check cmx %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
4043
4044 /* disable cmx */
4045 res = ov2640_set_cmx(&gs_handle, OV2640_BOOL_FALSE);
4046 if (res != 0)
4047 {
4048 ov2640_interface_debug_print("ov2640: set cmx failed.\n");
4049 (void)ov2640_deinit(&gs_handle);
4050
4051 return 1;
4052 }
4053 ov2640_interface_debug_print("ov2640: disable cmx.\n");
4054 res = ov2640_get_cmx(&gs_handle, &enable);
4055 if (res != 0)
4056 {
4057 ov2640_interface_debug_print("ov2640: get cmx failed.\n");
4058 (void)ov2640_deinit(&gs_handle);
4059
4060 return 1;
4061 }
4062 ov2640_interface_debug_print("ov2640: check cmx %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
4063
4064 /* ov2640_set_bpc/ov2640_get_bpc test */
4065 ov2640_interface_debug_print("ov2640: ov2640_set_bpc/ov2640_get_bpc test.\n");
4066
4067 /* enable bpc */
4068 res = ov2640_set_bpc(&gs_handle, OV2640_BOOL_TRUE);
4069 if (res != 0)
4070 {
4071 ov2640_interface_debug_print("ov2640: set bpc failed.\n");
4072 (void)ov2640_deinit(&gs_handle);
4073
4074 return 1;
4075 }
4076 ov2640_interface_debug_print("ov2640: enable bpc.\n");
4077 res = ov2640_get_bpc(&gs_handle, &enable);
4078 if (res != 0)
4079 {
4080 ov2640_interface_debug_print("ov2640: get bpc failed.\n");
4081 (void)ov2640_deinit(&gs_handle);
4082
4083 return 1;
4084 }
4085 ov2640_interface_debug_print("ov2640: check bpc %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
4086
4087 /* disable bpc */
4088 res = ov2640_set_bpc(&gs_handle, OV2640_BOOL_FALSE);
4089 if (res != 0)
4090 {
4091 ov2640_interface_debug_print("ov2640: set bpc failed.\n");
4092 (void)ov2640_deinit(&gs_handle);
4093
4094 return 1;
4095 }
4096 ov2640_interface_debug_print("ov2640: disable bpc.\n");
4097 res = ov2640_get_bpc(&gs_handle, &enable);
4098 if (res != 0)
4099 {
4100 ov2640_interface_debug_print("ov2640: get bpc failed.\n");
4101 (void)ov2640_deinit(&gs_handle);
4102
4103 return 1;
4104 }
4105 ov2640_interface_debug_print("ov2640: check bpc %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
4106
4107 /* ov2640_set_wpc/ov2640_get_wpc test */
4108 ov2640_interface_debug_print("ov2640: ov2640_set_wpc/ov2640_get_wpc test.\n");
4109
4110 /* enable wpc */
4111 res = ov2640_set_wpc(&gs_handle, OV2640_BOOL_TRUE);
4112 if (res != 0)
4113 {
4114 ov2640_interface_debug_print("ov2640: set wpc failed.\n");
4115 (void)ov2640_deinit(&gs_handle);
4116
4117 return 1;
4118 }
4119 ov2640_interface_debug_print("ov2640: enable wpc.\n");
4120 res = ov2640_get_wpc(&gs_handle, &enable);
4121 if (res != 0)
4122 {
4123 ov2640_interface_debug_print("ov2640: get wpc failed.\n");
4124 (void)ov2640_deinit(&gs_handle);
4125
4126 return 1;
4127 }
4128 ov2640_interface_debug_print("ov2640: check wpc %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
4129
4130 /* disable wpc */
4131 res = ov2640_set_wpc(&gs_handle, OV2640_BOOL_FALSE);
4132 if (res != 0)
4133 {
4134 ov2640_interface_debug_print("ov2640: set wpc failed.\n");
4135 (void)ov2640_deinit(&gs_handle);
4136
4137 return 1;
4138 }
4139 ov2640_interface_debug_print("ov2640: disable wpc.\n");
4140 res = ov2640_get_wpc(&gs_handle, &enable);
4141 if (res != 0)
4142 {
4143 ov2640_interface_debug_print("ov2640: get wpc failed.\n");
4144 (void)ov2640_deinit(&gs_handle);
4145
4146 return 1;
4147 }
4148 ov2640_interface_debug_print("ov2640: check wpc %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
4149
4150 /* ov2640_set_sde_indirect_register_address/ov2640_get_sde_indirect_register_address test */
4151 ov2640_interface_debug_print("ov2640: ov2640_set_sde_indirect_register_address/ov2640_get_sde_indirect_register_address test.\n");
4152
4153 /* set sde indirect register address */
4154 reg8 = 0x00;
4155 res = ov2640_set_sde_indirect_register_address(&gs_handle, reg8);
4156 if (res != 0)
4157 {
4158 ov2640_interface_debug_print("ov2640: set sde indirect register address failed.\n");
4159 (void)ov2640_deinit(&gs_handle);
4160
4161 return 1;
4162 }
4163 ov2640_interface_debug_print("ov2640: set sde indirect register address %d.\n", reg8);
4164 res = ov2640_get_sde_indirect_register_address(&gs_handle, &reg8_check);
4165 if (res != 0)
4166 {
4167 ov2640_interface_debug_print("ov2640: get sde indirect register address failed.\n");
4168 (void)ov2640_deinit(&gs_handle);
4169
4170 return 1;
4171 }
4172 ov2640_interface_debug_print("ov2640: check sde indirect register address %s.\n", reg8 == reg8_check ? "ok" : "error");
4173
4174 /* ov2640_set_sde_indirect_register_data/ov2640_get_sde_indirect_register_data test */
4175 ov2640_interface_debug_print("ov2640: ov2640_set_sde_indirect_register_data/ov2640_get_sde_indirect_register_data test.\n");
4176
4177 /* set sde indirect register data */
4178 reg8 = rand() % 256;
4179 res = ov2640_set_sde_indirect_register_data(&gs_handle, reg8);
4180 if (res != 0)
4181 {
4182 ov2640_interface_debug_print("ov2640: set sde indirect register data failed.\n");
4183 (void)ov2640_deinit(&gs_handle);
4184
4185 return 1;
4186 }
4187 ov2640_interface_debug_print("ov2640: set sde indirect register data %d.\n", reg8);
4188 res = ov2640_get_sde_indirect_register_data(&gs_handle, &reg8_check);
4189 if (res != 0)
4190 {
4191 ov2640_interface_debug_print("ov2640: get sde indirect register data failed.\n");
4192 (void)ov2640_deinit(&gs_handle);
4193
4194 return 1;
4195 }
4196 ov2640_interface_debug_print("ov2640: check sde indirect register data %s.\n", reg8 == reg8_check ? "ok" : "error");
4197
4198 /* ov2640_set_image_horizontal/ov2640_get_image_horizontal test */
4199 ov2640_interface_debug_print("ov2640: ov2640_set_image_horizontal/ov2640_get_image_horizontal test.\n");
4200
4201 reg16 = rand() % 0xFFF;
4202 res = ov2640_set_image_horizontal(&gs_handle, reg16);
4203 if (res != 0)
4204 {
4205 ov2640_interface_debug_print("ov2640: set image horizontal failed.\n");
4206 (void)ov2640_deinit(&gs_handle);
4207
4208 return 1;
4209 }
4210 ov2640_interface_debug_print("ov2640: set image horizontal %d.\n", reg16);
4211 res = ov2640_get_image_horizontal(&gs_handle, &reg16_check);
4212 if (res != 0)
4213 {
4214 ov2640_interface_debug_print("ov2640: get image horizontal failed.\n");
4215 (void)ov2640_deinit(&gs_handle);
4216
4217 return 1;
4218 }
4219 ov2640_interface_debug_print("ov2640: check image horizontal %s.\n", reg16 == reg16_check ? "ok" : "error");
4220
4221 /* ov2640_set_image_vertical/ov2640_get_image_vertical test */
4222 ov2640_interface_debug_print("ov2640: ov2640_set_image_vertical/ov2640_get_image_vertical test.\n");
4223
4224 reg16 = rand() % 0x7FF;
4225 res = ov2640_set_image_vertical(&gs_handle, reg16);
4226 if (res != 0)
4227 {
4228 ov2640_interface_debug_print("ov2640: set image vertical failed.\n");
4229 (void)ov2640_deinit(&gs_handle);
4230
4231 return 1;
4232 }
4233 ov2640_interface_debug_print("ov2640: set image vertical %d.\n", reg16);
4234 res = ov2640_get_image_vertical(&gs_handle, &reg16_check);
4235 if (res != 0)
4236 {
4237 ov2640_interface_debug_print("ov2640: get image vertical failed.\n");
4238 (void)ov2640_deinit(&gs_handle);
4239
4240 return 1;
4241 }
4242 ov2640_interface_debug_print("ov2640: check image vertical %s.\n", reg16 == reg16_check ? "ok" : "error");
4243
4244 /* ov2640_set_quantization_scale_factor/ov2640_get_quantization_scale_factor test */
4245 ov2640_interface_debug_print("ov2640: ov2640_set_quantization_scale_factor/ov2640_get_quantization_scale_factor test.\n");
4246
4247 reg8 = rand() % 16;
4248 res = ov2640_set_quantization_scale_factor(&gs_handle, reg8);
4249 if (res != 0)
4250 {
4251 ov2640_interface_debug_print("ov2640: set quantization scale factor failed.\n");
4252 (void)ov2640_deinit(&gs_handle);
4253
4254 return 1;
4255 }
4256 ov2640_interface_debug_print("ov2640: set quantization scale factor %d.\n", reg8);
4257 res = ov2640_get_quantization_scale_factor(&gs_handle, &reg8_check);
4258 if (res != 0)
4259 {
4260 ov2640_interface_debug_print("ov2640: get quantization scale factor failed.\n");
4261 (void)ov2640_deinit(&gs_handle);
4262
4263 return 1;
4264 }
4265 ov2640_interface_debug_print("ov2640: check quantization scale factor %s.\n", reg8 == reg8_check ? "ok" : "error");
4266
4267 /* ov2640_set_lp_dp/ov2640_get_lp_dp test */
4268 ov2640_interface_debug_print("ov2640: ov2640_set_lp_dp/ov2640_get_lp_dp test.\n");
4269
4270 /* enable lp dp */
4271 res = ov2640_set_lp_dp(&gs_handle, OV2640_BOOL_TRUE);
4272 if (res != 0)
4273 {
4274 ov2640_interface_debug_print("ov2640: set lp dp failed.\n");
4275 (void)ov2640_deinit(&gs_handle);
4276
4277 return 1;
4278 }
4279 ov2640_interface_debug_print("ov2640: enable lp dp.\n");
4280 res = ov2640_get_lp_dp(&gs_handle, &enable);
4281 if (res != 0)
4282 {
4283 ov2640_interface_debug_print("ov2640: get lp dp failed.\n");
4284 (void)ov2640_deinit(&gs_handle);
4285
4286 return 1;
4287 }
4288 ov2640_interface_debug_print("ov2640: check lp dp %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
4289
4290 /* disable lp dp */
4291 res = ov2640_set_lp_dp(&gs_handle, OV2640_BOOL_FALSE);
4292 if (res != 0)
4293 {
4294 ov2640_interface_debug_print("ov2640: set lp dp failed.\n");
4295 (void)ov2640_deinit(&gs_handle);
4296
4297 return 1;
4298 }
4299 ov2640_interface_debug_print("ov2640: disable lp dp.\n");
4300 res = ov2640_get_lp_dp(&gs_handle, &enable);
4301 if (res != 0)
4302 {
4303 ov2640_interface_debug_print("ov2640: get lp dp failed.\n");
4304 (void)ov2640_deinit(&gs_handle);
4305
4306 return 1;
4307 }
4308 ov2640_interface_debug_print("ov2640: check lp dp %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
4309
4310 /* ov2640_set_round/ov2640_get_round test */
4311 ov2640_interface_debug_print("ov2640: ov2640_set_round/ov2640_get_round test.\n");
4312
4313 /* enable round */
4314 res = ov2640_set_round(&gs_handle, OV2640_BOOL_TRUE);
4315 if (res != 0)
4316 {
4317 ov2640_interface_debug_print("ov2640: set round failed.\n");
4318 (void)ov2640_deinit(&gs_handle);
4319
4320 return 1;
4321 }
4322 ov2640_interface_debug_print("ov2640: enable round.\n");
4323 res = ov2640_get_round(&gs_handle, &enable);
4324 if (res != 0)
4325 {
4326 ov2640_interface_debug_print("ov2640: get round failed.\n");
4327 (void)ov2640_deinit(&gs_handle);
4328
4329 return 1;
4330 }
4331 ov2640_interface_debug_print("ov2640: check round %s.\n", enable == OV2640_BOOL_TRUE ? "ok" : "error");
4332
4333 /* disable round */
4334 res = ov2640_set_round(&gs_handle, OV2640_BOOL_FALSE);
4335 if (res != 0)
4336 {
4337 ov2640_interface_debug_print("ov2640: set round failed.\n");
4338 (void)ov2640_deinit(&gs_handle);
4339
4340 return 1;
4341 }
4342 ov2640_interface_debug_print("ov2640: disable round.\n");
4343 res = ov2640_get_round(&gs_handle, &enable);
4344 if (res != 0)
4345 {
4346 ov2640_interface_debug_print("ov2640: get round failed.\n");
4347 (void)ov2640_deinit(&gs_handle);
4348
4349 return 1;
4350 }
4351 ov2640_interface_debug_print("ov2640: check round %s.\n", enable == OV2640_BOOL_FALSE ? "ok" : "error");
4352
4353 /* ov2640_set_vertical_divider/ov2640_get_vertical_divider test */
4354 ov2640_interface_debug_print("ov2640: ov2640_set_vertical_divider/ov2640_get_vertical_divider test.\n");
4355
4356 reg8 = rand() % 8;
4357 res = ov2640_set_vertical_divider(&gs_handle, reg8);
4358 if (res != 0)
4359 {
4360 ov2640_interface_debug_print("ov2640: set vertical divider failed.\n");
4361 (void)ov2640_deinit(&gs_handle);
4362
4363 return 1;
4364 }
4365 ov2640_interface_debug_print("ov2640: set vertical divider %d.\n", reg8);
4366 res = ov2640_get_vertical_divider(&gs_handle, &reg8_check);
4367 if (res != 0)
4368 {
4369 ov2640_interface_debug_print("ov2640: get vertical divider failed.\n");
4370 (void)ov2640_deinit(&gs_handle);
4371
4372 return 1;
4373 }
4374 ov2640_interface_debug_print("ov2640: check vertical divider %s.\n", reg8 == reg8_check ? "ok" : "error");
4375
4376 /* ov2640_set_horizontal_divider/ov2640_get_horizontal_divider test */
4377 ov2640_interface_debug_print("ov2640: ov2640_set_horizontal_divider/ov2640_get_horizontal_divider test.\n");
4378
4379 reg8 = rand() % 8;
4380 res = ov2640_set_horizontal_divider(&gs_handle, reg8);
4381 if (res != 0)
4382 {
4383 ov2640_interface_debug_print("ov2640: set horizontal divider failed.\n");
4384 (void)ov2640_deinit(&gs_handle);
4385
4386 return 1;
4387 }
4388 ov2640_interface_debug_print("ov2640: set horizontal divider %d.\n", reg8);
4389 res = ov2640_get_horizontal_divider(&gs_handle, &reg8_check);
4390 if (res != 0)
4391 {
4392 ov2640_interface_debug_print("ov2640: get horizontal divider failed.\n");
4393 (void)ov2640_deinit(&gs_handle);
4394
4395 return 1;
4396 }
4397 ov2640_interface_debug_print("ov2640: check horizontal divider %s.\n", reg8 == reg8_check ? "ok" : "error");
4398
4399 /* ov2640_set_horizontal_size/ov2640_get_horizontal_size test */
4400 ov2640_interface_debug_print("ov2640: ov2640_set_horizontal_size/ov2640_get_horizontal_size test.\n");
4401
4402 reg16 = (rand() % 0x3FF) / 4;
4403 res = ov2640_set_horizontal_size(&gs_handle, reg16);
4404 if (res != 0)
4405 {
4406 ov2640_interface_debug_print("ov2640: set horizontal size failed.\n");
4407 (void)ov2640_deinit(&gs_handle);
4408
4409 return 1;
4410 }
4411 ov2640_interface_debug_print("ov2640: set horizontal size %d.\n", reg16);
4412 res = ov2640_get_horizontal_size(&gs_handle, &reg16_check);
4413 if (res != 0)
4414 {
4415 ov2640_interface_debug_print("ov2640: get horizontal size failed.\n");
4416 (void)ov2640_deinit(&gs_handle);
4417
4418 return 1;
4419 }
4420 ov2640_interface_debug_print("ov2640: check horizontal size %s.\n", reg16 == reg16_check ? "ok" : "error");
4421
4422 /* ov2640_set_vertical_size/ov2640_get_vertical_size test */
4423 ov2640_interface_debug_print("ov2640: ov2640_set_vertical_size/ov2640_get_vertical_size test.\n");
4424
4425 reg16 = (rand() % 0x1FF) / 4;
4426 res = ov2640_set_vertical_size(&gs_handle, reg16);
4427 if (res != 0)
4428 {
4429 ov2640_interface_debug_print("ov2640: set vertical size failed.\n");
4430 (void)ov2640_deinit(&gs_handle);
4431
4432 return 1;
4433 }
4434 ov2640_interface_debug_print("ov2640: set vertical size %d.\n", reg16);
4435 res = ov2640_get_vertical_size(&gs_handle, &reg16_check);
4436 if (res != 0)
4437 {
4438 ov2640_interface_debug_print("ov2640: get vertical size failed.\n");
4439 (void)ov2640_deinit(&gs_handle);
4440
4441 return 1;
4442 }
4443 ov2640_interface_debug_print("ov2640: check vertical size %s.\n", reg16 == reg16_check ? "ok" : "error");
4444
4445 /* ov2640_set_offset_x/oov2640_get_offset_x test */
4446 ov2640_interface_debug_print("ov2640: ov2640_set_offset_x/oov2640_get_offset_x test.\n");
4447
4448 /* set offset x */
4449 reg16 = rand() % 0x7FF;
4450 res = ov2640_set_offset_x(&gs_handle, reg16);
4451 if (res != 0)
4452 {
4453 ov2640_interface_debug_print("ov2640: set offset x failed.\n");
4454 (void)ov2640_deinit(&gs_handle);
4455
4456 return 1;
4457 }
4458 ov2640_interface_debug_print("ov2640: set offset x %d.\n", reg16);
4459 res = ov2640_get_offset_x(&gs_handle, &reg16_check);
4460 if (res != 0)
4461 {
4462 ov2640_interface_debug_print("ov2640: get offset x failed.\n");
4463 (void)ov2640_deinit(&gs_handle);
4464
4465 return 1;
4466 }
4467 ov2640_interface_debug_print("ov2640: check offset x %s.\n", reg16 == reg16_check ? "ok" : "error");
4468
4469 /* ov2640_set_offset_y/oov2640_get_offset_y test */
4470 ov2640_interface_debug_print("ov2640: ov2640_set_offset_y/oov2640_get_offset_y test.\n");
4471
4472 /* set offset y */
4473 reg16 = rand() % 0x7FF;
4474 res = ov2640_set_offset_y(&gs_handle, reg16);
4475 if (res != 0)
4476 {
4477 ov2640_interface_debug_print("ov2640: set offset y failed.\n");
4478 (void)ov2640_deinit(&gs_handle);
4479
4480 return 1;
4481 }
4482 ov2640_interface_debug_print("ov2640: set offset y %d.\n", reg16);
4483 res = ov2640_get_offset_y(&gs_handle, &reg16_check);
4484 if (res != 0)
4485 {
4486 ov2640_interface_debug_print("ov2640: get offset y failed.\n");
4487 (void)ov2640_deinit(&gs_handle);
4488
4489 return 1;
4490 }
4491 ov2640_interface_debug_print("ov2640: check offset y %s.\n", reg16 == reg16_check ? "ok" : "error");
4492
4493 /* ov2640_set_dp_selx/ov2640_get_dp_selx test */
4494 ov2640_interface_debug_print("ov2640: ov2640_set_dp_selx/ov2640_get_dp_selx test.\n");
4495
4496 /* set dp selx */
4497 reg8 = rand() % 0xF;
4498 res = ov2640_set_dp_selx(&gs_handle, reg8);
4499 if (res != 0)
4500 {
4501 ov2640_interface_debug_print("ov2640: set dp selx failed.\n");
4502 (void)ov2640_deinit(&gs_handle);
4503
4504 return 1;
4505 }
4506 ov2640_interface_debug_print("ov2640: set dp selx %d.\n", reg8);
4507 res = ov2640_get_dp_selx(&gs_handle, &reg8_check);
4508 if (res != 0)
4509 {
4510 ov2640_interface_debug_print("ov2640: get dp selx failed.\n");
4511 (void)ov2640_deinit(&gs_handle);
4512
4513 return 1;
4514 }
4515 ov2640_interface_debug_print("ov2640: check dp selx %s.\n", reg8 == reg8_check ? "ok" : "error");
4516
4517 /* ov2640_set_dp_sely/ov2640_get_dp_sely test */
4518 ov2640_interface_debug_print("ov2640: ov2640_set_dp_sely/ov2640_get_dp_sely test.\n");
4519
4520 /* set dp sely */
4521 reg8 = rand() % 0xF;
4522 res = ov2640_set_dp_sely(&gs_handle, reg8);
4523 if (res != 0)
4524 {
4525 ov2640_interface_debug_print("ov2640: set dp sely failed.\n");
4526 (void)ov2640_deinit(&gs_handle);
4527
4528 return 1;
4529 }
4530 ov2640_interface_debug_print("ov2640: set dp sely %d.\n", reg8);
4531 res = ov2640_get_dp_sely(&gs_handle, &reg8_check);
4532 if (res != 0)
4533 {
4534 ov2640_interface_debug_print("ov2640: get dp sely failed.\n");
4535 (void)ov2640_deinit(&gs_handle);
4536
4537 return 1;
4538 }
4539 ov2640_interface_debug_print("ov2640: check dp sely %s.\n", reg8 == reg8_check ? "ok" : "error");
4540
4541 /* ov2640_set_output_width/ov2640_get_output_wide test */
4542 ov2640_interface_debug_print("ov2640: ov2640_set_output_width/ov2640_get_output_wide test.\n");
4543
4544 /* set output wide */
4545 reg16 = rand() % 0x3FF;
4546 res = ov2640_set_output_width(&gs_handle, reg16);
4547 if (res != 0)
4548 {
4549 ov2640_interface_debug_print("ov2640: set output width failed.\n");
4550 (void)ov2640_deinit(&gs_handle);
4551
4552 return 1;
4553 }
4554 ov2640_interface_debug_print("ov2640: set output width %d.\n", reg16);
4555 res = ov2640_get_output_width(&gs_handle, &reg16_check);
4556 if (res != 0)
4557 {
4558 ov2640_interface_debug_print("ov2640: get output width failed.\n");
4559 (void)ov2640_deinit(&gs_handle);
4560
4561 return 1;
4562 }
4563 ov2640_interface_debug_print("ov2640: check output width %s.\n", reg16 == reg16_check ? "ok" : "error");
4564
4565 /* ov2640_set_output_height/ov2640_get_output_height test */
4566 ov2640_interface_debug_print("ov2640: ov2640_set_output_height/ov2640_get_output_height test.\n");
4567
4568 /* set output height */
4569 reg16 = rand() % 0x1FF;
4570 res = ov2640_set_output_height(&gs_handle, reg16);
4571 if (res != 0)
4572 {
4573 ov2640_interface_debug_print("ov2640: set output height failed.\n");
4574 (void)ov2640_deinit(&gs_handle);
4575
4576 return 1;
4577 }
4578 ov2640_interface_debug_print("ov2640: set output height %d.\n", reg16);
4579 res = ov2640_get_output_height(&gs_handle, &reg16_check);
4580 if (res != 0)
4581 {
4582 ov2640_interface_debug_print("ov2640: get output height failed.\n");
4583 (void)ov2640_deinit(&gs_handle);
4584
4585 return 1;
4586 }
4587 ov2640_interface_debug_print("ov2640: check output height %s.\n", reg16 == reg16_check ? "ok" : "error");
4588
4589 /* ov2640_set_zoom_speed/ov2640_get_zoom_speed test */
4590 ov2640_interface_debug_print("ov2640: ov2640_set_zoom_speed/ov2640_get_zoom_speed test.\n");
4591
4592 /* set zoom speed */
4593 reg8 = 0;
4594 res = ov2640_set_zoom_speed(&gs_handle, reg8);
4595 if (res != 0)
4596 {
4597 ov2640_interface_debug_print("ov2640: set zoom speed failed.\n");
4598 (void)ov2640_deinit(&gs_handle);
4599
4600 return 1;
4601 }
4602 ov2640_interface_debug_print("ov2640: set zoom speed %d.\n", reg8);
4603 res = ov2640_get_zoom_speed(&gs_handle, &reg8_check);
4604 if (res != 0)
4605 {
4606 ov2640_interface_debug_print("ov2640: get zoom speed failed.\n");
4607 (void)ov2640_deinit(&gs_handle);
4608
4609 return 1;
4610 }
4611 ov2640_interface_debug_print("ov2640: check zoom speed %s.\n", reg8 == reg8_check ? "ok" : "error");
4612
4613 /* ov2640_set_light_mode test */
4614 ov2640_interface_debug_print("ov2640: ov2640_set_light_mode test.\n");
4615
4616 /* set light mode auto */
4618 if (res != 0)
4619 {
4620 ov2640_interface_debug_print("ov2640: set light mode failed.\n");
4621 (void)ov2640_deinit(&gs_handle);
4622
4623 return 1;
4624 }
4625 ov2640_interface_debug_print("ov2640: check light mode auto %s.\n", res == 0 ? "ok" : "error");
4626
4627 /* set light mode sunny */
4629 if (res != 0)
4630 {
4631 ov2640_interface_debug_print("ov2640: set light mode failed.\n");
4632 (void)ov2640_deinit(&gs_handle);
4633
4634 return 1;
4635 }
4636 ov2640_interface_debug_print("ov2640: check light mode sunny %s.\n", res == 0 ? "ok" : "error");
4637
4638 /* set light mode cloudy */
4640 if (res != 0)
4641 {
4642 ov2640_interface_debug_print("ov2640: set light mode failed.\n");
4643 (void)ov2640_deinit(&gs_handle);
4644
4645 return 1;
4646 }
4647 ov2640_interface_debug_print("ov2640: check light mode cloudy %s.\n", res == 0 ? "ok" : "error");
4648
4649 /* set light mode office */
4651 if (res != 0)
4652 {
4653 ov2640_interface_debug_print("ov2640: set light mode failed.\n");
4654 (void)ov2640_deinit(&gs_handle);
4655
4656 return 1;
4657 }
4658 ov2640_interface_debug_print("ov2640: check light mode office %s.\n", res == 0 ? "ok" : "error");
4659
4660 /* set light mode home */
4662 if (res != 0)
4663 {
4664 ov2640_interface_debug_print("ov2640: set light mode failed.\n");
4665 (void)ov2640_deinit(&gs_handle);
4666
4667 return 1;
4668 }
4669 ov2640_interface_debug_print("ov2640: check light mode home %s.\n", res == 0 ? "ok" : "error");
4670
4671 /* ov2640_set_color_saturation test */
4672 ov2640_interface_debug_print("ov2640: ov2640_set_color_saturation test.\n");
4673
4674 /* set color saturation +2 */
4676 if (res != 0)
4677 {
4678 ov2640_interface_debug_print("ov2640: set color saturation failed.\n");
4679 (void)ov2640_deinit(&gs_handle);
4680
4681 return 1;
4682 }
4683 ov2640_interface_debug_print("ov2640: check color saturation +2 %s.\n", res == 0 ? "ok" : "error");
4684
4685 /* set color saturation +1 */
4687 if (res != 0)
4688 {
4689 ov2640_interface_debug_print("ov2640: set color saturation failed.\n");
4690 (void)ov2640_deinit(&gs_handle);
4691
4692 return 1;
4693 }
4694 ov2640_interface_debug_print("ov2640: check color saturation +1 %s.\n", res == 0 ? "ok" : "error");
4695
4696 /* set color saturation 0 */
4698 if (res != 0)
4699 {
4700 ov2640_interface_debug_print("ov2640: set color saturation failed.\n");
4701 (void)ov2640_deinit(&gs_handle);
4702
4703 return 1;
4704 }
4705 ov2640_interface_debug_print("ov2640: check color saturation 0 %s.\n", res == 0 ? "ok" : "error");
4706
4707 /* set color saturation -1 */
4709 if (res != 0)
4710 {
4711 ov2640_interface_debug_print("ov2640: set color saturation failed.\n");
4712 (void)ov2640_deinit(&gs_handle);
4713
4714 return 1;
4715 }
4716 ov2640_interface_debug_print("ov2640: check color saturation -1 %s.\n", res == 0 ? "ok" : "error");
4717
4718 /* set color saturation -2 */
4720 if (res != 0)
4721 {
4722 ov2640_interface_debug_print("ov2640: set color saturation failed.\n");
4723 (void)ov2640_deinit(&gs_handle);
4724
4725 return 1;
4726 }
4727 ov2640_interface_debug_print("ov2640: check color saturation -2 %s.\n", res == 0 ? "ok" : "error");
4728
4729 /* ov2640_set_brightness test */
4730 ov2640_interface_debug_print("ov2640: ov2640_set_brightness test.\n");
4731
4732 /* set brightness +2 */
4734 if (res != 0)
4735 {
4736 ov2640_interface_debug_print("ov2640: set brightness failed.\n");
4737 (void)ov2640_deinit(&gs_handle);
4738
4739 return 1;
4740 }
4741 ov2640_interface_debug_print("ov2640: check brightness +2 %s.\n", res == 0 ? "ok" : "error");
4742
4743 /* set brightness +1 */
4745 if (res != 0)
4746 {
4747 ov2640_interface_debug_print("ov2640: set brightness failed.\n");
4748 (void)ov2640_deinit(&gs_handle);
4749
4750 return 1;
4751 }
4752 ov2640_interface_debug_print("ov2640: check brightness +1 %s.\n", res == 0 ? "ok" : "error");
4753
4754 /* set brightness 0 */
4755 res = ov2640_set_brightness(&gs_handle, OV2640_BRIGHTNESS_0);
4756 if (res != 0)
4757 {
4758 ov2640_interface_debug_print("ov2640: set brightness failed.\n");
4759 (void)ov2640_deinit(&gs_handle);
4760
4761 return 1;
4762 }
4763 ov2640_interface_debug_print("ov2640: check brightness 0 %s.\n", res == 0 ? "ok" : "error");
4764
4765 /* set brightness -1 */
4767 if (res != 0)
4768 {
4769 ov2640_interface_debug_print("ov2640: set brightness failed.\n");
4770 (void)ov2640_deinit(&gs_handle);
4771
4772 return 1;
4773 }
4774 ov2640_interface_debug_print("ov2640: check brightness -1 %s.\n", res == 0 ? "ok" : "error");
4775
4776 /* set brightness -2 */
4778 if (res != 0)
4779 {
4780 ov2640_interface_debug_print("ov2640: set brightness failed.\n");
4781 (void)ov2640_deinit(&gs_handle);
4782
4783 return 1;
4784 }
4785 ov2640_interface_debug_print("ov2640: check brightness -2 %s.\n", res == 0 ? "ok" : "error");
4786
4787 /* ov2640_set_contrast test */
4788 ov2640_interface_debug_print("ov2640: ov2640_set_contrast test.\n");
4789
4790 /* set contrast +2 */
4792 if (res != 0)
4793 {
4794 ov2640_interface_debug_print("ov2640: set contrast failed.\n");
4795 (void)ov2640_deinit(&gs_handle);
4796
4797 return 1;
4798 }
4799 ov2640_interface_debug_print("ov2640: check contrast +2 %s.\n", res == 0 ? "ok" : "error");
4800
4801 /* set contrast +1 */
4803 if (res != 0)
4804 {
4805 ov2640_interface_debug_print("ov2640: set contrast failed.\n");
4806 (void)ov2640_deinit(&gs_handle);
4807
4808 return 1;
4809 }
4810 ov2640_interface_debug_print("ov2640: check contrast +1 %s.\n", res == 0 ? "ok" : "error");
4811
4812 /* set contrast 0 */
4813 res = ov2640_set_contrast(&gs_handle, OV2640_CONTRAST_0);
4814 if (res != 0)
4815 {
4816 ov2640_interface_debug_print("ov2640: set contrast failed.\n");
4817 (void)ov2640_deinit(&gs_handle);
4818
4819 return 1;
4820 }
4821 ov2640_interface_debug_print("ov2640: check contrast 0 %s.\n", res == 0 ? "ok" : "error");
4822
4823 /* set contrast -1 */
4825 if (res != 0)
4826 {
4827 ov2640_interface_debug_print("ov2640: set contrast failed.\n");
4828 (void)ov2640_deinit(&gs_handle);
4829
4830 return 1;
4831 }
4832 ov2640_interface_debug_print("ov2640: check contrast -1 %s.\n", res == 0 ? "ok" : "error");
4833
4834 /* set contrast -2 */
4836 if (res != 0)
4837 {
4838 ov2640_interface_debug_print("ov2640: set contrast failed.\n");
4839 (void)ov2640_deinit(&gs_handle);
4840
4841 return 1;
4842 }
4843 ov2640_interface_debug_print("ov2640: check contrast -2 %s.\n", res == 0 ? "ok" : "error");
4844
4845 /* ov2640_set_special_effect test */
4846 ov2640_interface_debug_print("ov2640: ov2640_set_special_effect test.\n");
4847
4848 /* set special effect antique */
4850 if (res != 0)
4851 {
4852 ov2640_interface_debug_print("ov2640: set special effect failed.\n");
4853 (void)ov2640_deinit(&gs_handle);
4854
4855 return 1;
4856 }
4857 ov2640_interface_debug_print("ov2640: check special effect antique %s.\n", res == 0 ? "ok" : "error");
4858
4859 /* set special effect bluish */
4861 if (res != 0)
4862 {
4863 ov2640_interface_debug_print("ov2640: set special effect failed.\n");
4864 (void)ov2640_deinit(&gs_handle);
4865
4866 return 1;
4867 }
4868 ov2640_interface_debug_print("ov2640: check special effect bluish %s.\n", res == 0 ? "ok" : "error");
4869
4870 /* set special effect greenish */
4872 if (res != 0)
4873 {
4874 ov2640_interface_debug_print("ov2640: set special effect failed.\n");
4875 (void)ov2640_deinit(&gs_handle);
4876
4877 return 1;
4878 }
4879 ov2640_interface_debug_print("ov2640: check special effect greenish %s.\n", res == 0 ? "ok" : "error");
4880
4881 /* set special effect reddish */
4883 if (res != 0)
4884 {
4885 ov2640_interface_debug_print("ov2640: set special effect failed.\n");
4886 (void)ov2640_deinit(&gs_handle);
4887
4888 return 1;
4889 }
4890 ov2640_interface_debug_print("ov2640: check special effect reddish %s.\n", res == 0 ? "ok" : "error");
4891
4892 /* set special effect b&w */
4894 if (res != 0)
4895 {
4896 ov2640_interface_debug_print("ov2640: set special effect failed.\n");
4897 (void)ov2640_deinit(&gs_handle);
4898
4899 return 1;
4900 }
4901 ov2640_interface_debug_print("ov2640: check special effect b&w %s.\n", res == 0 ? "ok" : "error");
4902
4903 /* set special effect negative */
4905 if (res != 0)
4906 {
4907 ov2640_interface_debug_print("ov2640: set special effect failed.\n");
4908 (void)ov2640_deinit(&gs_handle);
4909
4910 return 1;
4911 }
4912 ov2640_interface_debug_print("ov2640: check special effect negative %s.\n", res == 0 ? "ok" : "error");
4913
4914 /* set special effect b&w negative */
4916 if (res != 0)
4917 {
4918 ov2640_interface_debug_print("ov2640: set special effect failed.\n");
4919 (void)ov2640_deinit(&gs_handle);
4920
4921 return 1;
4922 }
4923 ov2640_interface_debug_print("ov2640: check special effect b&w negative %s.\n", res == 0 ? "ok" : "error");
4924
4925 /* set special effect normal */
4927 if (res != 0)
4928 {
4929 ov2640_interface_debug_print("ov2640: set special effect failed.\n");
4930 (void)ov2640_deinit(&gs_handle);
4931
4932 return 1;
4933 }
4934 ov2640_interface_debug_print("ov2640: check special effect normal %s.\n", res == 0 ? "ok" : "error");
4935
4936 /* finish register */
4937 ov2640_interface_debug_print("ov2640: finish register test.\n");
4938 (void)ov2640_deinit(&gs_handle);
4939
4940 return 0;
4941}
driver ov2640 register test header file
uint8_t ov2640_get_awb(ov2640_handle_t *handle, ov2640_bool_t *enable)
get awb status
uint8_t ov2640_set_offset_y(ov2640_handle_t *handle, uint16_t size)
set offset y
uint8_t ov2640_set_aec_enable(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable aec enable
uint8_t ov2640_set_vertical_size(ov2640_handle_t *handle, uint16_t size)
set vertical size
uint8_t ov2640_set_awb_gain(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable awb gain
uint8_t ov2640_get_byte_swap(ov2640_handle_t *handle, ov2640_byte_swap_t *byte_swap)
get byte swap
uint8_t ov2640_set_cip(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable cip
uint8_t ov2640_set_vfirst(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable vfirst
uint8_t ov2640_set_output_width(ov2640_handle_t *handle, uint16_t size)
set output width
ov2640_dvp_output_format_t
ov2640 dvp output format enumeration definition
uint8_t ov2640_get_sde(ov2640_handle_t *handle, ov2640_bool_t *enable)
get sde status
uint8_t ov2640_set_rgb(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable rgb
uint8_t ov2640_set_pre(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable pre
uint8_t ov2640_get_quantization_scale_factor(ov2640_handle_t *handle, uint8_t *factor)
get quantization scale factor
uint8_t ov2640_set_sccb_protocol_command(ov2640_handle_t *handle, uint8_t cmd)
set sccb protocol command
uint8_t ov2640_get_wpc(ov2640_handle_t *handle, ov2640_bool_t *enable)
get wpc status
uint8_t ov2640_get_yuv(ov2640_handle_t *handle, ov2640_bool_t *enable)
get yuv status
uint8_t ov2640_set_dg(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable dg
uint8_t ov2640_get_image_vertical(ov2640_handle_t *handle, uint16_t *size)
get image vertical
uint8_t ov2640_get_offset_x(ov2640_handle_t *handle, uint16_t *size)
get offset x
uint8_t ov2640_set_uv_avg(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable uv avg
uint8_t ov2640_get_aec_sel(ov2640_handle_t *handle, ov2640_bool_t *enable)
get aec sel status
uint8_t ov2640_get_sensor_pass_through_access(ov2640_handle_t *handle, ov2640_bool_t *enable)
get sensor pass through access status
uint8_t ov2640_get_dmy(ov2640_handle_t *handle, ov2640_bool_t *enable)
get dmy status
uint8_t ov2640_set_dvp_y8(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable dvp y8
uint8_t ov2640_set_sde(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable sde
uint8_t ov2640_set_sccb_master_access(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable sccb master access
uint8_t ov2640_get_cmx(ov2640_handle_t *handle, ov2640_bool_t *enable)
get cmx status
uint8_t ov2640_get_dvp_y8(ov2640_handle_t *handle, ov2640_bool_t *enable)
get dvp y8 status
uint8_t ov2640_set_address_auto_increase(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable address auto increase
uint8_t ov2640_set_round(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable round
uint8_t ov2640_get_dsp_bypass(ov2640_handle_t *handle, ov2640_bool_t *enable)
get dsp bypass status
uint8_t ov2640_get_dg(ov2640_handle_t *handle, ov2640_bool_t *enable)
get dg status
uint8_t ov2640_set_sccb_master_clock_delay(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable sccb master clock delay
uint8_t ov2640_set_sccb(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable sccb
uint8_t ov2640_get_sccb_master_clock_delay(ov2640_handle_t *handle, ov2640_bool_t *enable)
get sccb master clock delay status
uint8_t ov2640_get_stat_sel(ov2640_handle_t *handle, ov2640_bool_t *enable)
get stat sel status
uint8_t ov2640_set_lp_dp(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable lp dp
uint8_t ov2640_set_horizontal_divider(ov2640_handle_t *handle, uint8_t divider)
set horizontal divider
uint8_t ov2640_get_raw_gma(ov2640_handle_t *handle, ov2640_bool_t *enable)
get raw gma status
uint8_t ov2640_set_dvp_pclk(ov2640_handle_t *handle, uint8_t pclk)
set dvp pclk
uint8_t ov2640_get_lp_dp(ov2640_handle_t *handle, ov2640_bool_t *enable)
get lp dp status
uint8_t ov2640_set_bist(ov2640_handle_t *handle, ov2640_bist_t bist, ov2640_bool_t enable)
enable or disable bist
uint8_t ov2640_get_sde_indirect_register_address(ov2640_handle_t *handle, uint8_t *addr)
get sde indirect register address
uint8_t ov2640_get_vertical_divider(ov2640_handle_t *handle, uint8_t *divider)
get vertical divider
uint8_t ov2640_get_output_width(ov2640_handle_t *handle, uint16_t *size)
get output width
uint8_t ov2640_get_sccb_master_access(ov2640_handle_t *handle, ov2640_bool_t *enable)
get sccb master access status
uint8_t ov2640_set_program_memory_pointer_address(ov2640_handle_t *handle, uint16_t addr)
set program memory pointer address
uint8_t ov2640_set_raw(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable raw
uint8_t ov2640_set_yuv422(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable yuv422
uint8_t ov2640_set_uv_adj(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable uv adj
uint8_t ov2640_set_dp_selx(ov2640_handle_t *handle, uint8_t size)
set dp selx
uint8_t ov2640_get_sccb_protocol_command(ov2640_handle_t *handle, uint8_t *cmd)
get sccb protocol command
uint8_t ov2640_get_jpeg_output(ov2640_handle_t *handle, ov2640_bool_t *enable)
get jpeg output status
uint8_t ov2640_set_quantization_scale_factor(ov2640_handle_t *handle, uint8_t factor)
set quantization scale factor
uint8_t ov2640_set_horizontal_size(ov2640_handle_t *handle, uint16_t size)
set horizontal size
uint8_t ov2640_get_uv_avg(ov2640_handle_t *handle, ov2640_bool_t *enable)
get uv avg status
uint8_t ov2640_set_vertical_divider(ov2640_handle_t *handle, uint8_t divider)
set vertical divider
uint8_t ov2640_set_raw_gma(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable raw gma
uint8_t ov2640_set_stat_sel(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable stat sel
uint8_t ov2640_set_sensor_pass_through_access(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable sensor pass through access
uint8_t ov2640_get_output_height(ov2640_handle_t *handle, uint16_t *size)
get output height
ov2640_byte_swap_t
ov2640 byte sawp enumeration definition
uint8_t ov2640_set_output_height(ov2640_handle_t *handle, uint16_t size)
set output height
uint8_t ov2640_get_sccb_protocol_status(ov2640_handle_t *handle, uint8_t *status)
get sccb protocol status
uint8_t ov2640_get_vertical_size(ov2640_handle_t *handle, uint16_t *size)
get vertical size
uint8_t ov2640_set_reset(ov2640_handle_t *handle, ov2640_reset_t type, ov2640_bool_t enable)
enable or disable reset
uint8_t ov2640_set_image_horizontal(ov2640_handle_t *handle, uint16_t size)
set image horizontal
uint8_t ov2640_set_cmx(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable cmx
uint8_t ov2640_get_raw(ov2640_handle_t *handle, ov2640_bool_t *enable)
get raw status
uint8_t ov2640_get_image_horizontal(ov2640_handle_t *handle, uint16_t *size)
get image horizontal
uint8_t ov2640_set_bpc(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable bpc
uint8_t ov2640_get_sccb(ov2640_handle_t *handle, ov2640_bool_t *enable)
get sccb status
uint8_t ov2640_get_program_memory_pointer_access_address(ov2640_handle_t *handle, uint8_t *addr)
get program memory pointer access address
uint8_t ov2640_get_address_auto_increase(ov2640_handle_t *handle, ov2640_bool_t *enable)
get address auto increase status
uint8_t ov2640_set_byte_swap(ov2640_handle_t *handle, ov2640_byte_swap_t byte_swap)
set byte swap
uint8_t ov2640_get_zoom_speed(ov2640_handle_t *handle, uint8_t *speed)
get zoom speed
uint8_t ov2640_get_dcw(ov2640_handle_t *handle, ov2640_bool_t *enable)
get dcw status
uint8_t ov2640_get_round(ov2640_handle_t *handle, ov2640_bool_t *enable)
get round status
uint8_t ov2640_get_lenc(ov2640_handle_t *handle, ov2640_bool_t *enable)
get lenc status
uint8_t ov2640_set_zoom_speed(ov2640_handle_t *handle, uint8_t speed)
set zoom speed
ov2640_href_timing_t
ov2640 href timing enumeration definition
uint8_t ov2640_get_rgb(ov2640_handle_t *handle, ov2640_bool_t *enable)
get rgb status
uint8_t ov2640_set_dvp_jpeg_output_href_timing(ov2640_handle_t *handle, ov2640_href_timing_t timing)
set dvp jpeg output href timing
uint8_t ov2640_get_reset(ov2640_handle_t *handle, ov2640_reset_t type, ov2640_bool_t *enable)
get reset status
uint8_t ov2640_set_aec_sel(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable aec sel
uint8_t ov2640_set_awb(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable awb
uint8_t ov2640_set_offset_x(ov2640_handle_t *handle, uint16_t size)
set offset x
uint8_t ov2640_get_pre(ov2640_handle_t *handle, ov2640_bool_t *enable)
get pre status
uint8_t ov2640_set_sde_indirect_register_data(ov2640_handle_t *handle, uint8_t data)
set sde indirect register data
uint8_t ov2640_set_jpeg_output(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable jpeg output
uint8_t ov2640_get_sde_indirect_register_data(ov2640_handle_t *handle, uint8_t *data)
get sde indirect register data
uint8_t ov2640_set_sde_indirect_register_address(ov2640_handle_t *handle, uint8_t addr)
set sde indirect register address
uint8_t ov2640_set_image_vertical(ov2640_handle_t *handle, uint16_t size)
set image vertical
uint8_t ov2640_get_sccb_slave_id(ov2640_handle_t *handle, uint8_t *id)
get sccb slave id
uint8_t ov2640_get_bist(ov2640_handle_t *handle, ov2640_bist_t bist, ov2640_bool_t *enable)
get bist status
uint8_t ov2640_set_lenc(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable lenc
uint8_t ov2640_get_program_memory_pointer_address(ov2640_handle_t *handle, uint16_t *addr)
get program memory pointer address
uint8_t ov2640_get_uv_adj(ov2640_handle_t *handle, ov2640_bool_t *enable)
get uv adj status
uint8_t ov2640_set_dsp_bypass(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable dsp bypass
uint8_t ov2640_get_dvp_jpeg_output_href_timing(ov2640_handle_t *handle, ov2640_href_timing_t *timing)
get dvp jpeg output href timing
uint8_t ov2640_get_vfirst(ov2640_handle_t *handle, ov2640_bool_t *enable)
get vfirst status
uint8_t ov2640_get_horizontal_divider(ov2640_handle_t *handle, uint8_t *divider)
get horizontal divider
uint8_t ov2640_get_dvp_pclk(ov2640_handle_t *handle, uint8_t *pclk)
get dvp pclk
uint8_t ov2640_get_yuv422(ov2640_handle_t *handle, ov2640_bool_t *enable)
get yuv422 status
uint8_t ov2640_get_cip(ov2640_handle_t *handle, ov2640_bool_t *enable)
get cip status
uint8_t ov2640_get_dp_selx(ov2640_handle_t *handle, uint8_t *size)
get dp selx
uint8_t ov2640_set_auto_mode(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable auto_mode
uint8_t ov2640_set_sccb_slave_id(ov2640_handle_t *handle, uint8_t id)
set sccb slave id
uint8_t ov2640_get_bpc(ov2640_handle_t *handle, ov2640_bool_t *enable)
get bpc status
uint8_t ov2640_get_horizontal_size(ov2640_handle_t *handle, uint16_t *size)
get horizontal size
uint8_t ov2640_set_wpc(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable wpc
uint8_t ov2640_set_yuv(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable yuv
uint8_t ov2640_get_auto_mode(ov2640_handle_t *handle, ov2640_bool_t *enable)
get auto mode status
uint8_t ov2640_get_sccb_master_speed(ov2640_handle_t *handle, uint8_t *speed)
get sccb master speed
uint8_t ov2640_get_dvp_output_format(ov2640_handle_t *handle, ov2640_dvp_output_format_t *format)
get dvp output format
uint8_t ov2640_get_awb_gain(ov2640_handle_t *handle, ov2640_bool_t *enable)
get awb gain status
uint8_t ov2640_set_program_memory_pointer_access_address(ov2640_handle_t *handle, uint8_t addr)
set program memory pointer access address
uint8_t ov2640_set_sccb_master_speed(ov2640_handle_t *handle, uint8_t speed)
set sccb master speed
uint8_t ov2640_set_dmy(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable dmy
uint8_t ov2640_get_aec_enable(ov2640_handle_t *handle, ov2640_bool_t *enable)
get aec enable status
uint8_t ov2640_set_sccb_protocol_status(ov2640_handle_t *handle, uint8_t status)
set sccb protocol status
uint8_t ov2640_set_dcw(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable dcw
uint8_t ov2640_set_dvp_output_format(ov2640_handle_t *handle, ov2640_dvp_output_format_t format)
set dvp output format
uint8_t ov2640_set_dp_sely(ov2640_handle_t *handle, uint8_t size)
set dp sely
uint8_t ov2640_get_offset_y(ov2640_handle_t *handle, uint16_t *size)
get offset y
uint8_t ov2640_get_dp_sely(ov2640_handle_t *handle, uint8_t *size)
get dp sely
@ OV2640_DVP_OUTPUT_FORMAT_YUV422
@ OV2640_DVP_OUTPUT_FORMAT_RGB565
@ OV2640_DVP_OUTPUT_FORMAT_RAW10
@ OV2640_BYTE_SWAP_UVUV
@ OV2640_BYTE_SWAP_YUYV
@ OV2640_BIST_BOOT_ROM
@ OV2640_BIST_RW_1_ERROR_512_BYTE
@ OV2640_BIST_RW_1_ERROR_12K_BYTE
@ OV2640_BIST_RW_0_ERROR_12K_BYTE
@ OV2640_BIST_BUSY_OR_SHOT_RESET
@ OV2640_BIST_MICROCONTROLLER_RESET
@ OV2640_BIST_RW_0_ERROR_512_BYTE
@ OV2640_BIST_LAUNCH
@ OV2640_RESET_JPEG
@ OV2640_RESET_MICROCONTROLLER
@ OV2640_RESET_SCCB
@ OV2640_RESET_DVP
@ OV2640_RESET_IPU
@ OV2640_HREF_TIMING_VSYNC
@ OV2640_HREF_TIMING_SENSOR
uint8_t ov2640_set_special_effect(ov2640_handle_t *handle, ov2640_special_effect_t effect)
set special effect
uint8_t ov2640_set_light_mode(ov2640_handle_t *handle, ov2640_light_mode_t mode)
set light mode
uint8_t ov2640_set_color_saturation(ov2640_handle_t *handle, ov2640_color_saturation_t color)
set color saturation
uint8_t ov2640_set_contrast(ov2640_handle_t *handle, ov2640_contrast_t contrast)
set contrast
uint8_t ov2640_set_brightness(ov2640_handle_t *handle, ov2640_brightness_t brightness)
set brightness
@ OV2640_SPECIAL_EFFECT_ANTIQUE
@ OV2640_SPECIAL_EFFECT_BW_NEGATIVE
@ OV2640_SPECIAL_EFFECT_GREENISH
@ OV2640_SPECIAL_EFFECT_BLUISH
@ OV2640_SPECIAL_EFFECT_REDDISH
@ OV2640_SPECIAL_EFFECT_NEGATIVE
@ OV2640_SPECIAL_EFFECT_NORMAL
@ OV2640_SPECIAL_EFFECT_BW
@ OV2640_CONTRAST_POSITIVE_1
@ OV2640_CONTRAST_0
@ OV2640_CONTRAST_NEGATIVE_1
@ OV2640_CONTRAST_POSITIVE_2
@ OV2640_CONTRAST_NEGATIVE_2
@ OV2640_BRIGHTNESS_0
@ OV2640_BRIGHTNESS_NEGATIVE_1
@ OV2640_BRIGHTNESS_NEGATIVE_2
@ OV2640_BRIGHTNESS_POSITIVE_2
@ OV2640_BRIGHTNESS_POSITIVE_1
@ OV2640_COLOR_SATURATION_NEGATIVE_1
@ OV2640_COLOR_SATURATION_POSITIVE_2
@ OV2640_COLOR_SATURATION_POSITIVE_1
@ OV2640_COLOR_SATURATION_0
@ OV2640_COLOR_SATURATION_NEGATIVE_2
@ OV2640_LIGHT_MODE_OFFICE
@ OV2640_LIGHT_MODE_CLOUDY
@ OV2640_LIGHT_MODE_SUNNY
@ OV2640_LIGHT_MODE_HOME
@ OV2640_LIGHT_MODE_AUTO
uint8_t ov2640_interface_sccb_deinit(void)
interface sccb bus deinit
uint8_t ov2640_interface_reset_init(void)
interface reset init
uint8_t ov2640_interface_power_down_deinit(void)
interface power down deinit
void ov2640_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t ov2640_interface_power_down_write(uint8_t level)
interface power down write
uint8_t ov2640_interface_power_down_init(void)
interface power down init
void ov2640_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t ov2640_interface_sccb_read(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface sccb bus read
uint8_t ov2640_interface_reset_deinit(void)
interface reset deinit
uint8_t ov2640_interface_sccb_write(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface sccb bus write
uint8_t ov2640_interface_sccb_init(void)
interface sccb bus init
uint8_t ov2640_interface_reset_write(uint8_t level)
interface reset write
uint8_t ov2640_get_power_reset_pin_remap(ov2640_handle_t *handle, ov2640_bool_t *enable)
get power reset pin remap status
uint8_t ov2640_get_line_interval_adjust(ov2640_handle_t *handle, uint16_t *adjust)
get line interval adjust
uint8_t ov2640_get_luminance_signal_high_range(ov2640_handle_t *handle, uint8_t *range)
get luminance signal high range
uint8_t ov2640_set_vertical_flip(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable vertical flip
ov2640_edge_t
ov2640 edge enumeration definition
uint8_t ov2640_get_hsync_position_and_width_end_point(ov2640_handle_t *handle, uint16_t *position)
get hsync position and width end point
uint8_t ov2640_get_agc_gain(ov2640_handle_t *handle, uint16_t *gain)
get agc gain
uint8_t ov2640_get_luminance_average(ov2640_handle_t *handle, uint8_t *average)
get luminance average
uint8_t ov2640_set_hsync_polarity(ov2640_handle_t *handle, ov2640_polarity_t polarity)
set hsync polarity
uint8_t ov2640_set_60hz_banding_aec(ov2640_handle_t *handle, uint16_t aec)
set 60hz banding aec
uint8_t ov2640_set_horizontal_window_end(ov2640_handle_t *handle, uint16_t end)
set horizontal window end
uint8_t ov2640_set_mode(ov2640_handle_t *handle, ov2640_mode_t mode)
set mode
uint8_t ov2640_get_16_zone_average_weight_option(ov2640_handle_t *handle, uint32_t *avg)
get 16 zone average weight option
uint8_t ov2640_get_band_filter(ov2640_handle_t *handle, ov2640_bool_t *enable)
get band filter status
uint8_t ov2640_get_href_chsync_swap(ov2640_handle_t *handle, ov2640_bool_t *enable)
get href chsync swap status
uint8_t ov2640_set_frame_length_adjustment(ov2640_handle_t *handle, uint16_t frame)
set frame length adjustment
ov2640_resolution_t
ov2640 resolution enumeration definition
struct ov2640_info_s ov2640_info_t
ov2640 information structure definition
uint8_t ov2640_set_hsync_position_and_width_end_point(ov2640_handle_t *handle, uint16_t position)
set hsync position and width end point
uint8_t ov2640_set_clock_rate_double(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable double clock rate
uint8_t ov2640_set_href_chsync_swap(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable href chsync swap
uint8_t ov2640_set_pclk(ov2640_handle_t *handle, ov2640_pclk_t pclk)
set pclk
uint8_t ov2640_get_clock_divider(ov2640_handle_t *handle, uint8_t *divider)
get clock divider
uint8_t ov2640_deinit(ov2640_handle_t *handle)
close the chip
ov2640_agc_gain_t
ov2640 agc gain enumeration definition
uint8_t ov2640_set_output_drive(ov2640_handle_t *handle, ov2640_output_drive_t select)
set output drive
uint8_t ov2640_set_flash_light(ov2640_handle_t *handle, uint8_t control)
set flash light
uint8_t ov2640_get_histogram_algorithm_high_level(ov2640_handle_t *handle, uint8_t *level)
get histogram algorithm high level
uint8_t ov2640_get_frame_length_adjustment(ov2640_handle_t *handle, uint16_t *frame)
get frame length adjustment
uint8_t ov2640_get_horizontal_window_start(ov2640_handle_t *handle, uint16_t *start)
get horizontal window start
uint8_t ov2640_set_vertical_window_line_start(ov2640_handle_t *handle, uint16_t start)
set vertical window line start
uint8_t ov2640_get_luminance_signal_low_range(ov2640_handle_t *handle, uint8_t *range)
get luminance signal low range
uint8_t ov2640_set_zoom(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable zoom
uint8_t ov2640_get_zoom_mode_vertical_window_start_point(ov2640_handle_t *handle, uint16_t *point)
get zoom mode vertical window start point
uint8_t ov2640_set_vertical_window_line_end(ov2640_handle_t *handle, uint16_t end)
set vertical window line end
uint8_t ov2640_get_resolution(ov2640_handle_t *handle, ov2640_resolution_t *resolution)
get resolution
ov2640_pin_status_t
ov2640 pin status enumeration definition
uint8_t ov2640_get_pclk(ov2640_handle_t *handle, ov2640_pclk_t *pclk)
get pclk
uint8_t ov2640_set_live_video_after_snapshot(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable live video after snapshot
uint8_t ov2640_get_zoom_window_horizontal_start_point(ov2640_handle_t *handle, ov2640_bool_t *enable)
get zoom window horizontal start point status
uint8_t ov2640_get_output_drive(ov2640_handle_t *handle, ov2640_output_drive_t *select)
get output drive
uint8_t ov2640_set_pclk_edge(ov2640_handle_t *handle, ov2640_edge_t edge)
set pclk edge
uint8_t ov2640_get_fast_mode_large_step_range(ov2640_handle_t *handle, uint8_t *high_threshold, uint8_t *low_threshold)
get fast mode large step range
uint8_t ov2640_set_band(ov2640_handle_t *handle, ov2640_band_t band)
set band
ov2640_control_t
ov2640 control enumeration definition
uint8_t ov2640_set_aec(ov2640_handle_t *handle, uint16_t aec)
set aec
uint8_t ov2640_info(ov2640_info_t *info)
get chip's information
uint8_t ov2640_set_clock_output_power_down_pin_status(ov2640_handle_t *handle, ov2640_pin_status_t status)
set clock output power down pin status
uint8_t ov2640_get_vertical_window_line_start(ov2640_handle_t *handle, uint16_t *start)
get vertical window line start
uint8_t ov2640_get_60hz_banding_aec(ov2640_handle_t *handle, uint16_t *aec)
get 60hz banding aec
uint8_t ov2640_set_line_interval_adjust(ov2640_handle_t *handle, uint16_t adjust)
set line interval adjust
uint8_t ov2640_set_pclk_output_qualified_by_href(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable pclk output qualified by href
uint8_t ov2640_set_auto_band(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable auto band
uint8_t ov2640_get_horizontal_window_end(ov2640_handle_t *handle, uint16_t *end)
get horizontal window end
uint8_t ov2640_set_zoom_mode_vertical_window_start_point(ov2640_handle_t *handle, uint16_t point)
set zoom mode vertical window start point
uint8_t ov2640_get_vsync_polarity(ov2640_handle_t *handle, ov2640_polarity_t *polarity)
get vsync polarity
uint8_t ov2640_get_chsync_href_swap(ov2640_handle_t *handle, ov2640_bool_t *enable)
get chsync href swap status
uint8_t ov2640_set_exposure_control(ov2640_handle_t *handle, ov2640_control_t control)
set exposure control
uint8_t ov2640_set_luminance_signal_low_range(ov2640_handle_t *handle, uint8_t range)
set luminance signal low range
uint8_t ov2640_get_frame_exposure_pre_charge_row_number(ov2640_handle_t *handle, uint8_t *num)
get frame exposure pre charge row number
uint8_t ov2640_get_flash_light(ov2640_handle_t *handle, uint8_t *control)
get flash light
uint8_t ov2640_get_aec(ov2640_handle_t *handle, uint16_t *aec)
get aec
uint8_t ov2640_set_dummy_frame(ov2640_handle_t *handle, ov2640_dummy_frame_t frame)
set dummy frame
uint8_t ov2640_get_hsync_position_and_width_start_point(ov2640_handle_t *handle, uint16_t *position)
get hsync position and width start point
uint8_t ov2640_set_16_zone_average_weight_option(ov2640_handle_t *handle, uint32_t avg)
set 16 zone average weight option
uint8_t ov2640_set_color_bar_test(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable color bar test
uint8_t ov2640_get_vsync_pulse_width(ov2640_handle_t *handle, uint16_t *width)
get vsync pulse width
ov2640_bool_t
ov2640 bool enumeration definition
ov2640_output_drive_t
ov2640 output drive enumeration definition
uint8_t ov2640_set_chsync_href_swap(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable chsync href swap
struct ov2640_handle_s ov2640_handle_t
ov2640 handle structure definition
uint8_t ov2640_set_frame_exposure_pre_charge_row_number(ov2640_handle_t *handle, uint8_t num)
set frame exposure pre charge row number
uint8_t ov2640_get_hsync_polarity(ov2640_handle_t *handle, ov2640_polarity_t *polarity)
get hsync polarity
uint8_t ov2640_set_50hz_banding_aec(ov2640_handle_t *handle, uint16_t aec)
set 50hz banding aec
uint8_t ov2640_get_agc_control(ov2640_handle_t *handle, ov2640_control_t *control)
get agc control
uint8_t ov2640_set_resolution(ov2640_handle_t *handle, ov2640_resolution_t resolution)
set resolution
uint8_t ov2640_init(ov2640_handle_t *handle)
initialize the chip
uint8_t ov2640_set_clock_divider(ov2640_handle_t *handle, uint8_t divider)
set clock divider
ov2640_mode_t
ov2640 mode enumeration definition
uint8_t ov2640_set_fast_mode_large_step_range(ov2640_handle_t *handle, uint8_t high_threshold, uint8_t low_threshold)
set fast mode large step range
uint8_t ov2640_set_agc_gain_ceiling(ov2640_handle_t *handle, ov2640_agc_gain_t agc)
set agc
uint8_t ov2640_get_pclk_edge(ov2640_handle_t *handle, ov2640_edge_t *edge)
get pclk edge
uint8_t ov2640_set_horizontal_mirror(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable horizontal mirror
uint8_t ov2640_get_zoom(ov2640_handle_t *handle, ov2640_bool_t *enable)
get zoom status
uint8_t ov2640_get_exposure_control(ov2640_handle_t *handle, ov2640_control_t *control)
get exposure control
uint8_t ov2640_set_vsync_polarity(ov2640_handle_t *handle, ov2640_polarity_t polarity)
set vsync polarity
uint8_t ov2640_get_vertical_flip(ov2640_handle_t *handle, ov2640_bool_t *enable)
get vertical flip status
uint8_t ov2640_set_agc_control(ov2640_handle_t *handle, ov2640_control_t control)
set agc control
uint8_t ov2640_get_auto_band(ov2640_handle_t *handle, ov2640_bool_t *enable)
get auto band status
uint8_t ov2640_set_histogram_algorithm_high_level(ov2640_handle_t *handle, uint8_t level)
set histogram algorithm high level
uint8_t ov2640_set_band_filter(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable band filter
uint8_t ov2640_get_histogram_algorithm_low_level(ov2640_handle_t *handle, uint8_t *level)
get histogram algorithm low level
uint8_t ov2640_get_clock_output_power_down_pin_status(ov2640_handle_t *handle, ov2640_pin_status_t *status)
get clock output power down pin status
uint8_t ov2640_get_pclk_output_qualified_by_href(ov2640_handle_t *handle, ov2640_bool_t *enable)
get pclk output qualified by href status
ov2640_polarity_t
ov2640 polarity enumeration definition
uint8_t ov2640_get_mode(ov2640_handle_t *handle, ov2640_mode_t *mode)
get mode
ov2640_band_t
ov2640 band enumeration definition
uint8_t ov2640_set_luminance_signal_high_range(ov2640_handle_t *handle, uint8_t range)
set luminance signal high range
uint8_t ov2640_set_luminance_average(ov2640_handle_t *handle, uint8_t average)
set luminance average
uint8_t ov2640_get_50hz_banding_aec(ov2640_handle_t *handle, uint16_t *aec)
get 50hz banding aec
uint8_t ov2640_get_horizontal_mirror(ov2640_handle_t *handle, ov2640_bool_t *enable)
get horizontal mirror status
uint8_t ov2640_set_horizontal_window_start(ov2640_handle_t *handle, uint16_t start)
set horizontal window start
uint8_t ov2640_get_agc_gain_ceiling(ov2640_handle_t *handle, ov2640_agc_gain_t *agc)
get agc
uint8_t ov2640_set_hsync_position_and_width_start_point(ov2640_handle_t *handle, uint16_t position)
set hsync position and width start point
uint8_t ov2640_set_href_polarity(ov2640_handle_t *handle, ov2640_polarity_t polarity)
set href polarity
uint8_t ov2640_get_href_polarity(ov2640_handle_t *handle, ov2640_polarity_t *polarity)
get href polarity
uint8_t ov2640_get_band(ov2640_handle_t *handle, ov2640_band_t *band)
get band
uint8_t ov2640_set_zoom_window_horizontal_start_point(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable zoom window horizontal start point
uint8_t ov2640_set_power_reset_pin_remap(ov2640_handle_t *handle, ov2640_bool_t enable)
enable or disable power reset pin remap
uint8_t ov2640_set_agc_gain(ov2640_handle_t *handle, uint16_t gain)
set agc gain
uint8_t ov2640_soft_reset(ov2640_handle_t *handle)
soft reset
uint8_t ov2640_get_live_video_after_snapshot(ov2640_handle_t *handle, ov2640_bool_t *enable)
get live video after snapshot status
uint8_t ov2640_set_histogram_algorithm_low_level(ov2640_handle_t *handle, uint8_t level)
set histogram algorithm low level
uint8_t ov2640_get_color_bar_test(ov2640_handle_t *handle, ov2640_bool_t *enable)
get color bar test status
ov2640_pclk_t
ov2640 pclk enumeration definition
uint8_t ov2640_get_dummy_frame(ov2640_handle_t *handle, ov2640_dummy_frame_t *frame)
get dummy frame
ov2640_dummy_frame_t
ov2640 dummy frame enumeration definition
uint8_t ov2640_set_vsync_pulse_width(ov2640_handle_t *handle, uint16_t width)
set vsync pulse width
uint8_t ov2640_get_vertical_window_line_end(ov2640_handle_t *handle, uint16_t *end)
get vertical window line end
uint8_t ov2640_get_clock_rate_double(ov2640_handle_t *handle, ov2640_bool_t *enable)
get clock rate double status
@ OV2640_EDGE_FALLING
@ OV2640_EDGE_RISING
@ OV2640_RESOLUTION_CIF
@ OV2640_RESOLUTION_SVGA
@ OV2640_RESOLUTION_UXGA
@ OV2640_AGC_128X
@ OV2640_AGC_4X
@ OV2640_AGC_64X
@ OV2640_AGC_8X
@ OV2640_AGC_16X
@ OV2640_AGC_2X
@ OV2640_AGC_32X
@ OV2640_PIN_STATUS_LAST_STATE
@ OV2640_PIN_STATUS_TRI_STATE
@ OV2640_CONTROL_MANUAL
@ OV2640_CONTROL_AUTO
@ OV2640_BOOL_FALSE
@ OV2640_BOOL_TRUE
@ OV2640_OUTPUT_DRIVE_3_CAPABILITY
@ OV2640_OUTPUT_DRIVE_1_CAPABILITY
@ OV2640_OUTPUT_DRIVE_2_CAPABILITY
@ OV2640_OUTPUT_DRIVE_4_CAPABILITY
@ OV2640_MODE_STANDBY
@ OV2640_MODE_NORMAL
@ OV2640_POLARITY_NEGATIVE
@ OV2640_POLARITY_POSITIVE
@ OV2640_BAND_50HZ
@ OV2640_BAND_60HZ
@ OV2640_PCLK_DIVIDE_4
@ OV2640_PCLK_NO_EFFECT
@ OV2640_PCLK_DIVIDE_2
@ OV2640_DUMMY_FRAME_7
@ OV2640_DUMMY_FRAME_3
@ OV2640_DUMMY_FRAME_1
uint8_t ov2640_register_test(void)
register test
float supply_voltage_max_v
uint32_t driver_version
char interface[16]
char manufacturer_name[32]
float supply_voltage_min_v
char chip_name[32]