Example #1
0
static INT32 parse_tp_info(UINT8 *data, INT32 data_len, T_NODE *t_node)
{
	INT32 i;
	struct si_descriptor *desc;
	UINT32 polar;
	INT32 ret = MULTIFEED_SUCCESS;
	
	for(i=0; i<data_len; i+=sizeof(struct si_descriptor)+desc->len)
	{
		desc = (struct si_descriptor *)(data+i);

		if (desc->tag == SATELLITE_DELIVERY_SYSTEM_DESCRIPTOR)
		{
			struct satellite_delivery_system_descriptor *sat;
			sat = (struct satellite_delivery_system_descriptor *)desc;
			
			polar = sat->polarization;
			t_node->pol = polar<SAT_POL_CIRCLE_LEFT?polar: polar-2;
			t_node->frq = bcd2integer(sat->frequency, 8, 0)/100;
			t_node->sym = bcd2integer(sat->symbol_rate, 7, 0)/10;
			t_node->FEC_inner = sat->FEC_inner;
			//if( t_node->frq== 12031) // for debug
			//	t_node->frq = 3550;
			break;
		}
	}
	return ret;
}
INT32 si_on_sat_delivery_desc(UINT8 tag, UINT8 length, UINT8 *data, void *priv)
{
	UINT16 polar;
	struct satellite_delivery_system_descriptor *sat =
		(struct satellite_delivery_system_descriptor *)(data-2);
	struct nit_section_info *n_info = (struct nit_section_info *)priv;
	TP_INFO *tp_info;

	if (n_info->xp_nr==PSI_MODULE_MAX_TP_NUMBER) {
		SDD_PRINTF("%s: maximum xponder collected!\n", __FUNCTION__);
		return SI_SUCCESS;
	}
	
	tp_info	= &n_info->xp[n_info->xp_nr++];
	polar = sat->polarization;

	/*
	 * AV require us to support L/R circle modulation for DVB-S.
	 *
	 * The following patch code is based on an un-official forum article:
	 * http://www.sat-china.com/vbb/showthread.php?threadid=19934
	 * that make the assumption that in voltage control,
	 *  L_CIRCLE is similar to HORIZONAL,
	 *  R_CIRCLE is similar to VIRTICAL,
	 *
	 * I didn't perform any detail verification, so we acctually need more 
	 * official document/theory to confirm this patch.
	 *
	 *			- Zhengdao Li.
	 */
	tp_info->s_info.polarity = polar<SAT_POL_CIRCLE_LEFT? polar: polar-2;
	
	tp_info->s_info.tsid = n_info->tsid;
	tp_info->s_info.onid = n_info->onid;

	tp_info->s_info.frequency = bcd2integer(sat->frequency, 8, 0)/100;
	tp_info->s_info.position = bcd2integer(sat->orbital_position, 4, 0);
	tp_info->s_info.symbol_rate = bcd2integer(sat->symbol_rate, 7, 0)/10;
	
	if (!sat->west_east_flag) {
		tp_info->s_info.position = 3600 - tp_info->s_info.position;
	}
	
	/*
	 * Arion require us to support FEC distinguish.
	 *
	 * I don't know why they need this, but sure we could support it.
	 *
	 *			- Zhengdao Li
	 */
	tp_info->s_info.FEC_inner = sat->FEC_inner;
	
	SDD_PRINTF("*freq: %d\n", tp_info->s_info.frequency);
	SDD_PRINTF("*symbol_rate: %d\n", tp_info->s_info.symbol_rate);
	SDD_PRINTF("*position: %d\n", tp_info->s_info.position);
	SDD_PRINTF("*FEC_inner: %d\n", tp_info->s_info.FEC_inner);
	
	return SI_SUCCESS;
}