|
|
/*
|
|
|
* Copyright (c) Technologies Co., Ltd. 2012-2019. All rights reserved.
|
|
|
* Description: vi test common function
|
|
|
* Author: sdk
|
|
|
* Create: 2013-11-15
|
|
|
*/
|
|
|
|
|
|
#ifndef __VI_ST_COMMON_H__
|
|
|
#define __VI_ST_COMMON_H__
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
#include <stdio.h>
|
|
|
#include <string.h>
|
|
|
#include <assert.h>
|
|
|
#include <unistd.h>
|
|
|
#include <fcntl.h>
|
|
|
#include <sys/types.h>
|
|
|
#include <sys/stat.h>
|
|
|
#include <sys/time.h>
|
|
|
#include <pthread.h>
|
|
|
|
|
|
#include "uapi_system.h"
|
|
|
#include "uapi_pq.h"
|
|
|
#include "uapi_disp.h"
|
|
|
#include "uapi_panel.h"
|
|
|
#include "uapi_win.h"
|
|
|
|
|
|
#include "uapi_tvd.h"
|
|
|
#include "uapi_hdmirx.h"
|
|
|
|
|
|
#include "uapi_vi.h"
|
|
|
#include "mpi_vi_ext.h"
|
|
|
|
|
|
#include "securec.h"
|
|
|
#include "drv_sys_struct.h"
|
|
|
|
|
|
#define FILE_PATH_MAX_SIZE 200
|
|
|
|
|
|
#define VI_REPEAT_TIMES 1000
|
|
|
|
|
|
#define VI_BACKEND_WIDTH 1920
|
|
|
#define VI_BACKEND_HEIGHT 1080
|
|
|
|
|
|
#define VI_FRONTEND_PORT 0
|
|
|
#define VI_FRONTEND_NUM 4
|
|
|
|
|
|
#define NorMatchValue 1
|
|
|
#define VGAMatchValue 4
|
|
|
#define AVMatchValue 6
|
|
|
#define RFMatchValue 14
|
|
|
|
|
|
#ifdef VI_SUPPORT_AUTOTEST
|
|
|
#include "CUnit.h"
|
|
|
|
|
|
#define TD_UNUSED(x) ((x) = (x))
|
|
|
|
|
|
#define test_equal_nsp(api, rtn) \
|
|
|
do { \
|
|
|
EXT_TEST_EQUAL_NSP(api, rtn); \
|
|
|
} while (0)
|
|
|
|
|
|
#define test_unequal_nsp(api, rtn) \
|
|
|
do { \
|
|
|
EXT_TEST_UNEQUAL_NSP(api, rtn); \
|
|
|
} while (0)
|
|
|
|
|
|
#define test_case_begin_print() \
|
|
|
do { \
|
|
|
EXT_TEST_CASE_BEGIN_PRINT(); \
|
|
|
} while (0)
|
|
|
|
|
|
#define test_case_end_print() \
|
|
|
do { \
|
|
|
EXT_TEST_CASE_END_PRINT(); \
|
|
|
} while (0)
|
|
|
|
|
|
#define vi_st_pass() \
|
|
|
do { \
|
|
|
printf("\n\033[0;32mtest case <%s> passed\033[0;39m\n", __FUNCTION__); \
|
|
|
CU_PASS(); \
|
|
|
} while (0)
|
|
|
|
|
|
#else
|
|
|
#define test_case_begin_print() \
|
|
|
do { \
|
|
|
printf("\n====================================================\n"); \
|
|
|
printf("test case <%s> begin", __FUNCTION__); \
|
|
|
printf("\n====================================================\n"); \
|
|
|
} while (0)
|
|
|
|
|
|
#define test_case_end_print() \
|
|
|
do { \
|
|
|
printf("\n====================================================\n"); \
|
|
|
printf("test case <%s> end", __FUNCTION__); \
|
|
|
printf("\n====================================================\n"); \
|
|
|
} while (0)
|
|
|
|
|
|
#define test_equal_nsp(api, rtn) \
|
|
|
do { \
|
|
|
td_s32 _ret_test_ = (api); \
|
|
|
if ((rtn) != _ret_test_) { \
|
|
|
printf("\n\033[0;32mtest case <%s> ret(0x%x)\033[0;39m\n", __FUNCTION__, _ret_test_); \
|
|
|
} \
|
|
|
} while (0)
|
|
|
|
|
|
#define test_unequal_nsp(api, rtn) \
|
|
|
do { \
|
|
|
td_s32 _ret_test_ = (api); \
|
|
|
if ((rtn) == _ret_test_) { \
|
|
|
printf("\n\033[0;32mtest case <%s> ret(0x%x)\033[0;39m\n", __FUNCTION__, _ret_test_); \
|
|
|
} \
|
|
|
} while (0)
|
|
|
|
|
|
#define vi_st_pass() \
|
|
|
do { \
|
|
|
printf("\n\033[0;32mtest case <%s> passed\033[0;39m\n", __FUNCTION__); \
|
|
|
} while (0)
|
|
|
#endif
|
|
|
|
|
|
#define vi_st_green_print(...) \
|
|
|
do { \
|
|
|
printf("\033[0;32m"); \
|
|
|
printf(__VA_ARGS__); \
|
|
|
printf("\033[0;32m \033[0;39m"); \
|
|
|
} while (0)
|
|
|
|
|
|
#define vi_st_red_print(...) \
|
|
|
do { \
|
|
|
printf("\033[0;31m"); \
|
|
|
printf(__VA_ARGS__); \
|
|
|
printf("\033[0;31m \033[0;39m"); \
|
|
|
} while (0)
|
|
|
|
|
|
#define vi_st_yellow_print(...) \
|
|
|
do { \
|
|
|
printf("\033[0;33m"); \
|
|
|
printf(__VA_ARGS__); \
|
|
|
printf("\033[0;33m \033[0;39m"); \
|
|
|
} while (0)
|
|
|
|
|
|
typedef struct {
|
|
|
uapi_vi_picture_mode picture_mode;
|
|
|
uapi_vi_quantization_range quantify_range;
|
|
|
uapi_video_nonstd_info nonstd_info;
|
|
|
uapi_vi_display_field display_field;
|
|
|
uapi_video_crop_rect crop_rect;
|
|
|
td_bool set_picture_mode;
|
|
|
td_bool set_quantify_range;
|
|
|
td_bool set_nonstd_info;
|
|
|
td_bool set_vi_config;
|
|
|
} st_vi_setting;
|
|
|
|
|
|
typedef struct {
|
|
|
uapi_hdr_type hdr_type;
|
|
|
uapi_video_frame_packing_type video_3d_type;
|
|
|
uapi_video_pixel_format pixel_format;
|
|
|
uapi_color_description color_description;
|
|
|
uapi_color_sys color_sys;
|
|
|
uapi_pixel_bit_depth bit_depth;
|
|
|
uapi_oversample over_sample;
|
|
|
td_u32 width;
|
|
|
td_u32 height;
|
|
|
td_bool interlace;
|
|
|
td_u32 frame_rate;
|
|
|
td_u32 vblank;
|
|
|
} st_vi_timing;
|
|
|
|
|
|
typedef struct {
|
|
|
uapi_hdr_type hdr_type;
|
|
|
uapi_video_frame_packing_type video_3d_type; /* 2D/3D <20><>ʽ */
|
|
|
uapi_video_pixel_format pixel_format; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>ʽ RGB444,YUV444/422 */
|
|
|
uapi_color_description color_description; /* <20><>ɫ<EFBFBD>ռ<EFBFBD> */
|
|
|
uapi_color_sys color_sys; /* ATV/CVBS<42><53>Դ<EFBFBD>µIJ<C2B5>ɫ<EFBFBD><C9AB>ʽ */
|
|
|
uapi_pixel_bit_depth bit_depth; /* λ<><CEBB> */
|
|
|
uapi_oversample over_sample; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ */
|
|
|
td_u32 width; /* active width of input standard signal */
|
|
|
td_u32 height; /* active height of input standard signal */
|
|
|
td_bool interlace; /* flag of progressive or interlance */
|
|
|
td_u32 frame_rate; /* standard frame rate like 50Hz or 60Hz */
|
|
|
td_u32 vblank; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>3D<33><44>ʽFP */
|
|
|
} st_vi_timing_info;
|
|
|
|
|
|
typedef struct {
|
|
|
uapi_video_source source_type;
|
|
|
td_u32 port;
|
|
|
td_bool frontend_bypass;
|
|
|
} st_vi_frontend_param;
|
|
|
|
|
|
typedef struct {
|
|
|
td_u32 x;
|
|
|
td_u32 y;
|
|
|
td_u32 width;
|
|
|
td_u32 height;
|
|
|
td_s32 abs_zorder;
|
|
|
td_bool low_latency;
|
|
|
td_bool pq_bypass;
|
|
|
td_bool vo_bypass;
|
|
|
} st_vi_backend_param;
|
|
|
|
|
|
typedef struct {
|
|
|
st_vi_setting vi_setting;
|
|
|
st_vi_timing vi_timing;
|
|
|
st_vi_frontend_param frontend_param;
|
|
|
st_vi_backend_param backend_param;
|
|
|
td_void *private_date;
|
|
|
} st_vi_test_info;
|
|
|
|
|
|
typedef struct {
|
|
|
td_char *tc_name;
|
|
|
td_u32 test_id;
|
|
|
st_vi_setting *vi_setting;
|
|
|
st_vi_timing *vi_timing;
|
|
|
st_vi_frontend_param frontend_param;
|
|
|
st_vi_backend_param backend_param;
|
|
|
td_u32 vi_setting_num;
|
|
|
td_u32 timing_num;
|
|
|
td_bool timing_change_non_destory;
|
|
|
} st_vi_autotest_info;
|
|
|
|
|
|
typedef struct {
|
|
|
td_handle vi_handle;
|
|
|
td_handle vo_handle;
|
|
|
|
|
|
st_vi_timing vi_timing;
|
|
|
|
|
|
pthread_t monitor_thread;
|
|
|
pthread_t acquire_frame_thread;
|
|
|
td_bool monitor_running;
|
|
|
td_bool acquire_thread_running;
|
|
|
} st_vi_ctx;
|
|
|
|
|
|
td_s32 st_iapi_vi_init(td_void);
|
|
|
td_s32 st_iapi_vi_deinit(td_void);
|
|
|
td_s32 st_iapi_vi_get_default_attr(uapi_vi_attr *attr);
|
|
|
td_s32 st_iapi_vi_create(uapi_vi_attr *attr, td_handle *vi_handle);
|
|
|
td_s32 st_iapi_vi_destroy(td_handle vi_handle);
|
|
|
td_s32 st_iapi_vi_attach(td_handle vi_handle, td_handle vo_handle);
|
|
|
td_s32 st_iapi_vi_detach(td_handle vi_handle, td_handle vo_handle);
|
|
|
td_s32 st_iapi_vi_start(td_handle vi_handle);
|
|
|
td_s32 st_iapi_vi_stop(td_handle vi_handle);
|
|
|
td_s32 st_iapi_vi_update_nstd_info(td_handle vi_handle, uapi_video_nonstd_info *info);
|
|
|
td_s32 st_iapi_vi_set_src_quantization_range(td_handle vi_handle, uapi_vi_quantization_range range_type);
|
|
|
td_s32 st_iapi_vi_set_config(td_handle vi_handle, uapi_vi_config *cfg);
|
|
|
td_s32 st_iapi_vi_get_config(td_handle vi_handle, uapi_vi_config *cfg);
|
|
|
td_s32 st_iapi_vi_get_attr(td_handle vi_handle, uapi_vi_attr *attr);
|
|
|
|
|
|
td_void st_vi_comm_wait_quit_test(td_void);
|
|
|
td_bool st_vi_comm_wait_input_select(td_char *str);
|
|
|
td_s32 st_vi_comm_wait_input_num(td_char *str);
|
|
|
|
|
|
td_s32 st_vi_comm_get_chip_info(ext_chip_name_id *chip_version, ext_chip_revision *chip_revision);
|
|
|
uapi_vi_access_type st_vi_comm_source2acess(uapi_video_source source_type, td_u32 port_index);
|
|
|
td_u32 st_vi_comm_get_hdmirx_port_num(td_void);
|
|
|
|
|
|
td_s32 st_vi_comm_win_init(td_handle vi, td_handle *vo_p);
|
|
|
td_s32 st_vi_comm_win_deinit(td_handle vi, td_handle vo);
|
|
|
td_void st_vi_set_win_outrect(st_vi_test_info *test_info, td_u32 x, td_u32 y, td_u32 w, td_u32 h);
|
|
|
td_void st_vi_comm_show_graphic(td_bool show);
|
|
|
|
|
|
td_u32 st_vi_comm_get_vi_num(td_void);
|
|
|
td_u32 st_vi_comm_get_vi_id(uapi_vi_access_type access_type);
|
|
|
td_s32 st_vi_comm_is_created(uapi_vi_access_type access_type);
|
|
|
td_s32 st_vi_comm_is_started(uapi_vi_access_type access_type);
|
|
|
td_s32 st_vi_comm_check_vi_proc_info(uapi_vi_access_type access_type);
|
|
|
|
|
|
td_void st_vi_comm_ctx_get(st_vi_ctx **vi_test_ctx);
|
|
|
td_void st_vi_comm_set_gentiming(uapi_vi_access_type access_type, td_u32 gen_data_type);
|
|
|
|
|
|
td_void st_vi_comm_create_monitor(st_vi_test_info *test_info);
|
|
|
td_void st_vi_comm_destroy_monitor(st_vi_test_info *test_info);
|
|
|
td_void st_vi_comm_init_monitor(td_void);
|
|
|
td_void st_vi_comm_deinit_monitor(td_void);
|
|
|
td_void st_vi_self_running(td_void);
|
|
|
td_void st_vi_comm_create_user_acquire_frame_thread(st_vi_ctx *vi_ctx);
|
|
|
td_void st_vi_comm_destroy_user_acquire_frame_thread(st_vi_ctx *vi_ctx);
|
|
|
td_s32 st_vi_comm_autotest_run_timing(st_vi_autotest_info *autotest_info);
|
|
|
#endif // __VI_ST_COMMON_H__
|