tuner_r820t.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. #ifndef _R820T_TUNER_H
  2. #define _R820T_TUNER_H
  3. #define R820T_I2C_ADDR 0x34
  4. #define R820T_CHECK_ADDR 0x00
  5. #define R820T_CHECK_VAL 0x69
  6. //***************************************************************
  7. //* INCLUDES.H
  8. //***************************************************************
  9. #define VERSION "R820T_v1.49_ASTRO"
  10. #define VER_NUM 49
  11. #define USE_16M_XTAL FALSE
  12. #define R828_Xtal 28800
  13. #define USE_DIPLEXER FALSE
  14. #define TUNER_CLK_OUT TRUE
  15. #ifndef _UINT_X_
  16. #define _UINT_X_ 1
  17. typedef unsigned char UINT8;
  18. typedef unsigned short UINT16;
  19. typedef unsigned int UINT32;
  20. #endif
  21. #define TRUE 1
  22. #define FALSE 0
  23. #define FUNCTION_SUCCESS 0
  24. #define FUNCTION_ERROR -1
  25. typedef enum _R828_ErrCode
  26. {
  27. RT_Success,
  28. RT_Fail
  29. }R828_ErrCode;
  30. typedef enum _Rafael_Chip_Type //Don't modify chip list
  31. {
  32. R828 = 0,
  33. R828D,
  34. R828S,
  35. R820T,
  36. R820C,
  37. R620D,
  38. R620S
  39. }Rafael_Chip_Type;
  40. //----------------------------------------------------------//
  41. // R828 Parameter //
  42. //----------------------------------------------------------//
  43. extern UINT8 R828_ADDRESS;
  44. #define DIP_FREQ 320000
  45. #define IMR_TRIAL 9
  46. #define VCO_pwr_ref 0x02
  47. extern UINT32 R828_IF_khz;
  48. extern UINT32 R828_CAL_LO_khz;
  49. extern UINT8 R828_IMR_point_num;
  50. extern UINT8 R828_IMR_done_flag;
  51. extern UINT8 Rafael_Chip;
  52. typedef enum _R828_Standard_Type //Don't remove standand list!!
  53. {
  54. NTSC_MN = 0,
  55. PAL_I,
  56. PAL_DK,
  57. PAL_B_7M, //no use
  58. PAL_BGH_8M, //for PAL B/G, PAL G/H
  59. SECAM_L,
  60. SECAM_L1_INV, //for SECAM L'
  61. SECAM_L1, //no use
  62. ATV_SIZE,
  63. DVB_T_6M = ATV_SIZE,
  64. DVB_T_7M,
  65. DVB_T_7M_2,
  66. DVB_T_8M,
  67. DVB_T2_6M,
  68. DVB_T2_7M,
  69. DVB_T2_7M_2,
  70. DVB_T2_8M,
  71. DVB_T2_1_7M,
  72. DVB_T2_10M,
  73. DVB_C_8M,
  74. DVB_C_6M,
  75. ISDB_T,
  76. DTMB,
  77. R828_ATSC,
  78. FM,
  79. STD_SIZE
  80. }R828_Standard_Type;
  81. extern UINT8 R828_Fil_Cal_flag[STD_SIZE];
  82. typedef enum _R828_SetFreq_Type
  83. {
  84. FAST_MODE = TRUE,
  85. NORMAL_MODE = FALSE
  86. }R828_SetFreq_Type;
  87. typedef enum _R828_LoopThrough_Type
  88. {
  89. LOOP_THROUGH = TRUE,
  90. SIGLE_IN = FALSE
  91. }R828_LoopThrough_Type;
  92. typedef enum _R828_InputMode_Type
  93. {
  94. AIR_IN = 0,
  95. CABLE_IN_1,
  96. CABLE_IN_2
  97. }R828_InputMode_Type;
  98. typedef enum _R828_IfAgc_Type
  99. {
  100. IF_AGC1 = 0,
  101. IF_AGC2
  102. }R828_IfAgc_Type;
  103. typedef enum _R828_GPIO_Type
  104. {
  105. HI_SIG = TRUE,
  106. LO_SIG = FALSE
  107. }R828_GPIO_Type;
  108. typedef struct _R828_Set_Info
  109. {
  110. UINT32 RF_KHz;
  111. R828_Standard_Type R828_Standard;
  112. R828_LoopThrough_Type RT_Input;
  113. R828_InputMode_Type RT_InputMode;
  114. R828_IfAgc_Type R828_IfAgc_Select;
  115. }R828_Set_Info;
  116. typedef struct _R828_RF_Gain_Info
  117. {
  118. UINT8 RF_gain1;
  119. UINT8 RF_gain2;
  120. UINT8 RF_gain_comb;
  121. }R828_RF_Gain_Info;
  122. typedef enum _R828_RF_Gain_TYPE
  123. {
  124. RF_AUTO = 0,
  125. RF_MANUAL
  126. }R828_RF_Gain_TYPE;
  127. typedef struct _R828_I2C_LEN_TYPE
  128. {
  129. UINT8 RegAddr;
  130. UINT8 Data[50];
  131. UINT8 Len;
  132. }R828_I2C_LEN_TYPE;
  133. typedef struct _R828_I2C_TYPE
  134. {
  135. UINT8 RegAddr;
  136. UINT8 Data;
  137. }R828_I2C_TYPE;
  138. //----------------------------------------------------------//
  139. // R828 Function //
  140. //----------------------------------------------------------//
  141. R828_ErrCode R828_Init(void *pTuner);
  142. R828_ErrCode R828_Standby(void *pTuner, R828_LoopThrough_Type R828_LoopSwitch);
  143. R828_ErrCode R828_GPIO(void *pTuner, R828_GPIO_Type R828_GPIO_Conrl);
  144. R828_ErrCode R828_SetStandard(void *pTuner, R828_Standard_Type RT_Standard);
  145. R828_ErrCode R828_SetFrequency(void *pTuner, R828_Set_Info R828_INFO, R828_SetFreq_Type R828_SetFreqMode);
  146. R828_ErrCode R828_GetRfGain(void *pTuner, R828_RF_Gain_Info *pR828_rf_gain);
  147. R828_ErrCode R828_RfGainMode(void *pTuner, R828_RF_Gain_TYPE R828_RfGainType);
  148. int
  149. r820t_SetRfFreqHz(
  150. void *pTuner,
  151. unsigned long RfFreqHz
  152. );
  153. int
  154. r820t_SetStandardMode(
  155. void *pTuner,
  156. int StandardMode
  157. );
  158. int
  159. r820t_SetStandby(
  160. void *pTuner,
  161. int LoopThroughType
  162. );
  163. #endif /* _R820T_TUNER_H */