Unit tests for OV7740 driver.
Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
#include "asf.h"
#include <unit_test/suite.h>
#include "stdio_serial.h"
#include "conf_board.h"
#include "conf_clock.h"
#include "conf_test.h"
Macros | |
#define | PIO_PCMR_DSIZE_WORD PIO_PCMR_DSIZE(2) |
#define | TWI_CLK (400000UL) |
Functions | |
static uint32_t | capture_init (void) |
Initialize PIO capture and the OV7740 image sensor. More... | |
static void | init_vsync_interrupts (void) |
Intialize Vsync_Handler. More... | |
void | ISI_Handler (void) |
Vertical synchronisation handler for the OV7740 image sensor. More... | |
static void | isi_module_init (void) |
ISI initialization. More... | |
int | main (void) |
Application entry point for image sensor capture example. More... | |
static void | ov7740_test_capture_process_run (const struct test_case *const test) |
Start capture process. More... | |
static void | ov7740_test_color_run (const struct test_case *const test) |
Test color of the reference picture from OV7740 image sensor. More... | |
static void | ov7740_test_initialization_run (const struct test_case *const test) |
Test the OV7740 initialization. More... | |
static uint32_t | test_color (uint8_t *p_uc_ref_color, uint8_t *p_uc_capture_data, uint32_t ul_index_capture) |
Test color of a reference picture. More... | |
Variables | |
COMPILER_WORD_ALIGNED struct isi_frame_buffer_descriptors | buf_desc |
uint8_t | g_auc_capture_buffer [153600] |
const uint8_t | g_auc_data_black_color [4] |
const uint8_t | g_auc_data_blue_color [4] |
const uint8_t | g_auc_data_cyan_color [4] |
const uint8_t | g_auc_data_green_color [4] |
const uint8_t | g_auc_data_purple_color [4] |
const uint8_t | g_auc_data_red_color [4] |
const uint8_t | g_auc_data_white_color [4] |
const uint8_t | g_auc_data_yellow_color [4] |
static volatile uint32_t | g_ul_init_error_flag = false |
static volatile uint32_t | g_ul_vsync_flag = false |
const usart_serial_options_t | usart_serial_options |
#define PIO_PCMR_DSIZE_WORD PIO_PCMR_DSIZE(2) |
#define TWI_CLK (400000UL) |
Referenced by capture_init().
|
static |
Initialize PIO capture and the OV7740 image sensor.
References delay_ms, twihs_options::master_clk, ov_configure(), ov_init(), ov_power(), ov_reset(), pmc_enable_periph_clk(), twihs_options::speed, sysclk_get_cpu_hz(), TEST_PATTERN, TWI_CLK, and twihs_master_init().
Referenced by ov7740_test_initialization_run().
|
static |
Intialize Vsync_Handler.
References isi_enable_interrupt().
Referenced by ov7740_test_capture_process_run().
void ISI_Handler | ( | void | ) |
Vertical synchronisation handler for the OV7740 image sensor.
References g_ul_vsync_flag.
|
static |
ISI initialization.
References buf_desc, isi_frame_buffer_descriptors::control, isi_frame_buffer_descriptors::current, g_auc_capture_buffer, isi_config_t::image_fmt, isi_dma_channel_enable(), isi_enable(), isi_init(), ISI_INPUT_YUV, isi_reset(), isi_set_dma_codec_path(), isi_yuv_configue(), isi_frame_buffer_descriptors::next, and pmc_enable_periph_clk().
Referenced by ov7740_test_initialization_run().
int main | ( | void | ) |
Application entry point for image sensor capture example.
References board_init(), DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, NULL, ov7740_test_capture_process_run(), ov7740_test_color_run(), ov7740_test_initialization_run(), stdio_serial_init(), sysclk_enable_peripheral_clock(), sysclk_init(), and test_suite_run().
|
static |
Start capture process.
test | Current test case. |
References g_ul_init_error_flag, g_ul_vsync_flag, init_vsync_interrupts(), isi_capture(), isi_disable_interrupt(), isi_get_status(), and test_assert_true.
Referenced by main().
|
static |
Test color of the reference picture from OV7740 image sensor.
test | Current test case. |
References g_auc_capture_buffer, g_auc_data_black_color, g_auc_data_blue_color, g_auc_data_cyan_color, g_auc_data_green_color, g_auc_data_purple_color, g_auc_data_red_color, g_auc_data_white_color, g_auc_data_yellow_color, test_assert_true, and test_color().
Referenced by main().
|
static |
Test the OV7740 initialization.
test | Current test case. |
References capture_init(), g_ul_init_error_flag, isi_module_init(), and test_assert_true.
Referenced by main().
|
static |
Test color of a reference picture.
p_uc_ref_color | Buffer which contains the reference color. |
p_uc_capture_data | Buffer which contains data from the captured picture. |
ul_index_capture | Index in p_uc_capture_data. |
Referenced by ov7740_test_color_run().
COMPILER_WORD_ALIGNED struct isi_frame_buffer_descriptors buf_desc |
Referenced by isi_module_init().
uint8_t g_auc_capture_buffer[153600] |
Referenced by isi_module_init(), and ov7740_test_color_run().
const uint8_t g_auc_data_black_color[4] |
Referenced by ov7740_test_color_run().
const uint8_t g_auc_data_blue_color[4] |
Referenced by ov7740_test_color_run().
const uint8_t g_auc_data_cyan_color[4] |
Referenced by ov7740_test_color_run().
const uint8_t g_auc_data_green_color[4] |
Referenced by ov7740_test_color_run().
const uint8_t g_auc_data_purple_color[4] |
Referenced by ov7740_test_color_run().
const uint8_t g_auc_data_red_color[4] |
Referenced by ov7740_test_color_run().
const uint8_t g_auc_data_white_color[4] |
Referenced by ov7740_test_color_run().
const uint8_t g_auc_data_yellow_color[4] |
Referenced by ov7740_test_color_run().
|
static |
Referenced by ov7740_test_capture_process_run(), and ov7740_test_initialization_run().
|
static |
Referenced by ISI_Handler(), and ov7740_test_capture_process_run().
const usart_serial_options_t usart_serial_options |
Referenced by main().