mid_dtv_scan.h 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899
  1. /*! \addtogroup scan
  2. * @{
  3. */
  4. /******************************************************************************/
  5. /**
  6. *
  7. * \file mid_scan.h
  8. *
  9. * \brief middle-ware of digital TV scan.
  10. *
  11. *
  12. * \note Copyright (c) 2008 Sunplus Technology Co., Ltd. \n
  13. * All rights reserved.
  14. *
  15. * \author EMI
  16. *
  17. ******************************************************************************/
  18. #ifndef _MID_SCAN_H_2008_03_18
  19. #define _MID_SCAN_H_2008_03_18
  20. //#include "types.h"
  21. //#include "config_sys.h"
  22. #include "mid_common.h"
  23. #include "dvb_dr_dvb.h"
  24. #include "cdbi.h"
  25. // scan capabilities
  26. #define MID_SCAN_CAPS_MAIN_SYSTEM (1<<0) ///< main DTV system
  27. #define MID_SCAN_CAPS_SUPPORT_NIT (1<<1) ///< additional support NIT info
  28. #define MID_SCAN_CAPS_SUPPORT_LCN (1<<2) ///< additional support LCN
  29. #define MID_SCAN_CAPS_SUPPORT_AC3 (1<<3) ///< additional support AC3
  30. #define MID_SCAN_CAPS_SUPPORT_CA_SYSTEM (1<<4) ///< additional support CA system
  31. #define MID_SCAN_CAPS_SUPPORT_TEMPORARY_SERVICE (1<<5) ///< additional support temporary service
  32. #define MID_SCAN_CAPS_SUPPORT_MHEG5 (1<<6) ///< additional support MHEG5
  33. #define MID_SCAN_CAPS_SUPPORT_DTG_CERTIFICATION (1<<7) ///< additional support DTG certification
  34. //BRAD 090928 MOD+ add new capability
  35. #define MID_SCAN_CAPS_SUPPORT_DEL_SRV_NOT_IN_SDT (1<<8) ///< additional support for removing service not in SDT
  36. #define MID_SCAN_CAPS_SUPPORT_ADD_SRV_IN_SDT_ONLY (1<<9) ///< additional support for keeping service only in SDT
  37. #define MID_SCAN_CAPS_SUPPORT_ADD_SRV_IN_SDT_PAT_ONLY (1<<10) ///< additional support for keeping service in SDT and PAT without PMT
  38. //BRAD MOD-
  39. #define MID_SCAN_CAPS_SUPPORT_LCN_VER2 (1<<11) ///< additional support LCN in LCD version 2
  40. #define MID_SCAN_CAPS_SUPPORT_HD_SIMUALCAST_LCN (1<<12) ///< additional support LCN in HD simulcast LCD
  41. //BRAD MOD+ for mantis 75250
  42. #define MID_SCAN_CAPS_SUPPORT_14BIT_LCN (1<<13) ///< additional support 14-bits LCN
  43. //BRAD MOD-
  44. #define MID_SCAN_CAPS_SUPPORT_EBOOK_PDSD (1<<14) ///< additional support for check private_dada_specifier_descriptor = 0x00_00_00_28
  45. #define MID_SCAN_CAPS_SUPPORT_NORDIG_PDSD (1<<15) ///< additional support for check private_dada_specifier_descriptor = 0x00_00_00_29
  46. //zhaorui 100108 added for mantis 76788 +
  47. #define MID_SCAN_CAPS_SUPPORT_MULTI_SERVICE_NAME (1<<16) ///< additional support multilingual service name //zhaorui 100108 added
  48. //zhaorui 100108 added end -
  49. #define MID_SCAN_CAPS_SUPPORT_ONE_SEG (1<<17) //added for Brazil for support oneseg scan
  50. #define MID_SCAN_CAPS_SUPPORT_COUNTRY_AVAILABILITY (1<<18) ///< additional support country availability descriptor //zhaorui 100925 add for mantis 0105229
  51. /* add by william.lee @2011/1/25 for support DVB-C */
  52. #define MID_SCAN_CAPS_SUPPORT_DVB_T (1<<19)
  53. #define MID_SCAN_CAPS_SUPPORT_DVB_C (1<<20)
  54. #define MID_SCAN_CAPS_SUPPORT_DVB_S (1<<21)
  55. /* add end */
  56. #define MID_SCAN_CAPS_SUPPORT_DYNAMIC_PDSD (1<<22) ///< DVB-C, dynamic check the PDSD(private_dada_specifier_descriptor) //junluo 20110825 add for Orion DVB_C spec
  57. #define MID_SCAN_CAPS_SUPPORT_DVB_SBTVD (1<<23)
  58. #define MID_SCAN_CAPS_SUPPORT_NO_CHECK_PDSD (1<<24)
  59. /* Scan T2 if DVB-T in current freq failed */
  60. #define MID_SCAN_CAPS_SUPPORT_DVB_T2_IMMEDIATE (1 << 25)
  61. /* After Scanning all DVB-T channel, the failed ones will be scaned by T2 */
  62. #define MID_SCAN_CAPS_SUPPORT_DVB_T2_LATER (1 << 26)
  63. /*parser TP after one TP found */
  64. #define MID_SCAN_CAPS_SUPPORT_BLIND_SCAN_METHOD_1 (1 << 27)
  65. /*parser TPs after all TP found */
  66. #define MID_SCAN_CAPS_SUPPORT_BLIND_SCAN_METHOD_2 (1 << 28)
  67. #define MID_SCAN_CAPS_SUPPORT_NORDIG_CERTIFICATION (1<<29) ///< additional support NRODIG certification
  68. #define MID_SCAN_CAPS_SUPPORT_NIT_SCAN (1 << 30) ///< additional support receive all NIT info zhongbaoxing added @20130307
  69. /*parser TP after some TP found */
  70. #define MID_SCAN_CAPS_SUPPORT_BLIND_SCAN_METHOD_3 (1 << 31)
  71. #define MID_SCAN_CAPS_EXT_SUPPORT_ASTRA_LCN (1 << 0) //support DVB-S ASTRA LCN
  72. #define MID_SCAN_CAPS_EXT_SUPPORT_DRA_AUDIO (1 << 1)// support DTMB DRA AUDIO STREAM
  73. #define MID_SCAN_CAPS_EXT_SCAN_ONLY_NIT_OTHER (1 << 2) // Some operators ,e.g. YouSee, might use only NITother and omit NITactual during NIT scan
  74. #define MID_SCAN_CAPS_EXT_SUPPORT_KDG_LCN (1 << 3) // support DVB-C KDG LCN
  75. #ifdef CONFIG_SUPPORT_FAST_SCANNING
  76. #define MID_SCAN_CAPS_EXT_SUPPORT_M7_FAST_SCAN (1 << 4)
  77. #define MAX_FST_BAD_TIME 1000 ///< 1000ms, FST delay time
  78. #define MAX_FNT_BAD_TIME 1000 ///< 1000ms, FNT delay time
  79. #endif
  80. #define MID_SCAN_CAPSEX_SUPPORT_CHECK_LCNV2_PDSD (1 << 5)
  81. /* End define */
  82. #define SCAN_THREAD_DELAY_TIME 10 ///< 10ms, the delay time decision is depend with the following max PSI bad times
  83. #define MAX_PAT_BAD_TIME 1000 ///From 500msec change to 1000msec, < 500ms, PAT delay time
  84. #define MAX_SDT_BAD_TIME 800 ///< 800ms, SDT delay time
  85. //[kiwi 20080730] modify MAX_NIT_BAD_TIME value from 800 -> 1500
  86. /* modify by kun.li @2011/6/9 */
  87. #if 0
  88. #define MAX_NIT_BAD_TIME 1500 ///< 1500ms, NIT delay time
  89. #else
  90. #define MAX_NIT_BAD_TIME 1300
  91. #endif
  92. /* modify end */
  93. #define MAX_CAT_BAD_TIME 500 ///< 500ms, CAT delay time
  94. #define MAX_BAT_BAD_TIME 1000///< 1000ms, BAT delay time
  95. #define MAX_PMT_BAD_TIME 500 ///< 500ms, PMT delay time
  96. #ifdef SUPPORT_ASTRA_LCN
  97. #define MAX_SGT_BAD_TIME 1000 ///< 5000ms, SGT delay time
  98. #endif
  99. #define MAX_PMT_SCAN_NUM 5 ///< Scan number of PMT in one loop
  100. #define MAX_NAME_LEN 256 ///< Scan prog name length of SDT
  101. #define MAX_CHNLIST_NAME_LEN 40 ///< ASTRA required 31 bytes, Ghana Spec required 23 bytes
  102. #ifdef CONFIG_DVB_SYSTEM_DVBS_SUPPORT
  103. typedef INT32 (*BlindScanChannelInfoCallback)(UINT32 freq_KHz, UINT32 symbol, UINT32 standard);
  104. typedef INT32 (*BlindScanUpdateUICallback)(UINT32 u32Progress, UINT32* UserSearchState, UINT32 reserve);
  105. #endif
  106. //JennyLee 20100624 added for mantis 86055 [start]
  107. #ifdef SUPPORT_TRD //Target Region Descriptor
  108. typedef struct _mid_scan_trd_info
  109. {
  110. UINT8 u8RegionDepth;
  111. char u8CountryCode[3];
  112. UINT8 u8PrimaryCode;
  113. UINT8 u8SecondayCode;
  114. UINT16 u16TertiaryCode;
  115. } MID_ScanTrdInfo_t;
  116. #endif // #ifdef SUPPORT_TRD
  117. //JennyLee 20100624 added for mantis 86055 [start]
  118. //#define LCN_INDICATOR 0x8000
  119. //#define LCN_MASK 0x3FFF //runqian modify 091228 for mantis 0075769
  120. //#ifdef SUPPORT_SDHD_SIMULCAST //yukai 110214 added for mantis 0124070
  121. typedef struct mid_scan_simulcast_linkageinfo
  122. {
  123. UINT16 i_original_network_id;
  124. UINT16 i_transport_stream_id;
  125. UINT16 i_service_id;
  126. UINT8 linkage_type;
  127. }MID_Scan_Simulcast_LinkageInfo_t;
  128. //#endif
  129. #if (defined(SUPPORT_LCN_VER2) || defined(SUPPORT_ASTRA_LCN))
  130. //#define MAX_LCN_VER2_DATA 10
  131. #define MAX_CHNLIST_NUM 10
  132. #endif
  133. /**
  134. * \brief general pid strcucture
  135. */
  136. typedef struct _mid_scan_pid_info
  137. {
  138. unsigned short usPid; ///< pid
  139. unsigned short usCompTag; ///< component tag, for ac3 audio, the tag is PES stream id
  140. unsigned short usCodec; ///< codec or format
  141. char Lang[4]; ///< store ISO_639_LANGUAGE info
  142. struct _mid_scan_pid_info *next; ///< link to next unit
  143. }MID_ScanPidInfo_t; ///< general pid strcucture
  144. /**
  145. * \brief ecm/emm pid strcuture
  146. */
  147. typedef struct _mid_scan_exm_info // ECM & EMM
  148. {
  149. unsigned short usPid; ///< pid
  150. unsigned short usCaSysId; ///< CA_system_id
  151. struct _mid_scan_exm_info* next; ///< link to next unit
  152. }MID_ScanExMPidInfo_t; ///< ecm/emm pid strcuture
  153. /**
  154. * \brief multi service name strcuture for matis 76788
  155. */
  156. // zhaorui 100108 added
  157. typedef struct _mid_scan_multi_name_info
  158. {
  159. char Lang[3]; ///< store ISO_639_LANGUAGE info
  160. char ucCarrierName[MAX_NAME_LEN]; ///< carrier name info
  161. char ucServiceName[MAX_NAME_LEN]; ///< service name info
  162. struct _mid_scan_multi_name_info *next; ///< link to next unit
  163. }_mid_scan_multi_name_info; ///< multi service name strcuture
  164. /**
  165. * \brief desc. lcn2 data strcuture
  166. */
  167. #if (defined(SUPPORT_LCN_VER2) || defined(SUPPORT_ASTRA_LCN))
  168. //typedef struct _mid_scan_lcn_v2_info
  169. typedef struct _mid_scan_multi_lcn_info
  170. {
  171. UINT8 channel_list_id; ///< channel list id
  172. UINT8 country_code[3]; ///< country code
  173. UINT8 visible_service_flag; ///< visible flag of the service
  174. UINT16 lcn; ///< store lcn
  175. UINT8 channel_list_name[MAX_CHNLIST_NAME_LEN];
  176. UINT8 channel_list_name_length;
  177. }MID_ScanMultiLCNInfo_t; ///< desc. lcn2 data strcuture
  178. typedef struct _mid_scan_sing_srv_lcn_info
  179. {
  180. UINT16 usONID;
  181. UINT16 usTSID;
  182. UINT16 usSrvID;
  183. UINT16 usLCN;
  184. bool bVisible;
  185. UINT8 ucServType;
  186. }MID_ScanSingSrvLCNInfo_t, *PMID_ScanSingSrvLCNInfo_t;
  187. typedef struct _mid_scan_multi_srv_lcn_info
  188. {
  189. UINT8 channel_list_id; ///< channel list id
  190. UINT8 channel_list_name[MAX_CHNLIST_NAME_LEN];
  191. UINT32 uiSrvCnt;
  192. PMID_ScanSingSrvLCNInfo_t pLCNList;
  193. struct _mid_scan_multi_srv_lcn_info *pNextChnList;
  194. }MID_ScanMultSrvLCNInfo_t, *PMID_ScanMultSrvLCNInfo_t;
  195. typedef struct _MID_ScanMultSrvLCNInfoNode_t
  196. {
  197. struct _MID_ScanMultSrvLCNInfoNode_t *pNext;
  198. PMID_ScanMultSrvLCNInfo_t pstMultiSrvLCNInfo;
  199. }MID_ScanMultSrvLCNInfoNode_t, *PMID_ScanMultSrvLCNInfoNode_t;
  200. #endif
  201. typedef struct _MID_ScanSpecialSpec
  202. {
  203. dvbsi_special_spec eSpecialSpec; /// mid scan => ap
  204. bool changeCapabilitie; /// ap => mid scan
  205. }MID_ScanSpecialSpec;
  206. typedef struct _MID_Scan_AllTSID_info
  207. {
  208. unsigned int uiTSIDNum;
  209. unsigned short *pTSIDList;
  210. }MID_Scan_AllTSID_info;
  211. typedef struct _MID_Scan_FreqList_info
  212. {
  213. dvbpsi_freqlist_codingtype_e coding_type;
  214. unsigned int uiFreqNum;
  215. dvbpsi_frequency_t *pFreqList;
  216. }MID_Scan_FreqList_info;
  217. /**
  218. * \brief DVB service info
  219. */
  220. typedef struct _mid_scan_dvb_service_info
  221. {
  222. // carrier related
  223. int iCarrierIndex; ///< carrier index
  224. char szCarrierName[MAX_NAME_LEN]; ///< carrier name, max size MAX_NAME_LEN
  225. char szProviderName[MAX_NAME_LEN]; ///< carrier name, max size MAX_NAME_LEN
  226. // transponder related
  227. unsigned short usNetId; ///< network id
  228. unsigned short usOrigNetId; ///< original network id
  229. unsigned short usTsId; ///< transport stream id for sdt nit
  230. unsigned short usTsId_pat; ///< transport stream id for pat
  231. #ifdef NIT_SCAN_SUPPORT
  232. UINT32 usFreq;
  233. #endif
  234. #ifdef CONFIG_SUPPORT_FAST_SCANNING
  235. bool bFST;
  236. unsigned short usOrbitalPos;
  237. unsigned char ucWestEastFlag;
  238. unsigned char ucModulationSystem;
  239. unsigned int uiFreq;
  240. unsigned int uiPolarization;
  241. unsigned int uiSymbRate;
  242. #endif
  243. #ifdef CONFIG_ISDB_SYSTEM
  244. unsigned char usRemoteControlKeyId;//yhong 2010.10.29 for 0109549, add oneseg flag to DB.
  245. unsigned char ucIsOneSeg; //Only use 1b, 1=Oneseg//yhong 2010.10.29 for 0109549, add oneseg flag to DB.
  246. #endif
  247. // service related
  248. unsigned char ucServiceFlag; ///< SERVICE_HIDE, SERVICE_TEMP, SERVICE_SCRAMBLED, ... ?
  249. unsigned char ucServiceType; ///< service type, TV, Radio,...?
  250. unsigned char ucSDTServiceType; ///< service_type from SDT
  251. unsigned char ucRunningStatus; ///< running status
  252. unsigned short usServiceId; ///< service id
  253. unsigned short usProgNo; ///< program number
  254. #ifdef CONFIG_DTMB_SYSTEM
  255. unsigned short usSDTOrder; ///< SDT order
  256. #endif
  257. unsigned short usPMTPid; ///< pmt pid
  258. unsigned short usPcrPid; ///< pcr pid
  259. char szProgNameLang0[MAX_NAME_LEN]; ///< program name lang 1 : english
  260. // multi service name //zhaorui 100108 added for mantis 76788
  261. int iMulProNameNum; ///< multilingual service name number
  262. _mid_scan_multi_name_info *pstMulProName; ///< multilingual service name pointer
  263. // video related
  264. int iVideoNum; ///< video count
  265. MID_ScanPidInfo_t *pstVideoPID; ///< head of Vidoe PID linked list
  266. // audio related
  267. int iAudioNum; ///< audio count
  268. MID_ScanPidInfo_t *pstAudioPID; ///< head of Audio PID linked list
  269. // teletext related
  270. int iTTXNum; ///< teletext count
  271. MID_ScanPidInfo_t *pstTTXPID; ///< head of Teletext PID linked list
  272. // subtitle related
  273. int iSubtitleNum; ///< subtitle count
  274. MID_ScanPidInfo_t *pstSubtitlePID; ///< head of Subtitle PID linked list
  275. // CAT related, EMM
  276. int iEmmNum; ///< EMM count
  277. MID_ScanExMPidInfo_t *pstEmmPid; ///< head of EMM PID linked list
  278. // ECM
  279. int iGlobEcmNum; ///< globle ECM count
  280. MID_ScanExMPidInfo_t *pstGlobEcmPid; ///< head of globle ECM PID linked list
  281. int iVidEcmNum; ///< VID ECM count
  282. MID_ScanExMPidInfo_t *pstVidEcmPid; ///< head of VID ECM PID linked list
  283. int iAudEcmNum1; ///< Audio ECM1 count
  284. MID_ScanExMPidInfo_t *pstAudEcmPid1; ///< head of Audio ECM1 PID linked list
  285. int iAudEcmNum2; ///< Audio ECM2 count
  286. MID_ScanExMPidInfo_t *pstAudEcmPid2; ///< head of Audio ECM2 PID linked list
  287. #ifdef SUPPORT_LCN
  288. unsigned short usOrgLcn; ///< original LCN carried in LCN descriptor in NIT,
  289. ///< We may get some programs with the same LCN value in other TPs,
  290. ///< application should change the LCN value(800 later) by LCN decision tree.
  291. #endif // #ifdef SUPPORT_LCN
  292. char szProgNameLang1[MAX_NAME_LEN]; ///< program name lang 2 : wel
  293. char szProgNameLang2[MAX_NAME_LEN]; ///< program name lang 3 : gla/gae
  294. // other undefined private PIDs : MHEG5 used
  295. int iPrivateNum; ///< private data count
  296. MID_ScanPidInfo_t *pstPrivatePID; ///< head of private data PID linked list
  297. char szProgNameLang3[MAX_NAME_LEN]; ///< program name lang 1 : english
  298. char szlangCode3[MAX_NAME_LEN]; ///< program name lang 1 : english
  299. //[kiwi 20090122] +
  300. #ifdef SUPPORT_HIERARCHY_MODE
  301. int iHierarchyMode; ///< hierarchy mode 0:NONE 1:MODE_1 2:MODE_2 3:MODE_4 4:MODE_AUTO
  302. #endif
  303. //[kiwi 20090122] -
  304. #if (defined(SUPPORT_LCN_VER2) || defined(SUPPORT_ASTRA_LCN))
  305. //MID_ScanLcnV2Info_t stLcnV2Data[MAX_LCN_VER2_DATA];
  306. MID_ScanMultiLCNInfo_t stMultiLCNData[MAX_CHNLIST_NUM];
  307. #endif
  308. #ifdef SUPPORT_HD_SIMULCAST_LCN
  309. unsigned short usHDSimulLcn; ///< LCN carried in HD simulcast LCN descriptor in NIT,
  310. #endif
  311. #ifdef SUPPORT_EPG_SERIES //Mika 091203 added for series rec.
  312. unsigned char ucDefAuthority[32]; ///< default authority descriptor
  313. #endif
  314. #ifdef SUPPORT_SUPPORT_COUNTRY_AVAILABILITY //zhaorui 100925 add for mantis 0105229
  315. dvbpsi_country_avail_dr_t *pstCountryAvail;
  316. #endif
  317. //#ifdef SUPPORT_SDHD_SIMULCAST //yukai 20110213 added for mantis 0124070
  318. MID_Scan_Simulcast_LinkageInfo_t stSimulcastInfo;
  319. //#endif
  320. #ifdef SUPPORT_TRD //JennyLee 20100624 added
  321. MID_ScanTrdInfo_t stTrdInfo[MAX_SRV_TRD];
  322. #endif
  323. #ifdef SUPPORT_NETWORK_UPDATE_RESCAN
  324. unsigned char ucNitVersion;
  325. #endif
  326. #ifdef SUPPORT_MONITOR_ONLY_NIT_OTHER
  327. unsigned char ucNetTableId;
  328. #endif
  329. MID_Scan_AllTSID_info stAllTSID; // all TS ID loaded in current network
  330. MID_Scan_FreqList_info stFreqList; // all Freqs loaded in the frequency list descriptor
  331. unsigned char ucOtherFreqFlag; // other_frequency_flag defined in T & T2 delivery system descriptor, current we only consider T(2014/11/17)
  332. #ifdef CONFIG_DVB_SYSTEM_DVBT2_SUPPORT
  333. unsigned char usPlpInfo; //< the total PLP num for DVB-T2
  334. unsigned char usPlpId; //< the PLP ID for DVB-T2
  335. #endif
  336. DBCIProtection_t usCIShunningData; //< the usCIShunningData
  337. }MID_ScanDVBServiceInfo_t; ///< DVB service info
  338. /**
  339. * \brief Scan DVB tp info structure
  340. */
  341. typedef struct _mid_scan_dvb_tp_info
  342. {
  343. #ifdef SUPPORT_TRD
  344. dvbpsi_target_region_name_dr_t *pst_trd_name_info;
  345. #endif
  346. }MID_ScanDVBTpInfo_t; ///< Scan DVB tp info structure
  347. /**
  348. * \brief Scan OFDM parameter structure
  349. */
  350. typedef struct _MID_ScanOFDMParam_t
  351. {
  352. UINT32 frequency; ///< Frequency
  353. unsigned short bandwidth; ///< Bandwidth
  354. #ifdef SUPPORT_HIERARCHY_MODE
  355. DRV_Frontend_Hierarchy_t HierarchyMode; ///< Hierarchy mode
  356. #endif
  357. UINT32 ScanMode;
  358. #ifdef CONFIG_DVB_SYSTEM_DVBT2_SUPPORT
  359. UINT8 u32plp_id; //plp index
  360. UINT8 u32plp_totle; //plp index
  361. #endif
  362. #ifdef SUPPORT_FREEVIEW_NZ
  363. UINT16 u16cell_id;
  364. #endif
  365. }MID_ScanOFDMParam_t; ///< Scan OFDM parameter structure
  366. /**
  367. * \brief Scan QPSK parameter structure
  368. */
  369. typedef struct _MID_ScanQPSKParam_t
  370. {
  371. UINT32 frequency; ///< Frequency
  372. UINT32 freq_end;
  373. UINT32 symrate; ///< Symrate
  374. UINT32 polarization; ///< Polarization
  375. UINT32 fe_type; ///< dvb-s or dvb-s2
  376. UINT32 Diseqc_Bank;
  377. }MID_ScanQPSKParam_t; ///< Scan QPSK parameter structure
  378. /**
  379. * \brief Scan QAM parameter structure
  380. */
  381. typedef struct _MID_ScanQAMParam_t
  382. {
  383. UINT32 frequency; ///< Frequency
  384. UINT32 symbrate; ///< Symrate
  385. UINT16 modulation; ///< Modulation
  386. UINT32 network_id; /// network id;
  387. }MID_ScanQAMParam_t; ///< Scan QAM parameter structure
  388. /**
  389. * \brief Scan TDSOFDM parameter structure
  390. */
  391. typedef struct _MID_ScanTDSOFDMParam_t
  392. {
  393. UINT32 frequency; ///< Frequency
  394. UINT16 bandwidth; ///< Bandwidth
  395. UINT32 dDemodPara;
  396. }MID_ScanTSDOFDMParam_t; ///< Scan TDSOFDM parameter structure
  397. /**
  398. * \brief Scan BSTOFDM parameter structure
  399. */
  400. typedef struct MID_ScanBSTOFDMParam_t
  401. {
  402. UINT32 frequency; ///< Frequency
  403. UINT16 bandwidth; ///< Bandwidth
  404. #ifdef SUPPORT_HIERARCHY_MODE
  405. DRV_Frontend_Hierarchy_t HierarchyMode;
  406. #endif
  407. }MID_ScanBSTOFDMParam_t; ///< Scan BSTOFDM parameter structure
  408. /**
  409. * \brief Scan tuner type
  410. */
  411. typedef enum _MID_ScanTunerType_e
  412. {
  413. TUNER_QPSK = 0, ///< QPSK
  414. TUNER_QAM, ///< QAM
  415. TUNER_OFDM, ///< OFDM
  416. TUNER_TDS_OFDM, ///< TDS OFDM
  417. TUNER_BST_OFDM, ///< BST OFDM
  418. }MID_ScanTunerType_e; ///< Scan tuner type
  419. /**
  420. * \brief Scan parameter structure
  421. */
  422. typedef struct _MID_ScanParam_t
  423. {
  424. MID_ScanTunerType_e enType; ///< Scan tuner type
  425. union
  426. {
  427. MID_ScanOFDMParam_t ofdm; ///< Scan OFDM parameter
  428. MID_ScanQPSKParam_t qpsk; ///< Scan QPSK parameter
  429. MID_ScanQAMParam_t qam; ///< Scan QAM parameter
  430. MID_ScanTSDOFDMParam_t tdsofdm; ///< Scan TSDOFDM parameter
  431. MID_ScanBSTOFDMParam_t bstofdm;
  432. }u; ///< Scan parameter
  433. UINT32 u32ScanFlag; ///< Scan flag for return value
  434. char szServiceLang[4]; ///< Service language
  435. }MID_ScanParam_t; ///< Scan parameter structure
  436. /**
  437. * \brief Scan status structure
  438. */
  439. typedef struct _MID_ScanStatus_t
  440. {
  441. UINT8 bIsScanning; ///< It indicate whether we are scanning now
  442. UINT16 u16SignalStrength; ///< Signal strenth
  443. UINT16 u16SignalQuality; ///< Signal quality
  444. }MID_ScanStatus_t; ///< Scan status structure
  445. /**
  446. * \brief Scan program result
  447. */
  448. typedef struct _MID_ScanProgramResult_t
  449. {
  450. char szProgName[32]; ///< Scan program result to store program name
  451. }MID_ScanProgResult_t; ///< Scan program result
  452. /**
  453. * \brief Scan Callback type
  454. */
  455. typedef enum _MID_ScanCallbackType_e
  456. {
  457. MID_SCAN_CALLBK_TYPE_REQUEST_NEXT_TP = 0, ///< request ap layer give the next TP parameter : pParam is point to the structure MID_ScanParam_t
  458. MID_SCAN_CALLBK_TYPE_LOCKED_TP = 1, ///< TP lock ok or failed? (*pParam) is a value of DRV_Status_t
  459. MID_SCAN_CALLBK_TYPE_GOT_PMT = 2, ///< Got a PMT. (*pParam) is a value of the PMT program number
  460. MID_SCAN_CALLBK_TYPE_SERVICE_INFO = 3, ///< Got a service. pParam is a pointer to MID_ScanDVBServiceInfo_t structure
  461. MID_SCAN_CALLBK_TYPE_UNDEFINED_SERVICE_INFO = 4, ///< Got a service exist in SDT but not exist in PAT. pParam is a pointer to MID_ScanDVBServiceInfo_t structure
  462. MID_SCAN_CALLBK_TYPE_CARRIER_INFO = 5, ///< Got carrier info. pParam is a pointer to MID_ScanDVBServiceInfo_t structure
  463. MID_SCAN_CALLBK_TYPE_PROGRESS = 6, ///< Got scan progress. pParam is a pointer to MID_ScanDVBServiceInfo_t structure
  464. MID_SCAN_CALLBK_TYPE_TP_INFO = 7, ///< Got a traget region name information
  465. MID_SCAN_CALLBK_TYPE_SPECIAL_SPEC = 8, /// the special spec
  466. MID_SCAN_CALLBK_TYPE_T2_INFO = 9, ///< T2 scan info
  467. MID_SCAN_CALLBK_TYPE_T2_ONE_TP_SCAN_FINISH = 10, ///< T2 one TP scan finish
  468. MID_SCAN_CALLBK_TYPE_REQUEST_NEXT_BLIND_INFO= 11,
  469. MID_SCAN_CALLBK_TYPE_LOCK_NEW_TP = 12,
  470. MID_SCAN_CALLBK_TYPE_RESET_BS_SCAN_TBL = 13, /// < Set the Scan Tbl to collected Tp
  471. #ifdef SUPPORT_ASTRA_LCN //DVB-S Spec (ASTRA LCN)
  472. MID_SCAN_CALLBK_TYPE_ASTRA_LCN_INFO = 16,
  473. #endif
  474. MID_SCAN_CALLBK_TYPE_BLIND_NO_SERVICE = 14,
  475. MID_SCAN_CALLBK_TYPE_REQUEST_NEXT_BS_LOST_TP= 17, ///Get blind scan Lost TP
  476. MID_SCAN_CALLBK_TYPE_BS_LOST_TP_TRY = 18, ///try lost TP
  477. MID_SCAN_CALLBK_TYPE_BLIND_CANDIDATE_TABLE = 19, ///candidate TP
  478. #ifdef NIT_SCAN_SUPPORT
  479. MID_SCAN_CALLBk_TYPE_NIT_SCAN_SERVICE_INFO = 20,
  480. MID_SCAN_CALLBK_TYPE_FINISH = 21,
  481. #endif
  482. }MID_ScanCallbkType_e; ///< Scan Callback type
  483. typedef enum
  484. {
  485. MID_SCAN_BLIND_RET_NO_ACTION = 0, // blind scan is running, should do nothing
  486. MID_SCAN_BLIND_RET_ERROR, // blind scan fail
  487. MID_SCAN_BLIND_RET_LOCK, // Channel found, lock channel and scan
  488. MID_SCAN_BLIND_RET_NEW, // blind scan new channel
  489. MID_SCAN_BLIND_RET_EXCEED, // blind scan exceed range
  490. MID_SCAN_BLIND_RET_PAUSE, // blind scan pause
  491. }MID_ScanBlindRetType_e;
  492. typedef enum _MID_Manual_FE_Type_e
  493. {
  494. MANUAL_FE_QAM = 1 << 0, ///< QAM
  495. MANUAL_FE_OFDM = 1 << 1, ///< OFDM
  496. MANUAL_FE_T2 = 1 << 2, ///< T2
  497. MANUAL_FE_QPSK = 1 << 3, ///< QPSK
  498. }MID_Manual_FE_Type_e;
  499. typedef enum
  500. {
  501. MID_SCAN_STATE_ONLY_DVBT = 1, //only dvb-t state
  502. MID_SCAN_STATE_ONLY_DVBT2 = 2, //only dvb-t2 state
  503. MID_SCAN_STATE_TOGETHER_DVBT = 3, //current state is dvb-t(scan dvb-t/t2 same time)
  504. MID_SCAN_STATE_TOGETHER_DVBT2 = 4, //current state is dvb-t2(scan dvb-t/t2 same time)
  505. MID_SCAN_STATE_SEPARATE_DVBT = 5, //current state is dvb-t(scan dvb-t/t2 separate time)
  506. MID_SCAN_STATE_SEPARATE_DVBT2 = 6, //current state is dvb-t2(scan dvb-t/t2 separate time)
  507. MID_SCAN_STATE_NONE = 7, //default dvb-t
  508. } MID_DVB_T_T2_ScanMode_e;
  509. #ifdef SCAN_FREQ_OFFSET_RANGE_ENLARGE//qiuwei20100208add
  510. typedef struct _dvb_Scan_FreqOffset_SetParam {
  511. unsigned int u32Step; ///< Scan frequency offset range enlarge steps
  512. unsigned int u32NegativeWayNum; ///< Scan frequency offset range enlarge negative way number
  513. unsigned int u32PositiveWayNum; ///< Scan frequency offset range enlarge positive way number
  514. }dvb_ScanFreqOffset;
  515. /*******************************************************************************************/
  516. /**
  517. * \fn unsigned int SP_DVBScanFreqGetVal( void )
  518. *
  519. * \param None.
  520. *
  521. * \return current scan freqency
  522. *
  523. * \note Description : To get current scan freq
  524. *
  525. * \note Restrictions: None.
  526. *
  527. ********************************************************************************************/
  528. unsigned int SP_DVBScanFreqGetVal( void );
  529. /*******************************************************************************************/
  530. /**
  531. * \fn void SP_DVBScanFreqOffsetSet( dvb_ScanFreqOffset *stFreqOffset )
  532. *
  533. * \param frequency offset return address.
  534. *
  535. * \return None.
  536. *
  537. * \note Description : To set Scan Freq Offset
  538. *
  539. * \note Restrictions: frequency offset return address can't be zero
  540. *
  541. ********************************************************************************************/
  542. void SP_DVBScanFreqOffsetSet( dvb_ScanFreqOffset *stFreqOffset );
  543. /*******************************************************************************************/
  544. /**
  545. * \fn UINT8 Dvb_GetFreqEnlargeEnable(void)
  546. *
  547. * \param None.
  548. *
  549. * \return TREU/FALSE by the scan freq enlarge enable or not
  550. *
  551. * \note Description : To get Scan Freq Enlarge enable or not
  552. *
  553. * \note Restrictions: None.
  554. *
  555. ********************************************************************************************/
  556. UINT8 Dvb_GetFreqEnlargeEnable(void);
  557. /*******************************************************************************************/
  558. /**
  559. * \fn void Dvb_SetFreqEnlargeEnable(UINT8 SetFreqEnlargeEnable)
  560. *
  561. * \param Enable or not of frequency enlarge
  562. *
  563. * \return None.
  564. *
  565. * \note Description : To set Scan Freq Enlarge enable
  566. *
  567. * \note Restrictions: None.
  568. *
  569. ********************************************************************************************/
  570. void Dvb_SetFreqEnlargeEnable(UINT8 SetFreqEnlargeEnable);
  571. #endif
  572. /**
  573. * \brief a callback function to obtain the next TP scan parameter
  574. *
  575. * return 0 means successful getting the next TP scan parameter
  576. * other return values means no next TP scan parameter, and the scan processer will auto terminate
  577. */
  578. typedef int (*iMidScanCallback)(MID_ScanCallbkType_e eCallbkType, void* pParam);
  579. /*************************************************************************************
  580. * Definition of SCAN module interfaces
  581. *************************************************************************************/
  582. /** \addtogroup DTV_scan DTV Scan
  583. * \brief Interfaces of DTV scan middle-ware.
  584. * <{ */
  585. /*******************************************************************************************/
  586. /**
  587. * \fn DRV_Status_t MID_ScanStart(UINT32 u32ScanCapabilities, UINT32 u32ScanCapabilitiesExt, iMidScanCallback pfGetScanParamCallbk)
  588. *
  589. * \param u32ScanCapabilities : The scan capabilities combined by MID_SCAN_CAPS_xxxxx
  590. * \param pfGetScanParamCallbk : a callback function to obtain the next TP scan parameter
  591. * callback function return 0 by ap layer means successful getting the next TP scan parameter
  592. * and other return values means no next TP scan parameter, and the scan processer will auto terminate.
  593. *
  594. * \return DRV_SUCCESS if successful, warning or error code if function failed
  595. *
  596. * \note Description : To trigger a thread for scan the programs of digital signal.
  597. *
  598. * \note Restrictions: None.
  599. *
  600. ********************************************************************************************/
  601. MID_Status_t MID_ScanStart(UINT32 u32ScanCapabilities, UINT32 u32ScanCapabilitiesExt, iMidScanCallback pfGetScanParamCallbk);
  602. /*******************************************************************************************/
  603. /**
  604. * \fn DRV_Status_t MID_ScanStop(void)
  605. *
  606. * \return DRV_SUCCESS if successful, warning or error code if function failed
  607. *
  608. * \note Description : To stop the scan processer while scanning.
  609. *
  610. * \note Restrictions:Once the module has been stop, calling this API a second time will
  611. * do nothing and will simply return a warning.
  612. ********************************************************************************************/
  613. MID_Status_t MID_ScanStop(void);
  614. /*******************************************************************************************/
  615. /**
  616. * \fn DRV_Status_t MID_ScanCheckStatus(MID_ScanStatus_t *pstScanStatus)
  617. *
  618. * \param pstScanStatus : the pointer to structure contains the scan status, signal strength, signal quality,.....
  619. *
  620. * \return DRV_SUCCESS if successful, warning or error code if function failed
  621. *
  622. * \note Description : To obtain the scan status while scanning.
  623. *
  624. * \note Restrictions : None.
  625. *
  626. ********************************************************************************************/
  627. MID_Status_t MID_ScanCheckStatus(MID_ScanStatus_t *pstScanStatus);
  628. /*******************************************************************************************/
  629. /**
  630. * \fn DRV_Status_t MID_ScanPause(void)
  631. *
  632. * \return DRV_SUCCESS if successful, warning or error code if function failed
  633. *
  634. * \note Description : To obtain the scan status while scanning.
  635. *
  636. * \note Restrictions : None.
  637. *
  638. ********************************************************************************************/
  639. MID_Status_t MID_ScanPause(void); //add by zhangjie for DVB-C 20100319
  640. /*******************************************************************************************/
  641. /**
  642. * \fn DRV_Status_t MID_ScanResume(void)
  643. *
  644. * \return DRV_SUCCESS if successful, warning or error code if function failed
  645. *
  646. * \note Description : To resume the scan processer while scanning.
  647. *
  648. * \note Restrictions:Once the module has been stop, calling this API a second time will
  649. * do nothing and will simply return a warning.
  650. ********************************************************************************************/
  651. MID_Status_t MID_ScanResume(void);//add by zhangjie for DVB-C 20100319
  652. /*******************************************************************************************/
  653. /**
  654. * \fn void MID_ScanGetManualSearchProgress(UINT16 *wCurrentCount, UINT16 *wTotalCount, UINT16 *wCurrentProgress)
  655. *
  656. * \param wCurrentCount: Current Program Count return address
  657. * \param wTotalCount: Total Program Count return address
  658. * \param wCurrentProgress: Current Scan Progress return address
  659. *
  660. * \return None.
  661. *
  662. * \note Description : To get scan current program count, total program count, and current scan progress
  663. *
  664. * \note Restrictions: wCurrentCount, wTotalCount, and wTotalCount address can't be zero
  665. *
  666. ********************************************************************************************/
  667. //Mika 100330 MOD for mantis 82627
  668. void MID_ScanGetManualSearchProgress(UINT16 *wCurrentCount, UINT16 *wTotalCount, UINT16 *wCurrentProgress);
  669. /*******************************************************************************************/
  670. /**
  671. * \fn void MID_ScanSetCountryCode(char *pszCountryCode)
  672. *
  673. * \param pszCountryCode: set the current country code to scan module
  674. *
  675. * \return None.
  676. *
  677. * \note Description : set the country code to scan module, to find the matched descriptor
  678. *
  679. ********************************************************************************************/
  680. void MID_ScanSetCountryCode(char *pszCountryCode);
  681. /*******************************************************************************************/
  682. /**
  683. * \fn void MID_ScanCheckCountryCode(char *pszCountryCode)
  684. *
  685. * \param pszCountryCode: the country code to be checked
  686. *
  687. * \return TRUE means country code matched, FALSE means country code not matched
  688. *
  689. * \note Description : check if the country code is matched or not
  690. *
  691. ********************************************************************************************/
  692. UINT8 MID_ScanCheckCountryCode(char *pszCountryCode);
  693. /*Add by william.lee @20110125 for sunpporting DTV manual search*/
  694. /*******************************************************************************************/
  695. /**
  696. * \fn DRV_Status_t MID_ScanManualSetFrontend(UINT32 frequence,UINT16 bandwidth)
  697. *
  698. * \param frequence: To be lock frequency
  699. * \param bandwidth: To be lock bandwidth
  700. * \param mode: bit[0] 0 for DVB-T, 1 for DVB-C
  701. * bit[1] 0 for DVB-T, 1 for DVB-T2
  702. *
  703. * \return TRUE if tuner success
  704. *
  705. * \note Description : Set tuner parameter for a specified frequency and bandwidth
  706. *
  707. ********************************************************************************************/
  708. MID_Status_t MID_ScanManualSetFrontend(UINT32 frequence,UINT16 bandwidth, UINT32 mode);
  709. /*add end*/
  710. int _ScanParsePidAddTail(MID_ScanPidInfo_t ** ppHead, MID_ScanPidInfo_t * pNew);
  711. void _ScanParseFreePidList(MID_ScanPidInfo_t ** ppPID);
  712. /*******************************************************************************************/
  713. /**
  714. * \fn void DVB_TpAdd_OtherType(MID_ScanParam_t * pstScanParam)
  715. *
  716. * \param pstScanParam: the Scan param
  717. *
  718. * \return none
  719. *
  720. * \note Description : none
  721. *
  722. ********************************************************************************************/
  723. void DVB_TpAdd_OtherType(MID_ScanParam_t * pstScanParam);
  724. /*******************************************************************************************/
  725. /**
  726. * \fn void DVB_Set_Scan_Status(DvbScanStatus_t EdvbscanType)
  727. *
  728. * \param EdvbscanType: the Status type param,-T,-T2
  729. *
  730. * \return none
  731. *
  732. * \note Description : none
  733. *
  734. ********************************************************************************************/
  735. void DVB_Set_Scan_Status(EDVBDeliveryType_t EdvbscanType);
  736. /*******************************************************************************************/
  737. /**
  738. * \fn void DVB_Set_Scan_Param2Driver(DvbScanStatus_t EdvbscanType)
  739. *
  740. * \param EdvbscanType: the Scan type param,-T,-T2
  741. *
  742. * \return none
  743. *
  744. * \note Description : none
  745. *
  746. ********************************************************************************************/
  747. void DVB_Set_Scan_Param2Driver(EDVBDeliveryType_t EdvbscanType);
  748. /*******************************************************************************************/
  749. /**
  750. * \fn DvbScanStatus_t DVB_Get_Scan_Status(void)
  751. *
  752. * \param none
  753. *
  754. * \return DvbScanStatus_t -T or -T2
  755. *
  756. * \note Description : none
  757. *
  758. ********************************************************************************************/
  759. EDVBDeliveryType_t DVB_Get_Scan_Status(void);
  760. /*******************************************************************************************/
  761. /**
  762. * \fn void MID_ScanManualSetPolling(void)
  763. *
  764. * \param none
  765. *
  766. * \return none
  767. *
  768. * \note Description : none
  769. *
  770. ********************************************************************************************/
  771. void MID_ScanManualSetPolling(void);
  772. void MID_ScanCleanNitCap(void);
  773. #ifdef CONFIG_DVB_SYSTEM_DVBS_SUPPORT
  774. void MID_ScanBlindScanChannelInfoCallback(BlindScanChannelInfoCallback pBlindScanChInfoCallback);
  775. void MID_ScanBlindScanUpdateUICallback(BlindScanUpdateUICallback pBlindScanUpdateUICallback);
  776. #endif
  777. #ifdef NIT_SCAN_SUPPORT
  778. UINT8 MID_ScanGetNitScanFlag(void);
  779. #endif
  780. bool MID_ScanIsScaning(void);
  781. #ifdef CONFIG_SUPPORT_FAST_SCANNING
  782. typedef enum
  783. {
  784. GET_FST_FNT_VERSION,
  785. SET_FST_FNT_VERSION,
  786. SET_FST_FOUND,
  787. } e_FAST_SCAN_OPERATION;
  788. typedef INT32 (*FastScanCallback)(e_FAST_SCAN_OPERATION op, UINT8 *param1, UINT8 *param2);
  789. void MID_ScanSetFastScanPid(UINT16 pid);
  790. void MID_ScanSetFastScanUpdateMode(bool bCheckVersion);
  791. void MID_ScanSetFastScanCallback(FastScanCallback pFastScanCallback);
  792. #endif
  793. /*! @} end of addtogroup DTV Scan*/
  794. #endif // #ifndef _MID_SCAN_H_2008_03_18