2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 #ifndef __IA_CSS_TPG_H
16 #define __IA_CSS_TPG_H
19 * This file contains support for the test pattern generator (TPG)
22 /** Enumerate the TPG IDs.
31 * Maximum number of TPG IDs.
33 * Make sure the value of this define gets changed to reflect the correct
34 * number of ia_css_tpg_id enum if you add/delete an item in the enum.
36 #define N_CSS_TPG_IDS (IA_CSS_TPG_ID2+1)
38 /** Enumerate the TPG modes.
40 enum ia_css_tpg_mode
{
42 IA_CSS_TPG_MODE_CHECKERBOARD
,
43 IA_CSS_TPG_MODE_FRAME_BASED_COLOR
,
47 /** @brief Configure the test pattern generator.
49 * Configure the Test Pattern Generator, the way these values are used to
50 * generate the pattern can be seen in the HRT extension for the test pattern
52 * devices/test_pat_gen/hrt/include/test_pat_gen.h: hrt_calc_tpg_data().
54 * This interface is deprecated, it is not portable -> move to input system API
57 unsigned int test_pattern_value(unsigned int x, unsigned int y)
59 unsigned int x_val, y_val;
60 if (x_delta > 0) (x_val = (x << x_delta) & x_mask;
61 else (x_val = (x >> -x_delta) & x_mask;
62 if (y_delta > 0) (y_val = (y << y_delta) & y_mask;
63 else (y_val = (y >> -y_delta) & x_mask;
64 return (x_val + y_val) & xy_mask;
68 struct ia_css_tpg_config
{
69 enum ia_css_tpg_id id
;
70 enum ia_css_tpg_mode mode
;
78 #endif /* __IA_CSS_TPG_H */