Example #1
0
void Si4709_work_func(struct work_struct *work)
{
	int i, ret = 0;
#ifdef RDS_TESTING
	u8 group_type;
#endif
	debug_rds("%s", __func__);
mutex_lock(&(Si4709_dev.lock));

	if (Si4709_dev.valid == eFALSE) {
		error("Si4709_dev_RDS_data_get called when DS is invalid");
		return;
	}

	if (RDS_Data_Lost > 1)
		debug_rds("No_of_RDS_groups_Lost till now : %d",
				RDS_Data_Lost);
	fmRdsStatus(1, 0);
	/* RDSR bit and RDS Block data, so reading the RDS registers */
	do {
		/* Writing into RDS_Block_Data_buffer */
		i = 0;
		RDS_Block_Data_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			BlockA;
		RDS_Block_Data_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			BlockB;
		RDS_Block_Data_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			BlockC;
		RDS_Block_Data_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			BlockD;

		/*Writing into RDS_Block_Error_buffer */
		i = 0;

		RDS_Block_Error_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			BleA;
		RDS_Block_Error_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			BleB;
		RDS_Block_Error_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			BleC;
		RDS_Block_Error_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			BleD;
		fmRdsStatus(1, 0);
	} while (RdsFifoUsed != 0);

#ifdef RDS_TESTING
	if (RDS_Block_Error_buffer
			[0 + 4 * RDS_Buffer_Index_write] < 3) {
		debug_rds("PI Code is %d",
				RDS_Block_Data_buffer[0 + 4
				* RDS_Buffer_Index_write]);
	}
	if (RDS_Block_Error_buffer
			[1 + 4 * RDS_Buffer_Index_write] < 2) {
		group_type = RDS_Block_Data_buffer[1 + 4
			* RDS_Buffer_Index_write] >> 11;

		if (group_type & 0x01) {
			debug_rds("PI Code is %d",
					RDS_Block_Data_buffer[2 + 4
					* RDS_Buffer_Index_write]);
		}
		if (group_type == GROUP_TYPE_2A
				|| group_type == GROUP_TYPE_2B) {
			if (RDS_Block_Error_buffer
					[2 + 4 * RDS_Buffer_Index_write] < 3) {
				debug_rds("Update RT with RDSC");
			} else {
				debug_rds("RDS_Block_Error_buffer"
						" of Block C is greater than 3");
			}
		}
	}
void Si47xx_work_func(struct work_struct *work)
{
	struct radio_data_t rds_data;
	int i = 0;
	u8 RdsFifoUsed;
#ifdef RDS_TESTING
	u8 group_type;
#endif
	debug_rds("%s", __func__);
mutex_lock(&(Si47xx_dev->lock));

	if (Si47xx_dev->valid == eFALSE) {
		dev_err(Si47xx_dev->dev, "Si47xx_dev_RDS_data_get called when DS is invalid");
		return;
	}

	if (RDS_Data_Lost > 1)
		debug_rds("No_of_RDS_groups_Lost till now : %d",
				RDS_Data_Lost);
	fmRdsStatus(1, 0, &rds_data, &RdsFifoUsed);
	/* RDSR bit and RDS Block data, so reading the RDS registers */
	do {
		/* Writing into RDS_Block_Data_buffer */
		i = 0;
		RDS_Block_Data_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			rds_data.rdsa;
		RDS_Block_Data_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			rds_data.rdsb;
		RDS_Block_Data_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			rds_data.rdsc;
		RDS_Block_Data_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			rds_data.rdsd;

		/*Writing into RDS_Block_Error_buffer */
		i = 0;

		RDS_Block_Error_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			rds_data.blera;
		RDS_Block_Error_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			rds_data.blerb;
		RDS_Block_Error_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			rds_data.blerc;
		RDS_Block_Error_buffer[i++ + 4 * RDS_Buffer_Index_write] =
			rds_data.blerd;
		fmRdsStatus(1, 0, &rds_data, &RdsFifoUsed);
	} while (RdsFifoUsed != 0);

#ifdef RDS_TESTING
	if (RDS_Block_Error_buffer
			[0 + 4 * RDS_Buffer_Index_write] < 3) {
		debug_rds("PI Code is %d",
				RDS_Block_Data_buffer[0 + 4
				* RDS_Buffer_Index_write]);
	}
	if (RDS_Block_Error_buffer
			[1 + 4 * RDS_Buffer_Index_write] < 2) {
		group_type = RDS_Block_Data_buffer[1 + 4
			* RDS_Buffer_Index_write] >> 11;

		if (group_type & 0x01) {
			debug_rds("PI Code is %d",
					RDS_Block_Data_buffer[2 + 4
					* RDS_Buffer_Index_write]);
		}
		if (group_type == GROUP_TYPE_2A
				|| group_type == GROUP_TYPE_2B) {
			if (RDS_Block_Error_buffer
					[2 + 4 * RDS_Buffer_Index_write] < 3) {
				debug_rds("Update RT with RDSC");
			} else {
				debug_rds("RDS_Block_Error_buffer"
						" of Block C is greater than 3");
			}
		}
	}