static bool t3900_set_ch(unsigned long freq
						, unsigned char subchid
						, bool factory_test)
{
	unsigned char ret_err;
	bool ret = false;

	if (t3900_pwr_on) {
		st_ch_info->nSetCnt = 1;
		st_ch_info->astSubChInfo[0].ulRFFreq = freq / 1000;
		st_ch_info->astSubChInfo[0].ucSubChID = subchid;
		st_ch_info->astSubChInfo[0].ucServiceType = 0x0;
		if (st_ch_info->astSubChInfo[0].ucSubChID >= 64) {
			st_ch_info->astSubChInfo[0].ucSubChID -= 64;
			st_ch_info->astSubChInfo[0].ucServiceType = 0x18;
		}

		t3900_on_air = false;

		if (factory_test == false)
			ret_err = INTERFACE_START(
				TDMB_I2C_ID80, st_ch_info);
		else
			ret_err = INTERFACE_START_TEST(
				TDMB_I2C_ID80, st_ch_info);

		if (ret_err == INC_SUCCESS) {
			/* TODO Ensemble  good code .... */
			t3900_on_air = true;
			ret = true;
		} else if (ret_err == INC_RETRY) {
			DPRINTK("IOCTL_TDMB_ASSIGN_CH retry\n");

			t3900_power_off();
			t3900_power_on();

			if (factory_test == false)
				ret_err = INTERFACE_START(
					TDMB_I2C_ID80, st_ch_info);
			else
				ret_err = INTERFACE_START_TEST(
					TDMB_I2C_ID80, st_ch_info);

			if (ret_err == INC_SUCCESS) {
				/* TODO Ensemble  good code .... */
				t3900_on_air = true;
				ret = true;
			}
		}
	}

	return ret;
}
Esempio n. 2
0
static bool T3900_set_ch(unsigned long freqHz, unsigned char subhcid, bool factory_test)
{
	INC_UINT8 reErr;
	bool ret = false;

	if (g_bPowerOn) {
		g_pStChInfo->nSetCnt = 1;
		g_pStChInfo->astSubChInfo[0].ulRFFreq = freqHz / 1000;
		g_pStChInfo->astSubChInfo[0].ucSubChID = subhcid;
		g_pStChInfo->astSubChInfo[0].ucServiceType = 0x0;
		if (g_pStChInfo->astSubChInfo[0].ucSubChID >= 64) {
			g_pStChInfo->astSubChInfo[0].ucSubChID -= 64;
			g_pStChInfo->astSubChInfo[0].ucServiceType = 0x18;
		}

		g_bOnAir = false;

		if (factory_test == false)
			reErr = INTERFACE_START(TDMB_I2C_ID80, g_pStChInfo);
		else
			reErr = INTERFACE_START_TEST(TDMB_I2C_ID80, g_pStChInfo);

		if (reErr == INC_SUCCESS) {
			/* TODO Ensemble  good code .... */
			g_bOnAir = true;
			ret = true;
		} else if (reErr == INC_RETRY) {
			DPRINTK("IOCTL_TDMB_ASSIGN_CH retry\n");

			T3900_power_off();
			T3900_power_on();

			if (factory_test == false)
				reErr = INTERFACE_START(TDMB_I2C_ID80, g_pStChInfo);
			else
				reErr = INTERFACE_START_TEST(TDMB_I2C_ID80, g_pStChInfo);

			if (reErr == INC_SUCCESS) {
				/* TODO Ensemble  good code .... */
				g_bOnAir = true;
				ret = true;
			}
		}
	}

	return ret;
}