tvin_global.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /*
  2. * TVIN global definition
  3. * enum, structure & global parameters used in all TVIN modules.
  4. *
  5. * Author: Lin Xu <lin.xu@amlogic.com>
  6. * Bobby Yang <bo.yang@amlogic.com>
  7. *
  8. * Copyright (C) 2010 Amlogic Inc.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #ifndef __TVIN_GLOBAL_H
  15. #define __TVIN_GLOBAL_H
  16. //#define VDIN_FIXED_FMT_TEST
  17. // ***************************************************************************
  18. // *** enum definitions *********************************************
  19. // ***************************************************************************
  20. #define STATUS_ANTI_SHOCKING 3
  21. #define MINIMUM_H_CNT 1400
  22. #define ADC_REG_NUM 112
  23. #define CVD_PART1_REG_NUM 64
  24. #define CVD_PART1_REG_MIN 0x00
  25. #define CVD_PART2_REG_NUM 144
  26. #define CVD_PART2_REG_MIN 0x70
  27. #define CVD_PART3_REG_NUM 7 // 0x87, 0x93, 0x94, 0x95, 0x96, 0xe6, 0xfa
  28. #define CVD_PART3_REG_0 0x87
  29. #define CVD_PART3_REG_1 0x93
  30. #define CVD_PART3_REG_2 0x94
  31. #define CVD_PART3_REG_3 0x95
  32. #define CVD_PART3_REG_4 0x96
  33. #define CVD_PART3_REG_5 0xe6
  34. #define CVD_PART3_REG_6 0xfa
  35. #define ACD_REG_MAX 0x32 //0x00-0x32 except 0x1E&0x31
  36. #define CRYSTAL_24M
  37. #ifndef CRYSTAL_24M
  38. #define CRYSTAL_25M
  39. #endif
  40. #ifdef CRYSTAL_24M
  41. #define CVD2_CHROMA_DTO_NTSC_M 0x262e8ba2
  42. #define CVD2_CHROMA_DTO_NTSC_443 0x2f4abc24
  43. #define CVD2_CHROMA_DTO_PAL_I 0x2f4abc24
  44. #define CVD2_CHROMA_DTO_PAL_M 0x2623cd98
  45. #define CVD2_CHROMA_DTO_PAL_CN 0x263566cf
  46. #define CVD2_CHROMA_DTO_PAL_60 0x2f4abc24
  47. #define CVD2_CHROMA_DTO_SECAM 0x2db7a328
  48. #define CVD2_HSYNC_DTO_NTSC_M 0x24000000
  49. #define CVD2_HSYNC_DTO_NTSC_443 0x24000000
  50. #define CVD2_HSYNC_DTO_PAL_I 0x24000000
  51. #define CVD2_HSYNC_DTO_PAL_M 0x24000000
  52. #define CVD2_HSYNC_DTO_PAL_CN 0x24000000
  53. #define CVD2_HSYNC_DTO_PAL_60 0x24000000
  54. #define CVD2_HSYNC_DTO_SECAM 0x24000000
  55. #define CVD2_DCRESTORE_ACCUM 0x98 // [5:0] = 24(MHz)
  56. #endif
  57. #ifdef CRYSTAL_25M
  58. #define CVD2_CHROMA_DTO_NTSC_M 0x24a7904a
  59. #define CVD2_CHROMA_DTO_NTSC_443 0x2d66772d
  60. #define CVD2_CHROMA_DTO_PAL_I 0x2d66772d
  61. #define CVD2_CHROMA_DTO_PAL_M 0x249d4040
  62. #define CVD2_CHROMA_DTO_PAL_CN 0x24ae2541
  63. #define CVD2_CHROMA_DTO_PAL_60 0x2d66772d
  64. #define CVD2_CHROMA_DTO_SECAM 0x2be37de9
  65. #define CVD2_HSYNC_DTO_NTSC_M 0x228f5c28
  66. #define CVD2_HSYNC_DTO_NTSC_443 0x228f5c28
  67. #define CVD2_HSYNC_DTO_PAL_I 0x228f5c28
  68. #define CVD2_HSYNC_DTO_PAL_M 0x228f5c28
  69. #define CVD2_HSYNC_DTO_PAL_CN 0x228f5c28
  70. #define CVD2_HSYNC_DTO_PAL_60 0x228f5c28
  71. #define CVD2_HSYNC_DTO_SECAM 0x228f5c28
  72. #define CVD2_DCRESTORE_ACCUM 0x99 // [5:0] = 25(MHz)
  73. #endif
  74. typedef enum tvin_sync_pol_e {
  75. TVIN_SYNC_POL_NULL = 0,
  76. TVIN_SYNC_POL_NEGATIVE,
  77. TVIN_SYNC_POL_POSITIVE,
  78. } tvin_sync_pol_t;
  79. typedef enum tvin_scan_mode_e {
  80. TVIN_SCAN_MODE_NULL = 0,
  81. TVIN_SCAN_MODE_PROGRESSIVE,
  82. TVIN_SCAN_MODE_INTERLACED,
  83. } tvin_scan_mode_t;
  84. typedef enum tvin_color_space_e {
  85. TVIN_CS_RGB444 = 0,
  86. TVIN_CS_YUV444,
  87. TVIN_CS_YUV422_16BITS,
  88. TVIN_CS_YCbCr422_8BITS,
  89. TVIN_CS_MAX
  90. } tvin_color_space_t;
  91. // ***************************************************************************
  92. // *** structure definitions *********************************************
  93. // ***************************************************************************
  94. // Hs_cnt Pixel_Clk(Khz/10)
  95. typedef struct tvin_format_s {
  96. unsigned short h_active; //Th in the unit of pixel
  97. unsigned short v_active; //Tv in the unit of line
  98. unsigned short h_cnt; //Th in the unit of T, while 1/T = 24MHz or 27MHz or even 100MHz
  99. unsigned short h_cnt_offset; //Tolerance of h_cnt
  100. unsigned short v_cnt_offset; //Tolerance of v_cnt
  101. unsigned short hs_cnt; //Ths in the unit of T, while 1/T = 24MHz or 27MHz or even 100MHz
  102. unsigned short hs_cnt_offset; //Tolerance of hs_cnt
  103. unsigned short h_total; //Th in the unit of pixel
  104. unsigned short v_total; //Tv in the unit of line
  105. unsigned short hs_front; //h front proch
  106. unsigned short hs_width; //HS in the unit of pixel
  107. unsigned short hs_bp; //HS in the unit of pixel
  108. unsigned short vs_front; //v front proch
  109. unsigned short vs_width; //VS in the unit of pixel
  110. unsigned short vs_bp; //HS in the unit of pixel
  111. enum tvin_sync_pol_e hs_pol;
  112. enum tvin_sync_pol_e vs_pol;
  113. enum tvin_scan_mode_e scan_mode;
  114. unsigned short pixel_clk; //(Khz/10)
  115. unsigned short vbi_line_start;
  116. unsigned short vbi_line_end;
  117. unsigned int duration;
  118. } tvin_format_t;
  119. #define VDIN_DEBUG
  120. #ifdef VDIN_DEBUG
  121. #define pr_dbg(fmt, args...) printk(fmt,## args)
  122. #else
  123. #define pr_dbg(fmt, args...)
  124. #endif
  125. #define pr_error(fmt, args...) printk(fmt,## args)
  126. #define VDIN_START_CANVAS 24 //24~35 used to tvin
  127. #define BT656IN_VF_POOL_SIZE 6//8
  128. #define VIUIN_VF_POOL_SIZE 6//8
  129. #define TVAFE_VF_POOL_SIZE 6//8
  130. #define VDIN_VF_POOL_MAX_SIZE 6//8
  131. #define TVHDMI_VF_POOL_SIZE 6//8
  132. #define BT656IN_ANCI_DATA_SIZE 0x4000 //save anci data from bt656in
  133. #define CAMERA_IN_ANCI_DATA_SIZE 0x4000 //save anci data from bt656in
  134. #define VIUIN_ANCI_DATA_SIZE 0x4000
  135. #define TVIN_MAX_PIXS 1600*1200
  136. #endif // __TVIN_GLOBAL_H