/*==================================================================== FUNCTION mtv319_ch_scan_start DESCRIPTION if for_air is greater than 0, this is for air play. DEPENDENCIES RETURN VALUE SIDE EFFECTS ======================================================================*/ void mtv319_ch_scan_start(int freq, int band, unsigned char for_air) { int res; TDMB_MSG_RTV_BB("[%s] Channel Frequency[%d] Band[%d] Mode[%d]\n", __func__, freq, band, for_air); rtvTDMB_CloseFIC(); res = rtvTDMB_ScanFrequency(freq); rtvTDMB_OpenFIC(); // 0501 for autoscan if((dmb_mode == TDMB_MODE_AUTOSCAN) #ifdef FEATURE_DMB_AUTOSCAN_DISCRETE || (dmb_mode == TDMB_MODE_SCAN_METRO) #endif ) { g_sync_status = (res == RTV_SUCCESS ? RTV_TDMB_CHANNEL_LOCK_OK : 0); } else { g_sync_status = RTV_TDMB_CHANNEL_LOCK_OK; } TDMB_MSG_RTV_BB("[%s] %s res[%d] sync_status[%d]\n",__func__,res==RTV_SUCCESS?"OK":"FAIL" ,res, g_sync_status); }
/*==================================================================== FUNCTION mtv319_subch_start DESCRIPTION DEPENDENCIES RETURN VALUE SIDE EFFECTS ======================================================================*/ int mtv319_subch_start(uint8 *regs, uint32 data_rate) { int res; uint16 uiSubChID, uiServiceType; uint32 ulRFNum; uiSubChID = g_stEnsembleInfo.astSubChInfo[0].uiSubChID; uiServiceType = (g_stEnsembleInfo.astSubChInfo[0].uiServiceType) == TDMB_BB_SVC_DMB ? RTV_SERVICE_DMB : RTV_SERVICE_DAB; ulRFNum = g_stEnsembleInfo.astSubChInfo[0].ulRFNum; TDMB_MSG_RTV_BB("[%s] uiSubChID[%d] uiServiceType[%d] ulRFNum[%d]\n", __func__, uiSubChID, uiServiceType, (int)ulRFNum); #ifdef FEATURE_TDMB_MULTI_CHANNEL_ENABLE// PJSIN 20110223 add-- [ 1 rtvTDMB_CloseFIC(); #endif// ]-- end res = rtvTDMB_OpenSubChannel(ulRFNum, uiSubChID, uiServiceType, RTV_SPI_CIF_MODE_INTERRUPT_SIZE); prev_subch_id = uiSubChID; #ifdef FEATURE_TDMB_MULTI_CHANNEL_ENABLE// PJSIN 20110223 add-- [ 1 rtvTDMB_OpenFIC(); #endif// ]-- end if(res != RTV_SUCCESS) { if (res != RTV_ALREADY_OPENED_SUBCHANNEL_ID) TDMB_MSG_RTV_BB("[%s] rtvTDMB_OpenSubChannel error [%d]\n", __func__, res); return 0; } return 1; }
static bool mtv318_scan_ch(struct ensemble_info_type *e_info , unsigned long freq) { bool ret = false; if (mtv318_pwr_on == true && e_info != NULL) { if (rtvTDMB_ScanFrequency(freq/1000) == RTV_SUCCESS) { rtvTDMB_OpenFIC(); ret = rtvFICDEC_Decode(freq/1000); rtvTDMB_CloseFIC(); if (ret == true) __get_ensemble_info(e_info, (freq)); } } return ret; }
/*==================================================================== FUNCTION mtv350_subch_start DESCRIPTION DEPENDENCIES RETURN VALUE SIDE EFFECTS ======================================================================*/ int mtv350_subch_start(uint8 *regs, uint32 data_rate) { int res; uint16 uiSubChID, uiServiceType; uint32 ulRFNum; uiSubChID = g_stEnsembleInfo.astSubChInfo[0].uiSubChID; uiServiceType = (g_stEnsembleInfo.astSubChInfo[0].uiServiceType) == TDMB_BB_SVC_DMB ? RTV_SERVICE_VIDEO : RTV_SERVICE_AUDIO; ulRFNum = g_stEnsembleInfo.astSubChInfo[0].ulRFNum; #ifdef FEATURE_TDMB_MULTI_CHANNEL_ENABLE// PJSIN 20110223 add-- [ 1 rtvTDMB_CloseFIC(); #endif// ]-- end res = rtvTDMB_OpenSubChannel(ulRFNum, uiSubChID, uiServiceType, 188*8); prev_subch_id = uiSubChID; #ifdef FEATURE_TDMB_MULTI_CHANNEL_ENABLE// PJSIN 20110223 add-- [ 1 rtvTDMB_OpenFIC(); #endif// ]-- end TDMB_MSG_RTV_BB("[%s] uiSubChID[%d] uiServiceType[%d] ulRFNum[%d]\n", __func__, uiSubChID, uiServiceType, (int)ulRFNum); if(res != RTV_SUCCESS) { if (res == RTV_ALREADY_OPENED_SUB_CHANNEL) TDMB_MSG_RTV_BB("[%s] Already opened %d\n", __func__, res); else { TDMB_MSG_RTV_BB("[%s] RTV_IOCTL_TDMB_SET_SUBCHANNEL error %d\n", __func__, res); return 0; } } return 1; }
/*------------------------------------------------------------------------------------- int8 tunerbb_drv_mtv319_multi_set_channel(int32 freq_num, uint8 subch_cnt, uint8 subch_id[ ], uint8 op_mode[ ]) (1) Setting the frequency , subch_id and op_mode. This function is used in Single Service and Mulitiple Service (2) Return Value Sucess : 1 Fail : 0 or negative interger (If there is error code) (3) Argument int32 freq_num (IN) - TDMB Frequency index(e.g 7A(71), 13C(133) etc). Convert frequency if needed uint8 subch_cnt (IN) - The number of multiple service. This value is 1 in case of Single Service uint8 subch_id[ ] (IN) - Service Componet Sub-Channel ID uint8 op_mode[ ] (IN) - Service Operation Mode DAB = 1; DMB = 2; VISUAL = 3; DATA = 4; TPEG = 5; ENSQUERY = 6 <notice> The size of subch_cnt[ ] and op_mode[ ] is the maximum number being supported by MTV319 --------------------------------------------------------------------------------------- */ int8 tunerbb_drv_mtv319_multi_set_channel(int32 freq_num, uint8 subch_cnt, uint8 subch_id[ ], uint8 op_mode[ ]) { uint8 i; uint32 freq_khz; enum E_RTV_SERVICE_TYPE svc_type; int ret; UINT intr_size; /* TS interrupt size. */ bool fic_open_in_play = FALSE; freq_khz = get_freq_from_table(freq_num); //printk("tunerbb_drv_mtv319_multi_set_channel, freq_khz = %d, freq_num = %d\n",freq_khz, freq_num); if (op_mode[0] == MTV319_ENSQUERY) { fic_timeout_retry_cnt = 0; rtvTDMB_CloseFIC(); rtvTDMB_CloseAllSubChannels(); ret = rtvTDMB_ScanFrequency(freq_khz); if (ret == RTV_SUCCESS) return MTV319_RESULT_SUCCESS; /* Channel found and FIC opened */ else { if(ret != RTV_CHANNEL_NOT_DETECTED) DMBERR("Device error: %d\n", ret); return MTV319_RESULT_ERROR; } } for (i = 0; i < subch_cnt; i++) { opened_subch_info[i].svc_type = op_mode[i]; opened_subch_info[i].subch_id = subch_id[i]; switch (op_mode[i]) { case MTV319_DMB: case MTV319_VISUAL: case MTV319_BLT_TEST: svc_type = RTV_SERVICE_DMB; intr_size = MTV319_DMB_INTERRUPT_SIZE; opened_subch_info[i].data_type = TDMB_BB_DATA_TS; break; case MTV319_DAB: svc_type = RTV_SERVICE_DAB; intr_size = 10 * 188;//MTV319_DMB_INTERRUPT_SIZE; opened_subch_info[i].data_type = TDMB_BB_DATA_DAB; break; case MTV319_DATA: svc_type = RTV_SERVICE_DAB; intr_size = 10 * 188;//MTV319_DMB_INTERRUPT_SIZE; opened_subch_info[i].data_type = TDMB_BB_DATA_PACK; break; case MTV319_ENSQUERY: fic_open_in_play = TRUE; opened_subch_info[i].data_type = TDMB_BB_DATA_FIC; break; default: DMBERR("Invalid op mode (%d)\n", op_mode[i]); goto svc_open_err; } if (op_mode[i] != MTV319_ENSQUERY) { ret = rtvTDMB_OpenSubChannel(freq_khz, subch_id[i], svc_type, intr_size); if (ret != RTV_SUCCESS) { if (ret != RTV_ALREADY_OPENED_SUBCHANNEL_ID) { DMBERR("Sub channel open failed: %d\n", ret); goto svc_open_err; } } } } if (fic_open_in_play) { /* Must open fic after sub channel in play state. */ ret = rtvTDMB_OpenFIC(); if (ret != RTV_SUCCESS) { DMBERR("FIC open failed: %d\n", ret); goto svc_open_err; } } return MTV319_RESULT_SUCCESS; svc_open_err: rtvTDMB_CloseAllSubChannels(); return MTV319_RESULT_ERROR; }