dm644x_ccdc.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  2. * Copyright (C) 2006-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 _DM644X_CCDC_H
  19. #define _DM644X_CCDC_H
  20. #include <media/davinci/ccdc_types.h>
  21. #include <media/davinci/vpfe_types.h>
  22. /* enum for No of pixel per line to be avg. in Black Clamping*/
  23. enum ccdc_sample_length {
  24. CCDC_SAMPLE_1PIXELS,
  25. CCDC_SAMPLE_2PIXELS,
  26. CCDC_SAMPLE_4PIXELS,
  27. CCDC_SAMPLE_8PIXELS,
  28. CCDC_SAMPLE_16PIXELS
  29. };
  30. /* enum for No of lines in Black Clamping */
  31. enum ccdc_sample_line {
  32. CCDC_SAMPLE_1LINES,
  33. CCDC_SAMPLE_2LINES,
  34. CCDC_SAMPLE_4LINES,
  35. CCDC_SAMPLE_8LINES,
  36. CCDC_SAMPLE_16LINES
  37. };
  38. /* enum for Alaw gama width */
  39. enum ccdc_gama_width {
  40. CCDC_GAMMA_BITS_15_6,
  41. CCDC_GAMMA_BITS_14_5,
  42. CCDC_GAMMA_BITS_13_4,
  43. CCDC_GAMMA_BITS_12_3,
  44. CCDC_GAMMA_BITS_11_2,
  45. CCDC_GAMMA_BITS_10_1,
  46. CCDC_GAMMA_BITS_09_0
  47. };
  48. enum ccdc_data_size {
  49. CCDC_DATA_16BITS,
  50. CCDC_DATA_15BITS,
  51. CCDC_DATA_14BITS,
  52. CCDC_DATA_13BITS,
  53. CCDC_DATA_12BITS,
  54. CCDC_DATA_11BITS,
  55. CCDC_DATA_10BITS,
  56. CCDC_DATA_8BITS
  57. };
  58. /* structure for ALaw */
  59. struct ccdc_a_law {
  60. /* Enable/disable A-Law */
  61. unsigned char enable;
  62. /* Gama Width Input */
  63. enum ccdc_gama_width gama_wd;
  64. };
  65. /* structure for Black Clamping */
  66. struct ccdc_black_clamp {
  67. unsigned char enable;
  68. /* only if bClampEnable is TRUE */
  69. enum ccdc_sample_length sample_pixel;
  70. /* only if bClampEnable is TRUE */
  71. enum ccdc_sample_line sample_ln;
  72. /* only if bClampEnable is TRUE */
  73. unsigned short start_pixel;
  74. /* only if bClampEnable is TRUE */
  75. unsigned short sgain;
  76. /* only if bClampEnable is FALSE */
  77. unsigned short dc_sub;
  78. };
  79. /* structure for Black Level Compensation */
  80. struct ccdc_black_compensation {
  81. /* Constant value to subtract from Red component */
  82. char r;
  83. /* Constant value to subtract from Gr component */
  84. char gr;
  85. /* Constant value to subtract from Blue component */
  86. char b;
  87. /* Constant value to subtract from Gb component */
  88. char gb;
  89. };
  90. /* structure for fault pixel correction */
  91. struct ccdc_fault_pixel {
  92. /* Enable or Disable fault pixel correction */
  93. unsigned char enable;
  94. /* Number of fault pixel */
  95. unsigned short fp_num;
  96. /* Address of fault pixel table */
  97. unsigned int fpc_table_addr;
  98. };
  99. /* Structure for CCDC configuration parameters for raw capture mode passed
  100. * by application
  101. */
  102. struct ccdc_config_params_raw {
  103. /* data size value from 8 to 16 bits */
  104. enum ccdc_data_size data_sz;
  105. /* Structure for Optional A-Law */
  106. struct ccdc_a_law alaw;
  107. /* Structure for Optical Black Clamp */
  108. struct ccdc_black_clamp blk_clamp;
  109. /* Structure for Black Compensation */
  110. struct ccdc_black_compensation blk_comp;
  111. /* Structure for Fault Pixel Module Configuration */
  112. struct ccdc_fault_pixel fault_pxl;
  113. };
  114. #ifdef __KERNEL__
  115. #include <linux/io.h>
  116. /* Define to enable/disable video port */
  117. #define FP_NUM_BYTES 4
  118. /* Define for extra pixel/line and extra lines/frame */
  119. #define NUM_EXTRAPIXELS 8
  120. #define NUM_EXTRALINES 8
  121. /* settings for commonly used video formats */
  122. #define CCDC_WIN_PAL {0, 0, 720, 576}
  123. /* ntsc square pixel */
  124. #define CCDC_WIN_VGA {0, 0, (640 + NUM_EXTRAPIXELS), (480 + NUM_EXTRALINES)}
  125. /* Structure for CCDC configuration parameters for raw capture mode */
  126. struct ccdc_params_raw {
  127. /* pixel format */
  128. enum ccdc_pixfmt pix_fmt;
  129. /* progressive or interlaced frame */
  130. enum ccdc_frmfmt frm_fmt;
  131. /* video window */
  132. struct v4l2_rect win;
  133. /* field id polarity */
  134. enum vpfe_pin_pol fid_pol;
  135. /* vertical sync polarity */
  136. enum vpfe_pin_pol vd_pol;
  137. /* horizontal sync polarity */
  138. enum vpfe_pin_pol hd_pol;
  139. /* interleaved or separated fields */
  140. enum ccdc_buftype buf_type;
  141. /*
  142. * enable to store the image in inverse
  143. * order in memory(bottom to top)
  144. */
  145. unsigned char image_invert_enable;
  146. /* configurable paramaters */
  147. struct ccdc_config_params_raw config_params;
  148. };
  149. struct ccdc_params_ycbcr {
  150. /* pixel format */
  151. enum ccdc_pixfmt pix_fmt;
  152. /* progressive or interlaced frame */
  153. enum ccdc_frmfmt frm_fmt;
  154. /* video window */
  155. struct v4l2_rect win;
  156. /* field id polarity */
  157. enum vpfe_pin_pol fid_pol;
  158. /* vertical sync polarity */
  159. enum vpfe_pin_pol vd_pol;
  160. /* horizontal sync polarity */
  161. enum vpfe_pin_pol hd_pol;
  162. /* enable BT.656 embedded sync mode */
  163. int bt656_enable;
  164. /* cb:y:cr:y or y:cb:y:cr in memory */
  165. enum ccdc_pixorder pix_order;
  166. /* interleaved or separated fields */
  167. enum ccdc_buftype buf_type;
  168. };
  169. #endif
  170. #endif /* _DM644X_CCDC_H */