Home | History | Annotate | Download | only in tests
      1 /*
      2  * test_common.h - test common
      3  *
      4  *  Copyright (c) 2015 Intel Corporation
      5  *
      6  * Licensed under the Apache License, Version 2.0 (the "License");
      7  * you may not use this file except in compliance with the License.
      8  * You may obtain a copy of the License at
      9  *
     10  *      http://www.apache.org/licenses/LICENSE-2.0
     11  *
     12  * Unless required by applicable law or agreed to in writing, software
     13  * distributed under the License is distributed on an "AS IS" BASIS,
     14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15  * See the License for the specific language governing permissions and
     16  * limitations under the License.
     17  *
     18  * Author: Wind Yuan <feng.yuan (at) intel.com>
     19  * Author: John Ye <john.ye (at) intel.com>
     20  */
     21 
     22 #ifndef XCAM_TEST_COMMON_H
     23 #define XCAM_TEST_COMMON_H
     24 
     25 #include <unistd.h>
     26 #include <getopt.h>
     27 
     28 #define TEST_CAMERA_POSITION_OFFSET_X 2000
     29 
     30 #undef CHECK_DECLARE
     31 #undef CHECK
     32 #undef CHECK_CONTINUE
     33 
     34 #define CHECK_DECLARE(level, exp, statement, msg, ...) \
     35     if (!(exp)) {        \
     36         XCAM_LOG_##level (msg, ## __VA_ARGS__);   \
     37         statement;                              \
     38     }
     39 
     40 #define CHECK(ret, msg, ...)  \
     41     CHECK_DECLARE(ERROR, (ret) == XCAM_RETURN_NO_ERROR, return -1, msg, ## __VA_ARGS__)
     42 
     43 #define CHECK_STATEMENT(ret, statement, msg, ...)  \
     44     CHECK_DECLARE(ERROR, (ret) == XCAM_RETURN_NO_ERROR, statement, msg, ## __VA_ARGS__)
     45 
     46 #define CHECK_CONTINUE(ret, msg, ...)  \
     47     CHECK_DECLARE(WARNING, (ret) == XCAM_RETURN_NO_ERROR, , msg, ## __VA_ARGS__)
     48 
     49 #define CHECK_EXP(exp, msg, ...) \
     50     CHECK_DECLARE(ERROR, exp, return -1, msg, ## __VA_ARGS__)
     51 
     52 #define CAPTURE_DEVICE_VIDEO "/dev/video3"
     53 #define CAPTURE_DEVICE_STILL "/dev/video0"
     54 #define DEFAULT_CAPTURE_DEVICE CAPTURE_DEVICE_VIDEO
     55 
     56 #define DEFAULT_EVENT_DEVICE   "/dev/v4l-subdev6"
     57 #define DEFAULT_CPF_FILE       "/etc/atomisp/imx185.cpf"
     58 #define DEFAULT_SAVE_FILE_NAME "capture_buffer"
     59 #define DEFAULT_DYNAMIC_3A_LIB "/usr/lib/xcam/plugins/3a/libxcam_3a_aiq.so"
     60 #define DEFAULT_HYBRID_3A_LIB "/usr/lib/xcam/plugins/3a/libxcam_3a_hybrid.so"
     61 #define DEFAULT_SMART_ANALYSIS_LIB_DIR "/usr/lib/xcam/plugins/smart"
     62 
     63 
     64 #define FPS_CALCULATION(objname, count) XCAM_STATIC_FPS_CALCULATION(objname, count)
     65 
     66 #define PROFILING_START(name)  XCAM_STATIC_PROFILING_START(name)
     67 #define PROFILING_END(name, times_of_print) XCAM_STATIC_PROFILING_END(name, times_of_print)
     68 
     69 #endif  // XCAM_TEST_COMMON_H
     70