Exemplo n.º 1
0
static bool __get_ensemble_info(EnsembleInfoType *ensembleInfo, unsigned long freqHz)
{
	int i;
	int j;
	int nSubChIdx = 0;
	int nCnt;
	const char *ensembleName = NULL;
	INC_CHANNEL_INFO *pINC_SubChInfo;

	DPRINTK("T3900_get_ensemble_info - freq(%ld)\n", freqHz);

	ensembleInfo->TotalSubChNumber = INTERFACE_GETDMB_CNT() + INTERFACE_GETDAB_CNT();
	DPRINTK("total subchannel number : %d\n", ensembleInfo->TotalSubChNumber);

	if (ensembleInfo->TotalSubChNumber > 0) {
		ensembleName = (char *)INTERFACE_GETENSEMBLE_LABEL(TDMB_I2C_ID80);
		DPRINTK("ensembleName : %s\n", ensembleName);

		if (ensembleName) {
			strncpy((char *)ensembleInfo->EnsembleLabelCharField, (char *)ensembleName, ENSEMBLE_LABEL_SIZE_MAX);
		}

		ensembleInfo->EnsembleFrequency = freqHz;

		for (i = 0; i < 2; i++) {
			nCnt = (i == 0) ? INTERFACE_GETDMB_CNT() : INTERFACE_GETDAB_CNT();

			for (j = 0; j < nCnt; j++, nSubChIdx++) {
				pINC_SubChInfo = (i == 0) ? INTERFACE_GETDB_DMB(j) : INTERFACE_GETDB_DAB(j);
				ensembleInfo->SubChInfo[nSubChIdx].SubChID		= pINC_SubChInfo->ucSubChID;
				ensembleInfo->SubChInfo[nSubChIdx].StartAddress = pINC_SubChInfo->uiStarAddr;
				ensembleInfo->SubChInfo[nSubChIdx].TMId 		= pINC_SubChInfo->uiTmID;
				ensembleInfo->SubChInfo[nSubChIdx].Type 		= pINC_SubChInfo->ucServiceType;
				ensembleInfo->SubChInfo[nSubChIdx].ServiceID	= pINC_SubChInfo->ulServiceID;
				memcpy(ensembleInfo->SubChInfo[nSubChIdx].ServiceLabel, pINC_SubChInfo->aucLabel, SERVICE_LABEL_SIZE_MAX);

				DPRINTK("%s(subchid:%d,TMID:%d)\n"
					, ensembleInfo->SubChInfo[nSubChIdx].ServiceLabel
					, ensembleInfo->SubChInfo[nSubChIdx].SubChID
					, ensembleInfo->SubChInfo[nSubChIdx].TMId);
			}
		}
		return true;
	} else {
		return false;
	}
}
static bool __get_ensemble_info(struct ensemble_info_type *e_info
						, unsigned long freq)
{
	int i;
	int j;
	int sub_i = 0;
	int cnt;
	const char *e_name = NULL;
	struct INC_CHANNEL_INFO *inc_sub_info;

	DPRINTK("t3900_get_ensemble_info - freq(%ld)\n", freq);

	e_info->tot_sub_ch =
		INTERFACE_GETDMB_CNT() + INTERFACE_GETDAB_CNT();
	DPRINTK("total subchannel number : %d\n"
		, e_info->tot_sub_ch);

	if (e_info->tot_sub_ch > 0) {
		e_name =
			(char *)INTERFACE_GETENSEMBLE_LABEL(TDMB_I2C_ID80);
		DPRINTK("e_name : %s\n", e_name);

		if (e_name)
			strncpy((char *)e_info->ensem_label,
					(char *)e_name,
					ENSEMBLE_LABEL_MAX);

		e_info->ensem_freq = freq;

		for (i = 0; i < 2; i++) {
			cnt = (i == 0) ? INTERFACE_GETDMB_CNT()
				: INTERFACE_GETDAB_CNT();

			for (j = 0; j < cnt; j++, sub_i++) {
				inc_sub_info = (i == 0)
					? INTERFACE_GETDB_DMB(j)
					: INTERFACE_GETDB_DAB(j);
				e_info->sub_ch[sub_i].sub_ch_id
					= inc_sub_info->ucSubChID;
				e_info->sub_ch[sub_i].start_addr
					= inc_sub_info->uiStarAddr;
				e_info->sub_ch[sub_i].tmid
					= inc_sub_info->uiTmID;
				e_info->sub_ch[sub_i].svc_type
					= inc_sub_info->ucServiceType;
				e_info->sub_ch[sub_i].svc_id
					= inc_sub_info->ulServiceID;
				memcpy(e_info->sub_ch[sub_i].svc_label,
						inc_sub_info->aucLabel,
						SVC_LABEL_MAX);

				DPRINTK("%s(subchid:%d,tmid:%d)\n",
					e_info->sub_ch[sub_i].svc_label,
					e_info->sub_ch[sub_i].sub_ch_id,
					e_info->sub_ch[sub_i].tmid);
			}
		}
		return true;
	} else {
		return false;
	}
}