tuner_r820t.h 3.8 KB

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