mtv23x.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. /******************************************************************************
  2. * (c) COPYRIGHT 2013 RAONTECH, Inc. ALL RIGHTS RESERVED.
  3. *
  4. * TITLE : MTV23x device driver API header file.
  5. *
  6. * FILENAME : mtv23x.h
  7. *
  8. * DESCRIPTION :
  9. * This file contains types and declarations associated
  10. * with the RAONTECH TV Services.
  11. *
  12. ******************************************************************************/
  13. /******************************************************************************
  14. * REVISION HISTORY
  15. *
  16. * DATE NAME REMARKS
  17. * ---------- ------------- ------------------------------------------------
  18. * 03/03/2013 Yang, Maverick Created.
  19. ******************************************************************************/
  20. #ifndef __MTV23X_H__
  21. #define __MTV23X_H__
  22. #include "mtv23x_port.h"
  23. #ifdef __cplusplus
  24. extern "C"{
  25. #endif
  26. /*=============================================================================
  27. *
  28. * Common definitions and types.
  29. *
  30. *===========================================================================*/
  31. #define MTV23X_SPI_CMD_SIZE 3
  32. #ifndef NULL
  33. #define NULL 0
  34. #endif
  35. #ifndef FALSE
  36. #define FALSE 0
  37. #endif
  38. #ifndef TRUE
  39. #define TRUE 1
  40. #endif
  41. #ifndef MAX
  42. #define MAX(a, b) (((a) > (b)) ? (a) : (b))
  43. #endif
  44. #ifndef MIN
  45. #define MIN(a, b) (((a) < (b)) ? (a) : (b))
  46. #endif
  47. #ifndef ABS
  48. #define ABS(x) (((x) < 0) ? -(x) : (x))
  49. #endif
  50. /* Error codes. */
  51. #define RTV_SUCCESS 0
  52. #define RTV_POWER_ON_CHECK_ERROR -1
  53. #define RTV_ADC_CLK_UNLOCKED -2
  54. #define RTV_PLL_UNLOCKED -3
  55. #define RTV_CHANNEL_NOT_DETECTED -4
  56. #define RTV_INVAILD_FREQUENCY_RANGE -5
  57. #define RTV_INVAILD_RF_BAND -6
  58. #define RTV_ERROR_LNATUNE -7
  59. #define RTV_INVAILD_THRESHOLD_SIZE -8
  60. #define RTV_INVAILD_SERVICE_TYPE -9
  61. #define RTV_INVALID_DIVER_TYPE -10
  62. /* Do not modify the order and value! */
  63. enum E_RTV_SERVICE_TYPE {
  64. RTV_SERVICE_INVALID = -1,
  65. RTV_SERVICE_UHF_ISDBT_1seg = 0, /* ISDB-T 1seg */
  66. RTV_SERVICE_UHF_ISDBT_13seg = 1, /* ISDB-T fullseg */
  67. RTV_SERVICE_VHF_ISDBTmm_1seg = 2, /* ISDB-Tmm 1seg */
  68. RTV_SERVICE_VHF_ISDBTmm_13seg = 3, /* ISDB-Tmm 13seg */
  69. RTV_SERVICE_VHF_ISDBTsb_1seg = 4, /* ISDB-Tsb 1seg */
  70. RTV_SERVICE_VHF_ISDBTsb_3seg = 5, /* ISDB-Tsb 3seg */
  71. #if defined(RTV_DVBT_ENABLE)
  72. RTV_SERVICE_DVBT = 6, /* DVB-T */
  73. #endif
  74. MAX_NUM_RTV_SERVICE
  75. };
  76. enum E_RTV_BANDWIDTH_TYPE {
  77. RTV_BW_MODE_5MHZ = 0, /* DVB_T */
  78. RTV_BW_MODE_6MHZ, /* DVB_T, FULLSEG, ISDB-Tmm */
  79. RTV_BW_MODE_7MHZ, /* DVB_T, FULLSEG */
  80. RTV_BW_MODE_8MHZ, /* DVB_T, FULLSEG */
  81. RTV_BW_MODE_430KHZ, /* 1SEG at 6MHz BW */
  82. RTV_BW_MODE_500KHZ, /* 1SEG at 7MHz BW */
  83. RTV_BW_MODE_571KHZ, /* 1SEG at 8MHz BW */
  84. RTV_BW_MODE_857KHZ, /* DAB */
  85. RTV_BW_MODE_1290KHZ, /* 3SEG */
  86. MAX_NUM_RTV_BW_MODE_TYPE
  87. };
  88. /*=============================================================================
  89. *
  90. * ISDB-T definitions, types and APIs.
  91. *
  92. *===========================================================================*/
  93. #define RTV_ISDBT_OFDM_LOCK_MASK 0x1
  94. #define RTV_ISDBT_TMCC_LOCK_MASK 0x2
  95. #define RTV_ISDBT_CHANNEL_LOCK_OK \
  96. (RTV_ISDBT_OFDM_LOCK_MASK|RTV_ISDBT_TMCC_LOCK_MASK)
  97. struct RTV_LAYER_SIGNAL_INFO {
  98. U32 cnr;
  99. U32 ber;
  100. U32 per;
  101. };
  102. struct RTV_Statistics {
  103. UINT lock;
  104. S32 rssi;
  105. U32 cnr;
  106. UINT antenna_level;
  107. UINT antenna_level_1seg;
  108. struct RTV_LAYER_SIGNAL_INFO layerA; /*LP 1SEG, DVB-T, ISDBT Layer A*/
  109. struct RTV_LAYER_SIGNAL_INFO layerB; /*ISDBT Layer B*/
  110. struct RTV_LAYER_SIGNAL_INFO layerC; /*ISDBT Layer C*/
  111. };
  112. #define RTV_ISDBT_BER_DIVIDER 100000
  113. #define RTV_ISDBT_CNR_DIVIDER 1000
  114. #define RTV_ISDBT_RSSI_DIVIDER 10
  115. #if defined(RTV_IF_SPI) || defined(RTV_IF_EBI2)
  116. extern UINT g_nRtvThresholdSize;
  117. static INLINE UINT rtvMTV23x_GetInterruptSize(void)
  118. {
  119. return g_nRtvThresholdSize;
  120. }
  121. #endif
  122. enum E_RTV_ISDBT_SEG_TYPE {
  123. RTV_ISDBT_SEG_1 = 0,
  124. RTV_ISDBT_SEG_2,
  125. RTV_ISDBT_SEG_3,
  126. RTV_ISDBT_SEG_4,
  127. RTV_ISDBT_SEG_5,
  128. RTV_ISDBT_SEG_6,
  129. RTV_ISDBT_SEG_7,
  130. RTV_ISDBT_SEG_8,
  131. RTV_ISDBT_SEG_9,
  132. RTV_ISDBT_SEG_10,
  133. RTV_ISDBT_SEG_11,
  134. RTV_ISDBT_SEG_12,
  135. RTV_ISDBT_SEG_13
  136. };
  137. enum E_RTV_ISDBT_MODE_TYPE {
  138. RTV_ISDBT_MODE_1 = 0,
  139. RTV_ISDBT_MODE_2,
  140. RTV_ISDBT_MODE_3
  141. };
  142. enum E_RTV_ISDBT_GUARD_TYPE {
  143. RTV_ISDBT_GUARD_1_32 = 0,
  144. RTV_ISDBT_GUARD_1_16,
  145. RTV_ISDBT_GUARD_1_8,
  146. RTV_ISDBT_GUARD_1_4
  147. };
  148. enum E_RTV_ISDBT_INTERLV_TYPE {
  149. RTV_ISDBT_INTERLV_0 = 0,
  150. RTV_ISDBT_INTERLV_1,
  151. RTV_ISDBT_INTERLV_2,
  152. RTV_ISDBT_INTERLV_4,
  153. RTV_ISDBT_INTERLV_8,
  154. RTV_ISDBT_INTERLV_16,
  155. RTV_ISDBT_INTERLV_32
  156. };
  157. enum E_RTV_MODULATION_TYPE {
  158. RTV_MOD_DQPSK = 0,
  159. RTV_MOD_QPSK,
  160. RTV_MOD_16QAM,
  161. RTV_MOD_64QAM
  162. };
  163. enum E_RTV_CODE_RATE_TYPE {
  164. RTV_CODE_RATE_1_2 = 0,
  165. RTV_CODE_RATE_2_3,
  166. RTV_CODE_RATE_3_4,
  167. RTV_CODE_RATE_5_6,
  168. RTV_CODE_RATE_7_8
  169. };
  170. enum E_RTV_LAYER_TYPE {
  171. RTV_LAYER_A = 0,
  172. RTV_LAYER_B,
  173. RTV_LAYER_C
  174. };
  175. struct RTV_ISDBT_LAYER_TMCC_INFO {
  176. enum E_RTV_ISDBT_SEG_TYPE eSeg; /* LP CodeRate @DVB-T */
  177. enum E_RTV_MODULATION_TYPE eModulation; /* Modulation @DVB-T */
  178. enum E_RTV_CODE_RATE_TYPE eCodeRate; /* Hierarchy Mode@DVB-T */
  179. enum E_RTV_ISDBT_INTERLV_TYPE eInterlv; /* HP CodeRate@DVB-T */
  180. };
  181. struct RTV_ISDBT_TMCC_INFO {
  182. BOOL fEWS;
  183. enum E_RTV_ISDBT_MODE_TYPE eTvMode;
  184. enum E_RTV_ISDBT_GUARD_TYPE eGuard;
  185. struct RTV_ISDBT_LAYER_TMCC_INFO eLayerA;
  186. struct RTV_ISDBT_LAYER_TMCC_INFO eLayerB;
  187. struct RTV_ISDBT_LAYER_TMCC_INFO eLayerC;
  188. };
  189. void rtvMTV23x_StandbyMode(int on);
  190. void rtvMTV23x_GetSignalStatistics(struct RTV_Statistics *ptSigInfo);
  191. UINT rtvMTV23x_GetLockStatus(void);
  192. UINT rtvMTV23x_GetAntennaLevel(U32 dwCNR);
  193. UINT rtvMTV23x_GetAntennaLevel_1seg(U32 dwCNR);
  194. U8 rtvMTV23x_GetAGC(void);
  195. U32 rtvMTV23x_GetPER(void);
  196. U32 rtvMTV23x_GetPER2(void);
  197. U32 rtvMTV23x_GetPER3(void);
  198. S32 rtvMTV23x_GetRSSI(void);
  199. U32 rtvMTV23x_GetCNR(void);
  200. U32 rtvMTV23x_GetCNR_LayerA(void);
  201. U32 rtvMTV23x_GetCNR_LayerB(void);
  202. U32 rtvMTV23x_GetCNR_LayerC(void);
  203. U32 rtvMTV23x_GetBER(void);
  204. U32 rtvMTV23x_GetBER2(void);
  205. U32 rtvMTV23x_GetBER3(void);
  206. U32 rtvMTV23x_GetPreviousFrequency(void);
  207. void rtvMTV23x_GetTMCC(struct RTV_ISDBT_TMCC_INFO *ptTmccInfo);
  208. void rtvMTV23x_DisableStreamOut(void);
  209. void rtvMTV23x_EnableStreamOut(void);
  210. INT rtvMTV23x_SetFrequency(U32 dwChFreqKHz, UINT nSubchID,
  211. enum E_RTV_SERVICE_TYPE eServiceType,
  212. enum E_RTV_BANDWIDTH_TYPE eBandwidthType, UINT nThresholdSize);
  213. INT rtvMTV23x_ScanFrequency(U32 dwChFreqKHz, UINT nSubchID,
  214. enum E_RTV_SERVICE_TYPE eServiceType,
  215. enum E_RTV_BANDWIDTH_TYPE eBandwidthType, UINT nThresholdSize);
  216. INT rtvMTV23x_Initialize(enum E_RTV_BANDWIDTH_TYPE eBandwidthType);
  217. #if !defined(RTV_IF_SPI) && !defined(RTV_IF_EBI2)
  218. /* 0: A,B,C 1: A 2: B */
  219. void rtvMTV23X_ISDBT_LayerSel(U8 layer);
  220. #endif
  221. #ifdef RTV_DUAL_DIVERISTY_ENABLE
  222. #define DIVERSITY_MASTER 0
  223. #define DIVERSITY_SLAVE 1
  224. INT rtvMTV23x_Diversity_Path_Select(BOOL bMS);
  225. INT rtvMTV23x_Get_Diversity_Current_path(void);
  226. INT rtvMTV23x_ConfigureDualDiversity(INT bMS);
  227. void rtvMTV23x_ONOFF_DualDiversity(BOOL onoff);
  228. /* return value : 0 :MIX, 1: Master 2: Slave */
  229. INT rtvMTV23x_MonDualDiversity(void);
  230. /* 0 : Auto 1 : Auto_NOT_Var_used 2: Force Master 3: Force Slave */
  231. void rtvMTV23x_Diver_Manual_Set(U8 sel);
  232. void rtvMTV23X_Diver_Update(void);
  233. #endif /* #ifdef RTV_DUAL_DIVERISTY_ENABLE */
  234. #ifdef __cplusplus
  235. }
  236. #endif
  237. #endif /* __MTV23X_H__ */