tvafe_cvd.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*******************************************************************
  2. * Copyright C 2010 by Amlogic, Inc. All Rights Reserved.
  3. * File name: TVAFE_CVD.h
  4. * Description: IO function, structure, enum, used in TVIN AFE sub-module processing
  5. *******************************************************************/
  6. #ifndef _TVAFE_CVD_H
  7. #define _TVAFE_CVD_H
  8. // ***************************************************************************
  9. // *** enum definitions *********************************************
  10. // ***************************************************************************
  11. //system state machine for cvd2
  12. typedef enum tvafe_cvd2_system_state_e {
  13. CVD2_IDLE_STATE = 0,
  14. CVD2_SIG_ON_STATE,
  15. CVD2_SIG_OFF_STATE,
  16. CVD2_SIG_DETECT_STATE,
  17. CVD2_MODE_CONFIG_STATE,
  18. CVD2_MODE_VCR_STATE,
  19. CVD2_MODE_UNSTABLE_STATE,
  20. } tvafe_cvd2_system_state_t;
  21. //cvd2 mode detect state machine
  22. typedef enum tvafe_cvd2_mode_search_state_e {
  23. CVD2_DET_START = 0,
  24. CVD2_DET_NTSC_M,
  25. CVD2_DET_PAL_M,
  26. CVD2_DET_NTSC_443,
  27. CVD2_DET_PAL_60,
  28. CVD2_DET_PAL_CN,
  29. CVD2_DET_PAL_BGDI,
  30. CVD2_DET_SECAM,
  31. } tvafe_cvd2_mode_search_state_t;
  32. typedef enum tvafe_cvd2_cordic_e {
  33. FCMORE,
  34. FCLESS,
  35. FCSAME
  36. } tvafe_cvd2_cordic_t;
  37. typedef enum tvafe_cvd2_sd_state_e {
  38. SD_NO_SIG = 0,
  39. SD_UNLOCK,
  40. SD_NONSTD,
  41. SD_VCR,
  42. SD_HV_LOCK,
  43. SD_PAL_I,
  44. SD_PAL_M,
  45. SD_PAL_CN,
  46. SD_NTSC,
  47. SD_NTSC_443,
  48. SD_PAL_60,
  49. SD_SECAM
  50. } tvafe_cvd2_sd_state_t;
  51. // 525 lines or 625 lines mode
  52. typedef enum tvafe_cvd2_video_lines_e {
  53. MODE_525 = 0,
  54. MODE_625,
  55. } tvafe_cvd2_video_lines_t;
  56. //cvd2 video detect result
  57. typedef enum tvafe_cvd2_detect_result_e {
  58. VIDEO_MODE_UNLOCK = 0,
  59. VIDEO_MODE_NONSTD,
  60. VIDEO_MODE_VCR,
  61. VIDEO_MODE_LINES_UNSTABLE,
  62. VIDEO_MODE_FOUND,
  63. VIDEO_MODE_NON_CVBS,
  64. VIDEO_MODE_SYSTEM_CHANGE,
  65. } tvafe_cvd2_detect_result_t;
  66. // ***************************************************************************
  67. // *** structure definitions *********************************************
  68. // ***************************************************************************
  69. typedef struct tvafe_cvd2_agc_s {
  70. unsigned int cnt;
  71. unsigned int dgain;
  72. unsigned int again;
  73. } tvafe_cvd2_agc_t;
  74. //CVD2 status list
  75. typedef struct tvafe_cvd2_sig_status_s {
  76. unsigned char no_sig :1;
  77. unsigned char h_lock :1;
  78. unsigned char v_lock :1;
  79. unsigned char h_nonstd :1;
  80. unsigned char v_nonstd :1;
  81. unsigned char no_color_burst :1;
  82. unsigned char comb3d_off :1;
  83. unsigned char hv_lock :1;
  84. unsigned char chroma_lock :1;
  85. unsigned char pal :1;
  86. unsigned char secam :1;
  87. unsigned char line625 :1;
  88. unsigned char fc_more :1;
  89. unsigned char fc_Less :1;
  90. unsigned char noisy :1;
  91. unsigned char vcr :1;
  92. unsigned char vcrtrick :1;
  93. unsigned char vcrff :1;
  94. unsigned char vcrrew :1;
  95. unsigned char cordic_data_min;
  96. unsigned char cordic_data_max;
  97. unsigned char stable_cnt;
  98. unsigned char new_fmt_cnt;
  99. unsigned char chroma_stable_cnt;
  100. unsigned char cvd_fmt_chg_cnt;
  101. unsigned char status_1;
  102. unsigned char status_2;
  103. unsigned char status_3;
  104. struct tvafe_cvd2_fmt_cordic_s cordic;
  105. enum tvafe_cvd2_sd_state_e cur_sd_state;
  106. enum tvafe_cvd2_sd_state_e detected_sd_state;
  107. struct tvafe_cvd2_agc_s agc;
  108. unsigned cordic_data_sum;
  109. unsigned int cvd2_mem_addr;
  110. unsigned int cvd2_mem_size;
  111. } tvafe_cvd2_sig_status_t;
  112. // *****************************************************************************
  113. // ******** GLOBAL FUNCTION CLAIM ********
  114. // *****************************************************************************
  115. extern void tvafe_set_cvd2_default(unsigned int mem_addr, unsigned int mem_size, enum tvin_sig_fmt_e fmt);
  116. extern void tvafe_cvd2_state_handler(struct tvafe_info_s *info);
  117. extern enum tvafe_cvbs_video_e tvafe_cvd2_video_locked(void);
  118. extern bool tvafe_cvd_no_sig(void);
  119. extern bool tvafe_cvd_fmt_chg(void);
  120. extern enum tvin_sig_fmt_e tvafe_cvd2_get_format(void);
  121. extern int tvafe_cvd2_video_agc_handler(struct tvafe_info_s *info);
  122. extern void tvafe_cvd2_state_init(void);
  123. extern void tvafe_cvd2_video_mode_confiure(enum tvin_sig_fmt_e fmt, enum tvin_port_e port);
  124. extern void init_cvd2_reg_module(enum tvafe_cvd2_sd_state_e vvd2_status );
  125. extern int tvafe_cvd2_get_cordic_para(struct tvafe_cvd2_fmt_cordic_s *info);
  126. extern int tvafe_cvd2_set_cordic_para(struct tvafe_cvd2_fmt_cordic_s *info);
  127. #endif // _TVAFE_CVD_H