Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dm355_ccdc.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2009 Texas Instruments Inc
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */
18 #ifndef _DM355_CCDC_H
19 #define _DM355_CCDC_H
22 
23 /* enum for No of pixel per line to be avg. in Black Clamping */
30 };
31 
32 /* enum for No of lines in Black Clamping */
39 };
40 
41 /* enum for Alaw gama width */
48 };
49 
55 };
56 
57 struct ccdc_col_pat {
62 };
63 
72 };
73 
83 };
88 };
89 
94 };
95 
96 /* structure for ALaw */
97 struct ccdc_a_law {
98  /* Enable/disable A-Law */
99  unsigned char enable;
100  /* Gama Width Input */
102 };
103 
104 /* structure for Black Clamping */
106  /* only if bClampEnable is TRUE */
107  unsigned char b_clamp_enable;
108  /* only if bClampEnable is TRUE */
110  /* only if bClampEnable is TRUE */
112  /* only if bClampEnable is TRUE */
113  unsigned short start_pixel;
114  /* only if bClampEnable is FALSE */
115  unsigned short sgain;
116  unsigned short dc_sub;
117 };
118 
119 /* structure for Black Level Compensation */
121  /* Constant value to subtract from Red component */
122  unsigned char r;
123  /* Constant value to subtract from Gr component */
124  unsigned char gr;
125  /* Constant value to subtract from Blue component */
126  unsigned char b;
127  /* Constant value to subtract from Gb component */
128  unsigned char gb;
129 };
130 
131 struct ccdc_float {
132  int integer;
133  unsigned int decimal;
134 };
135 
136 #define CCDC_CSC_COEFF_TABLE_SIZE 16
137 /* structure for color space converter */
138 struct ccdc_csc {
139  unsigned char enable;
140  /*
141  * S8Q5. Use 2 decimal precision, user values range from -3.00 to 3.99.
142  * example - to use 1.03, set integer part as 1, and decimal part as 3
143  * to use -1.03, set integer part as -1 and decimal part as 3
144  */
146 };
147 
148 /* Structures for Vertical Defect Correction*/
153 };
154 
158 };
159 
163 };
164 
168 };
169 
173 };
174 
178 };
179 
183  unsigned int vdflsft;
184 };
185 
191 };
192 
193 #define CCDC_DFT_TABLE_SIZE 16
194 /*
195  * Main Structure for vertical defect correction. Vertical defect
196  * correction can correct up to 16 defects if defects less than 16
197  * then pad the rest with 0
198  */
200  unsigned char ver_dft_en;
201  unsigned char gen_dft_en;
202  unsigned int saturation_ctl;
211 };
212 
214  unsigned char horz_offset;
215  unsigned char vert_offset;
216 };
217 
218 /*
219  * Structure for CCDC configuration parameters for raw capture mode passed
220  * by application
221  */
223  /* data shift to be applied before storing */
225  /* data size value from 8 to 16 bits */
227  /* median filter for sdram */
230  /* low pass filter enable/disable */
231  unsigned char lpf_enable;
232  /* Threshold of median filter */
234  /*
235  * horz and vertical data offset. Appliable for defect correction
236  * and lsc
237  */
239  /* Structure for Optional A-Law */
240  struct ccdc_a_law alaw;
241  /* Structure for Optical Black Clamp */
243  /* Structure for Black Compensation */
245  /* struture for vertical Defect Correction Module Configuration */
247  /* structure for color space converter Module Configuration */
248  struct ccdc_csc csc;
249  /* color patters for bayer capture */
252 };
253 
254 #ifdef __KERNEL__
255 #include <linux/io.h>
256 
257 #define CCDC_WIN_PAL {0, 0, 720, 576}
258 #define CCDC_WIN_VGA {0, 0, 640, 480}
259 
260 struct ccdc_params_ycbcr {
261  /* pixel format */
262  enum ccdc_pixfmt pix_fmt;
263  /* progressive or interlaced frame */
264  enum ccdc_frmfmt frm_fmt;
265  /* video window */
266  struct v4l2_rect win;
267  /* field id polarity */
268  enum vpfe_pin_pol fid_pol;
269  /* vertical sync polarity */
270  enum vpfe_pin_pol vd_pol;
271  /* horizontal sync polarity */
272  enum vpfe_pin_pol hd_pol;
273  /* enable BT.656 embedded sync mode */
274  int bt656_enable;
275  /* cb:y:cr:y or y:cb:y:cr in memory */
276  enum ccdc_pixorder pix_order;
277  /* interleaved or separated fields */
278  enum ccdc_buftype buf_type;
279 };
280 
281 /* Gain applied to Raw Bayer data */
282 struct ccdc_gain {
283  unsigned short r_ye;
284  unsigned short gr_cy;
285  unsigned short gb_g;
286  unsigned short b_mg;
287 };
288 
289 /* Structure for CCDC configuration parameters for raw capture mode */
290 struct ccdc_params_raw {
291  /* pixel format */
292  enum ccdc_pixfmt pix_fmt;
293  /* progressive or interlaced frame */
294  enum ccdc_frmfmt frm_fmt;
295  /* video window */
296  struct v4l2_rect win;
297  /* field id polarity */
298  enum vpfe_pin_pol fid_pol;
299  /* vertical sync polarity */
300  enum vpfe_pin_pol vd_pol;
301  /* horizontal sync polarity */
302  enum vpfe_pin_pol hd_pol;
303  /* interleaved or separated fields */
304  enum ccdc_buftype buf_type;
305  /* Gain values */
306  struct ccdc_gain gain;
307  /* offset */
308  unsigned int ccdc_offset;
309  /* horizontal flip enable */
310  unsigned char horz_flip_enable;
311  /*
312  * enable to store the image in inverse order in memory
313  * (bottom to top)
314  */
315  unsigned char image_invert_enable;
316  /* Configurable part of raw data */
317  struct ccdc_config_params_raw config_params;
318 };
319 
320 #endif
321 #endif /* DM355_CCDC_H */